What Makes Good Data for Training Coding Agents? A Systematic Study on SWE-Gym

Summary (Overview)

  • Core Question: What makes a task good training data for RL-based coding agents, focusing specifically on the correctness of reward labels (hidden tests)?
  • Key Finding 1: Unsolved tasks are often mislabeled — 74% of never-solved tasks in SWE-Gym have a test that rejects correct fixes (false negatives), versus 20% of sometimes-solved tasks.
  • Key Finding 2: Models trained on audited data (SWE-Gym-Verified) score 2.4 and 2.7 points higher on SWE-bench Verified and SWE-bench Pro respectively, at equal size and matched difficulty, while a pass-rate filter shows no such gain.
  • Key Finding 3: False positives (wrong patches passing tests) constitute ~26% of all passing patches and are common at every difficulty level.
  • Key Contribution: Release of SWE-Gym-Verified with 1,087 audited tasks, every verdict with executed evidence, training sets, and the full audit pipeline.

Introduction and Theoretical Foundation

Background

Reinforcement learning (RL) has become standard for training coding agents, with task collections like SWE-Gym, R2E-Gym, and SWE-smith supplying training tasks. In these collections mined from GitHub, a task pairs a repository and issue with the tests of the pull request that resolved it. The agent sees the issue but not the tests, and its patch is rewarded only if the tests pass — making the hidden tests the reward labels.

The Core Problem

A collection admits a task after checking only that:

  • The reference fix passes the tests
  • The original code fails them

This check shows the reward is attainable but does not show that:

  • Every correct fix obtains it
  • Only correct fixes obtain it

Tests can mislabel patches in two ways:

  • False Negative (FN): A correct fix rejected by tests (e.g., a test calls a private helper the issue never mentions)
  • False Positive (FP): A wrong patch accepted by tests (e.g., handles the reported case but breaks a nearby code path no test covers)

Theoretical Framework

The paper models a task as τ=(repo,s,tests,gold_patch)\tau = (repo, s, tests, gold\_patch) where a patch pp receives reward:

Rτ(p)={1if all tests pass after applying p0otherwiseR_\tau(p) = \begin{cases} 1 & \text{if all tests pass after applying } p \\ 0 & \text{otherwise} \end{cases}

A task's difficulty is its pass count kk (number of passes among eight base-model samples): never solved (k=0)(k=0), sometimes solved (1≤k≤7)(1 \leq k \leq 7), or always solved (k=8)(k=8).

How Label Errors Reach GRPO

GRPO computes each sample's advantage relative to other samples of the same task, so a group carries gradient only if rewards are not all equal. Label errors affect training in three ways:

  1. All-zero groups: Tests reject every reasonable patch → no gradient, wasted compute
  2. Partial rejection: Tests separate correct patches by unspecified details → gradient favors patches matching hidden requirements
  3. False positives: Wrong patches rewarded → can stall or derail learning

Methodology

The Audit Pipeline

The authors audited 2,265 usable, de-duplicated tasks among SWE-Gym's 2,438 using two LLM families (Claude Opus 5.5 and GPT-6.1 Sol). The core principle: no error verdict rests on judgment alone — every suspected error must be reproduced by execution.

False Negative Detection

  1. Both families rate every fail-to-pass (F2P) assertion against the statement
  2. Flagged assertions are tested with a witness: a patch that follows the statement but differs from the gold patch in the flagged detail
  3. A task receives an FN verdict when a flagged assertion rejects a witness the authoring family considers reasonable
  4. Repair: Tasks with FN verdicts are repaired by appending a Requirements block stating the missing requirement (accepted only if no leak detected and the repaired task passes audit again — 184 of 588 attempts)

False Positive Detection

  1. Collect distinct passing patches among eight base-model samples on Clean tasks
  2. Both families label each patch without seeing gold patch or tests
  3. A false positive requires: both LLMs label it incorrect and an executed counterexample confirms (a script whose output matches for original code and gold patch but differs for the suspect patch)

Training Sets

Four training sets of 512 tasks each:

SetDescription
OrigSampled from screened original SWE-Gym tasks, stratified by difficulty
CleanDrawn from SWE-Gym-Verified with matched difficulty quotas
Clean+FPClean plus new tests against false positives
Orig+FilterOrig with never-solved tasks replaced by sometimes-solved ones

Training Setup

  • Base model: Qwen3.5-9B
  • Algorithm: GRPO with SWE-agent scaffold
  • 80 steps × 16 tasks × 8 samples each (2.5 passes over a set)
  • Three seeds per set
  • Evaluation: SWE-bench Verified (397 tasks) and SWE-bench Pro

Empirical Validation / Results

RQ1: Where Do Label Errors Occur?

False negatives are common and concentrate on never-solved tasks:

  • 55% of audited tasks (1,091/2,001) receive an FN verdict
  • In Orig: 74% of never-solved tasks are FN-flawed vs. 20% of sometimes-solved
  • The contrast holds with only both-family-confirmed verdicts (68% vs. 13%)

False positives are common at every difficulty level:

  • 26.1% of 1,854 distinct passing patches are false positives
  • Another 37.3% are undetermined
  • 19–36% of passing patches are false positives at every pass count

RQ2: Which Label Errors Reach the Training Signal?

Never-solved flawed tasks are silent:

  • 57 never-solved FN-flawed tasks = 11.1% of Orig's groups but only 0.9% of gradient-carrying groups
  • Training reward stays at 0.8% for these tasks

Sometimes-solved flawed tasks train the policy:

  • 85 sometimes-solved FN-flawed tasks = 16.6% of Orig's tasks but contribute 19.5% of gradient-carrying groups
  • A pass-rate filter removes none of these

RQ3: Do Audited Tasks Train Better Policies?

Table 2. Held-out pass@1 (%) at each run's selected checkpoint (mean ± std over three seeds)

Training setVerified-397SWE-bench ProGain
Base model57.253.8—
Orig60.2 ± 2.153.5 ± 2.1+1.4 ± 0.9
Orig+Filter61.3 ± 2.151.4 ± 3.0+0.9 ± 2.5
Clean62.6 ± 1.156.2 ± 1.3+3.9 ± 1.2
Clean+FP62.6 ± 1.057.3 ± 3.7+4.5 ± 2.2
  • Clean outperforms Orig by 2.4 pp on Verified-397 and 2.7 pp on SWE-bench Pro
  • Orig+Filter shows no gain over Orig on average
  • The gap emerges late in training (after step 40)

RQ4: Does Hardening Against False Positives Change the Policy?

  • New tests catch 25% of false positives, covering 143 of 512 tasks
  • Clean+FP's training reward drops ~13 pp on hardened tasks (expected even without policy change)
  • Re-grading Clean's own patches shows only 0.4 and 1.8 pp improvement in passing new tests
  • Held-out pass@1 does not change detectably (−0.1 pp on Verified-397, +1.1 pp on Pro)

Verdict Quality Checks

CheckItemsResult
Claude and GPT flag same tasks2,001κ = 0.80
Both humans: flagged assertion open (never/sometimes solved)4533
Each human: unflagged control open303, 1
Each human: false positive incorrect1510, 12
FN in random sample of cleared tasks792

Theoretical and Practical Implications

Three Criteria for Good Training Data

  1. Every correct fix must obtain the reward: Most never-solved tasks have tests rejecting correct fixes, so filters reading zero pass rate as hardness act largely on label errors.

  2. The reward must vary for the right reason: The label errors that train the policy lie in tasks whose samples receive different rewards — pass-rate or reward-variance filters cannot detect them.

  3. Quality must be measured on held-out tasks, at matched size and difficulty: Orig+Filter attains the highest training reward but shows no held-out gain; Clean+FP attains lower training reward but shows no detectable held-out difference.

Practical Contributions

  • SWE-Gym-Verified: 1,087 audited tasks (184 with repaired statements), with per-task audit records
  • Every verdict backed by executed evidence: Allows others to check and contest individual verdicts
  • Release of training sets and full audit pipeline

Impact

  • Avoiding FN-flawed tasks prevents wasted rollouts on tasks whose tests reject correct patches
  • Hardening tests against false positives reduces reward hacking
  • Per-task audit records enable verification rather than reliance on aggregate filters

Conclusion

The paper demonstrates that in RL for coding agents, hidden tests serve as reward labels, and in SWE-Gym these labels are often wrong: 55% of judged tasks have a test that rejects correct fixes. Pass-rate filters keep exactly the errors that carry gradient, while audited tasks train better policies by 2.4–2.7 points on held-out benchmarks.

Key takeaways:

  • A pass rate shows whether a task yields reward, not whether that reward is right
  • Unsolved often means mislabeled, not just hard
  • Training reward cannot rank datasets

Open questions:

  1. How to remove false positives (the 484 false positives with executed counterexamples can serve as a benchmark)
  2. How cheap an audit can be (single-pass LLM rating matches final verdict on 91–95% of tasks, but untested for RL)

Limitations: One base model, scaffold, RL recipe, and task source; three seeds per set; 80-step budget; LLM judgments backed by execution and checked on 105 items by two authors.

Related papers