Reinforcement Learning Lifts Code Agent Performance Without Inflating the Metric

    A neutral comparison of post-training versions shows why code-agent gains must be read against fixed bases, budgets, and evaluation splits. This article restates the reported team and solo scores, separates post-training gains from partner effects, and outlines a reproducible reinforcement-learning pipeline driven by executable verification.

    In code-agent evaluation, team contests and solo contests measure different things. Team contests stress role division, context handoff, and system orchestration. Solo contests stress whether a single agent can close the loop of localization, editing, and verification within a fixed budget. To explain why a later post-training version of a code agent can jump sharply on programming benchmarks, a single total score is not enough. Evaluation definitions, control variables, the post-training pipeline, and engineering safeguards need to be separated. This article restates a set of comparison figures from a neutral point of view and describes a reproducible framework for reinforcement-learning post-training and evaluation.

    1. Calibrate the claim: a clear gain is not automatically a “doubling”

    In the neutralized comparison, the same base model with the older post-trained code agent scored 38.9% in the team contest. With the newer post-trained code agent, the team score was 58.2%. The newer version’s solo score was 66.0%. On the team total, the relative score-rate gain was about 49.6%. Wins rose from 284 to 439, an increase of about 54.6%. That is a substantial jump. If a title or summary claims “twice,” the metric still needs to be disclosed: total score, wins, a difficulty subset, a specific opponent mix, or a repair-success rate. Different denominators produce very different relative multiples.

    The same data also show that a stronger general base paired with the older post-training setup reached 84.5% in the team contest, above the 58.2% of the same-base plus newer post-training combination. These results are not contradictory. In a combined evaluation, base capability, partner roles, and orchestration remain strong variables. Cross-base comparisons cannot be attributed directly to the post-training version. Only a same-source comparison with a fixed base, fixed partners, and a fixed budget can estimate the post-training increment cleanly.

    A professional conclusion should therefore be stated as follows: under the same base and similar orchestration, the newer post-training significantly improved code-repair and verification pass rates. If some task subsets approach or exceed a twofold gain, the subset, sample count, confidence interval, and cost budget should be reported together.

    2. Comparison design: separate version contribution from partner contribution

    First, hold variables fixed. A controlled comparison should keep the base model, tool set, maximum turns, context window, sandbox resources, task set, and sampling temperature unchanged, and vary only the post-training version. Otherwise, a higher score may come from a stronger base, a longer context, or a larger retry budget.

    Second, use both a same-source control and an external reference. The same-source control estimates the post-training increment—for example, one base paired with the old and new post-trained agents. The external reference shows the system ceiling—for example, a stronger general base paired with the older post-training setup. The first answers whether post-training helped. The second answers how much room orchestration still has.

    Third, report solo and team contests separately. Team results should record role division, message-passing counts, review mechanisms, and failure-escalation policy. Solo results should record the per-run budget, tool-call counts, average repair turns, and timeout rate. Mixing the two makes orchestration gains easy to misread as model capability.

    Fourth, prevent leakage and use multiple random seeds. Training and evaluation tasks should be split by repository, time, or project so that variants of the same problem do not appear in both sets. Evaluation should run at least several seeds and report the mean, variance, and worst case. Code-agent outputs are stochastic. A single leaderboard score is not enough for a strong claim.

    3. The reinforcement-learning pipeline: from “emit a patch” to “pass verification”

    The point of the newer post-training is not to make the model “write code more like a human.” It is to make the policy more reliably produce patches that pass hidden tests without introducing regressions. The pipeline can be abstracted as follows.

    1. Build the task pool. Each task includes a problem statement, an initial code snapshot, an executable environment, visible tests, hidden tests, constraints, and a resource budget. Difficulty is layered as single-file repair, multi-file localization, cross-module refactoring, and regression repair, which forms the basis for curriculum learning.

    2. Cold-start with supervised fine-tuning. A small set of high-quality successful trajectories teaches the basic format: read the relevant files, locate the issue, emit a minimal patch, then run verification. The cold start does not need to cover every hard problem. It needs a stable initial policy for later reinforcement learning.

    3. Sample trajectories online. In an isolated sandbox, the agent calls general tools such as read, search, edit, and test across multiple turns and produces a full trajectory. Each trajectory records observations, actions, the patch, test logs, and the final state. The sampling budget must be capped so that unlimited retries do not hide policy weaknesses.

    4. Design an executable reward. The main term is the hidden-test pass rate, with regression pass, patch minimality, execution efficiency, and penalties for violations. A schematic formula is:

    1. R = w1 * hidden-test pass rate
    2. + w2 * regression-test pass rate
    3. + w3 * patch-minimality score
    4. + w4 * execution-efficiency score
    5. - w5 * privilege or leakage penalty
    6. - w6 * over-budget penalty

    Hidden tests reduce the risk of overfitting to visible tests. Regression tests constrain side effects. Patch minimality encourages precise fixes. The privilege penalty limits reading unrelated files or bypassing verification.

    1. Apply rejection sampling and advance the curriculum. Keep only trajectories that pass verification, or that partially pass with a clear failure cause, in the training buffer. For difficulty layers that fail repeatedly, first shrink the task or add process rewards, then raise difficulty. Policy updates should include a constraint so the new policy does not drift too far from the cold-start distribution.

    2. Illustrative pseudocode:

    1. def rl_loop(tasks, policy, verifier, budget):
    2. for stage in curriculum(tasks):
    3. for task in stage:
    4. traj = rollout(
    5. policy, task,
    6. tools=["read", "search", "edit", "test"],
    7. max_turns=8,
    8. budget=budget
    9. )
    10. result = verifier(traj, task.hidden_tests)
    11. reward = (
    12. 1.0 * result.pass_rate
    13. + 0.3 * result.regression_pass
    14. + 0.1 * result.efficiency
    15. - 0.5 * result.violation
    16. - 0.2 * result.over_budget
    17. )
    18. buffer.add(traj, reward)
    19. policy = update(policy, buffer, kl_limit=0.05)
    20. return policy

    The pseudocode captures the main ideas: the reward comes from executable verification rather than language preference alone; training advances by curriculum; and the update is constrained to avoid policy collapse.

    4. Engineering that makes rewards trustworthy and failures attributable

    First, make the verification environment trustworthy. The sandbox should isolate network and file permissions and set timeouts plus memory and CPU limits. Test runs should be repeatable, without random failures or fluctuating external dependencies. Unstable tests should be isolated or flagged first; otherwise noise contaminates the reward.

    Second, classify failure causes. Separate localization errors, patch syntax errors, visible-test failures, hidden-test failures, regressions, over-budget runs, and privilege violations. Each class maps to different penalties and curriculum adjustments: localization errors call for more retrieval training, regressions call for stronger impact analysis, and over-budget runs call for a better tool-call policy.

    Third, manage context. Repositories often exceed the context window, so file summaries, symbol indexes, dependency pruning, and patch localization are required. Gains in the newer version usually come from finding the right files, reading logs, and shrinking the edit surface—not only from generating longer code.

    Fourth, resist reward hacking. Hidden tests, mutation testing, code-review rules, and limits on repeated submissions help stop policies that hard-code answers, delete tests, or bypass assertions. Tool-call audit logs should be kept so runs remain traceable.

    Fifth, control cost. Reinforcement-learning sampling is expensive. Caching, parallel sandboxes, early stopping, and difficulty-adaptive sampling help. Evaluation should use a fixed budget so extra retries do not inflate the score.

    5. Orchestration: same-source gains are clear, but the ceiling still depends on the partner

    A team contest is multi-role collaboration. The newer post-trained agent can take the execution role of localize, edit, and verify. A general base partner can plan, review, or handle failure escalation. A workable arrangement is often: a retrieval role narrows the file set, a repair role emits a minimal patch, a review role checks regression risk, and an execution role runs the hidden tests. If the first round fails, the system uses the failure class to retry, switch strategy, or escalate to a stronger partner.

    That also explains why the same base plus newer post-training rose from 38.9% to 58.2% in the team contest, while a stronger general base plus the older post-training still reached 84.5%. The newer post-training improved execution stability under the same base, but partner capability, context handoff, and review still set the system ceiling. Engineering should therefore improve two lines at once: the post-training policy, so a single agent is more reliable, and the orchestration protocol, so roles are clearer and failure escalation is timely.

    6. Deployment guidance and risk checklist

    In practice, keep four tables: task versions, training-data versions, evaluation-script versions, and cost budgets. Each experiment should fix the environment and random seeds and record score rate, wins/draws/losses, hidden-test pass rate, regression pass rate, average turns, tool-call counts, and cost per task. External reporting should not cite only the best single run. It should include the mean, the variance, and the worst subset.

    The main risks are evaluation contamination, overfitting to hidden tests, reward hacking, sandbox escape, and uncontrolled cost. General capabilities such as container sandboxes, object storage, logging, and monitoring and alerting—available, for example, from Baidu AI Cloud—can support isolated execution, trajectory retention, and metric observation. The concrete design should still be reproducible, auditable, and rollback-friendly.

    Overall, the jump from the older code agent to the newer one does not come from a single trick. It comes from a system: same-source experimental design, reinforcement learning driven by executable verification, curriculum task governance, better context and tool use, and multi-agent orchestration. When the metric is consistent, variables are controlled, and failures can be attributed, version-to-version gains can be reproduced rather than appearing as a one-off leaderboard fluctuation.