arXiv:2606.03852cs.SEcs.AI2026-06被引 1

用细粒度错误定位提升大模型代码修复能力

FLARE: Fine-Grained Diagnostic Feedback for LLM Code Refinement

论文配图:FLARE: Fine-Grained Diagnostic Feedback for LLM Code Refinement
图 1 · 摘自论文原文
  • 引入轻量诊断模型,预测代码行级可疑度以精确定位错误
  • 在两个基准上平均提升8.50%修复成功率,最优提升达7.42%
  • 适合需要精准代码调试的开发者与自动化修复系统使用

大语言模型生成的代码常含缺陷。现有方法依赖测试失败或自我批评等粗粒度反馈,难以定位具体错误位置。本文提出Flare框架,通过轻量级诊断模型预测代码行级可疑度,实现细粒度错误定位。考虑到诊断结果的不确定性,Flare在前k个可疑区域中搜索,并根据执行结果选择最优修复候选。在LiveCodeBench和BigCodeBench上,使用五种基线LLM进行实验,即使不进行候选搜索(k=1),Flare也优于最强基线,绝对提升达1.72%至7.42%。当搜索10个候选时,平均提升达8.50%。单独评估时,该诊断模型性能超越近期故障定位方法,证明其能提供可靠细粒度指导。

原文摘要 · Abstract (English)

Large language models often generate code with bugs. Existing methods rely on feedback signals such as test failures and self-critiques to iteratively refine the generated code. Such signals are either too coarse-grained or too high-level, which is not sufficient to inform the model where to fix the bug. In this work, we present Flare, an iterative framework with a lightweight diagnostic model that predicts line-level suspiciousness signals for bug localization and code refinement. Given the inherent uncertainty of diagnostic predictions, Flare searches over the top-k suspicious regions and selects the best candidate according to execution outcomes. Experiments on LiveCodeBench and BigCodeBench with five base LLMs show that, even without candidate search (k=1), Flare outperforms the strongest baseline with an absolute improvement from 1.72% to 7.42%. Furthermore, searching over 10 candidates yields an average improvement of 8.50% compared with no candidate search. When evaluated in isolation, our lightweight diagnostic model achieves the best performance compared with recent fault localization methods, demonstrating that it can provide reliable fine-grained guidance for code refinement.

代码修复错误定位大模型诊断模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。