RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic
Program Repair
- URL: http://arxiv.org/abs/2309.06057v1
- Date: Tue, 12 Sep 2023 08:52:56 GMT
- Title: RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic
Program Repair
- Authors: Weishi Wang, Yue Wang, Shafiq Joty, Steven C.H. Hoi
- Abstract summary: We propose a novel Retrieval-Augmented Patch Generation framework (RAP-Gen)
RAP-Gen explicitly leveraging relevant fix patterns retrieved from a list of previous bug-fix pairs.
We evaluate RAP-Gen on three benchmarks in two programming languages, including the TFix benchmark in JavaScript, and Code Refinement and Defects4J benchmarks in Java.
- Score: 75.40584530380589
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: Automatic program repair (APR) is crucial to reduce manual debugging efforts
for developers and improve software reliability. While conventional
search-based techniques typically rely on heuristic rules or a redundancy
assumption to mine fix patterns, recent years have witnessed the surge of deep
learning (DL) based approaches to automate the program repair process in a
data-driven manner. However, their performance is often limited by a fixed set
of parameters to model the highly complex search space of APR. To ease such
burden on the parametric models, in this work, we propose a novel
Retrieval-Augmented Patch Generation framework (RAP-Gen) by explicitly
leveraging relevant fix patterns retrieved from a codebase of previous bug-fix
pairs. Specifically, we build a hybrid patch retriever to account for both
lexical and semantic matching based on the raw source code in a
language-agnostic manner, which does not rely on any code-specific features. In
addition, we adapt a code-aware language model CodeT5 as our foundation model
to facilitate both patch retrieval and generation tasks in a unified manner. We
adopt a stage-wise approach where the patch retriever first retrieves a
relevant external bug-fix pair to augment the buggy input for the CodeT5 patch
generator, which synthesizes a ranked list of repair patch candidates. Notably,
RAP-Gen is a generic APR framework that can flexibly integrate different patch
retrievers and generators to repair various types of bugs. We thoroughly
evaluate RAP-Gen on three benchmarks in two programming languages, including
the TFix benchmark in JavaScript, and Code Refinement and Defects4J benchmarks
in Java, where the bug localization information may or may not be provided.
Experimental results show that RAP-Gen significantly outperforms previous
state-of-the-art approaches on all benchmarks, e.g., repairing 15 more bugs on
818 Defects4J bugs.
Related papers
- A Novel Approach for Automatic Program Repair using Round-Trip
Translation with Large Language Models [50.86686630756207]
Research shows that grammatical mistakes in a sentence can be corrected by translating it to another language and back.
Current generative models for Automatic Program Repair (APR) are pre-trained on source code and fine-tuned for repair.
This paper proposes bypassing the fine-tuning step and using Round-Trip Translation (RTT): translation of code from one programming language to another programming or natural language, and back.
arXiv Detail & Related papers (2024-01-15T22:36:31Z) - GAMMA: Revisiting Template-based Automated Program Repair via Mask
Prediction [14.741742268621403]
Inappropriate donor code may cause plausible but incorrect patch generation even with correct fix patterns.
In this paper, we propose GAMMA, to directly leverage large pre-trained language models for donor code generation.
Results demonstrate that GAMMA correctly repairs 82 bugs on Defects4J-v1.2, which achieves 20.59% (14 bugs) and 26.15% (17 bugs) improvement over the previous state-of-the-art template-based approach TBar and learning-based one Recoder.
arXiv Detail & Related papers (2023-09-17T15:49:40Z) - Neural Program Repair with Program Dependence Analysis and Effective
Filter Mechanism [37.70518599085677]
We present a novel neural program repair framework called approach, which adapts the general pre-trained language model for fixing single-line Java bugs.
We make the first attempt to use program slicing to extract contextual information directly related to the given buggy statement as repair ingredients from the corresponding program dependence graph.
We demonstrate the effectiveness of approach on five benchmarks when compared with state-of-the-art baselines.
arXiv Detail & Related papers (2023-05-16T09:43:04Z) - Teaching Large Language Models to Self-Debug [62.424077000154945]
Large language models (LLMs) have achieved impressive performance on code generation.
We propose Self- Debugging, which teaches a large language model to debug its predicted program via few-shot demonstrations.
arXiv Detail & Related papers (2023-04-11T10:43:43Z) - BigIssue: A Realistic Bug Localization Benchmark [89.8240118116093]
BigIssue is a benchmark for realistic bug localization.
We provide a general benchmark with a diversity of real and synthetic Java bugs.
We hope to advance the state of the art in bug localization, in turn improving APR performance and increasing its applicability to the modern development cycle.
arXiv Detail & Related papers (2022-07-21T20:17:53Z) - CodeRL: Mastering Code Generation through Pretrained Models and Deep
Reinforcement Learning [92.36705236706678]
"CodeRL" is a new framework for program synthesis tasks through pretrained LMs and deep reinforcement learning.
During inference, we introduce a new generation procedure with a critical sampling strategy.
For the model backbones, we extended the encoder-decoder architecture of CodeT5 with enhanced learning objectives.
arXiv Detail & Related papers (2022-07-05T02:42:15Z) - Break-It-Fix-It: Unsupervised Learning for Program Repair [90.55497679266442]
We propose a new training approach, Break-It-Fix-It (BIFI), which has two key ideas.
We use the critic to check a fixer's output on real bad inputs and add good (fixed) outputs to the training data.
Based on these ideas, we iteratively update the breaker and the fixer while using them in conjunction to generate more paired data.
BIFI outperforms existing methods, obtaining 90.5% repair accuracy on GitHub-Python and 71.7% on DeepFix.
arXiv Detail & Related papers (2021-06-11T20:31:04Z) - CURE: Code-Aware Neural Machine Translation for Automatic Program Repair [11.556110575946631]
We propose CURE, a new NMT-based APR technique with three major novelties.
CURE pre-trains a programming language (PL) model on a large software to learn developer-like source code before the APR task.
Second, CURE designs a new code-aware search strategy that finds more correct fixes by focusing on compilable patches and patches that are close in length to the buggy code.
arXiv Detail & Related papers (2021-02-26T22:30:28Z) - ENCORE: Ensemble Learning using Convolution Neural Machine Translation for Automatic Program Repair [7.026028136636735]
We propose ENCORE, a new generate-and-validate (G&V) program repair technique.
It uses ensemble learning on convolutional neural machine translation (NMT) models to automatically fix bugs in multiple programming languages.
ENCORE is the first G&V repair technique to be applied to four popular programming languages.
arXiv Detail & Related papers (2019-06-20T15:25:16Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.