DeepRepoQA: Code Repository Question Answering with Deep Agent Exploration
Organizations: Shanghai Jiao Tong University · The Hong Kong University of Science and Technology · University of California San Diego
Abstract
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.
Figures & tables
| Action | Arguments | Embedding? |
| FindClass | class-name, file-pattern | No |
| FindFunction | function-name, class-name, file-pattern | No |
| FindCodeSnippet | code-snippet, file-pattern | No |
| ViewCode | code-span-list, file-pattern | No |
| SemanticSearch | query, category, file-pattern | Yes |
| Finish | answer, finish-reason | No |
| Methods | Evaluation Metrics | Overall | ||||
| Correctness | Completeness | Relevance | Clarity | Reasoning | ||
| Commercial Tools | ||||||
| Tongyi Lingma | 11.91 | 10.88 | 16.66 | 15.89 | 13.78 | 69.12 |
| Cursor | 12.31 | 11.34 | 17.32 | 16.07 | 13.67 | 70.71 |
| GLM-4.6 | ||||||
| Direct Prompting | 7.84 | 5.30 | 15.34 | 15.94 | 7.23 | 51.65 |
| Variant | Evaluation Metrics | Overall | ||||
| Correctness | Completeness | Relevance | Clarity | Reasoning | ||
| DeepRepoQA | 10.97 | 10.17 | 13.82 | 16.19 | 13.28 | 64.43 |
| w/o MCTS | 9.18 ( -1.79 ) | 9.62 ( -0.55 ) | 13.27 ( -0.55 ) | 16.88 ( +0.69 ) | 13.21 ( -0.07 ) | 62.16 ( -2.27 ) |
| w/o Perception Agent | 9.38 ( -1.59 ) | 9.77 ( -0.40 ) | 13.56 ( -0.26 ) | 16.77 ( +0.58 ) | 13.22 ( -0.06 ) | 62.70 ( -1.73 ) |
| w/o Evaluation Agent | 8.55 ( -2.42 ) | 9.41 ( -0.76 ) | 13.11 ( -0.71 ) | 16.45 ( +0.26 ) | 13.41 ( +0.13 ) | 60.93 ( -3.50 ) |
| w/o Semantic Search | 10.48 ( -0.49 ) | 10.08 ( -0.09 ) | 13.49 ( -0.33 ) | 16.00 ( -0.19 ) | 13.31 ( +0.03 ) | 63.36 ( -1.07 ) |
| Max Nodes | Evaluation Metrics | Overall | ||||
| Correctness | Completeness | Relevance | Clarity | Reasoning | ||
| 5 | 8.27 | 7.97 | 13.71 | 16.30 | 8.81 | 55.06 |
| 10 | 10.43 | 9.99 | 13.64 | 16.21 | 12.70 | 62.97 |
| 15 | 10.97 | 10.17 | 13.82 | 16.19 | 13.28 | 64.43 |
| 20 | 11.57 | 10.76 | 13.83 | 16.29 | 12.88 | 65.33 |
| 30 | 11.43 | 10.89 | 13.77 | 16.16 | 12.90 | 65.15 |
| Question Type | GLM-4.6 | Kimi K2 | Qwen3-Coder 480B-A35B-Instruct | GPT-5.1 | Average |
| What | 63.67 | 67.12 | 63.30 | 67.89 | 65.50 |
| Architecture exploration | 59.80 | 62.64 | 60.49 | 63.41 | 61.59 |
| Concept / Definition | 66.80 | 71.00 | 65.66 | 70.62 | 68.52 |
| Dependency tracing | 64.41 | 67.72 | 63.75 | 69.64 | 66.38 |
| Why | 68.01 | 68.79 | 65.10 | 71.49 | 68.35 |
| Design rationale | 70.02 | 70.26 | 66.28 | 73.95 | 70.13 |
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Qwen3-Coder- 480B-A35B-Instruct | Kimi K2 | GLM-4.6 | GPT-5.1 | Average |
| Direct | 94/65 | 94/34 | 94/76 | 94/87 | 94/63 |
| Function Chunking RAG | 5,084/106 | 5,084/92 | 5,084/240 | 5,084/196 | 5,084/130 |
| Sliding Window RAG | 6,302/112 | 6,302/110 | 6,302/233 | 6,302/201 | 6,302/138 |
| SWE-agent | 165,206/4,546 | 154,295/1,398 | 70,870/1,902 | 122,833/6,100 | 126,026/4,627 |
| OpenHands | 108,703/2,128 | 101,594/1,787 | 42,433/2,158 | 69,192/2,127 | 87,045/1,930 |
| DeepRepoQA | 119,633/3,812 | 68,679/4,059 | 42,888/9,867 | 83,526/7,251 | 78,681/6,247 |
| Dimension | Human | LLM | All-6 |
| Correctness | 0.837 | 0.908 | 0.878 |
| Completeness | 0.822 | 0.883 | 0.855 |
| Relevance | 0.828 | 0.832 | 0.838 |
| Clarity | 0.324 | 0.406 | 0.420 |
| Reasoning | 0.821 | 0.825 | 0.834 |
| Overall | 0.840 | 0.871 | 0.861 |
| Expert 1 | Expert 2 | Expert 3 | LLM row mean | |
| GPT-5.4 | 0.871 | 0.793 | 0.791 | 0.818 |
| Claude-Sonnet-4-6 | 0.661 | 0.915 | 0.918 | 0.831 |
| Gemini-3.1-Pro | 0.789 | 0.848 | 0.847 | 0.828 |
| Human col mean | 0.774 | 0.852 | 0.852 | Cross-group mean: 0.826 |
| Measure | Value |
| Pearson r | 0.972 [95% CI 0.964–0.979, bootstrap 2,000 resamples] |
| Spearman | 0.942 |
| MAE (0–100 scale) | 5.22 pts (5.2% of scale; inter-method gap ~25 pts) |
| Measure | Value |
| Preference agreement rate | 88.2% |
| Cohen’s (3-class: A > B / tie / B > A) | 0.725 (substantial) |
| System-level ranking Spearman | 0.900 (p = 0.037) |
| Length bin | percentage | Mean (LLM Human) | Pearson r (human vs LLM) |
| Short (< 100 words) | 53.9% | 4.85 | 0.983 |
| Medium (100–300 words) | 14.6% | 1.16 | 0.985 |
| Long (> 300 words) | 31.4% | 3.06 | 0.919 |
| Method | Correctness | Completeness | Relevance | Clarity | Reasoning | Overall |
| Direct | 5.42 | 4.18 | 10.85 | 11.36 | 5.71 | 37.52 |
| Function-Chunking RAG | 7.83 | 6.97 | 12.14 | 12.05 | 7.62 | 46.61 |
| Sliding-Window RAG | 8.46 | 7.51 | 12.48 | 12.23 | 8.05 | 48.73 |
| SWE-agent | 11.27 | 9.94 | 13.78 | 12.58 | 11.32 | 58.89 |
| OpenHands | 11.41 | 10.08 | 13.91 | 12.65 | 11.46 | 59.51 |
| DeepRepoQA | 12.29 | 11.30 | 14.37 | 13.13 | 12.21 | 63.29 |
| Mode | Categories most affected | Root cause |
| F1 Wrong location | where/iden-loca, where/funct-loca | Semantic literal match; no verification step |
| F2 Adjacent concept | why/purpose, where/data-control-flow | Semantic ambiguity causes all branches to share wrong initial retrieval |
| F3 Keyword-only exploration | why/design-rationale, how/algo-impl | No structural navigation fallback when semantic search stalls |
| F4 Open-ended design | how/system-design | Multiple valid answers; reference-matching rubric penalises divergent but correct designs |
| Reference | Candidate | |
| Location | parse_args_spec at reflex/event.py:2085 | _extract_func_kwargs_as_ast_nodes in pyi_generator.py |
| Scores | — | Correctness 2, Completeness 1, Relevance 2 |
| Reference | Candidate | |
| Target | AppInfo (a NamedTuple holding App + its module) | AppWrap (a component wrapping the root rendered tree) |
| Scores | — | Correctness 4, Completeness 3, Relevance 5 |
| Reference | Candidate | |
| Proposed solution | Specific approach involving theme token propagation via CSS variables | Alternative design using add_style() and inherited data attributes |
| Scores | — | Correctness 7, Completeness 8, Relevance 9 |