Research paper

ContextBench: A Benchmark for Context Retrieval in Coding Agents

Authors
Han Li, Letian Zhu, Bohan Zhang, Rili Feng, Jiaming Wang, Yue Pan and 4 more
Published
Citations
35

TL;DR

ContextBench evaluates how well coding agents retrieve the right code context during a task, not just whether they finish.

The problem

From the abstract
  • 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.

What they did

From the abstract
  • We introduce ContextBench, a process-oriented evaluation of context retrieval in coding agents.
  • 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.

Key results

Quoted from the abstract
  • ContextBench consists of 1,136 issue-resolution tasks from 66 repositories across eight programming languages, each augmented with human-annotated gold contexts.
  • 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.

Why builders care

Editor's note

Many coding-agent failures start with the wrong context. Measure retrieval directly.

How to apply it

Editor's note
  1. 1.Log which files your agent reads per task and compare against the files the fix actually touched.

Original abstract

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.

Everything above is written from this abstract. For methods and full results, read the paper PDF.

Ask the paper

Preview

Not live yet. Once it is, answers will quote the passages they come from.

Correspondence, re: arXiv:2602.05892Preview

Ask a question about ContextBench: A Benchmark for Context Retrieval in Coding Agents. Answers will come from the full paper and quote the passages they use.

More in Coding agents

All Coding agents papers