Automated Code Editing With Search-Generate-Modify
- 27 March 2024
- journal article
- research article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Transactions on Software Engineering
- Vol. 50 (7) , 1675-1686
Abstract
Code editing is essential in evolving software development. In literature, several automated code editing tools are proposed, which leverage Information Retrieval-based techniques and Machine Learning-based code generation and code editing models. Each technique comes with its own promises and perils, and for this reason, they are often used together to complement their strengths and compensate for their weaknesses. This paper proposes a hybrid approach to better synthesize code edits by leveraging the power of code search, generation, and modification. Our key observation is that a patch that is obtained by search & retrieval, even if incorrect, can provide helpful guidance to a code generation model. However, a retrieval-guided patch produced by a code generation model can still be a few tokens off from the intended patch. Such generated patches can be slightly modified to create the intended patches. We developed a novel tool to solve this challenge: SARGAM, which is designed to follow a real developer’s code editing behavior. Given an original code version, the developer may search for the related patches, generate or write the code, and then modify the generated code to adapt it to the right context. Our evaluation of SARGAM on edit generation shows superior performance w.r.t. the current state-of-the-art techniques. SARGAM also shows its effectiveness on automated program repair tasks.Keywords
All Related Versions
This publication has 48 references indexed in Scilit:
- KNOD: Domain Knowledge Distilled Tree Decoder for Automated Program Repair2023
- On Multi-Modal Learning of Editing Source Code2021
- CURE: Code-Aware Neural Machine Translation for Automatic Program Repair2021
- On Learning Meaningful Code Changes Via Neural Machine Translation2019
- LSRepair: Live Search of Fix Ingredients for Automated Program Repair2018
- Leveraging syntax-related code for automated program repair2017
- Detecting and characterizing semantic inconsistencies in ported code2013
- A study of repetitiveness of code changes in software evolution2013
- Lase: Locating and applying systematic edits by learning from examples2013
- Example-Based Program TransformationLecture Notes in Computer Science, 2008