Why Reinforcement Learning–Trained Code Models Score Several Times Higher: Benchmark Analysis

    This article explains why two code models built on the same-generation base model can show several-fold score gaps on coding benchmarks. It breaks the difference into four parts: real capability, evaluation environment, scoring criteria, and capability targets. The analysis covers harness isomorphism between training and evaluation, stricter pass/fail rubric shifts, resource competition between general and specialized models, and a practical reinforcement learning pipeline with reward design. Readers will learn how to build a reproducible evaluation matrix and validate the correlation between rewards and code quality.

    1. The Phenomenon: Same Base Model, Several-Fold Score Gap

    A common pattern appears in coding evaluations: two models share the same generation of base model, but after one of them undergoes code-specific training with pure Reinforcement Learning (RL), it scores more than twice as high as the other on several coding benchmarks. Meanwhile, the model with stronger general capabilities can fall noticeably behind on individual leaderboards.

    Attributing this simply to “the specialized model is stronger” is not enough. A more rigorous breakdown is:

    benchmark score gap = real capability gap + evaluation environment gap + scoring criteria gap + capability target gap

    The first term is about the model; the last three are about evaluation methodology. Ignoring the last three easily leads to wrong conclusions and, in turn, wrong decisions in model selection and training.

    2. Cause One: Systematic Advantage from Isomorphic Training and Evaluation Environments

    An AI Agent’s score is not determined by the model alone, but by the “model + harness” together. The harness is responsible for how repository context is chunked, how relevant files are retrieved, how patches are generated, how tests are executed, how many retries happen after failure, and how context is compressed when it exceeds the limit.

    When a specialized model and the official evaluation harness come from the same system, the model has already “seen” this interaction rhythm during the RL stage: the return format of tool calls, the wording of error messages, the failure modes of patch application, and the trigger conditions of retry strategies. This isomorphism significantly reduces wasted interaction turns and directly raises the pass rate.

    A reproducible way to verify this is to control variables: fix the same model weights, swap only the harness, and observe score drift. Similar magnitudes have appeared multiple times in third-party industry evaluations—the same model scores about 19.9% under harness A, about 22.0% under harness B, and up to 25.5% under the evaluator’s general-purpose harness. The differences among the three numbers reflect changes in environment fit, not changes in model capability.

    Practical recommendation:

    1. Evaluation matrix = {model version} × {harness A/B/C} × {temperature and sampling count} × {retry limit}
    2. Conclusions are comparable only within the matrix; cross-matrix comparisons must state the environment.

    3. Cause Two: The “Stricter Rubric Leap” and the Boundary of Leaderboard Gaming

    Newer versions of evaluation sets often “de-specify” prompts: instead of writing requirements explicitly, they leave substantial blanks and require the model to infer intent on its own. They also introduce veto-style criteria closer to how open-source maintainers review pull requests.

    Typical veto items include:

    • Fixing only the path explicitly pointed out in the prompt, without handling similar issues elsewhere in the repository;
    • Failing to stay compatible with other input types or historical usages already present in the repository;
    • Adding new dependencies, changing public interfaces, or breaking backward compatibility;
    • Missing necessary regression tests, so ordinary unit tests pass but boundary cases fail.

    Under such criteria, models not adapted to the scoring details generally lose points. This is a consequence of methodology rather than capability regression. When the evaluation set and the model come from the same system, the “interpretability space” of the detailed rules is naturally smaller, and the score advantage is amplified.

    A boundary needs to be clear here: understanding the scoring criteria and optimizing prompts and workflows is reasonable engineering practice; fitting specifically to evaluation samples makes the conclusions lose generalization value. The test is simple—whether the change transfers to unseen real repositories.

    4. Cause Three: Resource Competition Between General and Specialized Capabilities

    A general model must simultaneously carry goals such as multimodal understanding, long context, and office and research tasks, so its capacity and training budget are spread thin. A specialized model only needs to converge on the code distribution, and can trade more aggressive sampling strategies and longer execution budgets for pass rate.

    This explains why specialized models lead on benchmarks such as terminal tasks, long-horizon refactoring, and repository-level question answering, while general models are more stable on tasks requiring cross-domain knowledge transfer. Selection should match the scenario rather than follow a single leaderboard ranking.

    An illustrative capability–scenario mapping:

    Scenario Metrics that matter more Preferred choice
    Repository-level bug fixing Patch correctness rate, regression pass rate Code-specialized model
    Cross-domain analysis and documentation generation General reasoning, long-text consistency General model
    High-concurrency online completion First-token latency, cost per unit Small-parameter dedicated model

    5. A Practical Specialized RL Pipeline

    1. Data construction: mine “issue–patch–test” triples from historical merge requests in real repositories, and keep the original error stack as a negative feedback signal.
    2. Environment construction: provide a one-click rebuildable isolated sandbox for each task, with fixed dependencies and repeatable test execution, to avoid environment jitter polluting the reward.
    3. Reward design: use test passing as the main reward, plus penalties for patch size, dependency changes, and repeated failures, to suppress false passes that “change tests but not logic.”
    4. Training execution: use reinforcement learning with verifiable rewards; first validate the correlation between rewards and real quality on a small sample from a single repository, then scale up.
    5. Evaluation governance: fix the evaluation matrix, report means and confidence intervals, and provide a harness sensitivity analysis.

    Illustrative reward function:

    1. def reward(task, patch):
    2. if not applies_cleanly(patch):
    3. return -0.5
    4. tests = run_tests(task.sandbox, patch) # Execute in an isolated environment
    5. base = 1.0 if tests.all_passed else 0.0
    6. penalty = 0.1 * patch.changed_files + 0.2 * patch.new_dependencies
    7. return base - penalty

    6. Enterprise Implementation Recommendations

    When building similar capabilities on Baidu AI Cloud, you can use a container platform to host an isolated sandbox pool, object storage to save task snapshots and patch artifacts, a message queue to smooth peak scheduling of large-scale evaluation tasks, and logging and monitoring with alerting to track pass rates and failure clustering, forming a closed loop of “training–evaluation–regression.” The key is to treat the evaluation environment itself as an engineering asset that needs version management, not a one-off script.

    7. Conclusion

    Faced with conclusions like “the specialized model doubles its benchmark score,” the correct reading is to first ask three questions: is the evaluation harness the same, has the scoring criteria undergone a leap, and are the capability targets the same. After stripping away these three layers of interference, the remaining difference is the real increment in model capability. For teams, building a reproducible evaluation matrix and validating the reward–quality correlation is more valuable in the long run than chasing a single leaderboard number.