TL;DR: The paper introduces EditLord, a novel framework that enhances LLMs for code editing by introducing discrete and explicit procedural steps, leading to improved performance on various code editing tasks and better robustness.
Abstract: 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, and thus 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.
Lay Summary: Editing code is a common but complex part of software development.
Most current tools try to do this automatically, but they often treat the process as one big step, which can make the results unreliable or hard to generalize.
We created a new tool called EditLord that takes a more structured approach.
Instead of treating code editing as a black box, EditLord breaks the process down into clear steps.
EditLord uses a powerful language model to learn simple editing rules from examples of how code was changed.
These rules can then help guide future edits, whether the model is being fine-tuned or used directly.
EditLord consistently outperforms other tools across various real-world programming tasks, e.g., performance optimization, readability improvement, and security hardening.
It makes more accurate edits, handles different situations better, and maintains the original function of the code more reliably.
Primary Area: Applications->Everything Else
Keywords: Large Language Models, Machine Learning for Code Editing, Code Generation, Reasoning
Submission Number: 14642
Loading