Automated Code Editing with Search-Generate-Modify

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Liu, Changshu, Cetin, Pelin, Patodia, Yogesh, Chakraborty, Saikat, Ding, Yangruibo, Ray, Baishakhi
Format: Preprint
Veröffentlicht: 2023
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866909118996938752
author Liu, Changshu
Cetin, Pelin
Patodia, Yogesh
Chakraborty, Saikat
Ding, Yangruibo
Ray, Baishakhi
author_facet Liu, Changshu
Cetin, Pelin
Patodia, Yogesh
Chakraborty, Saikat
Ding, Yangruibo
Ray, Baishakhi
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2306_06490
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle Automated Code Editing with Search-Generate-Modify
Liu, Changshu
Cetin, Pelin
Patodia, Yogesh
Chakraborty, Saikat
Ding, Yangruibo
Ray, Baishakhi
Software Engineering
Programming Languages
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.
title Automated Code Editing with Search-Generate-Modify
topic Software Engineering
Programming Languages
url https://arxiv.org/abs/2306.06490