ContrastRepair: 通过对比测试用例对增强基于对话的自动程序修复
ContrastRepair: Enhancing Conversation-Based Automated Program Repair via Contrastive Test Case Pairs
AI总结:
ContrastRepair通过对比测试对提升基于对话的自动程序修复效果,显著优于现有方法。
摘要:
自动程序修复(APR)旨在自动生成补丁以纠正软件缺陷。近年来,大型语言模型(LLM)如ChatGPT在APR领域取得了显著进展,特别是在基于对话的APR框架中。然而,基于对话的APR效果依赖于反馈信息的质量。在本文中,我们提出了一种新的基于对话的APR方法ContrastRepair,通过为LLM提供对比测试对来增强基于对话的APR。一个测试对由一个失败的测试和一个通过的测试组成,为LLM提供对比反馈。我们的关键见解是通过最小化生成的通过测试与给定的失败测试之间的差异,更好地隔离缺陷的根本原因。通过提供信息丰富且具体的反馈,ContrastRepair使LLM能够生成有效的bug修复。ContrastRepair的实现基于最先进的LLM,ChatGPT,并且不断与ChatGPT交互,直到生成合理的补丁。我们在多个基准数据集上评估了ContrastRepair,包括Defects4j、QuixBugs和HumanEval-Java。结果表明,ContrastRepair显著优于现有方法,实现了程序修复的新状态。例如,在Defects4j 1.2和2.0中,ContrastRepair正确修复了所有337个缺陷案例中的143个,而最佳表现的基线修复了124个缺陷。
英文摘要:
Automated Program Repair (APR) aims to automatically generate patches for rectifying software bugs. Recent strides in Large Language Models (LLM), such as ChatGPT, have yielded encouraging outcomes in APR, especially within the conversation-driven APR framework. Nevertheless, the efficacy of conversation-driven APR is contingent on the quality of the feedback information. In this paper, we propose ContrastRepair, a novel conversation-based APR approach that augments conversation-driven APR by providing LLMs with contrastive test pairs. A test pair consists of a failing test and a passing test, which offer contrastive feedback to the LLM. Our key insight is to minimize the difference between the generated passing test and the given failing test, which can better isolate the root causes of bugs. By providing informative and specific feedback, ContrastRepair enables the LLM to produce effective bug fixes. The implementation of ContrastRepair is based on the state-of-the-art LLM, ChatGPT, and it iteratively interacts with ChatGPT until plausible patches are generated. We evaluate ContrastRepair on multiple benchmark datasets, including Defects4j, QuixBugs, and HumanEval-Java. The results demonstrate that ContrastRepair significantly outperforms existing methods, achieving a new state-of-the-art in program repair. For instance, among Defects4j 1.2 and 2.0, ContrastRepair correctly repairs 143 out of all 337 bug cases, while the best-performing baseline fixes 124 bugs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。