The SWE-Bench Illusion: When State-of-the-Art LLMs Remember Instead of Reason

Shanchao Liang, Spandan Garg, Roshanak Zilouchian Moghaddam

TL;DR

This paper reveals that the impressive performance of state-of-the-art Large Language Models (LLMs) on the popular SWE-Bench coding benchmark is heavily inflated by memorization rather than genuine reasoning. By introducing diagnostic tasks that strip away repository context, the authors demonstrate that top models frequently recall specific file paths and code snippets verbatim from their training data.

What Problem Does This Paper Address?

As LLMs are increasingly integrated into software development pipelines, evaluating their coding capabilities has become paramount. SWE-Bench (specifically SWE-Bench Verified) has emerged as the gold standard for this evaluation, testing whether models can resolve real-world GitHub issues.

However, because LLMs are trained on massive corpora of public code, there is a severe risk of data contamination. It is incredibly difficult to tell if a model is successfully fixing a bug because it understands the codebase and can reason through the problem, or if it is simply regurgitating a solution it memorized during pre-training. This paper aims to systematically untangle genuine problem-solving from rote memorization in software engineering benchmarks.

Methods

To isolate memorization from actual reasoning, the authors designed three "blind" diagnostic tasks that deliberately withhold critical information required for genuine problem-solving:

  1. File-Path Identification: The model is given only a GitHub issue description and the repository name—completely withholding the directory structure, codebase, and metadata. It is then asked to predict the exact file path that needs to be modified. A filtered version of this task also removes any explicit file path mentions from the issue text to eliminate surface-level string matching.
  2. Function Reproduction: The target buggy function is completely deleted from the codebase. Given only the issue description and the surrounding file context (but no function signatures or docstrings), the model must recreate the missing function from scratch.
  3. Prefix Completion: Mirroring the auto-regressive nature of LLM pre-training, the model is given the exact lines of code immediately preceding a bug and asked to complete the subsequent lines.
Overview of the benchmark memorization detection approach

To prove benchmark-specific memorization, the authors utilized a Cross-Benchmark Performance Analysis. If a model performs exceptionally well on a benchmark task but poorly on a structurally identical task from an unseen repository, it indicates contamination rather than generalizable coding proficiency.

The prompt template used to test models’ ability to identify buggy files without repo access.

Datasets

The evaluation was conducted across several benchmark variants and external datasets:

  • SWE-Bench Verified: A human-validated subset consisting of 500 curated Python tasks.
  • Full-SWE-Bench: A random sample of 200 tasks from the broader, unverified SWE-Bench dataset.
  • SWE-Bench Extra: A newly collected set of 217 fresh tasks from the same SWE-Bench repositories, but consisting of issues created after the dataset's original cutoff date.
  • Outside-Repo Tasks: 245 tasks sourced from 7 highly popular repositories (e.g., pytorch, pandas, numpy) that are not part of SWE-Bench but are widely available online.
  • RefactorBench: A subset of 39 handcrafted, multi-file refactoring tasks.
  • SWE-Bench C#: An internal benchmark of 75 tasks from C# repositories used to evaluate language-specific variations.

Key Insights and Ideas

  • The "Context-Free" Superpower: State-of-the-art models can accurately pinpoint the exact buggy file path up to 76% of the time without ever looking at the repository structure. Without prior exposure to the specific issue-file pairing, this level of accuracy is practically impossible.
  • Instance-Specific Memorization: Models don't just have a general familiarity with popular repositories (repository bias); they specifically remember the exact canonical solutions curated for the benchmark. When tested on fresh, post-cutoff issues from the exact same repositories (SWE-Bench Extra), their performance drops to the same level as completely external benchmarks.
  • The Capacity Paradox: Larger, more capable models exhibit higher rates of verbatim memorization. For instance, newer generations of the Claude family showed a monotonic increase in memorization rates, suggesting that scaling up model capacity might inadvertently scale up its tendency to memorize evaluation sets.

Key Results

  • File Path Identification: OpenAI’s o3 achieved a staggering 76% accuracy on SWE-Bench Verified without repository access. However, on Outside-Repo tasks, this accuracy dropped to under 53%, revealing a clear repository-level bias.
  • Function Reproduction: Models achieved up to a 34.9% consecutive 5-gram token overlap ratio when reproducing functions from SWE-Bench Verified. On the post-cutoff SWE-Bench Extra dataset, this overlap plummeted to 18.2%, aligning closely with completely external baselines like RefactorBench (18.1%).
  • Verbatim Completion: In the prefix completion task, Claude 4 Opus reproduced the exact ground-truth solution verbatim for nearly a third (31.6%) of all evaluated test instances.

Limitations and Future Work

The authors acknowledge that directly measuring memorization versus genuine reasoning is inherently challenging because models legitimately learn useful coding patterns during training. While their diagnostic tasks successfully expose memorization artifacts, they cannot perfectly map out a model's internal states.

The findings underscore an urgent need for the software engineering community to move away from static benchmarks. Future work must focus on developing freshness-controlled benchmarks with strict temporal boundaries, continuous task mutation (altering problem formulations), and cross-repository validation to ensure evaluations capture true generalization rather than dataset-specific overfitting.

Summary updated

BibTeX
@inproceedings{liang2026swe,
  author = {Shanchao Liang and Spandan Garg and Roshanak Zilouchian Moghaddam},
  title = {{The SWE-Bench Illusion: When State-of-the-Art LLMs Remember Instead of Reason}},
  booktitle = {SEIP@ICSE},
  year = {2026},
  doi = {10.1145/3786583.3786882},
}
Figure