Why Code Benchmark Scores Can Differ by 2x: Reinforcement Learning Post-Training for Coding Models

    This article explains why two code models with similar base capabilities can show a twofold gap on the same coding benchmark. It breaks model capability into three layers—base knowledge, post-training objectives, and the runtime harness—and shows how framework alignment, implicit evaluation veto rules, and the tradeoff between general and coding-specific abilities drive the difference. It also outlines a high-signal code reinforcement learning loop, reproducible evaluation practices, and cost-based routing decisions. The intended takeaway is to report harness and evaluation details, reward change completeness and regression safety, and treat capability mix as an explicit constraint.

    1. The Starting Observation: Same Base Model, Double the Coding Score

    In community discussions about code models, a familiar pattern appears: two models with comparable capabilities can score several times apart on a given coding benchmark. On the surface this looks like a difference in model strength. In practice, it is usually the combined result of training objectives, the execution framework, and the evaluation criteria. To understand the gap, it helps to split “model capability” into three layers: base knowledge, post-training objectives, and the runtime framework (the harness). A benchmark score is only the external result of these three layers interacting.

    2. Layer One: Alignment Between Training and Evaluation Frameworks

    A code model’s capability does not exist in isolation; it is shaped inside a specific execution framework. The tool-calling format, command-execution sandbox, retry policy, and context-trimming strategy used during reinforcement learning all become part of the model’s policy. When training and evaluation use the same framework, the model’s action distribution naturally matches the framework’s constraints. Switch frameworks, and the model must re-adapt to different tool signatures and feedback formats, so a score drop is expected.

    The practical approach is to isolate framework differences as a variable:

    1. # Pseudocode: evaluating the same model under different execution harnesses
    2. def evaluate(model, benchmark, harness):
    3. env = harness.build_env(benchmark.task)
    4. traj = []
    5. for step in range(env.max_steps):
    6. action = model.act(env.observe(), allowed_tools=env.tool_schema)
    7. obs = env.step(action)
    8. traj.append((action, obs))
    9. if env.done():
    10. break
    11. return env.score(traj), env.meta() # meta records harness version and prompt template

    The key point: whenever you report a score, you must also report the framework version, prompt template, and tool set. Without them, cross-framework comparisons are meaningless.

    3. Layer Two: The Implicit Veto in Evaluation Criteria

    The scoring logic of newer code benchmarks is shifting from “do the unit tests pass” to “does the change meet the standard an open-source maintainer would apply when reviewing a PR.” Typical traits include: prompts that deliberately leave requirements open rather than fixing every boundary; implicit expectations to fix all instances of the same class of problem; requirements to stay compatible with other input types already present in the repository; and veto conditions on change scope, regression risk, and style consistency. As a result, a patch can pass every unit test and still score zero.

    This kind of evaluation is highly sensitive to whether targeted training has been done. For developers, the more robust strategy is to improve the model’s repository-level reasoning and change completeness rather than chase a single leaderboard:

    • Change completeness: locate every occurrence of the same pattern first, then fix them consistently;
    • Compatibility regression: add existing input types and boundary conditions to a self-check list;
    • Minimal reviewability: keep the change contained, with a clear change description and test evidence.

    4. Layer Three: The Seesaw Between General and Specialized Capability

    Post-training on a shared base involves clear tradeoffs between capabilities. A code-specialized model only needs to optimize for writing code, while a general model must also cover multimodal understanding, long context, and office and research scenarios. When post-training pushes the distribution too far toward code, general capability commonly drops by 20%–50% in relative terms. Conversely, if you keep strengthening agentic capability (more complex planning and tool orchestration), coding metrics can also fall back significantly.

    Capability tradeoffs should therefore be treated as an explicit design variable, not a byproduct of training:

    1. # Pseudocode: capability mix and constraints for multi-objective post-training
    2. objectives:
    3. coding: {weight: 0.55, metric: repo_level_pass_rate}
    4. agentic: {weight: 0.25, metric: multi_step_task_success}
    5. general: {weight: 0.20, metric: long_context_and_knowledge}
    6. constraints:
    7. general_regression_max: 0.10 # upper limit on general capability regression
    8. coding_min_gain: 0.15 # minimum required coding gain

    5. Building a High-Signal Code Reinforcement Learning Loop

    What really sets the ceiling is the quality of training data and feedback signals, not leaderboard tricks. A practical loop has four stages:

    1. Task collection: build “issue–patch–test” triples from the commit history of real repositories, preserving original context and dependencies;
    2. Verifiable rewards: use automatically checkable signals such as test pass rate, static checks, and regression results as rewards, avoiding the noise of subjective scoring;
    3. Difficulty stratification: sample by change span, cross-file dependencies, and historical failure rate so that easy samples do not dominate the gradient;
    4. Anti-leakage governance: isolate training and evaluation repositories and deduplicate similar tasks to prevent inflated scores from “having seen the answer.”

    Illustrative reward design:

    1. def reward(patch, tests):
    2. r = 0.0
    3. r += 0.6 * tests.pass_rate() # target tests pass
    4. r += 0.2 * tests.regression_pass_rate() # no regressions
    5. r += 0.1 * tests.static_check_clean() # static checks clean
    6. r -= 0.1 * tests.scope_explosion() # penalty for uncontrolled change scope
    7. return max(0.0, r)

    6. Evaluation Design: Making Scores Explainable and Reproducible

    To avoid treating a benchmark score as the conclusion, evaluation should record at least: framework and version, prompt template, tool allowlist, retry count, timeout and resource limits, and scoring script version. It should also include three kinds of controls: cross-framework controls (the same model in a different execution environment), cross-prompt controls (open-ended versus fully specified prompts), and cross-capability controls (coding-specialized versus general configurations). Only with all controls in place can you tell whether a gap comes from the model, the framework, or the criteria.

    7. The Cost Perspective: The Value of Specialized Capability

    The value of a code-specialized model often shows up in effective output per unit of cost. Engineering teams can decide based on “success rate per ten thousand tasks / compute cost per unit” rather than absolute scores alone. For batch, clearly patterned repository-level fixes, a specialized configuration is usually more cost-effective; for composite tasks that require multimodal understanding, long-document summarization, and multi-step planning, a general configuration is a better fit. A common practice is routing: send simple tasks down a lightweight specialized path and escalate complex tasks to a stronger general model, balancing cost against the performance ceiling.

    8. Conclusion

    A twofold gap in coding benchmark scores is usually not a single “stronger model” but the combined effect of training-framework alignment, implicit veto rules in evaluation criteria, and the tradeoff between general and specialized capability. The takeaway for developers: write the framework and evaluation criteria into your reports, fold change completeness and regression safety into training rewards, treat the capability mix as an explicit constraint, and explain every score change with reproducible control experiments. If you need the elastic compute, object storage, logging, and monitoring and alerting capabilities required for training and evaluation, you can design the architecture around relevant general-purpose cloud products from Baidu AI Cloud.