arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.00992cs.SE
收藏

结合大型语言模型和程序分析的混合自动化程序修复

Hybrid Automated Program Repair by Combining Large Language Models and Program Analysis

Fengjie Li, Jiajun Jiang, Jiajun Sun, Hongyu Zhang

AI总结:

本文提出GIANTREPAIR方法,通过结合LLM生成补丁骨架与程序分析技术进行上下文感知的补丁实例化,有效提升了自动化程序修复在真实场景下的缺陷修复数量与性能。

摘要:

自动化程序修复(APR)因其在简化人类开发者的缺陷修复流程方面的潜力而备受关注。近期,基于LLM的APR方法在修复真实世界的缺陷方面展现出了潜力。然而,现有的APR方法通常直接使用LLM生成的补丁而未进行进一步优化,由于缺乏特定程序知识,导致有效性降低。此外,这些APR方法的评估通常在完美缺陷定位的假设下进行,这可能无法准确反映其在真实世界中的有效性。为了解决这些局限性,本文提出了一种名为GIANTREPAIR的创新APR方法。我们的方法利用了这样一个洞察:LLM生成的补丁虽然不一定正确,但为补丁生成过程提供了有价值的指导。基于这一洞察,GIANTREPAIR首先从LLM生成的补丁中构建补丁骨架以限制补丁空间,然后通过上下文感知的补丁生成实例化骨架,生成针对特定程序定制的高质量补丁。为了评估我们方法的性能,我们进行了两次大规模实验。结果表明,GIANTREPAIR不仅比直接使用LLM生成的补丁修复了更多缺陷(在Defects4J v1.2上平均为27.78%,在Defects4J v2.0上为23.40%),而且在完美和自动化缺陷定位场景下,分别通过至少多修复42个和7个缺陷,优于最先进的APR方法。

英文摘要:

Automated Program Repair (APR) has garnered significant attention due to its potential to streamline the bug repair process for human developers. Recently, LLM-based APR methods have shown promise in repairing real-world bugs. However, existing APR methods often utilize patches generated by LLMs without further optimization, resulting in reduced effectiveness due to the lack of program-specific knowledge. Furthermore, the evaluations of these APR methods have typically been conducted under the assumption of perfect fault localization, which may not accurately reflect their real-world effectiveness. To address these limitations, this paper introduces an innovative APR approach called GIANTREPAIR. Our approach leverages the insight that LLM-generated patches, although not necessarily correct, offer valuable guidance for the patch generation process. Based on this insight, GIANTREPAIR first constructs patch skeletons from LLM-generated patches to confine the patch space, and then generates high-quality patches tailored to specific programs through context-aware patch generation by instantiating the skeletons. To evaluate the performance of our approach, we conduct two large-scale experiments. The results demonstrate that GIANTREPAIR not only effectively repairs more bugs (an average of 27.78% on Defects4J v1.2 and 23.40% on Defects4J v2.0) than using LLM-generated patches directly, but also outperforms state-of-the-art APR methods by repairing at least 42 and 7 more bugs under perfect and automated fault localization scenarios, respectively.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑