Microsoft's FastContext Cuts Coding Agent Token Costs by 60% Before Writing a Line
Microsoft's FastContext offloads repo search to a tiny 4B model, cutting main-agent token use by up to 60% while improving benchmark scores across GPT-5.4, GLM-5.1, and Kimi-K2.6.
Takeaways
- What: Microsoft released FastContext-1.0, a 4B subagent that handles all repository file-search for coding agents, under MIT license.
- Token savings: Reduces main-agent token consumption by up to 60.3%, while improving end-to-end task resolution rates by up to 5.5% across three benchmarks.
- Surprising result: The 4B-RL model outperforms the 30B-SFT model on several benchmarks, showing RL beats naive scaling for this task.
- How it works: Issues parallel READ, GLOB, and GREP calls, then returns only compact file-line citations -- explorer's internal reasoning never enters the main agent's context.
- Training: Two-stage pipeline -- SFT on 2,954 Claude Sonnet 4.6 traces, then GRPO reinforcement learning with F1-based rewards against reference patches.
- Code & weights: Fully open-source at github.com/microsoft/fastcontext with the paper on arXiv.
Coding agents are surprisingly wasteful before they write a single line of code. Repository exploration is a major bottleneck in modern coding agents: locating relevant code consumes a large share of the token budget and pollutes the solver's context with irrelevant snippets. In an analysis of GPT-5.4 trajectories, reading and searching account for 56.2% of all tool-use turns and 46.5% of the main agent's total tokens. That's nearly half your inference budget gone before any actual fixing happens.
Microsoft's answer is FastContext, a lightweight subagent purpose-built for one job: finding the right files. FastContext-1.0 is a lightweight repository-exploration subagent for LLM coding agents. Instead of letting a single model both explore the repository and solve the task, FastContext separates these two roles: it is invoked on demand by a main coding agent, issues parallel read-only tool calls (READ, GLOB, GREP), and returns compact file paths and line ranges as focused context. The main agent never has to wade through exploratory dead ends again.
The hidden cost of "just grep it"
The problem is structural. LLM coding agents have achieved strong results on software engineering tasks, yet repository exploration remains a major bottleneck. In most agents, the same model explores the repository and solves the task, leaving exploratory reads and searches in the solver's history. Every file the agent reads to find the right one stays in the context window, inflating cost and diluting the signal the model actually needs to reason about a fix.
The paper also found a sequential bottleneck at the turn level: among trajectories where a first source-code edit could be identified, the agent started editing at turn 8.47 on average, with the median trajectory requiring six sequential exploration turns and 15.5 exploration tool calls before the first edit. FastContext attacks both problems at once by running exploration in parallel, outside the main agent's conversation history.
How it actually works
FastContext acts as an on-demand subagent, performing parallel READ, GLOB, and GREP tool calls to efficiently locate relevant code. It returns only compact file paths and line ranges, providing clean, grounded evidence to the main coding agent and preventing context pollution. The output is a tightly scoped