SiblingRepair: 基于兄弟的多补丁修复与大型语言模型
SiblingRepair: Sibling-Based Multi-Hunk Repair with Large Language Models
AI总结:
SiblingRepair利用大型语言模型进行基于兄弟的多补丁修复,通过语义相关性搜索和两种修复策略提升修复效率和准确性,优于现有技术。
摘要:
开发者在实现相关功能时常在多个代码位置犯相似错误,这些位置称为兄弟,需要相似修复。Hercules是用于兄弟修复的先进方法,但受限于对兄弟位置和提交历史的强假设、刚性的AST匹配和灵活的模板生成。为解决这些问题,我们提出了SiblingRepair,一种基于大型语言模型的多补丁自动修复(APR)技术。从通过频谱故障定位确定的可疑位置出发,SiblingRepair利用基于标记和嵌入的代码匹配搜索语义相关的兄弟候选。它使用LLM识别故障相关的兄弟并生成一致的补丁,通过同时修复和迭代修复两种互补策略。SiblingRepair还保留来自早期可疑位置的有希望的补丁,并将其组合成通用多补丁补丁。我们在Defects4J和GHRB基准上评估SiblingRepair,结果表明其显著优于Hercules等现有技术,证明了其修复效率、兄弟检测和修复组件的有效性,以及LLM数据泄漏对结果影响有限。
英文摘要:
Developers often make similar mistakes across code locations implementing related functionalities. These locations, called siblings, share similar issues and require similar fixes. Accurately identifying siblings and consistently repairing them are crucial for automated program repair. Hercules is a SOTA technique designed for sibling repair. However, it is limited by strong assumptions about sibling locations and commit-history availability, rigid AST-based sibling matching, and inflexible template-based patch generation. To address these limitations, we present SiblingRepair, a new LLM-based multi-hunk APR technique specialized for sibling repair. Starting from a suspicious location identified by spectrum-based fault localization, SiblingRepair searches for semantically related sibling candidates using token- and embedding-based code matching, without restricting discovery to failing-test coverage or commit history. It then uses an LLM to identify failure-relevant siblings and generate consistent patches through two complementary strategies: simultaneous repair, which jointly repairs siblings, and iterative repair, which progressively analyzes candidates for patch construction. SiblingRepair further preserves promising patches generated from earlier suspicious locations and combines them into generalized multi-hunk patches. We evaluate SiblingRepair on the Defects4J and GHRB benchmarks. The results show that SiblingRepair substantially outperforms SOTA multi-hunk repair techniques including Hercules. Our evaluation further demonstrates its repair efficiency, the effectiveness of its sibling detection and repair components, and limited impact of the LLM data leakage on the results. Overall, SiblingRepair advances automated sibling and general multi-hunk repair.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。