paperbot · PL 论文追踪

全部论文 待读 收藏

P2 One Size Does Not Fit All: Multi-granularity Patch Generation for Better Automated Program Repair

一刀切并不适用:面向更优自动程序修复的多粒度补丁生成
ISSTA Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis2024匹配度 3/10 · 该论文研究基于机器学习的自动程序修复,属于软件工程与程序语言交叉,但核心是补丁生成与重排序,并非用户关注的静态分析、形式化验证、浮点程序分析或贝叶斯程序分析,也未涉及 LLM/Agent 与静态分析的结合。仅在“机器学习用于程序语言任务”这一宽泛方向上略有交集,因此匹配度偏低。引用 15 inbox
Bo Lin, Shangwen Wang, Ming Wen, Liqian Chen, Xiaoguang Mao
crossref: 2026-09-12

AI 速览

一句话:提出 Mulpor,联合语句、表达式与 token 三个粒度生成补丁并启发式重排序,显著提升自动程序修复效果。

自动程序修复旨在自动纠正缺陷、减轻人工调试负担。已有学习式修复方法主要将修复视为翻译任务或完形填空任务,分别侧重语句级与 token 级修复;然而真实补丁可能处于语句、表达式或 token 等不同粒度,单一粒度生成难以应对多样缺陷。为此,本文提出多粒度补丁生成方法 Mulpor,包含语句级、表达式级与 token 级三个生成器,各自在对应粒度上预训练,先分别生成候选补丁,再依据启发式规则进行重排序以优先选择更可能正确的补丁。在 Defects4J-v1.2 上,Mulpor 正确修复 92 个缺陷,较 NMT 风格的 Rap-Gen 与 Cloze 风格的 GAMMA 分别提升 27.0%(20 个)与 12.2%(10 个);在漏洞修复任务中,正确修复补丁数较当前最优方法提升 51%,表明多粒度策略能实现更有效且多样的修复。

问题
现有学习式自动程序修复方法要么将修复建模为语句级翻译任务,要么建模为 token 级完形填空任务,仅从单一粒度生成补丁,难以覆盖真实缺陷中语句、表达式、token 等不同粒度的修复需求。
方法
提出 Mulpor,由语句级、表达式级和 token 级三个生成器组成,各生成器在对应粒度上预训练以生成候选补丁,随后使用启发式重排序策略对多粒度候选补丁排序并选出最终修复。
评估
在 Defects4J-v1.2 数据集上,将 Mulpor 与 NMT 风格的 Rap-Gen 及 Cloze 风格的 GAMMA 对比,并进一步在漏洞修复场景中评估其泛化能力。
原文摘要(Abstract)

Automated program repair aims to automate bug correction and alleviate the burden of manual debugging, which plays a crucial role in software development and maintenance. Recent studies reveal that learning-based approaches have outperformed conventional APR techniques (e.g., search-based APR). Existing learning-based APR techniques mainly center on treating program repair either as a translation task or a cloze task. The former primarily emphasizes statement-level repair, while the latter concentrates on token-level repair, as per our observations. In practice, however, patches may manifest at various repair granularity, including statement, expression, or token levels. Consequently, merely generating patches from a single granularity would be ineffective to tackle real-world defects. Motivated by this observation, we propose Mulpor, a multi-granularity patch generation approach designed to address the diverse nature of real-world bugs. Mulpor comprises three components: statement-level, expression-level, and token-level generator, each is pre-trained to generate correct patches at its respective granularity. The approach involves generating candidate patches from various granularities, followed by a re-ranking process based on a heuristic to prioritize patches. Experimental results on the Defects4J dataset demonstrate that Mulpor correctly repair 92 bugs on Defects4J-v1.2, which achieves 27.0% (20 bugs) and 12.2% (10 bugs) improvement over the previous state-of-the-art NMT-style Rap-Gen and Cloze-style GAMMA. We also studied the generalizability of Mulpor in repairing vulnerabilities, revealing a notable 51% increase in the number of correctly-fixed patches compared with state-of-the-art vulnerability repair approaches. This paper underscores the importance of considering multiple granularities in program repair techniques for a comprehensive strategy to address the diverse nature of real-world software defects. Mulpor, as proposed herein, exhibits promising results in achieving effective and diverse bug fixes across various program repair scenarios.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8455,
  title = {One Size Does Not Fit All: Multi-granularity Patch Generation for Better Automated Program Repair},
  author = {Bo Lin and Shangwen Wang and Ming Wen and Liqian Chen and Xiaoguang Mao},
  booktitle = {ISSTA},
  year = {2024},
  doi = {10.1145/3650212.3680381}
}