Bad tests, bad rewards: what an audit of SWE-Gym reveals about training coding agents
Reinforcement learning for coding agents trusts hidden tests as the reward. An audit of SWE-Gym by AMD and university researchers shows many of those tests reject correct fixes, and that repairing them, not just filtering hard tasks, lifts held-out SWE-bench scores by 2.4 to 2.7 points.
- Reading time
- 15 min
- Sections
- 7
- Code examples
- 2
- Tables
- 2
- Sources
- 6
- Published
- 25 Nov 2026
- What changed
- What Makes Good Data for Training Coding Agents? A Systematic Study on SWE-Gym (23 November 2026, AMD and university collaborators)
- Why it matters
- The study shifts attention from task difficulty to label correctness.
- What to do
- Audit before you filter
Coding agents are now trained the way chess engines once were: by trying, checking and repeating. The check is a set of hidden unit tests. If the agent's patch makes the failing tests pass, it gets a reward of 1; otherwise 0. The whole method rests on an assumption almost nobody verifies at scale: that those tests accept correct fixes and reject wrong ones.
A paper posted to arXiv on 23 November 2026 puts that assumption to the test on SWE-Gym, a widely used training set of real GitHub issues. The authors find that tasks a 9B model never solves are often not hard at all; about 74% of them have a test that rejects correct fixes. Training on an audited version of the data improves held-out SWE-bench Verified and SWE-bench Pro scores by 2.4 and 2.7 points, while the popular shortcut of dropping never-solved tasks does not. For anyone running RL on code, the message is direct: a pass rate tells you whether a task gives reward, not whether the reward is right.
What happened
What Makes Good Data for Training Coding Agents? A Systematic Study on SWE-Gym (23 November 2026, AMD and university collaborators)
Yikai Zhang, Mai Xu, Yunbei Zhang and co-authors, with Xiao Sun among the listed authors, posted arXiv paper 2611.30207 on 23 November 2026. The paper's overview lists AMD, the University of Michigan, Tulane University, Georgia Tech, UCL, UCLA and NYU as affiliations. The authors audit SWE-Gym with two LLM families, count an error only when execution reproduces it, train Qwen3.5-9B with GRPO on matched task sets, and release SWE-Gym-Verified: 1,087 audited tasks, each verdict with its executed evidence, plus their training sets and the audit pipeline.
SWE-Gym itself comes from an ICML 2025 paper by Pan and colleagues. It holds about 2,400 real tasks from 11 Python repositories, each with a Docker image, an issue description, a reference fix and tests. It is a standard source for training open software-engineering agents.
Why test-based rewards can be wrong
Think of a driving examiner who fails anyone who does not take the exact route the examiner drove that morning. Some failures are real; some are perfectly good drivers who turned one street earlier. That is a false negative. Now imagine an examiner who passes anyone who reaches the destination, even by driving on the pavement. That is a false positive.
Benchmark tasks in the SWE-bench family (see the SWE-bench cost and confidence simulation) check a patch with "fail-to-pass" tests, written by the original developer alongside the reference fix. The task collection only confirms those tests against that one reference fix. Nobody checks whether a different but correct fix also passes. Tests often assert implementation details: an exact error message, a specific function name, an internal attribute. An agent that fixes the bug a different way fails.
This problem is not new for evaluation. When OpenAI built SWE-bench Verified in 2024, annotators found that 61.1% of the 1,699 sampled SWE-bench tasks had unit tests that could unfairly mark valid solutions incorrect, and 68.3% were filtered out for that or other issues. The new paper asks the same question for training data, where the cost is not a wrong score but a wrong gradient.
How the audit works
The audit separates the two error types and demands execution evidence for each.
| Error type | What it means | How a suspicion is raised | What confirms it |
|---|---|---|---|
| False negative | A test rejects a correct fix | Claude Opus 5.5 and GPT-6.1 Sol each rate every fail-to-pass assertion against the issue statement | An alternative fix consistent with the issue is written and run; the test must reject it, and the authoring model family must judge the alternative a reasonable reading of the issue |
| False positive | A wrong patch passes | Both model families must label a passing patch wrong | An executed counterexample must distinguish the patch from both the original code and the reference fix |
The rule that matters is the last column: LLMs nominate suspects, but only running code convicts. The authors note one remaining soft spot: execution shows behaviour, but whether an alternative fix is a "reasonable reading" of the issue still rests on LLM judgment.
Why false negatives distort RL
GRPO, the RL algorithm used here, samples a group of attempts per task and scores each attempt relative to the group. The advantage of attempt i is
A_i = (r_i − mean(r)) / std(r)
Positive advantages are reinforced, negative ones discouraged (the GRPO simulation lets you try this with your own numbers). Take an illustrative group of 8 attempts on one task. Two copy the reference fix closely, two are different but correct fixes, and four are wrong.
- With a correct test, rewards are [1, 1, 1, 1, 0, 0, 0, 0]. The mean is 0.5 and the standard deviation 0.5, so each correct attempt gets +1.0 and each wrong one −1.0.
- With an over-specific test that rejects the alternative fixes, rewards are [1, 1, 0, 0, 0, 0, 0, 0]. The mean is 0.25 and the standard deviation 0.433. The two reference-like attempts get (1 − 0.25) / 0.433 = +1.732; the two correct alternatives get (0 − 0.25) / 0.433 = −0.577, exactly the same penalty as the wrong patches.
- If the test rejects everything the model writes, rewards are all 0, the standard deviation is 0, and every advantage is 0. The task contributes no gradient at all.
import statistics as st
def advantages(r):
m, s = st.mean(r), st.pstdev(r)
return [0.0 if s == 0 else (x - m) / s for x in r]
print(advantages([1, 1, 1, 1, 0, 0, 0, 0])) # clean test
print(advantages([1, 1, 0, 0, 0, 0, 0, 0])) # rejects two correct fixes
print(advantages([0] * 8)) # never solved: no gradient
This simple arithmetic explains the paper's most interesting result. Never-solved tasks with flawed tests are mostly harmless, because they produce no gradient. The damage comes from sometimes-solved tasks with flawed tests, which actively teach the model to imitate the reference fix and avoid other correct solutions.
What the paper measured
Never-solved tasks are usually mislabeled
Among tasks the 9B base model never solves, about 74% have a false-negative test. Among tasks it sometimes solves, the share is 20%. The authors stress that this is an association, not a proven cause, but it overturns a common intuition: a task that no model solves is more likely broken than hard.
Filtering versus auditing
The authors train Qwen3.5-9B with GRPO for 80 steps on three matched 512-task sets, with three seeds each: Orig (the original tasks), Orig+Filter (never-solved tasks dropped and replaced) and Clean (audited tasks, with flawed ones repaired or replaced). Results are pass@1 gains over the base model on 397 scored SWE-bench Verified tasks and 638 scored SWE-bench Pro tasks.
On SWE-bench Verified, Clean reaches 62.6% against 60.2% for Orig, the 2.4-point gain in the abstract. On SWE-bench Pro, Clean moves from −0.2 to +2.5, a 2.7-point swing. The filter shortcut helps a little on Verified (+1.1 over Orig) but hurts on Pro, landing 2.2 points below Orig. On the 100-task development split at step 80, the order is the same: Clean 53.0%, Filter 49.3%, Orig 48.0% and base 46.8%.
Why filtering misses the problem
The gradient analysis lines up with the worked example above. In the Orig set, 142 tasks have false-negative flaws. The never-solved filter removes 57 of them (40%), leaving 85. But those 57 tasks carried almost no gradient: the filter removes only 21 of the 482 gradient-carrying groups from flawed tasks (about 4%), leaving 461. The 85 sometimes-solved flawed tasks are 16.6% of the training set but 19.5% of the gradient-carrying groups, so they punch above their weight.
False positives are common but did not move scores
Wrong patches that pass the tests make up about a quarter of all passing patches, with a range of 19% to 36% depending on how many samples solved the task. The authors added 493 new tests on 143 tasks, which catch about a quarter of false positives in a sample of passing training patches. With three seeds, held-out pass@1 showed no detectable difference from Clean. The authors are careful to say that this does not establish that false positives are harmless; held-out benchmarks scored by the original tests cannot show whether the policy writes fewer wrong-but-passing patches.
| Finding | Number reported | What it means |
|---|---|---|
| Never-solved tasks with a false-negative test | about 74% | "Unsolvable" is often "mislabeled" |
| Sometimes-solved tasks with a false-negative test | about 20% | Flaws hide in tasks that give reward |
| Clean vs Orig, SWE-bench Verified | +2.4 points (62.6% vs 60.2%) | Repairing labels helps |
| Clean vs Orig, SWE-bench Pro | +2.7 points | The gain transfers to a harder set |
| Filter vs Orig, SWE-bench Pro | −2.2 points | Dropping hard tasks is not a fix |
| Passing patches that are wrong | about 25% (19% to 36%) | Pass rate overstates correctness |
Continue learning
How this article connects
5 pages link to or from it. Drag to turn, click a dot to open it.
Use cases and examples
An open-model team training a coding agent with RL. A team runs GRPO on 2,000 SWE-style tasks (similar in spirit to RL on expert-built tasks) and notices 300 are never solved. The common move is to drop them. The paper suggests a different first step: run an alternative-fix audit on those 300, since roughly three in four may have false-negative tests, and spend more audit effort on the sometimes-solved tasks, which are the ones that inject wrong gradients.
A company building internal training tasks from its own repositories. An enterprise mining its own bug-fix history for agent training can adopt the two-sided audit before training: one model writes an alternative fix, the test suite runs it, and a second model family reviews passing patches. Only executed disagreements become label changes, which keeps LLM judgment from silently rewriting data.
An evaluation lead reading a leaderboard. When a vendor reports a 3-point gain on SWE-bench Verified from a new data recipe, the lead can ask whether the training tasks were audited and whether a data-only change like Clean versus Orig, worth 2.4 points here at 9B scale, could explain it.
A researcher studying reward hacking. With about a quarter of passing patches being wrong, test-passing rate is a loose proxy for correctness. A researcher can use the released executed counterexamples in SWE-Gym-Verified to measure how often a trained policy produces wrong-but-passing patches, which the held-out benchmark cannot show.
What it means in practice
The study shifts attention from task difficulty to label correctness. Most data recipes for coding agents filter by pass rate: drop tasks that are too easy or never solved. This paper shows why that is not enough. A pass rate is computed with the same tests that may be wrong, so it cannot detect a wrong label.
It also gives a cheap rule of thumb for where to look. Flawed never-solved tasks waste compute but do little harm under GRPO, because identical rewards give zero advantage. Flawed sometimes-solved tasks are the dangerous ones. If you can audit only a fraction of your data, audit the tasks that give mixed rewards.
Finally, it is a reminder that benchmark numbers in this area move by a few points, and data quality alone moved them by 2.4 to 2.7 points here. Comparisons between agent training methods that do not control for label quality are hard to interpret, a theme also covered in a score is only as good as its report.
What to do now
- Audit before you filter. Before dropping never-solved tasks, sample them and try alternative correct fixes; expect many to be mislabeled.
- Prioritise mixed-reward tasks. Spend audit effort on tasks the model sometimes solves, since those carry gradient and flawed labels there push the model toward copying the reference fix.
- Require execution evidence for every label change. Let models nominate suspected errors, but change a label only when a run reproduces the problem.
- Use two model families. The paper's audit uses two different LLM families for ratings and false-positive review, which reduces the chance that one model's blind spot becomes a data rule.
- Track false positives separately. Sample passing patches and check them; at about a quarter wrong, pass rate overstates how often the agent is right.
- Start from SWE-Gym-Verified. If you train on SWE-Gym, use the 1,087 audited tasks and their executed verdicts instead of the raw set.
- Report data audits with results. When publishing agent training results, state whether tasks were audited and how, so others can separate data effects from method effects.
- Run several seeds. The paper uses three seeds per set; single-seed comparisons of a few points are not reliable, as the paired evaluation simulation shows.
Risks and open questions
One setup. The authors list the limits plainly: one task source, one model, one scaffold, one RL recipe, three seeds per set and an 80-step budget. The size of the gain at larger scale or with longer training is unknown.
Associations, not causes. The 74% and 20% shares, and the filter result, are associations. Clean also differs from Orig in which tasks were removed, repaired and replaced, so the 2.4-point gain cannot be credited to fixing false negatives alone.
LLM judgment remains in the loop. Execution proves that a test rejects a fix, but whether that fix is a reasonable reading of the issue is still judged by a model. Some verdicts may be contestable.
False positives are unresolved. Adding 493 tests on 143 tasks made no detectable difference to held-out scores, but held-out benchmarks scored by original tests cannot see wrong-but-passing patches. The real cost of false positives may be hidden by the measurement itself.
Watch next: whether other training sets, including synthetic task collections, show the same never-solved pattern, whether labs adopt execution-backed audits as a standard data step, and whether benchmark maintainers apply the same alternative-fix test to SWE-bench Pro.
Frequently asked questions
What is SWE-Gym-Verified?
It is an audited release of SWE-Gym tasks: 1,087 tasks, each with an executed verdict and its evidence. The authors also release their training sets and the full audit pipeline so others can audit their own task collections.
What is a false-negative test?
It is a test that rejects a correct fix, usually because it checks an implementation detail of the reference solution rather than the behaviour the issue asks for. In RL, it gives a correct attempt a reward of 0.
Why does dropping never-solved tasks not help?
Under GRPO, a task where every attempt gets 0 has zero advantage and contributes no gradient, so removing it changes little. The harmful flawed tasks are the sometimes-solved ones, which the filter keeps; in the paper, it removed 40% of flawed tasks but only about 4% of their gradient-carrying groups.
How big is the improvement from clean data?
The authors report 62.6% against 60.2% on SWE-bench Verified (+2.4 points) and a 2.7-point gain on SWE-bench Pro, training Qwen3.5-9B with GRPO for 80 steps on 512-task sets with three seeds each. These are self-reported results from one setup.
Are wrong patches that pass the tests a problem?
They are common, about a quarter of passing patches in the authors' estimate. Adding new tests to catch them did not change held-out scores detectably, but the authors note the benchmarks cannot show whether the policy writes fewer such patches, so the question is open.
Summary
A study of SWE-Gym by researchers from AMD and several universities shows that test-based rewards for coding agents are often wrong in a specific, predictable way: tests that reject correct fixes. About 74% of tasks a 9B model never solves have such a test, against 20% of sometimes-solved tasks. Because GRPO gives zero gradient to tasks with identical rewards, the common filter of dropping never-solved tasks removes mostly harmless data, while flawed sometimes-solved tasks keep teaching the model to copy reference fixes. An execution-backed audit with two LLM families, released as SWE-Gym-Verified with 1,087 tasks, improves held-out SWE-bench Verified by 2.4 points and SWE-bench Pro by 2.7 points in the authors' setup. Wrong-but-passing patches remain common and largely unmeasured, which is the next problem for anyone training agents on tests.
Sources
- Paper arXiv: What Makes Good Data for Training Coding Agents? A Systematic Study on SWE-Gym
- Web alphaXiv: SWE-Gym data study overview
- Code Hugging Face: paper page for arXiv 2611.30207
- Code GitHub: SWE-Gym, training software engineering agents and verifiers
- Official OpenAI: Introducing SWE-bench Verified
- Code Hugging Face: Weekly papers, week 48 of 2026
Cite this article
Kelahmet, Ö. C. (2026, November 25). Bad tests, bad rewards: what an audit of SWE-Gym reveals about training coding agents. Özer Cem KELAHMET. https://www.ozercemkelahmet.com/articles/swe-gym-verified-coding-agent-rewards
BibTeX
@online{kelahmet2026verified,
author = {Kelahmet, {\"O}zer Cem},
title = {{Bad tests, bad rewards: what an audit of SWE-Gym reveals about training coding agents}},
year = {2026},
month = {nov},
url = {https://www.ozercemkelahmet.com/articles/swe-gym-verified-coding-agent-rewards}
}Version historyfirst version
- Published
Factual corrections are listed here with what changed. Wording and formatting edits are not listed.