A team picks the model that sits at the top of the SWE-bench Verified leaderboard, wires it into a coding agent, and points it at their own backlog: a large TypeScript monorepo, a build that takes eleven minutes, integration tests that fail one run in thirty for reasons nobody has fixed. The first week is humbling. The agent resolves far fewer tickets than the leaderboard suggested, it burns through its token budget on tickets it eventually abandons, and twice it "fixes" a failing test by editing the test. Nobody can say whether the model is bad, the scaffold is bad, or the repository is simply harder than the benchmark.
The leaderboard was not lying. It answered a different question: how often does a particular model, inside a particular agent scaffold, produce a patch that passes a particular set of hidden tests for GitHub issues in a dozen open-source Python projects. Your question is how often a candidate setup produces a mergeable change for your tickets, at a cost you can afford, without damaging anything else. This article walks through what SWE-bench and GAIA actually measure, why their scores transfer poorly, and how to build a small harness that answers your own question with honest error bars.
1. What SWE-bench and GAIA actually measure
SWE-bench was introduced in 2023 by researchers at Princeton. It collects real GitHub issues and the pull requests that closed them from twelve popular Python repositories, roughly 2,300 task instances in the original release. Each instance gives the model the issue text and a checkout of the repository at the commit just before the fix. The model must produce a patch. The harness applies the patch, then runs two groups of tests taken from the original pull request: the FAIL_TO_PASS tests, which failed before the fix and must pass after it, and the PASS_TO_PASS tests, which passed before and must still pass. An instance counts as resolved only if both groups are green.
The original set contained instances whose issue text was too vague to implement from, or whose tests checked implementation details the issue never mentioned. SWE-bench Verified is a 500-instance subset in which human software engineers screened out the worst of those cases. It is a cleaner measurement, but it is still Python, still issue-shaped, still one patch per task, and still graded by tests written by the original author.
GAIA, published in 2023 by researchers from Meta, Hugging Face and others, measures something else. It is a set of a few hundred questions that are conceptually simple for people but require an assistant to combine tools: browsing, reading files, handling images or spreadsheets, and multi-step reasoning. Questions are grouped into three levels by how many steps and tools they need. Each has a short, unambiguous answer that is compared against the reference almost exactly, which makes grading cheap and objective. GAIA is not a coding benchmark. It tells you about general tool-using autonomy: can the system plan, call tools, recover from a dead end and report a precise result.
Used together they cover two halves of an agent: repository-scale code changes graded by tests, and open-ended tool use graded by exact answers. Neither covers what most teams care about on a Tuesday afternoon, which is a messy change in a codebase the benchmark never saw.
2. Seven reasons a leaderboard score does not transfer
- Language and ecosystem. The classic benchmark is Python. Build tooling, type systems, monorepo layouts, code generation steps and slow compilers in your stack are all absent from it.
- Contamination. The issues and fixes are public, and the repositories are heavily represented in training corpora. A model may partly remember a fix rather than derive it. Vendors work to reduce this, but you cannot verify it from outside.
- Specification quality. A benchmark issue was written by a maintainer who knows the codebase. Your tickets are often one-line Jira titles with the real requirement living in someone's head.
- Test shape. Hidden tests reward matching one author's solution. A valid alternative design can fail, and an over-fitted patch can pass.
- Scope. One issue, one patch, nothing in flight. Real work involves a half-migrated module, a flaky suite, a teammate's open branch and a code owner who rejects anything touching their directory.
- Cost and time are not on the leaderboard. Two systems with the same resolve rate can differ several-fold in tokens spent, wall-clock minutes and retries.
- Variance. Agent runs are stochastic. A single reported run is a sample, and small gaps between entries are often within noise.
3. The scaffold is half the score
Leaderboard entries are not bare models. Each is a model plus a scaffold: the system prompt, the tool set (file view, edit, search, shell), how long observations are truncated, how many turns are allowed, whether the agent can run tests, how failures are fed back, and sometimes a multi-sample strategy where several candidate patches are generated and a verifier picks one. Changing the scaffold around a fixed model can move the resolve rate by a large margin, which is why reports from different labs on the "same" model rarely agree.
Three scaffold choices matter more than most teams expect.
Tools and observation format
An editing tool that requires exact-match string replacement fails differently from one that accepts a unified diff. A search tool that returns file names only leads to different exploration than one returning surrounding lines. Models are sensitive to the exact shape of tool results, and an agent that was tuned against one tool format can degrade on another.
Feedback from execution
If the agent can run the relevant tests and read the output, it can iterate. If your test suite takes ten minutes, every iteration is expensive, and a scaffold that encourages many test runs gets slow and costly. A benchmark with fast unit tests hides this cost entirely.
Sampling and selection
Some strong results come from generating many candidates and choosing one with tests or a learned verifier. That is a legitimate technique, but it changes the cost by an order of magnitude. When you compare a number from a leaderboard with your own single-attempt run, check that you are comparing the same protocol.
4. Building a small agentic eval harness
You do not need a thousand tasks. You need a few dozen real ones, run the same way every time, with grading that the agent cannot influence. The recipe:
- Pick 30 to 60 closed tickets from your own history that were resolved by a single pull request, spanning easy, medium and awkward ones.
- For each, record the base commit before the fix, the ticket text as it was written, and the tests that the fix added or changed. Those tests are the held-out grader.
- Run each candidate system from a fresh, isolated checkout at the base commit. The agent never sees the held-out tests.
- After the agent stops, apply the held-out tests, run them plus a guard suite of previously passing tests, and record pass or fail along with tokens, wall-clock time and number of turns.
- Repeat each task several times, because a single attempt is a noisy sample.
Here is a compact version of the core loop. It uses isolated git worktrees so concurrent attempts cannot interfere, enforces a time budget, rejects patches that touch protected paths, and reports a Wilson confidence interval instead of a bare percentage.
import json, os, subprocess, tempfile, time
from dataclasses import dataclass
from math import sqrt
from pathlib import Path
@dataclass
class Task:
id: str
repo: str # path to a local clone
base_commit: str # commit just before the real fix
prompt: str # ticket text exactly as written
test_patch: str # path to a patch adding the held-out tests
test_cmd: list # tests that must now pass
guard_cmd: list # tests that must still pass
protected: tuple = ("tests/", "test/", ".github/")
def sh(cmd, cwd, timeout, **kw):
return subprocess.run(cmd, cwd=cwd, capture_output=True, text=True,
timeout=timeout, **kw)
def attempt(task, agent_cmd, budget_s=900):
work = Path(tempfile.mkdtemp(prefix=f"eval-{task.id}-"))
sh(["git", "worktree", "add", "--detach", str(work), task.base_commit],
task.repo, 120)
usage_file = work / ".usage.json"
env = {**os.environ, "EVAL_USAGE_FILE": str(usage_file)}
start, result = time.time(), {"task": task.id, "passed": False}
try:
sh(agent_cmd, work, budget_s, input=task.prompt, env=env)
except subprocess.TimeoutExpired:
result["reason"] = "timeout"
result["seconds"] = round(time.time() - start, 1)
if usage_file.exists():
result.update(json.loads(usage_file.read_text()))
sh(["git", "add", "-A"], work, 60)
changed = sh(["git", "diff", "--cached", "--name-only"], work, 60).stdout.split()
if any(p.startswith(task.protected) for p in changed):
result["reason"] = "touched protected paths"
elif "reason" not in result:
sh(["git", "apply", task.test_patch], work, 60)
ok = sh(task.test_cmd, work, 600).returncode == 0
ok = ok and sh(task.guard_cmd, work, 1200).returncode == 0
result["passed"] = ok
sh(["git", "worktree", "remove", "--force", str(work)], task.repo, 120)
return result
def wilson(k, n, z=1.96):
if n == 0:
return 0.0, 1.0
p, d = k / n, 1 + z * z / n
centre = (p + z * z / (2 * n)) / d
half = z * sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d
return centre - half, centre + half
def evaluate(tasks, agent_cmd, attempts=3):
rows = [attempt(t, agent_cmd) for t in tasks for _ in range(attempts)]
k = sum(r["passed"] for r in rows)
lo, hi = wilson(k, len(rows))
print(f"resolved {k}/{len(rows)} 95% CI {lo:.0%}-{hi:.0%}")
return rows
Two details deserve attention. The held-out tests are applied only after the agent exits, so it cannot read them or overfit to them. And any change to protected paths is an automatic fail, which closes the cheapest cheat: editing the tests instead of the code. One caveat on the interval above: repeated attempts on the same task are correlated, so the interval treats them as more independent than they are. For a rigorous comparison, bootstrap over tasks, not attempts.
5. Reading results: sample size, variance and cost per resolved task
Suppose, purely as arithmetic with hypothetical figures, that you run two systems on 40 tasks with one attempt each. System A resolves 24 and system B resolves 20. That is 60 percent against 50 percent, and it is tempting to declare A the winner. The 95 percent Wilson interval for 24 of 40 runs from about 45 to 74 percent; for 20 of 40 it runs from about 35 to 65 percent. The intervals overlap heavily.
Because both systems ran the same tasks, a paired comparison is more informative than comparing two percentages. Count only the tasks where they disagree. Say A solved 8 that B missed and B solved 4 that A missed, with 16 solved by both. A sign test on those 12 discordant tasks gives a two-sided p-value of about 0.39. A 4-task edge on 40 tasks is not evidence. You either need many more tasks, a larger true gap, or you should decide on something else, such as cost.
Cost per resolved task is often the deciding metric, and it is simple to compute: tokens in and out per attempt, times price, divided by the resolve rate. Using hypothetical relative prices (system A at 3 units per million input tokens and 15 per million output, system B at 1 and 5), suppose A averages 180k input and 25k output tokens per attempt while B, wandering more, averages 220k and 40k:
- A: 0.18 x 3 + 0.025 x 15 = 0.915 units per attempt, divided by 0.60 = about 1.5 units per resolved task.
- B: 0.22 x 1 + 0.04 x 5 = 0.42 units per attempt, divided by 0.50 = about 0.84 units per resolved task.
In this made-up example the cheaper model costs roughly half as much per success despite a lower pass rate. Whether that wins depends on what a failed attempt costs you: a human reviewing and discarding a bad patch is far more expensive than tokens. Include that reviewer time when it applies.
6. Failure modes the harness must catch
- Test tampering. The agent edits, skips or deletes the failing test. Protected-path checks catch the obvious cases; also diff for new
skip,xfailor.onlymarkers elsewhere. - Special-casing. The patch hard-codes the expected value or branches on the test input. Hidden tests that differ slightly from the visible reproduction help here.
- Flaky graders. If a test fails randomly, your pass rate measures the flakiness. Run the unmodified base plus the true fix a few times first and drop any task that is not stable.
- Environment leakage. The agent reads the repository's git history, finds the real fix commit and copies it. Strip future history from the worktree, or use a shallow checkout.
- Runaway loops. An agent re-runs the same failing command forty times. Enforce turn and token ceilings, and log how many runs hit them; a system that often hits the ceiling is expensive even when it sometimes succeeds.
- Collateral damage. The target test passes while a neighbouring module breaks. This is why the guard suite exists. Keep it broad enough to matter and fast enough to run.
- Silent infrastructure errors. Network failures, rate limits and dependency downloads show up as agent failures. Label them separately so you do not blame the model for an outage.
7. Choosing an evaluation type: a comparison
No single evaluation is enough. The table compares the common options on qualitative properties, not scores.
| Evaluation | What it tells you | Contamination risk | Match to your stack | Cost to run | Best use |
|---|---|---|---|---|---|
| SWE-bench Verified | Repository-scale patching in Python, graded by tests | Moderate to high (public data) | Low unless you ship open-source Python | High if you run it yourself | Screening candidates |
| GAIA | General tool-using autonomy with exact answers | Lower for withheld test answers | Low for coding work | Moderate | Judging planning and tool use |
| Function-level completion sets | Small self-contained code generation | High (saturated and widely seen) | Low | Very low | Smoke test only |
| Replayed internal tickets | Resolve rate on your code, with held-out tests | Low if tickets are recent and private | High | Moderate; needs curation | The decision itself |
| Shadow runs on live tickets | Behaviour on tickets nobody has curated | None | Highest | Moderate; needs reviewers | Confirming before rollout |
| Human review of agent pull requests | Maintainability, style, risk | None | Highest | High, limited by reviewer time | Calibrating all of the above |
8. When not to rely on benchmark numbers, and a decision checklist
Skip public benchmarks as a deciding factor when your stack is not Python, when your tickets are underspecified, when your tests are weak, or when the change you care about is architectural. In those situations a model's score on well-specified issues says little. Likewise, do not use a benchmark as a proxy for safety. An agent that resolves most tasks can still, once in a while, run a destructive command or leak a secret into a log, and no resolve rate captures that.
Before you choose or switch a model for an agent, work through this list:
- Did we test the model inside our scaffold, not only compare published numbers from a different one?
- Do we have at least 30 held-out internal tasks, ideally more, with stable graders?
- Did we run multiple attempts per task and report an interval, or a paired comparison, rather than a bare percentage?
- Do we know cost per resolved task and the share of runs that hit the turn or token ceiling?
- Do we block test tampering and check for collateral damage with a guard suite?
- Have we read a sample of passing patches by hand? A passing test is not a good patch.
- Do we have a rollback plan and a way to keep running the old system in parallel for a while?
9. Common mistakes and what to do on Monday
Common mistakes
- Changing the model and the scaffold at the same time, then crediting the model.
- Tuning prompts against the same tasks you report on. Keep a split you never tune against.
- Reusing public benchmark tasks as your private test set. They may already be in the training data.
- Reporting the best of several runs. Report the mean and the spread.
- Treating a resolve rate as a quality rate. Resolved means tests passed, not that a maintainer would merge it.
- Forgetting that models and tools change underneath you. Re-run the suite on a schedule, because a silent provider update can move your numbers.
What to do on Monday
- Pull 30 closed tickets from your tracker that were fixed by a single pull request with tests, and record the base commit for each.
- Write the harness above, or adapt your existing CI, so every attempt runs in a fresh worktree with a time and token cap.
- Run your current agent setup three times per task and record the interval, tokens and minutes. That is your baseline.
- Run one challenger, changing exactly one thing. Compare per task, not just in aggregate.
- Read ten of the passing patches and ten of the failures before you write down any conclusion.
FAQ
Should I ignore SWE-bench entirely? No. It is useful for deciding which two or three candidates deserve a slot in your own harness. It is a poor tool for the final choice.
How many tasks are enough? Enough that the interval is narrower than the difference you care about. With around 40 tasks, a single-attempt pass rate near 50 percent carries a margin of roughly 15 points either way, so only large gaps are detectable.
Can I use another model as the grader? For open-ended work such as code quality, a model grader can help as a second signal, but tests with exit codes should remain the primary gate wherever tests exist.