agent-readings / Evaluation and Benchmarks
SWE-bench
Coding agents graded by real tests
---
The one sentence
SWE-bench evaluates language models on real GitHub issues by asking them to patch repository snapshots and grading whether the repo's tests pass.
For agents, SWE-bench moved evaluation from generated snippets to repository-scale work with long context, tool execution, test feedback, and multi-file edits.
---
Core idea
Mine GitHub pull requests that resolve issues and add tests, validate them through execution, then evaluate models by applying generated patches and running the...
Mine GitHub pull requests that resolve issues and add tests, validate them through execution, then evaluate models by applying generated patches and running the associated tests.
Modelreason
Runtimeact
Worldobserve
01
Select popular Python repositories with substantial test suites.
02
Scrape merged pull requests and issue links.
03
Filter for PRs that resolve an issue and include test-file changes.
04
Apply execution filtering: the test patch must create fail-to-pass tests, and the reference solution must make them pass.
---
Executable shape
The mechanism should fit on one screen.
```python
for pr in scraped_pull_requests:
if not resolves_issue(pr) or not modifies_tests(pr):
continue
base = checkout(pr.base_commit)
apply(test_patch(pr), base)
before = run_tests(base)
apply(solution_patch(pr), base)
after = run_tests(base)
if has_fail_to_pass(before, after) and installs_cleanly(base):
add_instance(issue_text(pr), base_commit, test_patch(pr), tests)
for instance in benchmark:
patch = model.generate_patch(instance.issue, instance.codebase)
if apply_patch(patch, instance.codebase) and run_tests(instance.codebase):
resolved += 1
```
---