Research log Small Model Experimentation
GitHub

Qwen3.5-4B Trained vs Frozen Repair MDP Report

More fresh tries beat a trained code fixer

The one idea you need

A small coding model writes a program; it fails the tests. You can either train a specialist to patch the broken code, or throw the attempt away and write a few fresh ones. Here, the cheap fresh rewrites won.

The question

When a small coding model writes a program that fails its tests, is it better to train a dedicated fixer or just retry from scratch?

What we found

Retry from scratch. Given the same compute budget, a few more fresh attempts rescued 5 of 57 stuck problems, while a fixer trained to patch broken code rescued only 2 — and its repairs secretly failed the hidden tests nearly a third of the time. An untrained fixer helped slightly (3 of 57), but neither repair approach beat plain retries.

Why it matters

Before building a trained repair model, spend that budget on more diverse first-draft attempts — they recovered more failures here. And distrust code that passes the visible tests: repairs often quietly break on the hidden ones.

Solved by the four-tries baseline62%of 150 coding tasks, from four fresh tries before any repair or extra samples
Stuck tasks rescued: retry vs trained fixer5 vs 2 of 57more fresh attempts beat the trained fixer at equal cost
Trained fixes that secretly failednearly 1 in 3passed the visible tests but failed hidden ones (29%)
Untrained fixer rescues3 of 57a small lift, still below simply retrying
On this page
  1. Results at a glance
  2. Overview
  3. Report
    1. Summary
    2. Main Held-Out Results
    3. Zero-To-One Tasks
    4. Commit / Selection Summaries
    5. Training Details
    6. Figures
    7. Interpretation
    8. Limitations
    9. Conclusion
  4. Experiment log
  5. Figures
  6. Reproduce
  7. Related

Results at a glance 3

Stuck problems rescued by each extra-effort strategy (out of 57)

How to read

Of 57 problems with no working solution, each bar counts how many one strategy rescued: an untrained fixer, a trained fixer, and simply making more fresh attempts. Taller is better.

0246frozen repairfrozen repair3SFT-trained repairSFT-trained repair2sample more (token-matched)sample more (token-matched)5

Takeaway → More-fresh-attempts is the tallest bar and the trained fixer the shortest, so retrying beat repair and training the fixer actually made it worse.

Data table
arm (each spent ~80k extra forward tokens)tasks recovered
frozen repair3
SFT-trained repair2
sample more (token-matched)5

Numbers from report table (reports/qwen35_4b_trained_vs_frozen_repair_mdp_report.md, Main Held-Out Results)

Technical framing

Zero-coverage tasks recovered per arm (out of 57) — At matched token budget, simply sampling more direct solutions recovered more zero-coverage tasks than either repair loop; training made repair worse.

Share of problems solved, by strategy

How to read

Each bar shows the share of 150 problems solved. The leftmost is four fresh tries alone; the other three add extra effort in different ways. Higher is better.

0%20%40%60%80%direct x4direct x462%frozen repairfrozen repair64%SFT repairSFT repair63.3%sample moresample more65.3%

Takeaway → All extra-effort bars edge above the four-tries baseline, but more fresh attempts sits highest, adding the most coverage overall.

Data table
armcoverage
direct x462%
frozen repair64%
SFT repair63.3%
sample more65.3%

Numbers from report table (reports/qwen35_4b_trained_vs_frozen_repair_mdp_report.md, Main Held-Out Results)

Technical framing

Held-out coverage by arm (150 MBPP tasks) — Every budget extension beats the direct-x4 base, but sample-more tops both repair arms at essentially the same forward-token cost.

How often each fixer's code passed visible but failed hidden checks

How to read

Each bar shows how often a fixer produced code that passed the visible checks yet still failed the hidden ones — a misfire. Untrained versus trained fixer. Lower is better.

0%10%20%30%frozen repairfrozen repair25%SFT repairSFT repair29.2%

Takeaway → The trained fixer's bar is taller, meaning training made it more likely to output code that looks correct but quietly fails.

Data table
repair armfalse repair rate
frozen repair25%
SFT repair29.2%

Numbers from report table (reports/qwen35_4b_trained_vs_frozen_repair_mdp_report.md, Main Held-Out Results)

Technical framing

False-repair rate: visible-pass candidates that fail hidden tests — Training raised the false-repair rate: SFT repair more often produced candidates that pass public tests but fail hidden ones.

In the author’s words from the Overview · “Summary”

This experiment tested whether a trained repair policy can expand held-out coding coverage beyond frozen Qwen self-repair, under a fair comparison against spending the same estimated model-forward-token budget on more direct samples.

Overview

This top-level README was generated during repository normalization because the imported experiment did not include one.

How To Read

Start with the primary report, then inspect data/, reports/, analysis/, src/, and scripts/ as available. This folder remains self-contained; do not move its run data into shared directories.

Summary

This experiment tested whether a trained repair policy can expand held-out coding coverage beyond frozen Qwen self-repair, under a fair comparison against spending the same estimated model-forward-token budget on more direct samples.

Report

Rendered from reports/qwen35_4b_trained_vs_frozen_repair_mdp_report.md

Date: 2026-06-25

Summary

This experiment tested whether a trained repair policy can expand held-out coding coverage beyond frozen Qwen self-repair, under a fair comparison against spending the same estimated model-forward-token budget on more direct samples.

The result is negative for trained repair. On 150 held-out MBPP tasks, direct sampling covered 62.0% of tasks, leaving 57 zero-coverage tasks. Frozen repair recovered 3 of those 57 tasks. The SFT repair adapter recovered only 2 of 57 and had a higher false-repair rate. A token-matched sample-more baseline recovered 5 of 57, beating both repair arms at essentially the same estimated model-forward-token cost.

The practical read is: in this setup, the best use of extra model budget was more diverse direct generation, not trained repair. Frozen repair produced a small useful lift, but trained repair did not improve it.

Main Held-Out Results

ArmNCoverageZero-to-oneZero-to-one rateFalse repair rateCandidates/taskDistinct behaviorForward tokens
Direct x415062.0%0 / 570.0%-3.450.770138,902
Frozen repair15064.0%3 / 575.3%25.0%4.010.75479,614
SFT repair15063.3%2 / 573.5%29.2%3.980.76679,325
Sample more15065.3%5 / 578.8%-5.180.70879,861

Zero-To-One Tasks

ArmZero-to-one task IDs
Direct x4-
Frozen repair112, 137, 147
SFT repair112, 147
Sample more36, 42, 67, 129, 148

Commit / Selection Summaries

The following table uses the final budget available in each candidate pool. Oracle coverage is a ceiling: it selects a hidden-correct candidate if one exists in the pool. Other policies use only public/visible candidate behavior.

ArmCommit policyBudgetCoverage ceilingSelected hidden-passCoverage captured
Direct x4First visible-pass862.0%60.0%96.8%
Direct x4Public-signature majority862.0%60.0%96.8%
Direct x4Shortest visible-pass862.0%61.3%98.9%
Direct x4Oracle coverage862.0%62.0%100.0%
Frozen repairFirst visible-pass864.0%62.0%96.9%
Frozen repairPublic-signature majority864.0%62.0%96.9%
Frozen repairShortest visible-pass864.0%63.3%99.0%
Frozen repairOracle coverage864.0%64.0%100.0%
SFT repairFirst visible-pass863.3%61.3%96.8%
SFT repairPublic-signature majority863.3%61.3%96.8%
SFT repairShortest visible-pass863.3%62.7%98.9%
SFT repairOracle coverage863.3%63.3%100.0%
Sample moreFirst visible-pass865.3%62.0%94.9%
Sample morePublic-signature majority865.3%62.0%94.9%
Sample moreShortest visible-pass865.3%64.7%99.0%
Sample moreOracle coverage865.3%65.3%100.0%

Training Details

  • SFT training examples: 17.
  • Max steps: 80.
  • Batch size / grad accumulation: 1 / 4.
  • Learning rate: 0.0001.
  • Final logged SFT loss: 0.01351678092032671.
  • DPO was skipped because the SFT repair arm failed the held-out gate.

Figures

Interpretation

The headline test was trained repair versus frozen repair on tasks with no hidden-correct direct sample. Trained repair did not pass that test: it recovered fewer zero-base tasks than frozen repair and produced a worse visible-pass-but-hidden-fail profile.

The sample-more baseline is the decisive comparator. It spent approximately the same model-forward-token budget as frozen repair and recovered more zero-base tasks. That means the repair loop did not justify its extra prompt structure or training in this run.

The false-repair rates matter. Frozen repair had 28 visible-passing repair candidates, 7 of which failed hidden tests. SFT repair had 24 visible-passing repair candidates, also with 7 hidden failures. Repair can create plausible candidates that satisfy public evidence but do not generalize, so aggregate visible pass rates would overstate its value.

Limitations

  • This is one held-out MBPP run, not a multi-seed estimate.
  • The SFT adapter trained on only 17 mined repair examples, so the trained-arm negative should be read as a result for this small verified-repair recipe, not as a proof that repair training cannot work.
  • Repair was conservative: it repaired visible-failing parsed candidates and did not repair candidates that already passed visible tests but failed hidden tests.
  • No transfer benchmark was run in this package; the held-out MBPP comparison is the primary readout.
  • Hidden tests were used for evaluation and train-side label mining, but not included in repair prompts.

Conclusion

The experiment does not support trained repair as the next deployable posttraining lever. The best observed intervention was to preserve generation diversity and spend the matched budget on more direct samples. A stronger future repair experiment would need either a much larger verified repair set, a process objective that reduces false repairs, or a repair policy aimed at visible-pass hidden-fail near misses rather than only visible failures.

Experiment log 12

Show the running log (12 entries)

Date: 2026-06-25

Experiment directory: /workspace/experiments/qwen35_4b_trained_vs_frozen_repair_mdp

Large artifacts directory: /workspace/large_artifacts/qwen35_4b_trained_vs_frozen_repair_mdp

Objective

Test whether a trained repair policy expands held-out generation coverage beyond frozen Qwen self-repair at honestly matched model-forward-token budget.

The headline metric is zero-to-one hidden coverage lift: among held-out tasks where the direct sample pool contains no hidden-correct candidate, how many become covered after repair.

Design Commitments

  • The frozen Qwen repair loop is the primary baseline.
  • The sample-more baseline is matched by estimated forward tokens, not by candidate count.
  • Training labels may use full train-task tests, but repair prompts contain only task text, public tests, candidate code, and visible execution traces.
  • Hidden tests are used for evaluation and train-side labeling only; they are never included in repair prompts.
  • False repair rate is tracked: visible-pass repair candidates that fail hidden tests.
  • Diversity is tracked with behavior signatures after each arm.
  • Rounds beyond the smoke gate are skipped if the pre-registered gates fail.

Initial Package

  • Created package-local source utilities, direct sampler, repair rollout runner, repair dataset builder, SFT trainer, DPO trainer, token-matched sample-more baseline, and commit evaluator.
  • Large LoRA artifacts will be stored outside the experiment directory.

Smoke Gate

Smoke direct sampling on 12 MBPP train tasks completed:

  • Hidden coverage: 50.0%.
  • Mean candidates/task: 2.92.
  • Mean hidden-pass candidates/task: 1.33.
  • Estimated forward tokens: 8,525.

Frozen repair on the same smoke train pool completed:

  • Hidden coverage remained 50.0%.
  • Zero-base records: 6.
  • Zero-to-one repairs: 0.
  • Visible-passing repair candidates: 2.
  • False repairs among visible-passing repairs: 1.
  • Estimated repair forward tokens: 6,020.

The smoke repair dataset had only 1 SFT example and 1 DPO pair, so the SFT gate was not met. Decision: expand train repair mining before training rather than fitting a meaningless adapter.

Train Repair Mining

Main direct sampling on 100 MBPP train tasks completed:

  • Hidden coverage: 72.0%.
  • Zero-coverage train tasks: 28.
  • Mean candidates/task: 3.42.
  • Mean hidden-pass candidates/task: 1.89.
  • Estimated forward tokens: 93,141.

One-attempt frozen repair mining on this train pool completed:

  • Hidden coverage: 75.0%.
  • Zero-to-one repairs: 3 / 28.
  • Visible-passing repair candidates: 15.
  • False repair rate among visible-passing repairs: 13.3%.
  • Estimated repair forward tokens: 50,830.
  • Dataset: 13 SFT examples, 13 DPO pairs.

Expanded train-only repair mining with more sources and two attempts/source completed:

  • Hidden coverage: 76.0%.
  • Zero-to-one repairs: 4 / 28.
  • Visible-passing repair candidates: 26.
  • False repair rate among visible-passing repairs: 30.8%.
  • Estimated repair forward tokens: 136,948.
  • Dataset: 17 SFT examples, 15 DPO pairs.

Decision: train the repair SFT adapter on the expanded mined set. The signal is thin, so the trained-arm interpretation must be conservative and judged primarily against frozen repair.

Repair SFT

Repair SFT completed on the expanded mined training set:

  • Train examples: 17.
  • Max steps: 80.
  • Batch size / grad accumulation: 1 / 4.
  • Learning rate: 1e-4.
  • Max sequence length: 1,536.
  • Final logged loss: 0.0135.
  • Adapter directory: /workspace/large_artifacts/qwen35_4b_trained_vs_frozen_repair_mdp/models/repair_sft_lora.

Interpretation note: this adapter fit a very small, mined repair set. The loss confirms the optimizer can fit the examples, but the experiment's useful readout is whether the adapter beats frozen repair on held-out zero-to-one coverage without increasing false repairs.

Held-Out Direct Pool

Direct sampling on 150 MBPP held-out tasks completed:

  • Hidden coverage: 62.0% (93 / 150 tasks).
  • Zero-coverage held-out denominator: 57 / 150 tasks.
  • Visible coverage: 62.0%.
  • Mean candidates/task: 3.45.
  • Mean hidden-pass candidates/task: 1.63.
  • Mean visible-pass candidates/task: 1.96.
  • Mean distinct behavior rate: 0.77.
  • Estimated forward tokens: 138,902.

This locks the headline denominator. Repair arms are judged by how many of the 57 zero-coverage tasks become hidden-covered, and by whether they do so beyond frozen repair at comparable model-forward-token cost.

Held-Out Frozen Repair

Frozen Qwen repair on the held-out direct pool completed:

  • Hidden coverage: 64.0% (96 / 150 tasks).
  • Zero-to-one repairs: 3 / 57.
  • Zero-to-one rate: 5.3%.
  • Visible-passing repair candidates: 28.
  • False repairs among visible-passing repairs: 7.
  • False repair rate: 25.0%.
  • Mean candidates/task: 4.01.
  • Mean hidden-pass candidates/task: 1.77.
  • Mean distinct behavior rate: 0.754.
  • Estimated repair forward tokens: 79,614.

Interpretation note: frozen repair creates a small but real held-out frontier lift, but one quarter of visible-passing repairs fail hidden tests. A trained arm must improve the zero-to-one count without worsening this false-repair profile.

Held-Out Repair SFT

SFT-adapter repair on the same held-out direct pool completed:

  • Hidden coverage: 63.3% (95 / 150 tasks).
  • Zero-to-one repairs: 2 / 57.
  • Zero-to-one rate: 3.5%.
  • Visible-passing repair candidates: 24.
  • False repairs among visible-passing repairs: 7.
  • False repair rate: 29.2%.
  • Mean candidates/task: 3.98.
  • Mean hidden-pass candidates/task: 1.75.
  • Mean distinct behavior rate: 0.766.
  • Estimated repair forward tokens: 79,325.

Gate decision: skip DPO. The SFT adapter underperformed frozen repair on the headline metric (2 vs 3 zero-to-one repairs) and had a worse false-repair rate (29.2% vs 25.0%). Running DPO from this checkpoint would add variance without a positive SFT signal.

Held-Out Token-Matched Sample-More Baseline

Token-matched sample-more on the same held-out direct pool completed, using the frozen repair budget as the target:

  • Target forward-token budget: 79,614.
  • Actual estimated forward tokens: 79,861.
  • Extra direct-sampling calls: 344.
  • Hidden coverage: 65.3% (98 / 150 tasks).
  • Zero-to-one additions: 5 / 57.
  • Zero-to-one rate: 8.8%.
  • Mean candidates/task: 5.18.
  • Mean hidden-pass candidates/task: 2.39.
  • Mean distinct behavior rate: 0.708.

Interpretation note: at matched estimated model-forward-token cost, spending the budget on additional direct samples beat both repair arms on the headline metric: sample-more recovered 5 zero-base tasks, frozen repair recovered 3, and SFT repair recovered 2.

Analysis And Report

Commit-policy summaries were generated for direct, frozen repair, SFT repair, and token-matched sample-more pools under first-visible, public-signature-majority, shortest-visible, and oracle-coverage policies.

The final report was generated at reports/qwen35_4b_trained_vs_frozen_repair_mdp_report.md with figures under reports/figures/.

Final readout:

  • Trained repair did not beat frozen repair: SFT recovered 2 / 57 zero-base tasks versus frozen repair's 3 / 57.
  • SFT repair had a worse false-repair profile: 29.2% visible-pass-hidden-fail repairs versus frozen repair's 25.0%.
  • DPO was skipped by gate.
  • Token-matched sample-more was the strongest held-out arm: 5 / 57 zero-base tasks at approximately the same estimated forward-token budget as frozen repair.

Conclusion: this package does not support trained repair as a deployable posttraining lever under the tested small verified-repair recipe. The stronger observed use of extra model budget was additional diverse direct sampling.

Final Audit

  • python -m py_compile src/*.py scripts/*.py passed.
  • No files larger than 10 MB are present inside the experiment directory.
  • Large LoRA artifacts are stored separately under /workspace/large_artifacts/qwen35_4b_trained_vs_frozen_repair_mdp.
  • Report figures were generated as valid PNG files.
  • Generated __pycache__ directories were removed.
  • Standalone-reference scan found no external-paper/citation hooks or cross-track narrative references; only the date-like seed value 20260625 matched the broad scan.

Figures 6

coverage by arm
coverage by arm · reports/figures/
diversity by arm
diversity by arm · reports/figures/
false repair by arm
false repair by arm · reports/figures/
repair sft loss
repair sft loss · reports/figures/
tokens vs zero to one
tokens vs zero to one · reports/figures/
zero to one by arm
zero to one by arm · reports/figures/

Reproduce

Runnable scripts exist in the experiment folder, but the exact invocation was not written down.

Browse the experiment folder on GitHub ↗