Summary (Overview)
- FastContext is a dedicated exploration subagent that separates repository exploration from the main agent's problem-solving, reducing token consumption and improving resolution rates in coding agents.
- The system uses specialized exploration models (4B–30B parameters) trained via supervised fine-tuning (SFT) and reinforcement learning (RL) with task-grounded rewards.
- Integrating FastContext into Mini-SWE-Agent improves end-to-end resolution rates up to 5.5% while reducing main-agent token consumption up to 60% across three benchmarks (SWE-bench Multilingual, SWE-bench Pro, SWE-QA).
- FastContext exposes only three language-agnostic read-only tools (READ, GLOB, GREP) and returns compact file-and-line citations as focused context.
- Standalone evaluation shows trained FastContext checkpoints reach 73.71 file-level F1 and 60.35 module-level F1, outperforming existing localization baselines.
Introduction and Theoretical Foundation
Background
Coding agents powered by Large Language Models (LLMs) have achieved strong results on software engineering tasks, but repository exploration remains a major bottleneck. The authors observe that:
- 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.
- Benchmarks like SWE-bench and SWE-QA require navigating large, multi-file codebases, making exploration a critical factor in both task success and inference efficiency.
Preliminary Analysis
The paper presents a detailed analysis of 300 GPT-5.4-high trajectories on SWE-bench Multilingual:
- Reading and searching dominate the full trajectory, accounting for 56.2% of all tool-use turns and 46.5% of the main agent's total tokens.
- The agent starts editing at turn 8.47 on average, with a median of 6 sequential exploration turns and 15.5 exploration tool calls before the first edit.
- Unresolved trajectories are associated with more pre-edit exploration turns than resolved ones (8.34 vs. 6.67 turns on average).
This motivates the design of FastContext as a reusable exploration component that can be delegated to a subagent performing parallel search and returning compact evidence.
Methodology
3.1 FastContext Subagent Architecture
FastContext is a runtime delegation mechanism that separates repository exploration from solving:
- The main agent delegates exploration to the explorer, which returns evidence rather than a patch.
- The subagent exposes only three language-agnostic tools:
- READ: reads line-numbered file contents
- GLOB: discovers paths via pattern matching
- GREP*: regex search over repository text
- Multiple tool calls in the same turn are executed in parallel.
- The output contract is a compact final answer block containing file paths and line ranges:
<final_answer>
/src/router.py:42-58 (Router definition)
/tests/test_router.py:101-119
</final_answer>
3.2 Policy Initialization with Supervised Fine-Tuning
The initial exploration policy is trained via SFT with 2,954 filtered examples from Sonnet 4.6 exploration traces, split into three sources:
- parallel_toolcalls (990 examples): targets broad first-turn search with nonredundant parallel tool calls.
- multiturn_traj (983 examples): targets multi-turn evidence gathering with full trajectories.
- linerange (981 examples): targets precise citation generation with narrow
<final_answer>blocks.
The SFT objective is:
where masks out non-assistant tokens.
3.3 Policy Refinement with Reinforcement Learning
The explorer is refined with task-grounded RL using a 400-prompt set derived from issue-resolution tasks with reference patches. The reward function is:
Where:
- and : target file and line sets from the reference patch
- and : predicted sets parsed from the model's final citations
- : small bonus for bounded multi-call exploration
- : penalty for empty, overly long, malformed, or excessive-fan-out outputs
The format penalty is:
and the bounded-parallelism bonus is:
The models are optimized with GRPO (Group Relative Policy Optimization), initialized from the SFT checkpoint.
Empirical Validation / Results
4.2 End-to-End Results
Table 1: End-to-end performance and efficiency across three benchmarks
| Main Agent | Subagent | SWE-bench Multilingual Score | Tokens | SWE-bench Pro Score | Tokens | SWE-QA Score | Tokens |
|---|---|---|---|---|---|---|---|
| GPT-5.4 | w/o Explore | 71.7 | 457k | 46.0 | 818k | 81.3 | 418k |
| GPT-5.4 | GPT-5.4 | 73.3 ↑1.6 | 379k ↓17.1% | 51.5 ↑5.5 | 703k ↓14.1% | 81.4 ↑0.1 | 166k ↓60.3% |
| GPT-5.4 | FC-30B-SFT | 75.0 ↑3.3 | 356k ↓22.1% | 49.0 ↑3.0 | 688k ↓15.9% | 82.0 ↑0.7 | 206k ↓50.7% |
| GPT-5.4 | FC-4B-SFT | 73.3 ↑1.6 | 364k ↓20.4% | 47.0 ↑1.0 | 689k ↓15.8% | 81.9 ↑0.6 | 213k ↓49.0% |
| GPT-5.4 | FC-4B-RL | 74.7 ↑3.0 | 338k ↓26.0% | 48.5 ↑2.5 | 701k ↓14.3% | 82.0 ↑0.7 | 210k ↓49.8% |
| GLM-5.1 | w/o Explore | 72.3 | 2514k | 17.5 | 2692k | 72.7 | 401k |
| GLM-5.1 | GLM-5.1 | 73.3 ↑1.0 | 1994k ↓20.7% | 18.0 ↑0.5 | 2356k ↓12.5% | 73.4 ↑0.7 | 249k ↓37.9% |
| GLM-5.1 | FC-30B-SFT | 73.7 ↑1.4 | 1797k ↓28.5% | 20.0 ↑2.5 | 2370k ↓12.0% | 73.3 ↑0.6 | 292k ↓27.2% |
| GLM-5.1 | FC-4B-RL | 73.7 ↑1.4 | 1971k ↓21.6% | 22.5 ↑5.0 | 2210k ↓17.9% | 73.5 ↑0.8 | 302k ↓24.7% |
| Kimi-K2.6 | w/o Explore | 76.3 | 1553k | 31.0 | 2383k | 71.6 | 510k |
| Kimi-K2.6 | FC-4B-RL | 78.3 ↑2.0 | 1384k ↓10.9% | 33.5 ↑2.5 | 2158k ↓9.4% | 72.6 ↑1.0 | 378k ↓25.9% |
Key findings:
- FastContext improves end-to-end accuracy for every main agent and benchmark.
- Largest gains on SWE-bench Pro: GPT-5.4 improves from 46.0 to 51.5, GLM-5.1 from 17.5 to 22.5.
- Largest token savings on SWE-QA: 60.3% for GPT-5.4.
- 4B-RL can outperform the larger 30B-SFT explorer in several settings.
4.4 Standalone Exploration Quality
Table 2: Standalone exploration quality on SWE-bench Verified
| Scaffold | LLM | File-level F1 | Module-level F1 | Function-level F1 |
|---|---|---|---|---|
| OpenHands-Bash | CODESCOUT-14B | 68.57 | 50.88 | 40.32 |
| FastContext | FC-30B-SFT | 73.71 | 60.35 | 40.74 |
| FastContext | FC-4B-SFT | 70.55 | 55.26 | 37.48 |
| FastContext | FC-4B-RL | 71.48 | 56.26 | 38.45 |
Trained FastContext checkpoints reach 73.71 file-level F1 and 60.35 module-level F1, compared with 68.57 and 50.88 for the best non-FastContext rows.
Cost Audit
Table 3: Token and cost audit for GPT-5.4 SWE-bench Multilingual run
| Component | Tokens | API cost |
|---|---|---|
| Direct main | 457k / task | $282.47 |
| Main + 4B-RL | 338k / task | $208.92 |
| 4B-RL explorer | 22.58M total | $4.52 |
| Augmented total | - | $213.44 |
| Net saving | - | $69.03 |
The explorer accounts for only 2.1% of the augmented total cost.
Theoretical and Practical Implications
Theoretical Contributions
-
Modular view of coding agents: The paper demonstrates that repository exploration can be treated as a first-class, trainable component rather than an implicit cost inside monolithic solver trajectories.
-
Separation of concerns: By decoupling exploration from solving, FastContext shows that specialized small models can effectively handle navigation tasks, enabling collaboration between smaller specialized models and stronger main agents.
-
Task-grounded RL effectiveness: The results show that a 4B-parameter model trained with RL can outperform a 30B-SFT model, suggesting that task-grounded optimization is more important than raw model scale for exploration tasks.
Practical Implications
-
Token efficiency: FastContext reduces frontier-model token consumption by up to 60%, directly translating to inference cost savings.
-
Deployment feasibility: The 4B explorer is designed for local serving, eliminating per-token API costs while maintaining performance.
-
Cleaner context: The main agent receives focused file-line evidence rather than noisy exploratory context, improving both resolution rates and reasoning quality.
Conclusion
Main Takeaways
- Repository exploration should be separated from solving and handled by specialized models.
- FastContext's SFT + RL training recipe effectively bootstraps compact exploration models from reference trajectories.
- The architecture enables parallel tool use and returns compact file-and-line citations that are directly consumable by the main agent.
Future Directions
- Broader integration: Adapting FastContext to other coding-agent frameworks with different tool interfaces and orchestration mechanisms.
- Smaller main models: Exploring FastContext paired with 30B-class coding agents.
- Smaller explorers: Investigating whether the same recipe supports 1.7B or 0.6B parameter models.
- Benchmark decontamination: Addressing potential overlap between public benchmarks and frontier-model training data.
Limitations
- Evaluation is currently limited to Mini-SWE-Agent as the main-agent scaffold.
- Experiments focus on strong frontier models (GPT-5.4, GLM-5.1, Kimi-K2.6).
- The smallest explorer trained has 4B parameters; smaller variants remain to be explored.
The paper concludes that repository navigation can be optimized and evaluated separately from patch generation or answer synthesis, encouraging future systems to expose exploration as an explicit interface with clearer context boundaries.
Related papers
- CoSkill: Joint Reinforcement Learning of Reasoning and Meta-Skill Agents for Hierarchical Skill Evolution
CoSkill's multi-agent co-training of reasoning and meta-skill agents over a hierarchical library achieves 98.4% ALFWorld and 90.6% WebShop success, outperforming all baselines.
- HarnessEvolve: Learning from Reference Trajectories for Reliable Agent Self-Evolution
HarnessEvolve, a self-evolving agent framework with reference-guided error diagnosis and dual gating, outperforms all baselines across five benchmarks, achieving up to 21.6% accuracy gains.
- Data Scarcity and Model Sparsity: Mixtures-of-Experts Overfit More to Repeated Data
Mixture-of-Experts models overfit repeated data faster than dense Transformers, losing their advantage by 32x repetition, but dropout and output masking can restore it even at 64x.