Directional Diffusion-Style Code Editing Pre-training

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Liang, Qingyuan, Sun, Zeyu, Zhu, Qihao, Hu, Junhao, Zhao, Yifan, Chen, Yizhou, Zhu, Mingxuan, Wang, Guoqing, Zhang, Lu
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914191946809344
author Liang, Qingyuan
Sun, Zeyu
Zhu, Qihao
Hu, Junhao
Zhao, Yifan
Chen, Yizhou
Zhu, Mingxuan
Wang, Guoqing
Zhang, Lu
author_facet Liang, Qingyuan
Sun, Zeyu
Zhu, Qihao
Hu, Junhao
Zhao, Yifan
Chen, Yizhou
Zhu, Mingxuan
Wang, Guoqing
Zhang, Lu
contents Code pre-trained models have shown promising effectiveness in various software engineering tasks. Among these tasks, many tasks are related to software evolution and/or code editing. However, existing code pre-trained models often overlook the real-world code editing data and the evolutionary nature of the editing process. In this paper, to simulate the step-by-step code editing process of human developers, we propose DivoT5, a pre-trained model based on directional diffusion at the data level. In DivoT5, we adopt two categories of pre-training tasks. The first category is mask and denoising tasks augmented with a diffusion direction representing code evolution. That is, we first apply a noising process to the code snippets before evolution, and then ask the pre-training process to restore the snippets with noise into the code snippets after evolution. The second category is tasks aiming to reinforce the evolutionary direction. That is, we first generate various intermediate versions for each pair of snippets before and after evolution, and then ask the pre-training process to transform the intermediate versions into the snippet after evolution for each pair. We evaluate DivoT5 for two code-editing scenarios and one non-editing scenario using five downstream tasks. Given each downstream task, we fine-tune the pre-trained DivoT5 to evaluate its effectiveness. Our experimental results show that DivoT5 achieves state-of-the-art (SOTA) performance on most tasks in comparison to models of the same scale (220M), large scale (770M) models in fine-tuning, and billion-scale (6.7B, 8B, ChatGPT) models in few-shot settings. For one code-editing task (i.e., automated code review), DivoT5 pre-trained on top of CodeT5-small (60M) can even outperform CodeT5-base (220M) and other pre-trained models with 220M parameters except for DivoT5 pre-trained on top of CodeT5-base (220M).
format Preprint
id arxiv_https___arxiv_org_abs_2501_12079
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Directional Diffusion-Style Code Editing Pre-training
Liang, Qingyuan
Sun, Zeyu
Zhu, Qihao
Hu, Junhao
Zhao, Yifan
Chen, Yizhou
Zhu, Mingxuan
Wang, Guoqing
Zhang, Lu
Software Engineering
Code pre-trained models have shown promising effectiveness in various software engineering tasks. Among these tasks, many tasks are related to software evolution and/or code editing. However, existing code pre-trained models often overlook the real-world code editing data and the evolutionary nature of the editing process. In this paper, to simulate the step-by-step code editing process of human developers, we propose DivoT5, a pre-trained model based on directional diffusion at the data level. In DivoT5, we adopt two categories of pre-training tasks. The first category is mask and denoising tasks augmented with a diffusion direction representing code evolution. That is, we first apply a noising process to the code snippets before evolution, and then ask the pre-training process to restore the snippets with noise into the code snippets after evolution. The second category is tasks aiming to reinforce the evolutionary direction. That is, we first generate various intermediate versions for each pair of snippets before and after evolution, and then ask the pre-training process to transform the intermediate versions into the snippet after evolution for each pair. We evaluate DivoT5 for two code-editing scenarios and one non-editing scenario using five downstream tasks. Given each downstream task, we fine-tune the pre-trained DivoT5 to evaluate its effectiveness. Our experimental results show that DivoT5 achieves state-of-the-art (SOTA) performance on most tasks in comparison to models of the same scale (220M), large scale (770M) models in fine-tuning, and billion-scale (6.7B, 8B, ChatGPT) models in few-shot settings. For one code-editing task (i.e., automated code review), DivoT5 pre-trained on top of CodeT5-small (60M) can even outperform CodeT5-base (220M) and other pre-trained models with 220M parameters except for DivoT5 pre-trained on top of CodeT5-base (220M).
title Directional Diffusion-Style Code Editing Pre-training
topic Software Engineering
url https://arxiv.org/abs/2501.12079