ContextBench: A Benchmark for Context Retrieval in Coding Agents
Abstract
ContextBench evaluates context retrieval in coding agents through detailed process analysis, revealing that advanced agent designs provide limited improvements in context usage while highlighting gaps between explored and utilized information.
LLM-based coding agents have shown strong performance on automated issue resolution benchmarks, yet existing evaluations largely focus on final task success, providing limited insight into how agents retrieve and use code context during problem solving. We introduce ContextBench, a process-oriented evaluation of context retrieval in coding agents. ContextBench consists of 1,136 issue-resolution tasks from 66 repositories across eight programming languages, each augmented with human-annotated gold contexts. We further implement an automated evaluation framework that tracks agent trajectories and measures context recall, precision, and efficiency throughout issue resolution. Using ContextBench, we evaluate four frontier LLMs and five coding agents. Our results show that sophisticated agent scaffolding yields only marginal gains in context retrieval ("The Bitter Lesson" of coding agents), LLMs consistently favor recall over precision, and substantial gaps exist between explored and utilized context. ContextBench augments existing end-to-end benchmarks with intermediate gold-context metrics that unbox the issue-resolution process. These contexts offer valuable intermediate signals for guiding LLM reasoning in software tasks.
Community
Most repo-level benchmarks measure Pass@k β
But fixing a bug does not mean the agent understood the code π
We built ContextBench π
A benchmark to measure whether coding agents actually retrieve and use the right context ππ
π Whatβs inside
π§© 1,136 real-world issues
π 66 repositories
π 8 programming languages
π§ Expert-verified gold contexts at file, block, and line granularity
π£ Full trajectory tracking of agent behavior
π Metrics: Recall, Precision, F1, Efficiency, Usage Drop
π What surprised us
1οΈβ£ Complex agentic scaffolds often do not improve retrieval quality π
Instead, they introduce over-engineering.
A familiar pattern in AI researchβ¦ the Bitter Lesson again π
2οΈβ£ Many SOTA LLMs chase high recall but sacrifice precision π
More context retrieved, more noise introduced
3οΈβ£ Retrieved β Utilized β
Agents frequently inspect the right code but fail to incorporate it
4οΈβ£ More balanced retrieval strategies achieve stronger Pass@1 at lower cost βοΈβ¨
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper
