Language models that fix code in a loop (write a program, run the tests, read the error, try again) stop improving after two or three rounds. They tend to repeat the same mistake or swing back and forth between two flawed versions. We propose training several small add-on modules for one frozen code model so that they compete. On each training problem, every module attempts a full multi-round repair. Only the module whose attempt passes the most tests receives the learning update. Over training, this pressure should push the modules toward different repair strategies. At test time the same test runner that served as judge during training picks which module's answer to keep. The claim is that, with the number of test executions held fixed, a set of competing specialists has a better chance of containing at least one correct fix than the same number of samples from one model trained on every bug. The reason is that the specialists' failures should be less correlated.
The idea joins two lines of work that have not met. Competitive specialization trains several output heads so that only the best head on each example learns. The heads then split ambiguous data into distinct modes rather than averaging them. It has been carried over to language models, but only with a token-likelihood judge against fixed reference text. Execution-grounded code refinement has good judges in compilers and test suites, but it trains a single policy on all bug types at once. In code, the oracle that competitive learning lacks at test time is actually available, and that is why the pairing is worth testing.
Core Claim
Let a frozen base model carry $K$ low-rank adapters (small trainable weight matrices added to the frozen layers), indexed $k=1,\dots,K$. For problem $x$, adapter $k$ produces a repair trajectory $\tau_k$ of up to $T$ generate-execute-revise turns, and $s(\tau_k)\in[0,1]$ is the fraction of the problem's training tests passed by its final program. Training applies a trajectory-level winner-take-all rule:
$$k^*(x)=\arg\max_k \; s(\tau_k), \qquad \mathcal{L}(x)=\mathcal{L}_{\text{RL}}(\theta_{k^*};x)+\epsilon\sum_{k\ne k^*}\mathcal{L}_{\text{RL}}(\theta_k;x),$$
Here $\mathcal{L}_{\text{RL}}(\theta_k;x)$ is a group-relative policy-gradient loss computed on adapter $k$'s own sampled trajectories, $\theta_k$ are that adapter's weights, and $\epsilon$ is a small relaxation that keeps losing adapters from starving. Our hypothesis is that (i) adapters come to win on recognizably different kinds of problems and failures, (ii) the probability that all $K$ attempts fail is lower than for $K$ samples from a single policy trained with equal compute, and (iii) this shows up as higher pass@1 after selection on visible tests and as a refinement curve that keeps rising past the usual 2–3-round plateau.
The scope is narrow on purpose, which separates the proposal from its nearest neighbours. Multiple Choice Learning of Low-Rank Adapters for Language Modeling trains competing adapters with a next-token cross-entropy judge on captioning and translation. It shows unsupervised mode splitting, such as one adapter for English and one for French, and dominance over LoRA-MoE and diverse beam search. It never touches code or execution, and it leaves test-time selection open. That paper supplies our method: parallel adapters, batched evaluation of all of them in one pass, and relaxed or annealed winner-take-all. We change what the judge is and what unit is judged. Trajectory-wise Multiple Choice Learning for Dynamics Generalization in Reinforcement Learning shows that competition over whole trajectories, not single steps, is what makes dynamics heads specialize. It selects heads at test time from recent observed error. We borrow the trajectory-level judgement and the "observe, then select" logic and move them from continuous physics to discrete multi-turn code repair. From Search to Policy: Thompson Sampling Trees for Robust LLM Code Refinement and BOOSTAPR supply the execution-grounded RL machinery and motivate the gap. Both put every repair strategy into one set of weights, and TGPR explicitly reports standard GRPO converging on narrow "safe" fixes. We replace that single set of weights with competing modules, and we drop TGPR's CodeBLEU term so that no reference solution is needed.
Research Program
The first stage builds the system on a 7B code model, matching TGPR's scale so that its numbers are a meaningful reference. We use $K\in\{1,2,4,8\}$ adapters and batch all adapters in one forward pass, as LoRA-MCL does. Each training problem gets a few sampled trajectories per adapter of up to $T=3$ turns. Each turn feeds the interpreter traceback and the failing test output back into the context. The trajectory score is the pass fraction on training tests. This gives a dense signal without a reference program. We expect head collapse, where one early-lucky adapter wins everything, to be the main engineering risk, because the LoRA-MCL authors report acute sensitivity to $\epsilon$ and to annealing speed. We will therefore log each adapter's win share throughout training. We will compare relaxed winner-take-all against a temperature-annealed soft assignment, and we budget a small sweep over both knobs, reported honestly rather than tuned to a single best seed.
The second stage handles inference. All $K$ adapters generate. Only visible or public tests are run, and the passing candidate is returned, with ties broken by the adapter's training win rate on similar tracebacks. Hidden tests are used only for scoring. If every candidate fails, we test two continuation rules. In "self-continue", each adapter revises its own attempt. In "handoff", a failing traceback is given to a different adapter. Handoff is a direct test of whether the plateau comes from a model repeating its own errors. We also train a small scoring head that predicts the winning adapter from the problem and the first traceback. This addresses the uniform-prior limitation of standard multiple choice learning, and it allows a cheaper single-adapter mode when the test budget is one.
The third stage is analysis. We measure the empirical joint failure rate: across problems, how often all $K$ attempts fail, compared with $K$ samples from the single-policy baselines. This is the quantity the core claim actually rests on. We also measure the mutual information between which adapter wins and coarse failure categories read off the traceback (syntax or runtime exception, wrong answer, timeout, edge-case assertion). If adapters win uniformly across categories, the specialization story fails even if accuracy improves.
Baselines
The naive reference point is the frozen base model with greedy one-shot generation and with plain iterative self-repair for $T$ turns. This anchors the plateau curve. CodeTransOcean reports the shape we expect to beat: ChatGPT's DSR@0 of 48.57% rising only to 52.57% after three self-debugging rounds on LLMTrans.
The strongest existing method at our scale is TGPR. It reports pass@1 of 77.6 on MBPP and 41.2 on LiveCodeBench with a Qwen-7B base under greedy decoding, up to +4.4 points pass@1 over standard GRPO (From Search to Policy). We will reimplement standard GRPO and TGPR on the same base model, training problems, and number of sandbox executions during training. The single-policy LoRA will get the same total adapter parameter count as our $K$ adapters combined, so that capacity cannot explain any gap. Beating TGPR means higher hidden-test pass@1 at a matched inference execution budget of $K$ visible-test runs, and TGPR gets the same $K$ samples with visible-test selection. We are aware this setting already favours sampling methods. Without that matching, TGPR's single-pass number is not the right comparison.
At repository scale, the reference is BOOSTAPR's 40.7% resolve rate on SWE-bench Verified with Qwen2.5-Coder-32B (BOOSTAPR), trained on SWE-Gym. We treat this as a stretch evaluation rather than the main test, because matching its 32B training budget may not be feasible. Agentic protocols such as Adversarial Review (75.2% on SWE-bench Verified, 87% on LiveCodeBench) sit on strong frontier models at about 4.5x token cost. We report them as context, not as a matched competitor.
Three ablations isolate the key ingredient. The first is $K$ adapters trained with an averaged loss: every adapter is updated on every trajectory, with no competition, which tests whether parameter splitting alone helps. The second is $K$ adapters with the original LoRA-MCL token-likelihood judge against reference repairs, which tests whether the execution judge matters. The third is step-level rather than trajectory-level competition, which tests the claim carried over from T-MCL.
Why not just…?
Why not just sample $K$ times at high temperature from one execution-trained policy and pick by tests? This is the most serious threat, because it uses the same test-time oracle. The LoRA-MCL authors argue that decoding-time diversity is a patch on an averaged distribution, and they show competing adapters beating diverse beam search on the quality-diversity frontier. But that evidence comes from captioning, not code. The matched-budget comparison against GRPO and TGPR with $K$ samples and visible-test selection settles this directly. The joint-failure-rate measurement explains the result either way. If single-policy samples fail together no more often than our adapters do, the proposal has no advantage and we will say so.
Why not just train one policy with a reward for "any of $K$ samples passes"? That objective resembles winner-take-all, since only the best sample earns credit, but all samples share weights, so the policy can only raise its own variance. We found no reported result on Lacuna for set-level pass@k reward training on these benchmarks. We will therefore implement it as an extra matched baseline. If it equals our method, the conclusion is that the gain comes from the objective, not from separate modules, and that is a useful finding in its own right.
Why not just cluster training bugs by traceback type and train one adapter per cluster? This hand-designed partition is cheaper and easier to interpret. It assumes we know which distinctions matter, while competition finds the partition that the test outcomes reward. We will run it with the same $K$ and budget. Our mutual-information analysis also shows whether learned partitions simply rediscover traceback categories. If they do, clustering may be good enough.
Why not just run a multi-agent review loop? Adversarial Review shows that structured disagreement beats a 5-agent debate (75.2% vs 72.6% on SWE-bench Verified). It costs about 4.5x tokens and still over-edits. Our proposal produces diversity in the weights, with no conversation at inference. We do not claim to beat AR's absolute numbers. We claim a better accuracy-per-token trade-off at fixed model size, and we will report tokens alongside accuracy.
Proposed Experiments
The main experiment trains on the training problems used by TGPR and evaluates on MBPP and LiveCodeBench (LiveCodeBench). We include LCB's self-repair scenario, where GPT-4-Turbo rose from 24.5% to 36.9% with interpreter feedback. We use LCB's post-cutoff problems to limit contamination. The metrics are hidden-test pass@1 after visible-test selection, pass@$K$, tokens and executions per problem, and pass rate as a function of refinement turn up to 6 turns. LLMTrans DSR@K serves as a second view of the plateau.
The decisive checks are four. Competition must reduce the joint failure rate relative to equally budgeted single-policy samples. Gains must grow with $K$ rather than peaking at $K=2$ from collapse. The handoff rule must lift the curve past round three where self-continue flattens. Execution-judged competition must beat the token-likelihood judge. If the first check fails, the proposal is wrong regardless of headline accuracy. If the stage-one models train on SWE-Gym without collapse, we will extend the best configuration to SWE-bench Verified for a repository-scale comparison with BOOSTAPR.
References
- Multiple Choice Learning of Low-Rank Adapters for Language Modeling
- Trajectory-wise Multiple Choice Learning for Dynamics Generalization in Reinforcement Learning
- From Search to Policy: Thompson Sampling Trees for Robust LLM Code Refinement
- BOOSTAPR: Boosting Automated Program Repair via Execution-Grounded Reinforcement Learning with Dual Reward Models
- CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translation
- Adversarial Review: Structured Disagreement for Grounded Agentic Code Review
- LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code