Automated Code Editing with Search-Generate-Modify

06/10/2023
by   Changshu Liu, et al.
0

Code editing is essential in evolving software development. Many automated code editing tools have been proposed that leverage both Information Retrieval-based techniques and Machine Learning-based code generation and code editing models. Each technique comes with its own promises and perils, and 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 obtained by search and retrieval, even if imperfect, 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. SARGAM is a novel tool designed to mimic a real developer's code editing behavior. Given an original code version, the developer may search for 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 with respect to current state-of-the-art techniques. SARGAM also shows great effectiveness on automated program repair tasks.

READ FULL TEXT
research
08/15/2021

On Multi-Modal Learning of Editing Source Code

In recent years, Neural Machine Translator (NMT) has shown promise in au...
research
08/10/2022

CoditT5: Pretraining for Source Code and Natural Language Editing

Pretrained language models have been shown to be effective in many softw...
research
12/11/2020

A Comprehensive Study of Code-removal Patches in Automated Program Repair

Automatic Program Repair (APR) techniques can promisingly help reducing ...
research
11/15/2021

Beep: Fine-grained Fix Localization by Learning to Predict Buggy Code Elements

Software Fault Localization refers to the activity of finding code eleme...
research
07/14/2022

Attention: Not Just Another Dataset for Patch-Correctness Checking

Automated Program Repair (APR) techniques have drawn wide attention from...
research
10/26/2019

Automated Classification of Overfitting Patches with Statically Extracted Code Features

Automatic program repair (APR) aims to reduce the cost of manually fixin...
research
06/20/2002

Computer-Generated Photorealistic Hair

This paper presents an efficient method for generating and rendering pho...

Please sign up or login with your details

Forgot password? Click here to reset