Why Reinforcement Learning Post-Training Struggles to Deliver Stable Score Gains

    This article explains why a reinforcement learning post-trained model can outperform a stronger base model on public coding benchmarks, and why such gains are often hard to reproduce. It breaks the issue down into four variables: reward function design, rollout length oscillation, evaluation harness differences, and benchmark construction. It also outlines practical steps for turning post-training gains into reproducible engineering assets, including a unified evaluation setup, layered rewards, stability monitoring, strict data isolation, canary rollout, and general-purpose infrastructure. The key takeaway is to rely on a neutral in-house evaluation and canary system instead of leaderboard narratives.

    1. The Starting Point: Three Credibility Questions Behind a Higher Score

    In technical communities, you often see a familiar discussion: a coding model produced by reinforcement learning post-training on a previous-generation base model scores higher on public coding benchmarks than a newer, more capable base model from the same family. The first reaction is usually to call the result “unscientific.” But if you treat it as an engineering problem rather than a marketing claim, it actually exposes three things at once: the real gains from post-training, the sensitivity of the evaluation setup, and the gap between leaderboards and production environments.

    One common misunderstanding is worth clearing up first: post-training does not “replace the base model.” It reshapes the model’s sampling preferences and problem-solving strategies through reward signals on top of a fixed base. So a score that exceeds a stronger base model is mathematically possible, as long as the evaluation task distribution overlaps heavily with the post-training task distribution and the interaction constraints in the evaluation environment match those used during training. The real questions to ask are three: does the gain come from capability or from distribution alignment? Is the evaluation environment neutral? Can the leaderboard score transfer to a real development workflow?

    2. Variable One: Reward Design Determines What the Model Learns

    Rewards for long-horizon software engineering tasks are naturally sparse: a change either passes the tests or it does not. Using “did the tests pass” as the only reward pushes the model toward extreme strategies, such as making the given test cases turn green while ignoring similar defects elsewhere in the repository, compatibility regressions, and code maintainability.

    A more mature approach adds two correction terms to the reward. The first is a cost penalty, which converts token consumption, tool call counts, and execution time into negative reward to discourage brute-force, exhaustive solutions. The second is a length-weighted baseline, which makes samples of different lengths comparable during advantage estimation and prevents long trajectories from dominating the gradient because of excessive variance. A schematic reward structure can be written as:

    1. R_total = R_task
    2. - λ_cost * (token_used / token_budget)
    3. - λ_step * step_count
    4. + λ_style * style_check

    Here R_task is the signal for whether the task was accomplished, and the λ_* terms are weights. The real engineering difficulty is not the formula but weight calibration: penalties that are too heavy make the model conservative and afraid of necessary multi-file refactoring, while penalties that are too light degrade it into an exam-oriented, results-only strategy. A workable approach is to run a small-scale grid search first, then validate on a fixed held-out set, avoiding repeated tuning on the training set that causes hidden overfitting.

    3. Variable Two: Rollout Length Oscillation, the Top Killer of Long-Horizon Training

    A frequent failure when running reinforcement learning on long-horizon tasks is violent oscillation in rollout length: one batch of samples runs to tens of thousands of tokens, and the next is only a few hundred. The result is a spike in advantage estimation variance and a gradient direction that swings back and forth, showing up in the training curve as jagged score fluctuations or even collapse.

    The usual remedy has three layers. The first is sampling-side constraints: truncate or segment overly long trajectories, and increase the resampling ratio for overly short ones. The second is advantage-estimation-side correction: use length weighting or quantile normalization to reduce the leverage of extreme-length samples. The third is training-side stabilization, for example lowering the learning rate, increasing task diversity within a batch, and constraining the magnitude of policy updates. A simplified pseudocode sketch of the scheduling logic:

    1. for batch in stream:
    2. lens = [len(r.tokens) for r in batch.rollouts]
    3. if std(lens) / mean(lens) > 0.6:
    4. batch = rebalance(batch, target_len_ratio=0.5)
    5. adv = length_weighted_advantage(batch)
    6. update(policy, adv, lr=base_lr * decay(step))

    It is worth stressing that these are general engineering techniques, not exclusive features of any single approach. Teams differ widely in their threshold and weight choices, and these must be calibrated together with your own task distribution.

    4. Variable Three: The Evaluation Environment Is a Variable, and Harness Differences Can Eat Several Points

    The most important warning in the original phenomenon is that the same model can differ by several percentage points across different interaction harnesses. The actual score on a coding benchmark depends not only on the model but also on harness factors such as the prompt template, tool definitions, context truncation strategy, retry mechanism on failure, and file read/write permissions. If a model is deeply coupled with a particular harness during training, it naturally has an advantage when evaluated under that harness and falls back under a general-purpose one.

    So the lowest-cost way to judge score credibility is a “same-environment horizontal comparison”: put the candidate models into the same neutral evaluation framework, fix the prompts, tools, and retry policy, and only swap the model under test. If a model’s advantage shrinks sharply after the harness changes, its gain comes more from environment alignment than from capability improvement. In engineering terms, you can turn the evaluation into a matrix:

    Model Harness A Harness B General Harness
    Base Baseline Baseline Baseline
    Post-trained model To test To test To test

    5. Variable Four: How the Benchmark Is Built Determines “Everyone Loses Points”

    Another easily overlooked factor is the construction of the benchmark itself. When a leaderboard comes from the same organization as a model, and the new version deliberately leaves requirements implicit while introducing many “single-veto” review criteria (for example, requiring only that a defect on path A be fixed, but scoring zero because a similar issue on path B was not handled along the way or the repository’s existing input types were not supported), then models that have not adapted to that standard will broadly lose points, which is an inevitable outcome. What such a leaderboard measures is closer to “familiarity with that team’s open-source maintenance conventions” than pure coding ability.

    The advice for users is not to treat a single leaderboard as the basis for procurement or model selection. Cross at least three signals: neutral third-party evaluations, a held-out set built from your own business repositories, and adoption and rework rates in real development workflows. The in-house held-out set is especially important because it reflects the real constraints of your own code style, dependency structure, and test coverage.

    6. Practical Recommendations: Turning Post-Training Gains into Reproducible Engineering Assets

    1. Build the evaluation foundation first: unify the harness, prompts, and tool permissions, and put the evaluation scripts under version control so every experiment is comparable.
    2. Design rewards in layers: separate task completion, cost, and style into three layers, with weights in a separate configuration file for traceability.
    3. Monitor training stability: turn rollout length mean and variance, truncation rate, and resampling rate into monitoring and alerting metrics, with automatic pause on anomalies.
    4. Govern data and training separately: strictly isolate the training corpus, held-out set, and evaluation set to prevent inflated metrics.
    5. Run a canary before launch: validate adoption and rollback rates on small-traffic tasks from real repositories before deciding whether to expand the scope.
    6. Generalize the infrastructure: model training and inference can rely on container platforms for elastic scaling, corpora and artifacts can live in object storage, task scheduling can go through message queues, and full-chain metrics can be wired into logging and monitoring services, forming a reproducible loop on top of general cloud capabilities such as Baidu AI Cloud.

    7. Conclusion

    A post-trained model scoring higher than a stronger base model does not necessarily mean data fabrication, nor does it necessarily mean the new base model has regressed. A more reasonable explanation is usually a combination of three factors: real policy optimization from reward design and length stabilization, high alignment between the evaluation harness and the training environment, and a benchmark construction standard that favors specific maintenance conventions. For technical decision-makers, the only reliable approach is to build your own neutral evaluation and canary system, replacing leaderboard narratives with reproducible experimental data.