Repository-scale code reasoning is a cornerstone of modern AI-assisted software engineering, enabling Large Language Models (LLMs) to handle complex workflows from program comprehension to complex debugging. However, balancing accuracy with context cost remains a significant bottleneck, as existing agentic approaches often waste computational resources through inefficient, iterative full-text exploration. To address this, we introduce FastCode, a framework that decouples repository exploration from content consumption. FastCode utilizes a structural scouting mechanism to navigate a lightweight semantic-structural map of the codebase, allowing the system to trace dependencies and pinpoint relevant targets without the overhead of full-text ingestion. By leveraging structure-aware navigation tools regulated by a cost-aware policy, the framework constructs high-value contexts in a single, optimized step. Extensive evaluations on the SWE-QA, LongCodeQA, LOC-BENCH, and GitTaskBench benchmarks demonstrate that FastCode consistently outperforms state-of-the-art baselines in reasoning accuracy while significantly reducing token consumption, validating the efficiency of scouting-first strategies for large-scale code reasoning. Source code is available at https://github.com/HKUDS/FastCode.
Figures & tables
Figure 1: Accuracy and cost trade-off comparison
Figure 2: The overall framework of FastCode.
Metric
Community Baselines
Commercial Tools
Ours
Direct LLM
Func RAG
Sliding RAG
SWEQA-Agent
DeepWiki
CodeWiki
Gemini Code
Claude Code
Cursor
FastCode
Correctness
7.36
7.96
8.06
8.36
8.02
7.89
8.03
8.31
8.30
8.44
Completeness
3.71
5.75
5.99
6.94
5.90
6.49
6.09
7.25
8.13
7.94
Clarity
7.38
8.97
9.01
9.10
8.73
8.75
8.97
8.76
8.71
8.84
Relevance
8.94
9.56
9.65
9.72
9.36
9.21
9.68
9.56
9.39
9.35
Reasoning
4.91
7.38
7.51
8.22
7.52
7.82
7.92
8.21
8.64
8.72
Table 1: Comparison of baseline performance on the SWE-QA dataset (3-repository subset).
LongCodeQA
32K
64K
128K
256K
512K
1M
Jamba 1.5 - 400B Large
69.0
69.7
72.8
54.2
-
-
Llama 3.1 - 405B Ins.
69.9
72.4
67.4
-
-
-
Llama 4 Scout
66.4
73.7
70.7
63.1
78.7
76.0
GPT-4o
65.5
76.3
74.3
-
-
-
GPT-4.1
72.6
73.7
78.3
72.3
78.7
80.0
Qwen2.5-14B Ins.
61.9
65.8
68.5
63.1
70.2
40.0
Table 2: Performance comparison on LongCodeQA benchmark.
Figure 3: File-level localization accuracy (Acc@K) on Loc-Bench.
Figure 4: Performance of different frameworks on GitTaskBench.
Figure 5: Performance-cost tradeoffs for baselines and our framework across four benchmarks.
Figure 6: Ablation results on SWE-QA.
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
Model
Provider
Price ($ / 1M)
Input
Output
Gemini-3-Flash
Poe
0.40
2.40
Gemini-2.5-Pro
Poe
0.87
7.00
Claude 3.5 Sonnet
Poe
2.60
13.00
Claude 3.7 Sonnet
Poe
2.60
13.00
Qwen3-Coder-30B
OpenRouter
0.07
0.27
Appendix
Table 3: Detailed API usage costs. Prices are denoted in USD per 1M tokens.
Method
Total Score
Cost
Claude Code
42.08
0.057
Cursor
43.17
0.071
FastCode
43.28
0.032
Improvement over Claude Code
+2.85%
-43.86%
Appendix
Table 4: SWE-QA Performance Comparison
Context Length
Accuracy (%)
Cost
Acc. Gain
Direct
+FastCode
Direct
+FastCode
32K
65.5
69.9
0.083
0.041
+6.72%
64K
69.7
69.7
0.166
0.045
+0.00%
128K
71.7
72.83
0.333
0.069
+1.58%
256K
66.6
78.5
0.666
0.057
+17.87%
512K
-
76.6
1.331
0.075
-
Appendix
Table 5: LongCodeQA Performance: Direct vs. FastCode-Enhanced
Method
Acc@1 (%)
Acc@3 (%)
Acc@5 (%)
Cost
Existing Tools (Claude 3.5 Sonnet)
MoatlessTools
72.63
85.77
86.13
0.46
SWE-agent
77.37
87.23
90.15
0.67
Openhands
76.28
89.78
90.15
0.79
LocAgent
77.74
91.97
94.16
0.66
LocAgent (Fine-tuned Qwen)
Appendix
Table 6: LOC-BENCH (SWE-Bench-Lite) Performance
Method
ECR (%)
TPR (%)
Cost
Cost Ratio
Aider (Claude 3.5)
16.67
12.96
0.0304
1.00 ×
SWE-Agent (Claude 3.5)
41.67
22.23
1.38
45.39 ×
SWE-Agent (Claude 3.7)
64.81
42.59
1.67
54.93 ×
OpenHands (Claude 3.5)
53.70
40.74
8.95
294.41 ×
OpenHands (Claude 3.7)
72.22
48.15
29.8
980.26 ×
FastCode (Claude 3.5)
61.11
46.30
0.0878
2.89 ×
Appendix
Table 7: GitTaskBench Performance Comparison
Base Model
Direct LLM
SWEQA-Agent
FastCode
Ministral-3b
27.39
33.45
36.13
Deepseek-r1-8b
30.11
34.46
38.56
Qwen3-Coder-30b-A3b
35.77
37.08
41.44
Gemini-3-Flash
32.65
42.47
43.44
Appendix
Table 8: FastCode performance on SWE-QA under different LLMs.
Repository
DeepSeek-R1-8B
Gemini-3-Flash
Ministral-3B
Qwen3-Coder-30B
astropy
27.58
32.42
25.60
34.08
sphinx
28.54
32.67
24.60
34.44
matplotlib
31.52
33.88
28.38
37.48
pylint
28.46
32.79
27.33
35.56
flask
33.46
32.12
27.81
36.42
pytest
28.54
32.50
26.75
35.46
Appendix
Table 9: Direct LLM results on SWE-QA across all repositories with different backbone LLMs.
Repository
DeepSeek-R1-8B
Gemini-3-Flash
Ministral-3B
Qwen3-Coder-30B
astropy
31.44
41.32
35.15
36.21
sphinx
32.71
42.08
29.35
38.40
matplotlib
35.12
43.48
33.75
37.67
pylint
34.29
42.60
34.85
37.12
flask
35.71
42.15
38.67
37.60
pytest
33.25
42.92
27.44
39.77
Appendix
Table 10: SWEQA-Agent results on SWE-QA across all repositories with different backbone LLMs.
Repository
DeepSeek-R1-8B
Gemini-3-Flash
Ministral-3-3B
Qwen3-Coder-30B
astropy
36.40
41.58
33.88
40.33
sphinx
37.81
44.10
35.96
41.75
matplotlib
40.56
43.44
38.73
41.79
pylint
37.98
43.42
34.06
40.65
flask
40.27
44.98
38.12
43.19
pytest
38.65
44.12
35.00
41.96
Appendix
Table 11: FastCode results on SWE-QA across all repositories with different backbone LLMs.
A prerequisite for coding agents to perform tasks on large repositories is code localization - the identification of relevant files, classes, and functions to work on. While repository-level code localization has been performed using embedding-based retrieval approaches such as vector search, recent work has focused on developing agents to localize relevant code either as a standalone precursor to or interleaved with performing actual work. Most prior methods on agentic code search equip the agent with complex, specialized tools, such as repository graphs derived from static analysis. In this paper, we demonstrate that, with an effective reinforcement learning recipe, a coding agent equipped with nothing more than a standard Unix terminal can be trained to achieve strong results. Our experiments on three benchmarks (SWE-Bench Verified, Pro, and Lite) reveal that our models consistently achieve superior or competitive performance over 2-18x larger base and post-trained LLMs and sometimes approach performance provided by closed models like Claude Sonnet, even when using specialized scaffolds. Our work particularly focuses on techniques for re-purposing existing coding agent environments for code search, reward design, and RL optimization. We release the resulting model family, CodeScout, along with all our code and data for the community to build upon.
Lintang Sutawika, Aditya Bharat Soni, Bharath Sriraam R R +8
Carnegie Mellon University · Independent · OpenHands
Answering developer questions about a software repository is a critical yet under-explored problem in software engineering. While existing repository understanding methods have advanced the field, they predominantly rely on surface-level code retrieval and lack the ability for deep reasoning over multiple files, complex software architectures, and grounding answers in long-range code dependencies. To address these limitations, we propose DeepRepoQA, a novel question answering (QA) framework for repository-level code understanding. DeepRepoQA builds on an agentic framework where LLM agents find answers through a systematic tree search over the repository structure. A Monte-Carlo Tree Search (MCTS) mechanism is employed to empower agents to dynamically search, navigate, and inspect code, enabling effective multi-hop reasoning over long-range code dependencies. Comprehensive experiments on the SWE-QA benchmark demonstrate substantial performance gains over strong baselines, validating the effectiveness of systematic MCTS-guided exploration for multi-hop repository reasoning.
Weihan Peng, Yuling Shi, Yingwei Ma +3
Shanghai Jiao Tong University · The Hong Kong University of Science and Technology · University of California San Diego
Understanding large, complex, and rapidly evolving code bases remains a core challenge for software engineering at scale, hindering onboarding, maintenance, refactoring, and impact analysis. Providing this information to a Large-Language Model (LLM) is another hurdle, as the LLM must understand not only the required code method but also its associated methods in the grand scheme of the repository. We propose Code Comprehensor, a hybrid retrieval-reasoning framework combining (i) CodeGraph, a code dependency callgraph, (ii) CodeScribe, which uses code-aware LLMs to generate hierarchical documentation across repository call graphs, and (iii) CodeContrast, a CLIP-style dual-encoder model trained on CodeScribe output to learn aligned text-code embeddings. CodeContrast enables fast, semantically precise retrieval of relevant code-context neighborhoods, which serve as grounded evidence for an MCP-based LLM orchestrator answering domain-specific queries. Evaluation on OpenCV and a proprietary 5M-LOC repository shows that CodeScribe-derived supervision significantly improves cross-modal retrieval in text-to-code accuracy over baseline approaches. Richer textual supervision (hierarchical documentation, parent/sibling context, and LLM-generated synthetic questions) consistently enhances performance across both repositories. LLM-as-a-judge evaluation using the popular RAGAS of the Code Comprehensor output yields above 90% faithfulness scores.
Sujoy Roychowdhury, Joseph H. R. Isaac, Jiangning Gao +2