Skip to content

Failed Rollouts Still Teach: Teacher-Free Supervision for Code Repair

Chenyu Zhou, Qiliang Jiang, Shuning Wu, Xu Zhou

cs.LG

Abstract

Reinforcement learning for code repair pays one verifier call per proposal, yet a failed call reveals only that the program is wrong, not what it should have been. On HumanEval+ repair, over three quarters of GRPO updates have uniform rewards and no reward gradient. We introduce repair witnesses, which supervise each failed proposal with the nearest program in a bank of verified implementations under canonical token edit distance. Bootstrapping the bank from the model's own passing proposals needs no teacher or reference. One retrieval rule yields three operating points: offline (no online calls), online, and success-projected witnesses. Under equal online budgets, online witnesses learn faster and finish above GRPO in all 19 settings (five benchmarks, ten models, 1.7B to 32B), repairing 73% to 82% of held-out HumanEval+ bugs at low temperature, 37 to 58 points above GRPO. With a self-bootstrapped bank, construction included, Qwen3-14B reaches 94% on a hard repair task in 230 calls and matches GRPO's 1,600-call accuracy of 68% with 6.5 times less training GPU time. From a cold start on MBPP+ and LiveCodeBench, witnesses repair 52% and 47% of held-out bugs on functions that begin with a self-generated program, versus GRPO's 1% and 4% (78% against 7% on MBPP+ at 1,200 calls). On every HumanEval+ model, online witnesses write correct programs outside the bank more often than GRPO succeeds at all and beat GRPO even when it mixes a reference into every group. The nearest witness teaches faster than farther ones in every comparison, and the trained policies transfer to unseen functions.

Create a lesson