﻿# SWE-bench: evaluate issue resolution with repository context

Evaluate SWE-bench issue patches against the correct base commit, hidden solution boundary, repository tests, and explicit harness outcomes.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/data-guide-swebench-issue-patch-context/
Language: en

## Start from issue resolution in a repository

The [SWE-bench paper](https://arxiv.org/abs/2310.06770) frames a task in which a system receives a codebase and issue description, then edits the repository to address the issue. This requires identifying relevant files and coordinating changes beyond an isolated function. The benchmark is useful for studying that bounded issue-resolution workflow. It should not be reduced to matching the original pull-request patch, since a different implementation may satisfy the required behavior under the evaluation tests.

## Keep the repository state and target patch separate

The [owner dataset card](https://huggingface.co/datasets/SWE-bench/SWE-bench/blob/main/README.md) identifies `repo`, `base_commit`, `problem_statement`, reference `patch`, and `test_patch`, alongside environment and test metadata. The base commit defines the code state before the solution. Checking out the current repository head can include the fix or unrelated changes. Likewise, placing the gold patch in a retrieval index leaks the intended solution. Preserve a precise boundary between material supplied for solving and material used by the evaluator, with that boundary recorded in [provenance metadata](/journal/document-markdown-json-provenance/).

## Interpret test groups as distinct obligations

The card distinguishes `FAIL_TO_PASS` tests associated with the fix from `PASS_TO_PASS` tests intended to remain passing. Resolving an issue includes the required transition while avoiding the tested regressions. A locally selected demonstration that runs only a convenient test does not reproduce the full condition. Keep the selected dataset variant and development/test partition explicit, and preserve any exclusions rather than reporting success only over tasks whose setup happened to work.

## Preserve prediction identity and cache behavior

The official [evaluation guide](https://www.swebench.com/SWE-bench/guides/evaluation/) describes predictions with `instance_id`, model identity, and `model_patch`. It also warns that results are cached by run and instance identity: reusing a run identifier with a changed patch can reuse old results. Therefore, a patch hash and fresh run identity belong with a rerun. Keep instance logs, applied diff, and test output connected, so a reported outcome can be traced to the code that actually executed.

## Separate software failures from harness outcomes

The guide distinguishes resolved, unresolved, incomplete, empty-patch, and error outcomes, and explains why a harness success message need not mean that an issue was resolved. An editorial error study can inspect patch application, environment setup, and failing tests separately. Use [document-level leakage analysis](/journal/document-level-data-split-leakage/) when training or retrieval sources include public issues, pull requests, or later repository snapshots. SWE-bench measures behavior under a defined test-and-environment protocol; it does not prove that an accepted patch is the only correct fix or free of every untested regression.
