让代码修复智能体精准定位问题,提升修复成功率。
SHERLOC: Structured Diagnostic Localization for Code Repair Agents

- 用推理大模型+轻量工具,无需训练就能定位故障。
- 在SWE-Bench上定位准确率超84%,比之前方法快36.7%。
- 适合想提升代码修复效率的开发者和研究者。
LLM智能体通过多轮工具调用解决仓库级编程任务,但一半计算资源用于故障定位而非修改。现有定位框架仍以文件检索为评估标准,缺乏修复所需诊断上下文。我们提出SHERLOC(结构化假设驱动探索与推理定位),一种无需训练、不依赖多智能体协同的框架,结合推理大模型、紧凑仓库工具与自恢复机制。SHERLOC在不同模型规模下均达领先水平:在SWE-Bench Lite上准确率@1达84.33%,在SWE-Bench Verified上召回率@1达81.27%;参数量约300亿时,性能优于或匹配其他代理方法。将定位结果与诊断信息注入修复智能体后,平均修复成功率提升5.95个百分点。整体上,定位与总令牌消耗分别降低36.7%和23.1%。
原文摘要 · Abstract (English)
LLM agents solve repository-level coding tasks through multi-turn tool use, but utilize half their budget on locating faults before editing. Dedicated localization frameworks have emerged, yet are still evaluated as file retrieval rather than actionable diagnosis, producing locations without the diagnostic context a repair agent needs. We introduce SHERLOC (Structured Hypothesis-driven Exploration and Reasoning for Localization), a training-free framework pairing a reasoning LLM with compact repository tools and self-recovery, without fine-tuning or multi-agent orchestration. SHERLOC reaches state-of-the-art localization across model scales: 84.33% accuracy@1 on SWE-Bench Lite and 81.27% recall@1 on SWE-Bench Verified; at ~30B parameters, it matches or outperforms other agentic methods. Injecting our locations and diagnostic findings into repair agents yields an average +5.95 pp resolve-rate gain from the best SHERLOC result per setting on SWE-Bench Verified. SHERLOC cuts localization and total tokens by 36.7% and 23.1% on average.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。