How Reinforcement Learning Doubles Coding Model Benchmark Scores

    This article explains why coding agents can score far higher after post-training without any base model change. It breaks down the real sources of improvement—cost-penalized reward functions, length-bucketed reward baselines, and rollout length stabilization—and separates them from benchmark inflation caused by harness coupling and stricter grading criteria. It also offers a reusable practice checklist and a three-way validation method for trustworthy evaluation.

    1. The Phenomenon: Same Base Model, Higher Scores After Post-Training

    In the coding agent space, a pattern keeps recurring: teams keep the same underlying base model, apply reinforcement learning only during post-training, and the new version scores far above the previous official release on multiple coding benchmarks—on some leaderboards by roughly 2x. It is tempting to read this as “the base model was massively surpassed,” but from an engineering perspective the more reasonable explanation is that base capability is only the ceiling. What actually determines the score is how well post-training releases that capability in long-horizon tasks.

    The conclusion up front: the post-training gains are real, but the benchmark gap usually mixes three components—capability improvement, evaluation harness adaptation, and grading criteria alignment. Separating the three is what yields reusable engineering conclusions.

    2. Where the Capability Gains Actually Come From: Reward Design and Baselines

    2.1 Reward Function with Cost Penalties

    The typical reward for long-horizon code tasks is a sparse binary signal: did the tests pass. Used directly, it teaches the policy two bad habits: piling on tool calls and file edits without restraint, and trading extremely long reasoning for occasional success. Adding a cost penalty turns the reward from a single outcome signal into a composite “benefit minus cost” signal:

    1. # Example: reward with cost penalty
    2. def reward(task, rollout):
    3. passed = run_tests(task, rollout.patch) # 0/1 sparse outcome signal
    4. cost = token_cost(rollout) + tool_call_cost(rollout)
    5. length_penalty = alpha * max(0, rollout.steps - budget)
    6. return passed * w_pass - beta * cost - length_penalty

    What matters is not the formula but the weight magnitudes. Too strong a penalty pushes the model toward early exit, which loses points on repository-level tasks that need multiple rounds of localization; too weak, and it degenerates back to the original sparse reward. In practice, weights usually need to be set per difficulty bucket, with pass rate and average steps monitored at the same time.

    2.2 Length-Weighted Reward Baseline

    Policy gradient needs a baseline to reduce variance. When successful samples within the same batch vary enormously in length, a single global baseline gives an overly high advantage to the “happens to be short” successful trajectories, and noise dominates the training signal. Computing the baseline per length bucket lets advantage estimation compare within the same length range, which significantly mitigates this bias:

    1. # Example: length-bucketed baseline
    2. buckets = group_by(rollouts, key=lambda r: len_bucket(r.steps))
    3. baseline = {k: mean([r.reward for r in v]) for k, v in buckets.items()}
    4. advantage = [r.reward - baseline[len_bucket(r.steps)] for r in rollouts]

    2.3 Controlling Rollout Length Oscillation

    The most common instability in long-horizon training is average trajectory length swinging back and forth, with pass rate fluctuating in sync. Common causes include drift in sampling temperature and in-batch difficulty distribution, repeated reuse of failed trajectories, and inconsistent advantage normalization across batches. Practical remedies are fixing the difficulty sampling distribution, deduplicating failed trajectories and capping their quota, using a moving-average baseline across batches, and applying a soft constraint on length rather than a hard truncation. None of these change model capacity, yet they often decide whether training converges at all.

    3. The “Environment Component” in the Gap: Harness and Prompt Standards

    3.1 Harness Coupling

    If post-training is done inside one particular agent execution framework, the policy implicitly adapts to that framework’s tool signatures, context organization, and failure recovery logic. Switch execution frameworks, and the same model capability can drop by several percentage points. A common observation in third-party independent evaluations is that the same model scores progressively higher across different harnesses, and general-purpose harnesses often score above the custom harness it was trained on—which shows a meaningful share of the score comes from harness adaptation rather than the model itself.

    3.2 Uniform Drops from Stricter Grading

    When the evaluation version is upgraded, prompts are deliberately left underspecified, and “single-veto” items are introduced following open-source maintainer review standards, most models see a broad score decline. Typical veto cases: fixing the same class of defect only on the specified path without covering other paths, failing to stay compatible with other input types already present in the repository, or passing unit tests while violating implicit engineering conventions. Such criteria are extremely sensitive to whether alignment was done against that specific standard, so when the publisher and the evaluator share the same source, the score is naturally advantaged.

    3.3 How to Reach a Credible Judgment

    Three-way validation is recommended: first, rerun under at least two execution frameworks and observe the score spread; second, hold prompts and review rules fixed and run an ablation to separate capability gains from rule adaptation; third, report pass rate, average steps, average cost, and timeout rate together—looking at pass rate alone is easily contaminated by length strategy.

    4. A Reusable Practice Checklist

    • Reward design: outcome signal + cost penalty + soft length constraint, with weights tuned per difficulty bucket.
    • Stability: fixed difficulty distribution, failed-trajectory quota, moving baseline, consistent normalization across batches.
    • Evaluation discipline: cross-validation across multiple harnesses, ablation on prompts and review rules, multi-dimensional metrics reported together.
    • Engineering support: use a container platform for isolated execution environments, object storage to archive trajectories and patches, a message queue to smooth out sampling task scheduling, and logging plus monitoring with alerts to track length and pass-rate curves.
    • Pre-release validation: run regression on real repository samples, and avoid optimizing against a single leaderboard.

    5. Conclusion

    “Post-training doubles coding benchmark scores” is not mysterious: the capability gains come from careful reward and baseline design plus disciplined training-stability control, while another part of the gap comes from execution harness coupling and grading criteria alignment. For engineering teams, what is worth investing in is a transferable training recipe and a credible evaluation method. When deploying on platforms such as Baidu AI Cloud, treating isolated execution, trajectory archiving, scheduling, and observability as standard supporting infrastructure is what makes a single training conclusion reusable.