NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

SWE Context Bench: A Benchmark for Context Learning in Coding

Jiayuan Zhu, Junde Wu, Minhao Hu, Shengda Zhu, Jiazhen Pan, Weixiang Shen, Yijun Yang, Fenglin Liu, Jianye Hao, Yueming Jin, Qirong Ho, Min XuarXiv 2026

TL;DR

While large language models (LLMs) excel at solving isolated coding tasks, existing benchmarks fail to measure how well they learn from past experiences. This paper introduces SWE-ContextBench, a novel benchmark designed to evaluate cross-task context learning and retrieval in coding agents by utilizing real-world, interdependent GitHub issues and pull requests. The study reveals that while high-quality, concise summaries of past tasks significantly boost an agent's problem-solving accuracy and efficiency, naive or unfiltered context retrieval can actually degrade performance and increase costs.

What Problem Does This Paper Address?

Traditional software engineering benchmarks (like HumanEval or SWE-bench) evaluate AI coding agents in a vacuum. Each bug-fixing or code-generation task is treated as an independent episode, forcing the agent to solve every problem completely from scratch.

In contrast, real-world software development is highly iterative. Human engineers rarely work in isolation; they constantly leverage historical context, reuse patterns from previously resolved bugs, and learn from past mistakes within a repository. Existing long-context or memory benchmarks focus primarily on retrieving information within a single, massive task rather than summarizing and transferring knowledge across different tasks.

Figure 1: Compare SWE-ContextBench with existing agent benchmark and long-context benchmark.

SWE-ContextBench addresses this gap by providing a framework to explicitly measure an agent's ability to perform cross-task context learning—evaluating not just whether an agent can fix a bug, but how effectively it can use prior experience to do so more accurately and efficiently.

Methods

The authors constructed SWE-ContextBench using a multi-step pipeline:

  1. Context Pool Generation: They ran a advanced coding agent (Claude 4.5 Sonnet) on 1,100 base "experience" tasks, recording the complete interaction trajectories—including intermediate reasoning steps, file navigation, and tool calls—to serve as a historical context pool.
  2. Related Task Identification: Through manual analysis of GitHub cross-references, they identified 376 related downstream tasks. These tasks are linked to the base tasks via six distinct real-world workflows, such as multi-issue resolutions (where one PR fixes multiple issues) or issue-to-issue references.

To understand how agents handle this historical data, the authors evaluated them across five distinct context-exposure settings:

  • No-Context (Baseline): Solving the task from scratch.
  • Free Context Learning: Full access to the raw trajectory pool, allowing the agent to autonomously decide what to retrieve.
  • Oracle Context Learning: Explicitly providing the full, raw trajectory of the most relevant past task.
  • Free Summary Learning: Access to a pool of compact summaries of past trajectories.
  • Oracle Summary Learning: Explicitly providing a gold-standard summary of the single most relevant past task.

Additionally, they benchmarked four popular independent memory retrieval frameworks: Mem0, OpenViking, LangMem, and Supermemory.

Datasets

The benchmark is built on top of established repositories from SWE-Bench Lite, SWE-Bench Multilingual, and SWE-Bench Verified.

  • SWE-ContextBench (Full): Contains 1,476 tasks in total, split into 1,100 experience tasks (the context pool) and 376 related evaluation tasks. It spans 51 unique repositories and 9 programming languages (dominated by Python at ~70%).
  • SWE-ContextBench Lite: A smaller, cost-effective subset designed for rapid evaluation, consisting of 300 base tasks and 99 related tasks, focusing entirely on Python across 12 repositories.
Figure 2: Distribution of programming languages across tasks. The bar chart shows the number of repositories per language for experience and related tasks. The donut chart shows the percentage distribution by language, with the inner ring for experience tasks and the outer ring for related tasks.

Key Insights and Ideas

  • Richer, Compact Summaries Trump Raw Logs: Raw interaction trajectories are incredibly verbose (averaging over 25,000 tokens). Providing these full logs often overwhelms agents. Conversely, concise summaries (averaging ~217 tokens) that capture the root cause and solution patterns yield much higher success rates.
  • The Danger of Blind Trust: Coding trajectories naturally contain human-like trial-and-error, incorrect assumptions, and intermediate mistakes. If an agent blindly copies the step-by-step actions of a past trajectory without critically adapting it to the new problem, it will replicate those historical errors.
  • Autonomous Retrieval is Costly: When agents are given "free" access to search the context pool autonomously, they tend to over-consume tokens and increase repository access. This naive context learning often increases monetary costs without providing a corresponding bump in accuracy.

Key Results

The experimental evaluations on SWE-ContextBench Lite revealed clear performance shifts across different settings:

  • Accuracy Boost: Providing the ground-truth summary (Oracle Summary Learning) improved the task resolution rate from 26.26% (No-Context baseline) to 34.34%.
  • Efficiency Gains: Oracle Context Learning proved to be the fastest and cheapest configuration, reducing the average problem-solving time to 5.95 minutes (compared to 6.37 minutes for the baseline) and lowering the average token cost to $0.77 per instance.
  • Memory Framework Performance: Among the trending memory retrieval tools tested on the benchmark, Supermemory achieved the highest overall task resolution rate (30.30%), while LangMem demonstrated the highest precision in accurately matching top-1 relevant historical contexts (55.56%).

Limitations and Future Work

The authors note a few key limitations in their current work:

  • Lack of Human Annotation: The relationships between tasks and the correctness of problem descriptions rely on automated GitHub issue/PR mapping rather than manual verification by human annotators, which can introduce minor structural noise.
  • Noisy Context Pools: The experience trajectories are unfiltered and may contain incomplete or partially incorrect solutions. While this mirrors realistic developer environments, it makes context reuse significantly more challenging.

Future research directions include developing more adaptive retrieval strategies where agents dynamically adjust the number of retrieved contexts based on task complexity, and engineering better filtering mechanisms so agents can inherently distinguish between helpful insights and misleading trial-and-error steps in historical logs.

Summary updated

BibTeX
@misc{zhu2026swe,
  author = {Jiayuan Zhu and Junde Wu and Minhao Hu and Shengda Zhu and Jiazhen Pan and Weixiang Shen and Yijun Yang and Fenglin Liu and Jianye Hao and Yueming Jin and Qirong Ho and Min Xu},
  title = {{SWE Context Bench: A Benchmark for Context Learning in Coding}},
  year = {2026},
  eprint = {2602.08316},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.08316},
}
Figure