Why Reinforcement Learning Post-Training Improves Code Models Unevenly

    This article analyzes why reinforcement learning post-training produces uneven capability gains in code generation models, and how to measure and manage them in engineering practice. It explains how verifiable rewards shift optimization from imitating answers to producing runnable code, why dimensions that are hard to score automatically (such as UI fidelity and accessibility) tend to regress, and what a same-baseline evaluation setup requires. It also covers dual-model collaboration, including where the gains come from, the short-board effect, why same-distribution model pairs cooperate better, and cost-sensitive routing, followed by a practical checklist for rewards, evaluation, routing, and staged rollout.

    1. Framing the Problem: From “Benchmark Scores Doubled” to a Reusable Engineering Question

    In the AI coding tool space, a familiar kind of report appears regularly: a new version scores multiples higher than the previous generation on coding benchmarks, yet the real usage experience is structurally uneven — algorithm and logic reasoning improve markedly, while UI reproduction and styling details regress. Once the brand and model names are stripped away, this can be abstracted into a general engineering problem:

    When optimizing code generation on top of an existing base model through Reinforcement Learning Post-Training, why are the capability gains uneven? How should they be measured? And how can engineering amplify the gains while suppressing regressions?

    The question matters to both developers and platform teams: the former want to know “if I switch to the new model, will my project get slower and uglier,” the latter want to know “how to evaluate the ROI of post-training and how to design a staged rollout.”

    2. Where the Gains Come From: What Reinforcement Learning Post-Training Actually Changes

    Supervised fine-tuning (SFT) is essentially imitation: the model learns the distribution of “correct answers as demonstrated by humans.” Reinforcement learning post-training introduces verifiable reward signals instead — whether tests pass, whether static checks report errors, whether performance thresholds are met. The difference produces three structural changes.

    First, the optimization target shifts from “resembling an answer” to “actually running.” The model no longer chases text similarity alone but tends to produce implementations that pass verification, which directly explains the pronounced gains on decidable tasks such as algorithm problems, data processing, and concurrency control.

    Second, sampling and exploration are explicitly incentivized. Reinforcement learning typically pairs with multiple sampling rounds, result filtering, and preference alignment; the model learns to enumerate edge cases early in its reasoning, showing up as “thinking more”: proactively constructing extreme inputs, filling in null and exception branches, and providing complexity analysis.

    Third, reward coverage determines the shape of capability. If the reward comes mainly from automatically decidable test pass rates, then dimensions that are hard to score automatically — visual consistency, accessibility, naming conventions — receive no gradient, and the probability of relative regression rises sharply.

    An illustrative post-training loop (pseudocode, conveying the idea only):

    1. for batch in task_pool:
    2. # 1. Sample multiple times, preserving diversity
    3. candidates = policy.sample(batch.prompt, n=8, temperature=0.8)
    4. # 2. Verifiable rewards: test pass rate + static checks + complexity constraint
    5. rewards = []
    6. for code in candidates:
    7. pass_rate = run_tests(code, batch.tests) # 0.0 ~ 1.0
    8. lint_ok = static_check(code) # 0/1
    9. complexity_ok = check_big_o(code, batch.limit) # 0/1
    10. rewards.append(0.7 * pass_rate + 0.2 * lint_ok + 0.1 * complexity_ok)
    11. # 3. Group-relative advantage, reducing reward scale drift
    12. advantages = normalize(rewards)
    13. # 4. Policy update with KL constraint to prevent capability collapse
    14. policy.update(batch.prompt, candidates, advantages, kl_coef=0.05)

    The critical elements are the reward function and the KL constraint: too narrow a reward leads to “teaching to the test,” while too strong a constraint suppresses exploration. Together they determine the final capability distribution.

    3. Measurement First: Why “Doubled” Must Be Read Within the Same Evaluation Setup

    The most valuable part of the original observation is not any single score but the evaluation methodology: the same simplified adversarial coding task suite, run in two formats — team matches and individual matches — with multiple control groups. Four actionable principles can be abstracted from it.

    1. Same-baseline principle. Base version, context length, sampling temperature, maximum output length, and tool permissions must all be identical; otherwise the gains cannot be attributed.
    2. Control-group principle. At least three controls are needed — “previous-generation single model,” “same-generation model with a different positioning,” and “base model plus post-training” — to separate base-model progress from post-training contribution.
    3. Dual-format principle. Individual matches measure single-model reasoning and code quality; team matches (two models collaborating) measure collaboration gains in a realistic toolchain. The two often yield inconsistent conclusions.
    4. Composite metrics. Beyond win/loss/draw and score rate, also record goal-difference-style metrics (tests passed / tests failed), average interaction turns, per-task latency, and the distribution of failure types.

    A minimal usable evaluation skeleton:

    1. def evaluate(model_pair, suite, k=3):
    2. stats = {"score": 0.0, "pass": 0, "fail": 0, "turns": 0}
    3. for task in suite:
    4. results = [run(model_pair, task) for _ in range(k)]
    5. best = max(results, key=lambda r: r.tests_passed)
    6. stats["score"] += best.score
    7. stats["pass"] += best.tests_passed
    8. stats["fail"] += (task.total_tests - best.tests_passed)
    9. stats["turns"] += best.turns
    10. n = len(suite)
    11. return {k2: v / n for k2, v in stats.items()}

    4. Dual-Model Collaboration: Gains, Costs, and Applicability Boundaries

    The most engineering-relevant comparison in the original data is this: the same strong base model paired with different “secondary models” produced an enormous spread in score rate, from the low twenties to the high eighties in percentage points; and two models from the same source consistently outperformed a “same-source plus cross-generation” pairing. The abstracted conclusions are as follows.

    • Collaboration gains come from division of labor, not stacking. The primary model handles planning and complex implementation, while the secondary model takes on retrieval, local rewriting, and bulk small fixes; the payoff depends on whether the task can be cleanly partitioned.
    • The short-board effect is pronounced. Team match scores sit closer to the weaker of the two, and a secondary model’s weakness in long-context consistency gets amplified into overall failure.
    • Same-source pairs have a distribution-consistency advantage. Two models under the same post-training distribution are closer in interface conventions, code style, and error-handling habits, so collaboration friction is lower.
    • Cost-sensitive scenarios need explicit routing. A common practice is to configure the low-cost model as the default executor and escalate to the strong model only for complex subtasks.

    Routing strategy sketch:

    1. def route(task):
    2. if task.estimated_difficulty >= 0.7 or task.cross_module:
    3. return primary_model # planning, cross-module refactoring
    4. return secondary_model # local patches, formatting, test completion

    5. Causes and Remedies for Front-End Capability Regression

    “Stronger at algorithms, weaker at UI” is not mysticism; it reduces to four causes: missing reward (no automatic criterion for visuals and accessibility), training distribution shift (too high a share of verifiable tasks), context budget consumed by reasoning (long thinking squeezes out styling detail output), and evaluation blind spots (benchmarks lack pixel-level and interaction-consistency checks).

    The remedies map to four actions: add automatable UI checks to the reward (structural validity, style encapsulation, component reuse rate, accessibility static rules); retain a certain proportion of high-quality UI samples on the data side for regularization; set differentiated output budgets per task type on the inference side; and introduce a separate UI consistency suite on the evaluation side so a total score cannot mask structural defects.

    6. Implementation Checklist

    • Establish a same-baseline evaluation baseline, fixing decoding parameters and tool permissions so every version can be compared retrospectively.
    • Cover at least three signal types in post-training rewards: test passing, static checks, and resource/complexity constraints.
    • Validate task partitioning before enabling dual-model collaboration, then put routing in place; default to the low-cost executor to control spend.
    • Build separate evaluation and reward items for capabilities that are hard to judge automatically (UI, accessibility, documentation).
    • Observe staged rollouts layered by task type, focusing on the failure-type distribution rather than a single average.
    • Keep a rollback switch and versioned prompts and tool lists so capability regressions can be located quickly.

    Overall, the leap in coding capability comes mainly from post-training driven by verifiable rewards, while the uneven experience stems from incomplete reward coverage and evaluation scope. Making the four things — evaluation, rewards, routing, and staged rollout — solid is what allows gains to be reproduced reliably on the engineering side.