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)编码智能体在软件工程任务中取得了显著成果,但代码库探索仍是一大瓶颈:定位相关代码会消耗大量token预算,并将无关片段混入智能体的上下文。在大多数智能体中,同一模型既负责探索代码库又负责解决问题,导致求解器的历史记录中充斥着探索性读取和搜索操作。本文提出FastContext,一种专用的探索子智能体,将代码库探索与问题求解相分离。FastContext按需调用,通过并行工具调用获取信息,并返回简洁的文件路径和行范围作为聚焦上下文。FastContext由参数规模从4B到30B不等的专用探索模型驱动。我们从强参考模型轨迹中引导生成这些探索模型,并通过基于任务的奖励对其进行优化,以提升首轮搜索广度、多轮证据收集能力以及精确引用生成质量。在SWE-bench Multilingual、SWE-bench Pro和SWE-QA基准上,将FastContext集成到Mini-SWE-Agent中,端到端解决率最高提升5.5%,同时编码智能体token消耗降低高达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