FastContext:為程式碼代理訓練高效儲存庫探索器
FastContext: Training Efficient Repository Explorer for Coding Agents
June 12, 2026
作者: Shaoqiu Zhang, Maoquan Wang, Yuling Shi, Yuhang Wang, Xiaodong Gu, Yongqiang Yao, Rao Fu, Shengyu Fu
cs.AI
摘要
大型語言模型(LLM)編碼代理在軟體工程任務上已取得優異成果,但倉庫探索仍是主要瓶頸:定位相關程式碼消耗大量令牌預算,並將無關片段混入代理的上下文。在多數代理中,探索倉庫與解決任務由同一模型完成,導致求解器的歷史記錄中充斥著探索性讀取與搜索。我們提出 FastContext,這是一個專門的探索子代理,將倉庫探索與任務求解分離。FastContext 按需調用,發出並行工具呼叫,並返回精簡的檔案路徑與行範圍作為聚焦上下文。FastContext 由參數量從 4B 到 30B 的專門探索模型驅動。我們從強參考模型軌跡中引導這些模型,並使用基於任務的獎勵對其進行優化,以支援廣泛的首輪搜索、多輪證據收集及精確的引用生成。在 SWE-bench Multilingual、SWE-bench Pro 與 SWE-QA 上,將 FastContext 整合至 Mini-SWE-Agent 可將端到端解決率提升最多 5.5%,同時將編碼代理的令牌消耗降低最多 60%,且開銷極小。這些結果表明,倉庫探索可與任務求解分離,並由專門模型有效處理。程式碼與資料:https://github.com/microsoft/fastcontext
English
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