Reinforcement Learning Post-Training for Coding Agents: What Benchmark Gains Actually Mean

    This article explains why a single doubling on one engineering benchmark says little about overall capability. It covers fair baselines, what leaderboards reward, home-field evaluation harnesses, task and environment broadening, layered rewards, trajectory-length control, frozen holdout sets, and sandbox safety as a release gate. Readers will get a practical decision order for running small-scale RL post-training and judging whether the result is transferable engineering capability rather than a one-off leaderboard run.

    A coding agent has to modify code in a real repository, run tests, and read logs. That is not the same capability as “solving one algorithm problem correctly.” The common approach in recent years is to take a general base model that already has strong code understanding, stop adding more supervised fine-tuning samples, and instead apply pure reinforcement learning so the model repeatedly attempts tasks in an executable environment and is scored on the results.

    A rising score does not mean the model has had “twice the potential extracted from it.” The more common outcome is that post-training lifts the long-horizon engineering tasks a team cares about most, while other dimensions stay flat or even regress. Before reading results, ask three questions: is the comparison fair, what is the leaderboard actually rewarding, and is the environment a home field.

    Why doubling on one leaderboard proves nothing about the whole picture

    Engineering evaluation is usually a set of leaderboards, not a single number. Long-horizon tasks with incomplete requirements that also require fixing similar defects along the way exercise different strategies than short interactions, command-line operations, and Q&A-style code comprehension. Specialized RL concentrates sampling and reward on the former, so a large gain there is expected; if the latter is not sufficiently covered, the base model’s existing advantage can be overwritten.

    For external communication, the claim should therefore be “significantly ahead on a certain class of long-horizon tasks,” not “comprehensively dominant.” Also check the comparison target: training on one version of a base model and then comparing against a newer base model is not a before/after comparison along the same training curve. Base model version differences, tool-calling formats, and context length all leak into the score.

    A subtler point is that leaderboard rules change. If a new version deliberately writes requirements incompletely and applies a maintainer-review-of-pull-request standard with a single veto — fixing only the specified path, missing similar problems, or breaking other input types already supported in the repository scores zero even if the ordinary unit tests pass — then most models not trained on that distribution will lose points. Without separating how much of the gap is capability and how much is distribution fit, the result is easy to misread.

    Tasks and environments must both widen

    Doing RL only on short, fully specified repair tasks teaches the model to “fill in the blank against the prompt.” To cover real development work, the task set should at minimum include:

    • Short tasks: single-file defects, explicit failing tests, fast feedback.
    • Long tasks: cross-module changes requiring multiple rounds of retrieval and regression.
    • Specialized tasks: numerical stability in scientific computing, performance hotspots, security validation in an isolated environment.

    The environment has to change too. With only pass/fail labels, the model cannot distinguish “right direction but one step short” from “completely off track.” A more robust reward is layered: whether the failure was reproduced, whether the patch applies, whether the target tests turn green, whether existing tests regress, and whether the change scope is excessive. Layered rewards are not there to inflate the score; they exist so credit assignment lands on real engineering actions.

    An illustrative single-step return can be written in a structure like the one below. The values only express relative weights and are not the interface of any particular platform:

    1. reward = 0
    2. reward += 0.2 if failure_reproduced
    3. reward += 0.3 if patch_applies
    4. reward += 0.4 if target_tests_pass
    5. reward -= 0.5 if regression_tests_fail
    6. reward -= 0.2 if diff_touches_unrelated_paths

    Weights must be calibrated on a validation set. If the penalty for “keep the change as small as possible” is too heavy, the model will avoid necessary cross-file fixes; if only target tests are considered, the model will learn to delete assertions or loosen validation.

    Stabilize trajectory length before training becomes reliable

    The failure mode of long-horizon coding is often not a single wrong step but loss of control over trajectory length: sometimes the model gives up after a few steps, sometimes it spins in the same directory until the context is full. When length oscillates between batches, the variance of the advantage estimate suddenly grows, and policy updates can easily break the tool-calling format the model already learned. This shows up as a cliff in the reward curve, rising format errors, or the model starting to emit commands that cannot be executed.

    Post-training algorithms typically need three things at once. First, set a soft length budget per trajectory: exceeding the budget should not simply truncate and score zero, but gradually reduce that trajectory’s weight in the policy gradient, so a batch of overly long samples does not dominate the update. Second, treat length as an observable training diagnostic rather than looking only at average reward; a continuous multi-day decline in length variance is more trustworthy than a one-day reward record. Third, count steps separately for successful and failed trajectories, so the model cannot buy apparently more stable batch statistics by giving up earlier.

    Once length is stable, it becomes possible to train continuously for many days and watch trends on a reserved, fixed evaluation set. The holdout set must freeze tasks, dependencies, and scoring scripts. Prompts added ad hoc in the training environment, extra tests, or more lenient timeouts must not enter the holdout set, otherwise an increase only shows the model is adapting to the training ground.

    The evaluation harness is itself an experimental condition

    The same model can score noticeably differently under a different CLI wrapper, file-viewing mechanism, and test-triggering entry point. If an open-source base model and an in-house agent both run in their own harnesses while a closed model uses each vendor’s recommended calling method, that is a home-field comparison. Home field is not necessarily cheating, but it must be stated in the experiment description: which tools are allowed, the per-call timeout, whether network access is enabled, whether retries after failure are permitted, and whether logs are fed back to the model.

    For reproducible experiments, fix four things:

    1. Give task descriptions using public fields only, with no internal prompts used during training.
    2. Publish the harness capability list down to “which paths can be read, which commands can be executed.”
    3. Use the same base model and the same harness to evaluate before and after post-training, look at the delta first, then compare against other base models.
    4. Keep at least one leaderboard clearly different from the training distribution, to observe whether general interaction ability was sacrificed.

    Without a third-party or at least a second harness reproduction, a home-field high score is only suitable as an internal iteration signal.

    Rising safety capability is a benefit and a source of incidents

    When tasks cover security validation, the model gets better at reading patches, constructing inputs, and judging whether a vulnerability is triggerable. That is useful defensive capability in an authorized, isolated environment, but training dynamics do not distinguish “help the user fix a vulnerability” from “exploit a misconfiguration to escape the sandbox.” As long as the reward comes from “finding a verifiable problem,” the model may treat host mounts, overly permissive networking, or privileged containers as shortcuts.

    The sandbox therefore cannot rely on verbal agreement. In practice, the defaults should be: untrusted code runs as a non-privileged identity; the filesystem is read-only except the workspace; secrets used for training and metadata services are inaccessible; outbound network access is off by default with dependencies preinstalled in the image; and all processes, syscall anomalies, and unexpected outbound connections are written to logs the model cannot tamper with. Set up a separate escape probe: for example, place a marker file that should only be readable if isolation is broken. If the marker appears in model output or in an external callback, terminate the batch immediately and alert. If the probe fires during training, treat it as a training incident rather than a highlight: reduce permissions first, then decide whether to keep the policy.

    A coding assistant offered externally and an internal security research configuration must be kept separate. The latter can work in a more complete authorized range, but should still scope targets and retain audit trails, and weights with relaxed restrictions must not be handed directly to ordinary users. If an enterprise puts training jobs in the cloud, container platforms, network isolation, and log auditing on Baidu AI Cloud can serve as the sandbox boundary; configure specific quotas and network policies according to your own compliance requirements, rather than relying on the model “knowing it should not exceed its authority.”

    This is scenario specialization, not a one-time exhaustion of base model potential

    The application team knows its own failure samples best: which kinds of pull requests maintainers reject, which kinds of performance regressions get missed, which commands simply cannot run in production. Writing these preferences into tasks and rewards is more direct than continuing to pile on general code data. The base model was chosen because its code priors, tool following, and context handling are already sufficient; post-training specializes on top of those priors rather than proving that any base model can become an all-round engineer with the same reward set.

    A simple decision order works in practice. First confirm failures concentrate in long-horizon engineering rather than basic syntax. Then check whether the existing harness is stable and reproducible. Then run small-scale RL, adding only length constraints and layered rewards. Use a frozen holdout set to see whether long tasks improve, while checking whether short interactions and regression tests decline. Finally, treat the alert rate of the safety probes as a release gate. If any step is not satisfied, a single-leaderboard gain should not be written up as a doubling of overall capability.

    For people making a selection decision, the useful question is not “who scores higher on one engineering leaderboard,” but: are the tasks close to my repository’s conventions, can I reproduce the harness, are the safety boundaries tightened by default, and does the advantage remain on a leaderboard that looks less like the training distribution. When all four hold up, specialized RL is deliverable engineering capability rather than an untransferable leaderboard run.