ReCUBE: Evaluating Repository-Level Context Utilization in Code Generation
Organizations: Language Technologies Institute, Carnegie Mellon University · Computer Science, Emory University
Abstract
Large Language Models (LLMs) have recently emerged as capable coding assistants that operate over large codebases through either agentic exploration or full-context generation. Existing benchmarks capture a broad range of coding capabilities, such as resolving GitHub issues, but none of them directly isolate and measure how effectively LLMs leverage repository-level context during code generation. To address this, we introduce ReCUBE, a benchmark in which LLMs reconstruct a masked file within a real-world repository, using all remaining source files, dependency specifications, and documentation as their only source of context. ReCUBE evaluates reconstructed code with usage-aware test cases that simulate both internal module logic and external cross-file integration, reflecting real-world software usage patterns. We further propose the Caller-Centric Exploration (CCE) toolkit, a set of dependency graph-based tools that can be integrated into agentic frameworks to guide agents toward the most relevant caller files during repository exploration. Experiments across eight models in four settings show that repository-level context utilization remains highly challenging even for state-of-the-art models, with GPT-5 achieving only 37.57% strict pass rate in the full-context setting. Agents augmented with our CCE toolkit consistently outperform all baselines across all evaluated models, with improvements of up to 7.56% in strict pass rate. We release our benchmark, code, and evaluation framework as open source for the NLP research community.
Figures & tables
| Benchmark | Repository Level | Prompt-Free Evaluation | Contamination Free | Maximum Context | Manually Curated | Agent Support |
| LiveCodeBench Jain et al. (2024) | ✗ | ✗ | ✓ | 3K | ✓ | ✗ |
| Bench Zhang et al. (2024) | ✗ | ✗ | ✗ | 256K | ✗ | ✗ |
| SWE-Bench Jimenez et al. (2024) | ✓ | ✗ | ✗ | 50K | ✓ | ✓ |
| Commit0 Zhao et al. (2024) | ✓ | ✗ | ✗ | ✓ | ✓ | |
| RepoBench-C Liu et al. (2023) | ✓ | ✓ | ✗ | 8K | ✓ | ✗ |
| LocBench Chen et al. (2025) | ✓ | ✗ | ✗ | ✓ | ✓ |
| Metric | Total | External | Internal |
| Test Count | 10,785 | 6,334 | 4,451 |
| Dataset | Average Context | Maximum Context | # Instances |
| ReCUBE | 71K | 111K | 366 |
| ReCUBE-large | 146K | 338K | 138 |
| GPT-5 Mini | Qwen3-Coder 30B | |||
| Difficulty | ||||
| Hardest | 0.184 | 0.259 | 0.020 | 0.026 |
| Hard | 0.280* | 0.404* | 0.304* | 0.408* |
| Medium | 0.125 | 0.172 | 0.171 | 0.217 |
| Easiest | 0.063 | 0.086 | 0.135 | 0.200 |
| Overall | 0.009 | 0.013 | 0.073 | 0.106 |
| Overall (%) | External TCs (%) | Internal TCs (%) | |||||
| Setting | Model | SPR | APR | SPR | APR | SPR | APR |
| Full-Context | GPT-OSS 20B | 25.07 | 36.83 | 22.19 | 32.61 | 30.63 | 39.11 |
| Devstral Small 2507 | 21.76 | 30.20 | 17.36 | 25.57 | 27.93 | 34.99 | |
| Qwen3-Coder 30B | 25.34 | 38.54 | 21.86 | 34.44 | 31.23 | 40.88 | |
| Claude 3 Haiku | 18.66 | 23.17 | 14.79 | 18.85 | 21.02 | 25.74 | |
| Gemini 2.5 Flash | 25.69 | 40.28 | 23.15 | 37.26 | 33.03 | 43.00 | |
| Setting / Model | GPT-5 mini | Qwen3-Coder-30B | Devstral |
| Full-Context | 55.86 +1.02 | 38.36 +1.07 | 13.72 16.20 |
| Full-Context + CoT | 55.28 0.80 | 34.04 3.03 | 14.20 11.34 |
| Agent | 54.47 +5.08 | 35.48 5.58 | 33.74 +0.25 |
| Agent + CCE toolkit | 57.72 +1.58 | 42.60 0.11 | 36.84 3.28 |
| Scale | Method | Cost | Turns | SPR/Cost | SPR/Turn |
| Original | Agent | $ 0.1226 | 21.35 | 254.6 | 1.46 |
| Agent (Ours) | $ 0.1241 | 20.30 | 312.5 | 1.91 | |
| Large | Agent | $ 0.1410 | 25.66 | 221.4 | 1.22 |
| Agent (Ours) | $ 0.1166 | 19.81 | 332.6 | 1.96 |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Repository | Functionality | Key Components |
| OpenManus | Agent orchestration with sandbox execution | Base agent, ReAct pattern, tool execution |
| nanochat | GPT training infrastructure | SFT/RL training, data loading, checkpointing |
| DeepSeek-OCR | Vision-based OCR system | CLIP/SAM encoders, image/PDF processing |
| deer-flow | Workflow-based agent with RAG | Graph orchestration, web crawling, retrieval |
| openai-agents | Core runtime with guardrails | Agent execution, function schemas, prompts |
| openai-agents | Computer use & file editing | Editor interface, computer control |
| Parameter | Value |
| Temperature | 0.0 |
| Max Tokens | 8,192 (Full-Context) |
| 16,384 (Full-Context + CoT) | |
| Timeout (s) | 300 |
| Inference Backend | vLLM == 0.17.0 |
| enable_auto_tool_choice | False (Default) |
| Parameter | Value |
| Temperature | 0.0 |
| Max Tokens | 8,192 (Full-Context) |
| 16,384 (Full-Context + CoT) | |
| Timeout (s) | 300 |
| Inference Backend | vLLM == 0.17.0 |
| config-format | mistral |
| Parameter | Value |
| Temperature | 0.0 |
| Max Tokens | 8,192 (Full-Context) |
| 16,384 (Full-Context + CoT) | |
| Timeout (s) | 300 |
| Inference Backend | vLLM == 0.17.0 |
| max-model-len | 131,072 (Default) |
| Parameter | Value |
| Max Completion Tokens | 128,000 |
| Step Limit | 75 |
| Environment | Docker |
| Timeout (s) | 300 |
| Parameter | Value |
| Temperature | 0.0 |
| Max Completion Tokens | 8,192 |
| Step Limit | 75 |
| Environment | Apptainer |
| Timeout (s) | 300 |
| Inference Backend | vLLM == 0.17.0 |
| Overall | Ext. TCs | Int. TCs | ||||
| Setting | SPR | APR | SPR | APR | SPR | APR |
| Agent | 25.06 | 36.83 | 22.19 | 32.61 | 30.63 | 39.11 |
| Agent + CCE | 21.01 | 30.49 | 16.40 | 23.95 | 24.32 | 33.20 |
| Model | Input | Output |
| gpt-5-mini | 0.25 | 2.00 |
| gemini-2.5-flash | 0.30 | 2.50 |
| gpt-5 | 1.25 | 10.00 |
| gemini-2.5-pro | 1.25 | 10.00 |
| claude-3-haiku | 0.25 | 1.25 |
| Method | Model | Scale | Cost ($) |
| Full-Context | claude-3-haiku | Original | 0.0202 |
| gemini-2.5-flash | Original | 0.0302 | |
| gemini-2.5-pro | Original | 0.1158 | |
| gpt-5 | Original | 0.1207 | |
| gpt-5-mini | Original | 0.0271 | |
| Full-Context +CoT | gpt-5 | Original | 0.1245 |
Repository-Level Code Generation
Repository-level code generation builds or modifies software across files using project context, dependencies, and requirements.
See all 42 papers