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

当大型语言模型面对仓库级自动程序修复:它们表现如何?

When Large Language Models Confront Repository-Level Automatic Program Repair: How Well They Done?

Yuxiao Chen, Jingzheng Wu, Xiang Ling, Changjiang Li, Zhiqing Rui, Tianyue Luo, Yanjun Wu

AI总结:

本文构建含124个仓库级缺陷的RepoBugs基准,揭示LLM仓库级APR表现不足,并提出通用RLCE上下文提取方法,使修复率最高提升160%。

摘要:

近年来,大型语言模型(LLM)在解决自动程序修复(APR)任务方面展现出巨大潜力。然而,当前对这些模型在APR任务上的评估仅关注缺陷所在的单个函数或文件这一有限上下文,忽视了仓库级上下文中的宝贵信息。本文研究了主流LLM在处理仓库级修复任务时的表现。我们引入了RepoBugs,这是一个包含来自开源仓库的124个典型仓库级缺陷的新基准。基于错误所在函数、使用GPT3.5开展的初步实验表明,其在RepoBugs上的修复率仅为22.58%,与相关研究中GPT3.5在函数级缺陷上的表现存在显著差异。这凸显了在解决该级别缺陷时提供仓库级上下文的重要性。然而,初步方法提供的仓库级上下文往往被证明冗余且不精确,并且容易超出LLM的提示长度限制。为解决该问题,我们提出了一种简单通用的仓库级上下文提取方法(RLCE),旨在为仓库级代码修复任务提供更精确的上下文。对三种主流LLM的评估表明,RLCE显著增强了修复仓库级缺陷的能力。与初步方法相比,改进幅度最高达到160%。此外,我们还全面分析了RLCE的有效性与局限性,以及LLM解决仓库级缺陷的能力,为未来研究提供了有价值的洞见。

英文摘要:

In recent years, large language models (LLMs) have demonstrated substantial potential in addressing automatic program repair (APR) tasks. However, the current evaluation of these models for APR tasks focuses solely on the limited context of the single function or file where the bug is located, overlooking the valuable information in the repository-level context. This paper investigates the performance of popular LLMs in handling repository-level repair tasks. We introduce RepoBugs, a new benchmark comprising 124 typical repository-level bugs from open-source repositories. Preliminary experiments using GPT3.5 based on the function where the error is located, reveal that the repair rate on RepoBugs is only 22.58%, significantly diverging from the performance of GPT3.5 on function-level bugs in related studies. This underscores the importance of providing repository-level context when addressing bugs at this level. However, the repository-level context offered by the preliminary method often proves redundant and imprecise and easily exceeds the prompt length limit of LLMs. To solve the problem, we propose a simple and universal repository-level context extraction method (RLCE) designed to provide more precise context for repository-level code repair tasks. Evaluations of three mainstream LLMs show that RLCE significantly enhances the ability to repair repository-level bugs. The improvement reaches a maximum of 160% compared to the preliminary method. Additionally, we conduct a comprehensive analysis of the effectiveness and limitations of RLCE, along with the capacity of LLMs to address repository-level bugs, offering valuable insights for future research.

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

↑