EditLord: Learning Code Transformation Rules for Code Editing

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Li, Weichen, Jan, Albert, Ray, Baishakhi, Yang, Junfeng, Mao, Chengzhi, Pei, Kexin
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915380304281600
author Li, Weichen
Jan, Albert
Ray, Baishakhi
Yang, Junfeng
Mao, Chengzhi
Pei, Kexin
author_facet Li, Weichen
Jan, Albert
Ray, Baishakhi
Yang, Junfeng
Mao, Chengzhi
Pei, Kexin
contents Code editing is a foundational task in software development, where its effectiveness depends on whether it introduces desired code property changes without changing the original code's intended functionality. Existing approaches often formulate code editing as an implicit end-to-end task, omitting the fact that code-editing procedures inherently consist of discrete and explicit steps. Thus, they suffer from suboptimal performance and lack of robustness and generalization. We introduce EditLord, a code editing framework that makes the code transformation steps explicit. Our key insight is to employ a language model (LM) as an inductive learner to extract code editing rules from the training code pairs as concise meta-rule sets. Such rule sets will be manifested for each training sample to augment them for finetuning or assist in prompting- and iterative-based code editing. EditLord outperforms the state-of-the-art by an average of 22.7% in editing performance and 58.1% in robustness while achieving 20.2% higher functional correctness across critical software engineering and security applications, LM models, and editing modes.
format Preprint
id arxiv_https___arxiv_org_abs_2504_15284
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle EditLord: Learning Code Transformation Rules for Code Editing
Li, Weichen
Jan, Albert
Ray, Baishakhi
Yang, Junfeng
Mao, Chengzhi
Pei, Kexin
Software Engineering
Cryptography and Security
Machine Learning
Code editing is a foundational task in software development, where its effectiveness depends on whether it introduces desired code property changes without changing the original code's intended functionality. Existing approaches often formulate code editing as an implicit end-to-end task, omitting the fact that code-editing procedures inherently consist of discrete and explicit steps. Thus, they suffer from suboptimal performance and lack of robustness and generalization. We introduce EditLord, a code editing framework that makes the code transformation steps explicit. Our key insight is to employ a language model (LM) as an inductive learner to extract code editing rules from the training code pairs as concise meta-rule sets. Such rule sets will be manifested for each training sample to augment them for finetuning or assist in prompting- and iterative-based code editing. EditLord outperforms the state-of-the-art by an average of 22.7% in editing performance and 58.1% in robustness while achieving 20.2% higher functional correctness across critical software engineering and security applications, LM models, and editing modes.
title EditLord: Learning Code Transformation Rules for Code Editing
topic Software Engineering
Cryptography and Security
Machine Learning
url https://arxiv.org/abs/2504.15284