rootxhacker commited on
Commit
e43286f
·
verified ·
1 Parent(s): 24ddbf7

Patchbench spec v0: schema, verification contract, sourcing plan

Browse files
Files changed (1) hide show
  1. README.md +58 -0
README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PatchBench
2
+
3
+ A multi-language benchmark for evaluating whether an LLM can **fix a bug correctly and without introducing new bugs**. Each row presents a real issue report plus a large code context (~500–1500 lines); the model under test produces a patch; a per-row test suite then checks that (a) previously failing tests now pass and (b) the rest of the suite stays green.
4
+
5
+ **Status: v0 spec. Rows are being built.**
6
+
7
+ ## Row schema
8
+
9
+ | Field | Type | In `tasks` config | Description |
10
+ |---|---|---|---|
11
+ | `id` | string | ✅ | `patchbench-{lang}-{source}-{nnnn}` |
12
+ | `language` | string | ✅ | `python` \| `javascript` \| `typescript` \| `go` \| `java` \| `rust` |
13
+ | `source` | string | ✅ | `real` (mined bug-fix PR) \| `synthetic` (injected bug) |
14
+ | `origin` | string | ✅ | Source dataset, e.g. `swe-bench-live-multilang`, `swesmith-go` |
15
+ | `repo` | string | ✅ | GitHub repo the code came from |
16
+ | `base_commit` | string | ✅ | Commit the buggy state is taken at |
17
+ | `issue_text` | string | ✅ | Issue/PR report the model must diagnose from |
18
+ | `context_files` | list of `{path, content}` | ✅ | ~500–1500 lines total incl. the buggy file(s), callers, and related modules |
19
+ | `buggy_files` | list of string | ✅ | Paths the fix is expected to touch |
20
+ | `test_files` | list of `{path, content}` | ✅ | Test patch materialized as files |
21
+ | `test_cmds` | list of string | ✅ | Commands that run the tests for this row (language-native) |
22
+ | `env_setup_cmds` | list of string | ❌ (harness only) | Install/build commands needed before `test_cmds` |
23
+ | `fail_to_pass` | list of string | ❌ | Tests that MUST fail pre-fix and pass post-fix |
24
+ | `pass_to_pass` | list of string | ❌ | Tests that MUST stay passing post-fix (the regression check) |
25
+ | `gold_patch` | string | ❌ | Reference fix, for harness/self-eval only |
26
+
27
+ Two configs prevent leakage:
28
+ - **`tasks`** (public eval surface): everything an agent sees — issue, context, tests.
29
+ - **`gold`** (harness-only): `fail_to_pass`, `pass_to_pass`, `gold_patch`, `env_setup_cmds`.
30
+
31
+ ## Verification contract (every released row)
32
+
33
+ 1. **Pre-fix:** apply `test_files` to the repo at `base_commit` → every `fail_to_pass` test fails; every `pass_to_pass` test passes.
34
+ 2. **Post-fix:** apply `gold_patch` → every `fail_to_pass` and `pass_to_pass` test passes.
35
+ 3. **Determinism:** each check is run twice; any row with a flaky test is dropped.
36
+ 4. **No-leak check:** issue text must not name the exact function/line to change (auto-screen + spot manual review).
37
+
38
+ A model's fix is scored: **resolved** iff all `fail_to_pass` pass AND all `pass_to_pass` still pass. Rows also record per-test results so partial behavior (fix works but broke something) is visible — that is the "introduced a new bug" signal.
39
+
40
+ ## Sourcing plan (target ~1,500–2,000 rows)
41
+
42
+ | Language | Real source | Synthetic top-up | Target |
43
+ |---|---|---|---|
44
+ | Python | SWE-Gym + SWE-bench Verified/train | SWE-smith-py | ~550 |
45
+ | Rust | SWE-bench-Live rust + rustbench | SWE-smith-rs | ~300 |
46
+ | Java | SWE-bench-Live java + Multi-SWE-bench java | SWE-smith-java | ~300 |
47
+ | Go | SWE-bench-Live go + Multi-SWE-bench go | SWE-smith-go | ~250 |
48
+ | JS/TS | SWE-bench-Live js+ts + Multi-SWE-bench | SWE-smith-js/ts | ~400 |
49
+
50
+ Context expansion is PatchBench's own contribution: no upstream dataset ships sliced 500–1500-line windows. We materialize the repo at `base_commit`, compute the failing-test dependency closure, and slice the modules inside it, filtering out rows whose closure exceeds the window.
51
+
52
+ ## Harness
53
+
54
+ Language-native runner (no Docker required, adapted from the SWE-bench grading loop + microsoft/RepoLaunch per-language build/test recipes): clone at `base_commit` → `env_setup_cmds` → apply `test_files` (+ candidate patch) → run `test_cmds` → parse per-test results → grade against F2P/P2P. Per-repo env caching makes verification tractable.
55
+
56
+ ## License audit
57
+
58
+ Upstream dataset licenses: SWE-bench-Live (MIT), SWE-Gym (MIT), SWE-smith (MIT). Multi-SWE-bench / PrimeIntellect rows are CC0/“other” (ByteDance community terms) — those rows are re-verified from original permissively-licensed repos before inclusion, or excluded.