ThinkRepair:自导向自动程序修复
ThinkRepair: Self-Directed Automated Program Repair
AI总结:
本文提出自导向自动程序修复方法ThinkRepair,通过收集阶段自动收集思维链,修复阶段结合少样本学习与LLM交互修复bug,在Defects4J和QuixBugs上显著优于12个SOTA方法。
摘要:
尽管已提出许多用于自动程序修复(APR)的方法并确实取得了显著的性能,但它们在修复需要分析和推理有缺陷程序逻辑的bug方面仍存在局限性。最近,由提示工程指导的大型语言模型(LLMs)因其在解决包括bug修复在内的多种任务方面的强大能力而备受关注。然而,提示的质量将极大地影响LLMs的能力,且手动构建高质量提示是一项成本高昂的工作。为了解决这一局限性,我们提出了一种基于LLM的自导向自动程序修复方法ThinkRepair,包含两个主要阶段:收集阶段和修复阶段。前一阶段通过使用思维链(CoT)提示指导LLMs,自动收集构成预修复知识的各种思维链。后一阶段旨在通过首先为少样本学习选择示例,其次自动与LLMs交互来修复bug,并可选地附加测试信息的反馈。在两个广泛研究的数据集(Defects4J和QuixBugs)上通过将ThinkRepair与12个SOTA APR进行比较的评估表明了ThinkRepair在修复bug方面的优势。值得注意的是,ThinkRepair在Defects4J V1.2上修复了98个bug,并比基线提高了27%-344.4%。在Defects4J V2.0上,ThinkRepair比SOTA APR多修复了12-65个bug。此外,ThinkRepair在QuixBugs上也取得了相当大的改进(Java最多31个,Python最多21个)。
英文摘要:
Though many approaches have been proposed for Automated Program Repair (APR) and indeed achieved remarkable performance, they still have limitations in fixing bugs that require analyzing and reasoning about the logic of the buggy program. Recently, large language models (LLMs) instructed by prompt engineering have attracted much attention for their powerful ability to address many kinds of tasks including bug-fixing. However, the quality of the prompt will highly affect the ability of LLMs and manually constructing high-quality prompts is a costly endeavor. To address this limitation, we propose a self-directed LLM-based automated program repair, ThinkRepair, with two main phases: collection phase and fixing phase. The former phase automatically collects various chains of thoughts that constitute pre-fixed knowledge by instructing LLMs with the Chain-of-Thought (CoT) prompt. The latter phase targets fixing a bug by first selecting examples for few-shot learning and second automatically interacting with LLMs, optionally appending with feedback of testing information. Evaluations on two widely studied datasets (Defects4J and QuixBugs) by comparing ThinkRepair with 12 SOTA APRs indicate the priority of ThinkRepair in fixing bugs. Notably, ThinkRepair fixes 98 bugs and improves baselines by 27%-344.4% on Defects4J V1.2. On Defects4J V2.0, ThinkRepair fixes 12-65 more bugs than the SOTA APRs. Additionally, ThinkRepair also makes a considerable improvement on QuixBugs (31 for Java and 21 for Python at most).
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。