Skip to content

feat(eval): run and grade SWE-bench Verified through the agent benchmarks - #4400

Merged
kovtcharov-amd merged 7 commits into
amd:mainfrom
kovtcharov:feat/eval-swebench
Sep 28, 2026
Merged

kovtcharov-amd merged 7 commits into
amd:mainfrom
kovtcharov:feat/eval-swebench

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

Stacked on #4335 — merge that first. This branch is feat/eval-harness-benchmarks plus one commit; the diff against main shows both until #4335 lands.

The agent benchmarks could only be compared with each other: everyday is a project built for the benchmark and therock has no published numbers. gaia eval tasks run --suite swebench now runs either harness on SWE-bench Verified instances — the public yardstick — and grades the patches with the official SWE-bench harness in Docker, so a GAIA number can be set beside a published one on the same instances and grader. Nothing of the dataset is committed: instances are fetched from Hugging Face at run time and cached under the work root, the checkout is built the leak-proof way #4335 builds TheRock's (bare cache by commit, file:// clone at depth 200, git fsck must find nothing), and the amd64-only 3 GB images are pulled and removed one at a time.

Test plan

  • pytest tests/unit/eval — 1036 passed, 2 skipped (31 new in test_bench_swebench.py: stubbed fetcher, real-git checkout with exact argv, prediction capture, mocked harness/docker argv and pull→grade→rmi order, report parsing in the swebench 5.x shape, run/judge/grade through the suite, CLI flags)
  • python util/lint.py --black --isort; flake8 and pylint clean on the changed files
  • gaia eval tasks run --suite swebench --no-judge --out /tmp/swe on a machine with Docker and pip install swebench — not run here: the local Docker Desktop VM is wedged (needs a GUI reset), so evaluate is verified against the harness's argv and report format only, not a live container
  • The five-instance pilot on both harnesses, then gaia eval tasks report

Kalin Ovtcharov and others added 5 commits September 25, 2026 00:17
Comparing GAIA with Claude Code, or one model with another, needed a local
lab folder that nobody else could run, so its numbers could not be checked or
reproduced. `gaia eval tasks run --harness claude-code` now drives Claude Code
over the same tasks, fixtures, time limit and judge the flagship gets, and
`report` builds the harness × model table from finished runs.

What the harness now guarantees, each from a bug found while comparing the two:
both agents get the same wall-clock cap and the same project toolchain on PATH;
a run cut off at the cap keeps the record of what it did instead of reporting
zero turns; and both are scored by the same probes and judged from the same
tool record.

Six "everyday" tasks are ported from the lab (issue triage, duplicate
detection, issue-to-fix, drafting a reply, a shell injection, labelling
issues), giving a 14-task `everyday` suite. The GitHub ones run against an
offline `gh` stand-in serving committed fixtures, so no task reaches a personal
login, every call is logged, and writes are refused unless the task grants
them.

A `therock` suite reproduces four real merged fixes in ROCm/TheRock, built from
public git at run time: a shallow checkout at the fix's true parent with its
remote removed, so the answer is not on disk, and the reference diff
(`merge^..merge`) fetched only by the judge step, after the agent has exited.

Cost carries its source, because the three are different kinds of dollar:
`metered` (the provider's billing API, fixed window), `api_equivalent` (Claude
Code's own figure on a subscription — a price of compute, not money spent, and
labelled as such in the reports) and `harness_counts` (rate-carded token
counts). A run that reached the model but counted nothing reads n/a, never
$0.00.

Since artifacts are meant to be published: no provider key is ever in the
agent's environment, every transcript is scrubbed and the run fails rather than
writing a surviving secret, and `--fence` is refused where it cannot be
enforced instead of pretending.
…n prompt

Running the full 14-task suite on a Fireworks-routed model surfaced three
things worth fixing.

`--meter fireworks` read the API key through the OS credential store, and a
macOS keychain item whose ACL demands authorisation blocks its reader until
someone clicks. Unattended — which is how a benchmark runs — that is a hang
with no output before the first task, not a failure anyone can act on. The read
is now bounded and names FIREWORKS_ACCOUNT_ID's companion variable in the
error, and the scrubber's own key lookup goes through the same bounded path.

A suite takes a quarter of an hour and its progress is the only sign it is
alive, but redirected to a log every line sat in a block buffer until the run
ended. Progress is line-buffered now.

Lemonade reports zero usage on a streamed Anthropic reply for a cloud-routed
model as well as a local one, so the note about it says so: that leg has no
token counts of its own and `--meter` is the only way to price it.
Reproducing a harness x model comparison meant reading source and the
skill file to work out the commands, the cost, and what a result even
means. This adds a plain-language guide at
docs/reference/agent-benchmarks.mdx (registered in docs.json next to
Session Analytics): what the two suites are, harness vs. model, how
mechanical checks and the judge combine, the no-internet detector, real
cost, every command, and the traps that have actually bitten a run
(single-run noise, account-wide metering contamination, an unjudged
task silently counted as failed, the harness undercounting the
provider's own meter by 1-6%).

Every quick-start command was run for real against a live Fireworks-routed
model (controls, a --harness gaia run, report) and a two-task
reproduction against an independently produced run agreed on pass/fail
for both, with step and token counts in the same order of magnitude.
The guide said GLM-5.3 Flash under GAIA 'matches' Claude Opus 5 under Claude Code.
Measured, it scores 4.89 (4.80-4.95) against Opus's 5.00 on a single run - close, not
equal. It also put Claude Code's run-to-run spread at 2x; the measured spread is 4.5x
(4:06 to 18:30 on the same model and tasks), and one TheRock run moved from 3/4 to 4/4
on repeat.
…ent benchmarks

The benchmarks could only be compared with each other: the toybox suite is
built for the benchmark and TheRock has no published numbers. A `swebench`
suite now runs either harness on SWE-bench Verified instances and grades the
patches with the official harness in Docker, so a GAIA number can be set
beside a published one on the same instances and the same grader.

Nothing of the dataset is committed. Instances are read from the Hugging
Face dataset at run time (`datasets` if installed, else the datasets-server
REST API) and cached under the work root, which `--fence` denies. The
checkout is built the way TheRock's is: a bare cache filled by commit to
depth 200, a single-branch `file://` clone of it, detached, no remote, and
`git fsck --unreachable` must find nothing. The agent's diff becomes one row
of `predictions.jsonl`; an empty diff fails the task at once, and a run that
errored is shown to the judge but never submitted. Grading pulls each
amd64-only 3 GB image just before its run and removes it after; a missing
`swebench` package or Docker daemon is an error before anything runs. The
judge grades quality against the gold patch, read only in the judge step,
and never decides the pass.
@github-actions github-actions Bot added documentation Documentation changes dependencies Dependency updates cli CLI changes eval Evaluation framework changes tests Test changes performance Performance-critical changes labels Sep 26, 2026
@kovtcharov
kovtcharov marked this pull request as ready for review September 26, 2026 22:57
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

This adds a swebench suite that runs either harness on SWE-bench Verified instances and grades the patches with the official harness in Docker. The checkout is built the same leak-proof way as TheRock's, and the judge only grades quality, never the pass. The design is sound and well tested at the unit level. Two things should be fixed before merge:

  • The Docker grading step has never run. The test plan says so, and that step is the whole point of the PR. The unit tests only check the command we build and a report format we wrote ourselves, so they can't show the harness accepts the command or writes the report where we look. Please run the pilot (or one instance) on a machine with Docker, then post the gaia eval tasks swebench output and the per-instance verdicts.
  • One stuck instance crashes the whole grading run. A hung docker pull or harness run ends in a raw traceback. The remaining instances go ungraded and the ~3 GB image stays on disk. The code promises the opposite: a failed instance is recorded and the rest keep going. A failed pull also stops everything instead of being recorded for that instance.

The PR is stacked on #4335, so this review covers only the new SWE-bench commit.

Real-world evidence

N/A: no evidence bundle was produced for this PR, and the description has no live run of the new CLI surface (gaia eval tasks run --suite swebench, gaia eval tasks swebench). The author says the local Docker VM was wedged. This verdict therefore rests on static review alone. I did confirm that the live SWE-bench Verified dataset has the image column the loader requires.

🔍 Technical details

🟡 Timeouts escape the per-instance error handling (src/gaia/eval/bench/swebench.py:480, :528)

_docker(...) and the harness subprocess.run(..., timeout=HARNESS_TIMEOUT_S + 600) both raise subprocess.TimeoutExpired, and nothing catches it. The CLI's _grade_swebench catches only (SweBenchError, ValueError), so the user gets a traceback. rmi never runs, and parse_report and write_scorecard are skipped, so verdicts from instances that already finished are lost too. The SweBenchError raised on a failed pull (:523) also aborts the loop, which contradicts the evaluate docstring ("an instance whose harness run fails is reported in its verdict, and the others still run"). Suggested fix: catch TimeoutExpired around both calls, record it in failures[instance_id], and put the rmi in a finally: block. For a pull failure, either record it per instance or change the docstring to say it aborts. Add a test for each.

🟡 No live test of the harness contract (tests/unit/eval/test_bench_swebench.py)

This is the "mocks prove we called it, not that the call is valid" case from CLAUDE.md. Three things are asserted only against stubs:

  • The argv: --report_dir, --timeout, and --instance_ids with a single id.
  • The report location: logs/run_evaluation/<run_id>/<model>/<id>/report.json under cwd=report_dir.
  • That the harness uses the pulled image rather than building or pulling under its own namespace.

If any of these is wrong, every instance quietly becomes "the harness wrote no report". An integration test marked to skip without Docker or swebench would lock the contract in, as would a pasted pilot run in the PR.

🟢 gaia eval tasks swebench and --suite swebench are missing from docs/reference/cli.mdx

The examples block around line 1855 lists run, judge and gate, but neither SWE-bench command. eval.mdx and agent-benchmarks.mdx do cover them.

🟢 --no-evaluate, --keep-images and --docker-platform are silently ignored on other suites (src/gaia/cli.py:3582)

--instances without --suite swebench is rejected, but these three flags are not. Rejecting them the same way would be consistent.

🟢 Re-grading pulls images the harness then skips

run_evaluation skips instances whose report.json already exists. Running gaia eval tasks swebench again on the same run directory therefore pulls and removes each ~3 GB image for nothing. Checking for an existing report before the pull would avoid that.

Strengths

  • The leak-proofing matches TheRock's: history fetched only up to the base commit, a file:// clone with no remote, and git fsck --unreachable must find nothing. The gold patch is read only in the judge step.
  • The official harness alone decides pass or fail. The judge grades quality only, and _apply_verdict correctly leaves SWE-bench tasks alone.
  • Setup failures are loud and actionable: missing swebench, a Docker daemon that doesn't answer, an unknown instance id, or the older dataset without the image column.

# Conflicts:
#	docs/reference/agent-benchmarks.mdx
#	docs/reference/eval.mdx
#	src/gaia/cli.py
#	src/gaia/eval/flagship_tasks.py
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 28, 2026
Merged via the queue into amd:main with commit e00d290 Sep 28, 2026
29 of 35 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the feat/eval-swebench branch September 28, 2026 19:41
kovtcharov-amd pushed a commit to kovtcharov/gaia that referenced this pull request Sep 29, 2026
Since amd#4400 merged this afternoon, the Linux and macOS unit lanes have
been red on **every open PR** in the repo. The cause is one missing
section: `gaia eval tasks swebench` exists in the parser but never got a
CLI reference entry, so
`test_cli_docs_drift::test_every_leaf_command_is_documented` fails
everywhere. This documents it, and the lanes go green again.

The allowlist in that test is deliberately untouched — its docstring
says nothing may be added to it going forward, so the gap is closed
rather than excused.

### Test plan

- [x] `pytest tests/unit/cli/test_cli_docs_drift.py` — **3 passed**
- [x] Diff is one file, `docs/reference/cli.mdx`, +13/-0; `git diff
--name-only -- tests/` is empty
- [ ] Linux + macOS unit lanes go green on this PR

<details>
<summary>🔍 What was undocumented</summary>

`src/gaia/cli.py:2634` registers the subcommand, and `:2503` / `:2509`
add the two flags that only apply to the `swebench` suite:

```
tasks_swebench_parser = tasks_actions.add_parser(
    "swebench",
    help="Grade a swebench run's predictions with the official harness (Docker)",
```

Before:

```
$ git grep -c "eval tasks swebench" origin/main -- docs/reference/cli.mdx
0
$ pytest tests/unit/cli/test_cli_docs_drift.py
FAILED test_every_leaf_command_is_documented - AssertionError: New undocumented
subcommand(s) ...: [('eval', 'tasks', 'swebench')]
```

After: `3 passed`.
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI changes dependencies Dependency updates documentation Documentation changes eval Evaluation framework changes performance Performance-critical changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants