Skip to main content
QUICK REVIEW

[论文解读] The Fact Selection Problem in LLM-Based Program Repair

Nikhil Parasaram, Huijie Yan|arXiv (Cornell University)|Apr 8, 2024
Advanced Data Storage Technologies被引用 4
一句话总结

本文识别出基于大语言模型(LLM)的程序修复中的“事实选择问题”,即在提示中包含过多与错误相关的事实会降低修复效果。作者通过对19,000个提示进行大规模研究,提出Maniple——一种统计事实选择模型,通过选择与错误相关的特定事实,而非使用通用事实集,显著提升了修复效果,在BugsInPy基准测试中成功修复88个错误,较最佳基线高出17%。

ABSTRACT

Recent research has shown that incorporating bug-related facts, such as stack traces and GitHub issues, into prompts enhances the bug-fixing capabilities of large language models (LLMs). Considering the ever-increasing context window of these models, a critical question arises: what and how many facts should be included in prompts to maximise the chance of correctly fixing bugs? To answer this question, we conducted a large-scale study, employing over 19K prompts featuring various combinations of seven diverse facts to rectify 314 bugs from open-source Python projects within the BugsInPy benchmark. Our findings revealed that each fact, ranging from simple syntactic details like code context to semantic information previously unexplored in the context of LLMs such as angelic values, is beneficial. Specifically, each fact aids in fixing some bugs that would remain unresolved or only be fixed with a low success rate without it. Importantly, we discovered that the effectiveness of program repair prompts is non-monotonic over the number of used facts; using too many facts leads to subpar outcomes. These insights led us to define the fact selection problem: determining the optimal set of facts for inclusion in a prompt to maximise LLM's performance on a given task instance. We found that there is no one-size-fits-all set of facts for bug repair. Therefore, we developed a basic statistical model, named Maniple, which selects facts specific to a given bug to include in the prompt. This model significantly surpasses the performance of the best generic fact set. To underscore the significance of the fact selection problem, we benchmarked Maniple against the state-of-the-art zero-shot, non-conversational LLM-based bug repair methods. On our testing dataset of 157 bugs, Maniple repairs 88 bugs, 17% above the best configuration.

研究动机与目标

  • 研究不同与错误相关的事实如何影响基于大语言模型的程序修复性能。
  • 确定在提示中增加事实数量是否能提升或降低修复结果。
  • 确认事实数量与修复成功率之间是否存在非单调关系。
  • 开发一种定制化的事实选择策略,使基于大语言模型的修复效果超越通用配置。
  • 评估统计模型(Maniple)在为单个错误选择最优事实方面的有效性。

提出的方法

  • 基于BugsInPy基准中314个错误,使用19,000个提示进行大规模实证研究,提示中包含七种不同事实的多种组合。
  • 整合了包括代码上下文、堆栈跟踪、GitHub问题在内的多样化事实,以及新颖的语义事实(如天使值)。
  • 提出Maniple——一种基于每项错误的修复效果,为每个错误选择特定事实的统计模型。
  • 利用历史修复成功率数据(按事实-错误对)训练Maniple,以预测最优事实组合。
  • 在保留的157个错误测试集上,将Maniple与零样本、非对话式的大语言模型修复方法进行对比评估。
  • 利用非单调性能曲线识别每个错误的最佳事实数量,避免提示过载。

实验结果

研究问题

  • RQ1不同组合的与错误相关的事实如何影响基于大语言模型的程序修复成功率?
  • RQ2提示中事实数量与修复效果之间是否存在非单调关系?
  • RQ3基于数据驱动且针对错误的特定事实选择模型,是否能超越通用事实集在基于大语言模型修复中的表现?
  • RQ4引入此前未探索的语义事实(如天使值)对修复结果有何影响?
  • RQ5定制化事实选择模型(Maniple)的性能与最先进的零样本大语言模型修复方法相比如何?

主要发现

  • 七种事实(从语法代码上下文到语义天使值)中,每一种都对某些原本无法修复的错误提升了修复成功率。
  • 提示的有效性具有非单调性:事实过多会导致修复性能显著下降。
  • 不存在一种通用的事实集合能对所有错误实现最优修复,证实了事实选择问题的存在。
  • Maniple——一种针对错误定制的事实选择模型,在测试集上成功修复了157个错误中的88个,较最佳通用配置高出17个百分点。
  • 将天使值作为事实类型引入,显著改善了某些此前在基于大语言模型的修复中未被探索的错误类别。
  • 本研究表明,基于大语言模型的自动程序修复中的提示工程必须具备自适应性和上下文感知能力,而不仅仅是简单叠加事实。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。