arXiv:2606.03852 · 中英对照阅读
FLARE:用于大语言模型代码精炼的细粒度诊断反馈
FLARE: Fine-Grained Diagnostic Feedback for LLM Code Refinement
中文速览
大语言模型写代码常有 bug,而普通的报错信息或自我检查往往只告诉它“哪里不对劲”,却说不清该改哪一行。Flare 先用一个轻量诊断模型给代码行标出可疑程度,再让大模型针对排名靠前的几行分别生成修改版本,并通过运行测试挑选更好的方案。它在 LiveCodeBench 和 BigCodeBench 上测试了五种大语言模型:只看最可疑的一行时,Flare 在十组设置中的九组超过最强对照方法;同时尝试十个可疑位置后,平均正确率又提升了近 9 个百分点。结果说明,给模型更具体的改错位置,并允许它比较多种修法,能让代码迭代修复更有效,也为自动编程提供了一种实用的诊断思路。
摘要
Large language models often generate code with bugs. Existing methods revise such code using feedback signals such as test failures and self-critiques, but these signals are too coarse-grained or too high-level to tell the model where the code should be revised. We present Flare, an iterative code generation framework whose lightweight diagnostic model predicts line-level suspiciousness to guide code refinement. Given the inherent uncertainty of diagnostic predictions, Flare searches over the top-k suspicious lines at each step and selects the next candidate according to execution outcomes. Experiments on LiveCodeBench and BigCodeBench with five base LLMs show that, even without candidate search, Flare ( $k$ =1) outperforms the strongest baseline, NL-Debugging, with an absolute improvement from 1.06% to 9.71% in 9 of 10 settings. Expanding the search to 10 candidates adds an average improvement of 8.97%, and Flare keeps an average lead of 3.39% over the strongest baseline under the same candidate budget. When evaluated in isolation, our lightweight diagnostic model outperforms recent fault localization methods, demonstrating that it can provide reliable fine-grained guidance for code refinement.
术语表
- Flare
- Flare
- large language model (LLM)
- 大语言模型(LLM)
- iterative code generation
- 迭代式代码生成
- iterative refinement
- 迭代式精炼
- diagnostic model
- 诊断模型
- line-level suspiciousness
- 行级可疑度
- fine-grained diagnostic feedback
- 细粒度诊断反馈
- candidate search
- 候选搜索
- fault localization
- 故障定位
- LiveCodeBench
- LiveCodeBench
- BigCodeBench
- BigCodeBench
- NL-Debugging
- NL-Debugging
- Self-Debugging
- Self-Debugging
- Self-Refine
- Self-Refine
- Best-of-N
- Best-of-N
- Collu-Bench
- Collu-Bench
- HumanEval
- HumanEval
- MBPP
- MBPP
- HumanEval-Java
- HumanEval-Java
- Defects4J
- Defects4J
- SWE-bench
- SWE-bench
- abstract syntax tree (AST)
- 抽象语法树(AST)
- lexical unit
- 词法单元
- subword token
- 子词元
- Byte-Pair Encoding (BPE)
- 字节对编码(BPE)
- bidirectional transformer encoder
- 双向 Transformer 编码器
- positional encoding
- 位置编码
- Top-k localization accuracy
- Top-k 定位准确率