修 bug 的人,教找 bug 的人
AI 修 bug 分两步:先找到问题代码,再动手改。训练「找」的那一步,一直拿「最终改了哪些文件」当标准答案——但修 bug 时要读的代码,和要改的代码,根本不是同一批。这篇论文换了个老师:让「找」的模型给出几个候选位置,由一个冻结的「修」模型打分——照这个位置找过去,你有多大把握改对?再用这些分数训练定位模型,全程不跑测试、不用强化学习。效果很直接:修复成功率不变,但要读的代码少了 27.5%;在 78 个任务上,单 agent 最多解出 11 个,基座模型是 8 个。对小团队更实在的是它的成本结构:整套流程跑在一个 4B 小模型上,数据、代码、权重全部公开。它不是你明天能装上的工具,但「让下游干活的人来教上游找线索的人」这个思路,可能会成为训练小型 agent 的通用做法。
📄 原文摘要(英文)
Code localizers are usually trained to predict the files a reference patch edits, but the code a fixer needs to read is not the same as the code it changes. We propose Fixer-Guided Localization (FGL): the localizer proposes several localizations, a frozen fixer scores each by how likely it makes a verified patch, and the localizer is trained on these scores with weighted supervised fine-tuning, without running tests and without reinforcement learning. We build the full pipeline on Gemma 4 E4B for the Kaggle Gemma-4 Developer Agent competition, from 1,629 test-verified Kimi K3 trajectories. The FGL target helps the fixer find the bug as often as the teacher's localization while using 27.5% less code. On the development set, one EM round moves the agent in the expected direction compared with a matched control: more tasks reach a patch (53 vs. 46), fewer tasks get stuck reading files that do not exist (43 vs. 54), and more tasks are solved (8 vs. 6). Training also changes how the agent works: trained agents explore about three times more than the base model and write far fewer wrong patches, and the single agent solves up to 11 of 78 tasks, against 8 for the base model. An analysis of 13 evaluation runs identifies what limits a 4B agent under an 8-minute budget (time, repetition loops and edit quality) and gives practical lessons for training small coding agents. All data, code and adapters are publicly available.