AI写代码时翻仓库的苦活,终于有人专门干了
现在的AI编程助手在改大项目时,会先花大量token(算力成本)翻遍整个代码仓库找相关文件,而且翻仓库和写代码用的是同一个模型,导致历史记录里塞满无关片段。这篇论文把“找文件”这个苦活单独拆出来,训练了一个4B~30B参数的小模型专门干——它被调起时并行搜索,只返回文件路径和行号,不污染主模型的上下文。在SWE-bench等测试集上,集成这个“探路者”后,代码修复成功率最高提升5.5%,token消耗却降了60%。它不是你明天就能用的工具,但指明了一个方向:AI写代码的效率瓶颈,可能不在写代码本身,而在找代码。
📄 原文摘要(英文)
Large Language Model (LLM) coding agents have achieved strong results on software engineering tasks, yet repository exploration remains a major bottleneck: locating relevant code consumes substantial token budget and pollutes the agent's context with irrelevant snippets. In most agents, the same model explores the repository and solves the task, leaving exploratory reads and searches in the solver's history. We present FastContext, a dedicated exploration subagent that separates repository exploration from solving. Invoked on demand, FastContext issues parallel tool calls and returns concise file paths and line ranges as focused context. FastContext is powered by specialized exploration models spanning 4B--30B parameters. We bootstrap them from strong reference-model trajectories and refine them with task-grounded rewards for broad first-turn search, multi-turn evidence gathering, and precise citation generation. Across SWE-bench Multilingual, SWE-bench Pro, and SWE-QA, integrating FastContext into Mini-SWE-Agent improves end-to-end resolution rates up to 5.5\% while reducing coding-agent token consumption up to 60\%, with marginal overhead. These results show that repository exploration can be separated from solving and handled effectively by specialized models. Code and data: https://github.com/microsoft/fastcontext