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

基于规范的自动化程序修复

Specification Vibing for Automated Program Repair

The University of Manchester(曼彻斯特大学);Mohamed bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学)

Taohong Zhu, Lucas C. Cordeiro, Mustafa A. Mustafa, Youcheng Sun

AI总结:

VibeRepair通过行为规范修复替代传统代码编辑,提升自动化程序修复的准确性和泛化能力。

摘要:

大型语言模型(LLM)驱动的自动化程序修复(APR)已取得快速进展,但大多数方法仍以代码为中心:它们直接重写源代码,从而可能导致幻觉和行为不一致的修复。这一限制表明,需要一种替代的修复范式,该范式依赖于比原始代码更易于LLM理解的表示,以在修复过程中实现更准确的理解、分析和对齐。为了解决这一差距,我们提出了VibeRepair,一种以规范为中心的APR技术,将修复视为行为规范修复,而非随意的代码编辑。VibeRepair首先将有bug的代码转换为结构化的行为规范,该规范捕捉了程序的预期运行行为,然后推断并修复规范偏差,最后严格根据修正后的行为规范合成代码。一个按需推理组件在处理困难案例时通过程序分析和历史bug修复证据进行补充,同时控制成本。在Defects4J和真实世界基准测试以及多个LLM上,VibeRepair展示了持续强劲的修复效果,且具有显著更小的补丁空间。在Defects4J v1.2上,VibeRepair正确修复了174个bug,超过最先进的现有基线方法28个bug,这对应于19%的提升。在Defects4J v2.0上,它修复了178个bug,优于先前方法33个bug,代表23%的提升。在选定LLM训练期后收集的真实世界基准测试评估进一步证实了其有效性和通用性。通过将修复聚焦于明确的行为意图,VibeRepair重新定义了

英文摘要:

Large language model (LLM)-driven automated program repair (APR) has advanced rapidly, but most methods remain code-centric: they directly rewrite source code and thereby risk hallucinated, behaviorally inconsistent fixes. This limitation suggests the need for an alternative repair paradigm that relies on a representation more accessible to LLMs than raw code, enabling more accurate understanding, analysis, and alignment during repair. To address this gap, we propose VibeRepair, a specification-centric APR technique that treats repair as behavior-specification repair rather than ad-hoc code editing. VibeRepair first translates buggy code into a structured behavior specification that captures the program's intended runtime behavior, then infers and repairs specification misalignments, and finally synthesizes code strictly guided by the corrected behavior specification. An on-demand reasoning component enriches hard cases with program analysis and historical bug-fix evidence while controlling cost. Across Defects4J and real-world benchmarks and multiple LLMs, VibeRepair demonstrates consistently strong repair effectiveness with a significantly smaller patch space. On Defects4J v1.2, VibeRepair correctly repairs 174 bugs, exceeding the strongest state-of-the-art baseline by 28 bugs, which corresponds to a 19% improvement. On Defects4J v2.0, it repairs 178 bugs, outperforming prior approaches by 33 bugs, representing a 23% improvement. Evaluations on real-world benchmarks collected after the training period of selected LLMs further confirm its effectiveness and generalizability. By centering repair on explicit behavioral intent, VibeRepair reframes APR for the era of "vibe" coding: make the behavior sing, and the code will follow.

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

↑