paperbot · PL 论文追踪

全部论文 待读 收藏

P2 RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair

RAP-Gen:基于 CodeT5 的检索增强补丁生成用于自动程序修复
FSE Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2023匹配度 4/10 · 论文属于深度学习自动程序修复(APR),与PL+ML交叉相关,但其核心不是静态分析、形式化验证、Agentic程序、浮点程序分析或贝叶斯程序分析。使用检索增强的CodeT5而非当前强LLM/Agent,且研究目标偏向修复模型本身。引用 140 inbox
Weishi Wang, Yue Wang, Shafiq Joty, Steven C.H. Hoi
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出检索增强补丁生成框架 RAP-Gen,以混合检索器增强 CodeT5,显著提升多基准自动程序修复效果。

自动程序修复可减少人工调试负担,但基于搜索的方法依赖启发式规则或冗余假设,深度学习方法受固定参数限制,难以覆盖庞大的修复搜索空间。本文提出检索增强的补丁生成框架 RAP-Gen:以语言无关的混合补丁检索器,结合词法与语义匹配从历史缺陷-修复对中检索修复模式;再用代码感知模型 CodeT5 统一完成检索与生成,输出排序的补丁候选,且可灵活替换检索器与生成器。在 JavaScript 的 TFix 与 Java 的 Code Refinement、Defects4J 基准上,RAP-Gen 均显著优于此前最优方法:TFix 上 T5-large 准确率由 49.70% 提升至 54.15%,多修复 478 个缺陷;Defects4J 上多修复 15 个缺陷。分析表明检索到的修复模式能有效引导修复系统。

问题
自动程序修复的搜索空间极为复杂,传统基于启发式规则或冗余假设的方法以及参数固定的深度模型难以覆盖多样的修复模式,泛化能力受限。
方法
提出 RAP-Gen:用语言无关的混合补丁检索器(词法+语义匹配)从历史缺陷-修复对中检索相关修复模式来增强缺陷输入,再由基于 CodeT5 的补丁生成器合成排序的修复候选,框架可灵活组合不同检索器与生成器。
评估
在两种编程语言的三个基准上评测:JavaScript 的 TFix,以及 Java 的 Code Refinement 与 Defects4J(含提供与不提供缺陷定位信息的设定)。
原文摘要(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 (SoTA) approaches on all benchmarks, e.g., boosting the accuracy of T5-large on TFix from 49.70% to 54.15% (repairing 478 more bugs) and repairing 15 more bugs on 818 Defects4J bugs. Further analysis reveals that our patch retriever can search for relevant fix patterns to guide the APR systems.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{abs-2309-06057,
  title = {RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair},
  author = {Weishi Wang and Yue Wang and Shafiq Joty and Steven C.H. Hoi},
  booktitle = {FSE},
  year = {2023},
  doi = {10.1145/3611643.3616256}
}