Paper 75~11 min read2023 / 2024worked math + runnable code
Paper Breakdown

SWE-bench & SWE-agent,
explained.

Writing one tidy function from a docstring — the HumanEval task — turned out to be the easy part. Real software engineering is messier: read an issue, hunt through a sprawling codebase to find the bug, change the right lines across the right files, and prove you fixed it without breaking anything else. SWE-bench turned actual resolved GitHub issues into a benchmark that demands exactly that, and early models scored a few percent. SWE-agent then asked what interface a model needs to do the job at all. Here's how the benchmark grades a fix, and why the tools you give an agent matter as much as the model.

Video breakdown
The animated walkthrough is in production.
Read the full breakdown below in the meantime ↓
01

Beyond one function

Benchmarks like HumanEval measure whether a model can write a small, self-contained function from a clear spec. Useful — but a poor proxy for what software engineers actually do. Real work means operating inside a large, unfamiliar codebase: interpreting a vague bug report, locating the relevant code among thousands of files, making a correct, minimal change, and confirming with the test suite that the bug is gone and nothing else broke. None of that is captured by "write this function."

SWE-bench closed the gap by building its tasks from reality. Each instance is a genuine GitHub issue that was actually resolved by a pull request in a popular open-source Python project, packaged with the repository as it was before the fix and the tests that validate the fix. The model gets the issue and the repo; it must produce a patch. It's the difference between a coding quiz and a real ticket in a real backlog.

The one-sentence version

SWE-bench grades models on resolving real GitHub issues — the patch must apply, fix the failing tests, and break nothing — and SWE-agent gives the model a purpose-built interface to do it.

02

Grading a fix

How do you score a code change objectively? By running the tests — but SWE-bench is careful about which tests. It splits them into two sets and requires both to come out right for an issue to count as resolved:

resolved  =  patch applies  ∧  FAIL_TO_PASS (bug's failing tests now pass)  ∧  PASS_TO_PASS (existing tests still pass)

The FAIL_TO_PASS tests are the ones that failed before the fix — they prove the bug is actually fixed, not merely that the patch runs. The PASS_TO_PASS tests already passed — requiring they still pass is a regression check, so a "fix" that quietly breaks something else does not count. And the patch must apply cleanly to begin with. All three, or it's not resolved. This is a strict, execution-based grade with no partial credit — exactly the honesty you want for real engineering. The runnable version below encodes this rule and the regression trap.

03

The Agent-Computer Interface

SWE-bench sets the task; SWE-agent asks how a model can actually do it. A language model can't magically edit a repo — it needs a way to look around and act. The naive approach is to hand it a normal shell. The paper's key finding is that this is a mistake: interfaces built for humans serve models poorly. Models get lost in verbose output, mangle multi-line edits, and waste turns on malformed commands.

The fix is a purpose-built Agent-Computer Interface (ACI) — a small set of commands designed for how a language model reads and writes:

Commands built for the model, not the human
SearchFind files and symbols with concise, summarized results — no wall of grep output.
Open / scrollView a file in bounded windows, so context stays readable and cheap.
Edit + lintMake edits through a command that lint-checks and rejects malformed changes on the spot.
Run testsExecute the suite and see the result — the agent's feedback loop.

The result was measurable: a well-designed ACI raised the resolve rate substantially over a plain shell, holding the model fixed. The lesson generalized far beyond this paper — how you let an agent act, not just how smart the model is, is a first-class design variable. Guardrails (like the edit linter) that catch mistakes before they compound turned out to matter enormously.

04

The agent loop

With the ACI in place, SWE-agent runs the familiar agent loop — the same reason-then-act cycle, specialized for coding. The model observes, decides on a command, runs it, reads the result, and repeats until it submits a patch:

observe → think → run a command → read output → … → submit patch

It might search for the error message, open the offending file, scroll to the function, edit it (the linter catching a botched edit before it lands), run the tests, see two still failing, adjust, and finally submit. Every step is a turn where the model reasons about what it sees and picks the next action. The whole trajectory is bounded — limited turns and cost — so the agent must localize and fix efficiently. When it submits, SWE-bench applies the strict three-part grade from section 02.

RUN IT YOURSELF

The strict resolution rule

SWE-bench's grade is a three-way AND you can hold in your hand. A patch resolves an issue only if it applies, makes the FAIL_TO_PASS tests pass, and keeps the PASS_TO_PASS tests passing — so a fix that introduces a regression fails, and a patch that doesn't even apply fails. This encodes that rule, computes a resolve rate over a set of issues, and prices the Agent-Computer Interface: a well-designed ACL produces more well-formed commands (90% vs 50%), which is what lifts the agent's success. Flip any condition and watch the verdict change.

CPython · WebAssembly
05

A hard yardstick

SWE-bench's first scores were humbling — resolving only a low single-digit percentage of issues — and that was the point:

FindingSignificance
Low early scoresExposed the gap between "writes a function" and "does real software engineering."
ACI matters a lotSWE-agent's interface design raised resolve rate markedly at a fixed model — tools, not just intelligence.
The standard benchmarkBecame the yardstick for coding agents; SWE-bench Verified curated a cleaner subset.
Rapid climbScores rose fast as models and agent scaffolds improved — a visible frontier.

The benchmark did what a good benchmark does: it made a fuzzy goal ("can AI do software engineering?") into a concrete, execution-graded number that everyone could chase. And it repeatedly showed that closing the gap took two things advancing together — stronger models and better agent scaffolding around them.

06

What it drives

SWE-bench and SWE-agent set the agenda for the coding-agent era. The benchmark is now the headline metric quoted for every serious coding model and agent, and its verified subset is a trusted standard. SWE-agent's ACI insight — design the interface for the model — shaped how agent frameworks are built across the industry, well beyond code.

Its deepest contribution is a reframing of what "coding AI" is measured on. HumanEval asked "can it write code?"; SWE-bench asked "can it engineer?" — navigate, localize, edit, and verify in a real repository, graded by whether the software actually works afterward. That execution-grounded, whole-task evaluation is far closer to the real job, and it turned agent design (interfaces, guardrails, verification loops) into a research frontier alongside the models themselves. When a coding agent reports a SWE-bench score today, it's speaking the language this work created.

Worth knowing

SWE-bench builds directly on the functional-correctness idea — grade by running tests — but scales it from a single function to an entire repository and a real, human-reported bug, which is why it's so much harder.

Frequently asked

Quick answers

What is SWE-bench?

A benchmark of real resolved GitHub issues; a model must produce a patch that applies, fixes the failing tests, and breaks no passing tests to count as resolving the issue.

What does resolution require?

Three things: the patch applies, the FAIL_TO_PASS tests now pass (bug fixed), and the PASS_TO_PASS tests still pass (no regression).

What is the ACI?

SWE-agent's Agent-Computer Interface — search/open/edit/run commands designed for a model (concise output, edit linting), which raises the resolve rate over a plain shell.

Why is it harder than HumanEval?

It requires navigating a whole codebase, localizing a bug across files, and verifying with the real test suite — not writing one self-contained function.

Finished this one? 0 / 101 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns