FLARE: 面向大语言模型代码精炼的细粒度诊断反馈
FLARE: Fine-Grained Diagnostic Feedback for LLM Code Refinement
AI总结:
提出FLARE框架,利用轻量级诊断模型预测行级可疑信号进行缺陷定位和代码精炼,通过Top-K候选搜索提升修复效果。
摘要:
大型语言模型生成的代码常含有错误。现有方法依赖测试失败和自批评等反馈信号来迭代精炼生成的代码,但这些信号要么过于粗粒度,要么过于高层,不足以告知模型何处需要修复。在本工作中,我们提出了Flare,一个迭代框架,配备轻量级诊断模型,用于预测行级可疑信号以进行缺陷定位和代码精炼。鉴于诊断预测固有的不确定性,Flare搜索前K个最可疑区域,并根据执行结果选择最佳候选。在LiveCodeBench和BigCodeBench上使用五个基础LLM的实验表明,即使没有候选搜索(k=1),Flare也以1.72%到7.42%的绝对提升优于最强基线。此外,与无候选搜索相比,搜索10个候选平均提升8.50%。单独评估时,我们的轻量级诊断模型与最近的缺陷定位方法相比取得了最佳性能,表明它能提供可靠的细粒度代码精炼指导。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。