Reinforcement Learning Post-Training for Agentic Coding: A Practical Guide
This article breaks down why doubling a coding benchmark score does not mean a model became twice as capable. It explains how to design controlled experiments for agentic coding evaluation, treat the partner model and sub-agent routing as first-class variables, build verifiable reward functions for reinforcement learning post-training, and assemble a reproducible evaluation pipeline with layered and cost-aware reporting.
1. Why a Doubled Score Does Not Mean a Doubled Capability
In the agentic coding community, you often see claims like “the post-trained version, built on the previous base model with reinforcement learning, scores more than twice as high on coding leaderboards.” A representative comparison from the source material: post-trained version A on the same base reaches a score rate of about 38.9%, while version B, after another round of reinforcement learning, reaches about 58.2% — nearly a 50% relative improvement and close to 20 percentage points in absolute terms. Under the individual competition format, the post-trained version places in the top six with a score rate of about 66.0%.
One methodological premise must be clear first: the score rate is a statistic weighted across wins, draws, and losses, not a linear scale of capability. A doubling can come from three completely different causes:
- Real capability gains: better multi-step planning, error recovery, and more stable tool calls;
- Evaluation setup changes: task set difficulty, timeout settings, concurrency strategy, or scoring weights;
- Composition effects: changes in how the main model works with partner models and sub-agent models.
Therefore, any “doubling” conclusion must first answer one question: do the controlled variables hold?
2. Experiment Design: Treat the Partner and Sub-Agent as Variables, Not Background
The most valuable part of the original evaluation is that it did not run a single configuration; it designed control groups:
- Original combination: a strong main model plus a general-purpose chat model;
- Swapped partner group: a strong main model plus a lightweight, fast model (a common practice is to set the lightweight model as the secondary model, with sub-agents automatically routed to it to cut costs);
- Extra-large group: a strong main model plus another leading model from a different vendor;
- Same-lineage control: the base plus its post-trained version, then compared against the next round of reinforcement learning on the post-trained version.
The point of this design is to decouple “model capability” from “system orchestration.” In practice, it helps to fix the variables in a table:
Variable dimension Fixed items Variable itemsBase version Same checkpoint -Post-training stage SFT / RL phase split Number of RL stepsInference config temperature, max tokens Context windowTool set Read/write files, run tests, Network access allowedretrievalOrchestration Main model + sub-agent Sub-agent routing targetEvaluation set Same tasks and random seed Concurrency, timeout
Conclusions are reproducible only when exactly one variable item changes at a time.
3. What Reinforcement Learning Post-Training Actually Optimizes
Agentic coding differs from single-turn question answering in three ways: sparse rewards, long trajectories, and diverse failure modes. Common verifiable reward sources include:
- Unit test pass rate (the most mainstream and most stable);
- Whether static checks and type checks pass;
- Whether a patch applies cleanly and touches only the necessary files;
- Whether execution times out or falls into loop-like repeated calls.
A simplified reward function can be written as:
def reward(traj, tests):applied = apply_patch(traj.patch) # Patch appliesif not applied:return -0.2passed, total = run_tests(tests)base = passed / max(total, 1)# Penalize meaningless large-scale edits and overly long trajectoriespenalty = 0.05 * traj.edit_file_count + 0.02 * traj.step_countreturn max(-1.0, base - penalty)
Three points matter more in engineering:
- Rewards must be reproducible: containerize the test environment, lock dependencies, and fix random seeds;
- Guard against reward hacking: for example, editing test files directly or hard-coding return values just to pass tests, which requires a hard constraint in the reward that forbids modifying the test directory;
- Control trajectory length: without a length penalty, the model learns that “trying a few more times will eventually hit the right answer,” inflating scores while making real costs unacceptable.
4. Why the Post-Trained Version Improves Most on Algorithm Problems
The intuitive observation from the original testing is that the new version “thinks more.” This has a clear technical explanation on algorithm tasks:
- The base model tends to produce output in one shot, while the post-trained model learns to construct small examples first and then verify edge cases;
- Reinforcement learning strengthens the “self-check and correct” loop, effectively turning the expected correctness of a single generation into the correctness after multiple verification steps;
- A long-context version combined with sub-agents can split “read code — locate — modify — run tests” into several short-context tasks, reducing noise within a single window.
An illustrative behavioral difference:
Base trajectory: read problem -> write implementation directly -> submitPost-trained trajectory: read problem -> construct examples -> write implementation -> run examples-> find edge-case failure -> local fix -> run again -> submit
Those three extra steps are the main source of the score improvement, not “more parameters.”
5. What the Gap Between Team and Individual Formats Shows
Comparing the two leaderboards yields one important conclusion: in the team format, the main model’s partner can significantly amplify or mask the gap. In the source material, the same strong main model paired with different partners drops from a score rate of 84.5% to just over 20% — an enormous spread — while the individual leaderboard better reflects single-model capability.
This suggests the following for engineering deployment:
- Do not treat team-format scores directly as a conclusion about model capability;
- Sub-agent routing strategy must be part of the evaluation matrix, especially the common configuration of “switching sub-agents to a lightweight model to save costs”;
- Track “sub-agent failure rate” and “main model correction success rate” separately, otherwise the bottleneck cannot be located.
Suggested log fields:
{"task_id": "t-001","main_model": "m-large","sub_model": "m-small","steps": 14,"sub_calls": 6,"sub_fail": 1,"tests_pass": "18/20","wall_time_ms": 92000,"token_in": 41230,"token_out": 8600}
6. A Reproducible Evaluation Pipeline
Make evaluation a pipeline rather than a one-off script:
- Version the task set: give each task a unique ID, a dependency list, and the expected test command;
- Isolate environments: one container per task, with a unified network policy;
- Double-run verification: run the same configuration twice; if the score rate fluctuates beyond a threshold, mark the environment as unstable;
- Layered reporting: break down scores by task type (algorithms, bug fixes, refactoring, script writing);
- Cost columns: report tokens and elapsed time alongside scores so that “high score, high cost” is not overlooked.
7. Common Pitfalls
- Comparing across different context windows makes conclusions invalid;
- Evaluation-set同源 problems leaking into post-training data; (evaluation-set questions of the same origin mixed into post-training data, causing leakage);
- Reporting only the total score without variance;
- Ignoring patch applicability and treating generation similarity as capability;
- Sub-agents routed to a lightweight model by default without declaring it, causing reproduction failures.
8. Conclusion
In engineering, a “doubled score” is usually not a single breakthrough but the combined result of “verifiable rewards + multi-round self-checking + controlled orchestration variables.” For developers, the truly transferable takeaway is this: build controlled comparison experiments and a reproducible pipeline first, then discuss model selection; treat the partner model, sub-agent routing, and context window as first-class variables; and replace a single total score with layered, cost-aware reporting. Do these things, and you can turn “it feels stronger” into an engineering conclusion that is verifiable, reproducible, and optimizable in your own agentic coding system.
