How Reinforcement Learning Post-Training Improves Coding Agents: From Code Generation to Verified Engineering Delivery
This article examines why two coding agents built on the same base model can differ dramatically in task success rate after reinforcement learning post-training, and how that gap can be closed. It breaks down the real sources of the capability difference, including full-task completion, long-context handling, tool calling, and the impact of weaker companion models in team settings. It then covers key design choices for RL post-training, such as verifiable rewards, train-evaluation alignment, process rewards, failure trajectory reuse, and infrastructure stability. Finally, it explains how to interpret evaluation metrics and offers practical engineering recommendations for building a continuously improving coding agent.
How Reinforcement Learning Post-Training Improves Coding Agents: From Code Generation to Verified Engineering Delivery
1. The Phenomenon and Problem Definition
A recurring pattern shows up in coding agent evaluations: two agents share the same base model, but the one that has undergone reinforcement learning post-training for software engineering tasks achieves a multiple-fold difference in task success rate. In the original observation, the version without post-training scored around 38.9%, while the post-trained version reached 58.2%. In the individual competition scenario, the post-trained version ranked near the top with a 66.0% success rate.
This gap does not come from a change in base model parameter size, nor from simple prompt optimization. It comes from a change in the training paradigm. The core question this article addresses is therefore: When the base model capability is fixed, how can reinforcement learning upgrade an agent from “able to write code” to “able to deliver verifiable engineering results”?
2. Where the Capability Gap Really Comes From
2.1 From Generating Snippets to Completing Tasks
General-purpose models are good at generating locally correct code snippets, but the unit of evaluation for software engineering tasks is a “complete delivery”: understanding repository context, locating defects, modifying multiple files, running tests, and iterating based on failure messages. Post-training optimizes exactly this long chain, rather than single-point generation quality.
2.2 Long Context and Tool Calling Working Together
Post-trained versions are typically paired with a longer context window and more stable tool-calling ability. The former determines whether repository-level information can fit, and the latter determines whether builds and tests can actually be executed. Missing either one caps the success rate at a low level.
2.3 The Impact of Companion Models in Team Competitions
In the original data, the same strong primary model paired with different companion models saw team success rates fall from 84.5% all the way to 20.3%. This shows that in multi-agent collaboration, the weakest member determines the system ceiling: if the companion model cannot reliably complete subtasks such as retrieval, localization, and verification, the primary model’s capability is consumed by large amounts of ineffective back-and-forth.
3. Key Design Choices for Reinforcement Learning Post-Training
3.1 Prioritize Verifiable Rewards
The biggest advantage of code tasks is that rewards are objective. It is recommended to use “unit test pass rate + static check pass + successful build” as the main reward, and to avoid using model self-scoring as the primary signal.
Illustrative reward structure:
def reward(patch, repo):build = run_build(repo) # 0/1tests = run_tests(repo) # passed/totallint = run_lint(repo) # 0/1# Main reward + small formatting and minimal-change constraintsreturn 0.6 * tests + 0.25 * build + 0.1 * lint - 0.05 * churn_penalty(patch)
3.2 Keep Training and Evaluation Isomorphic
The execution sandbox, dependency versions, and timeout policies used during training should match the evaluation environment. Otherwise, distribution shift occurs, producing “high scores on the training set and collapse on the evaluation set.”
3.3 Process Rewards and Failure Trajectory Reuse
Rewarding only the final result leads to low exploration efficiency. Intermediate signals can be introduced: whether the relevant files were successfully located, whether the problem was reproduced first, and whether the agent corrected course after failure instead of repeating the same mistake. Filtered failure trajectories fed back into training are often more effective than simply piling on more data.
3.4 Stability Engineering
Reinforcement learning training is sensitive to infrastructure. It requires containerized isolated execution, dependency caching, concurrency limits, and complete trajectory logging, with logging services and monitoring/alerting systems tracking reward curves and crash rates.
4. Evaluation Methods and Metric Interpretation
4.1 Success Rate, Win-Draw-Loss, and Pass-to-Fail Ratio
Success rate reflects the overall pass proportion; win-draw-loss reveals stability; the pass-to-fail ratio (passed cases : failed cases) reflects marginal capability. A high success rate combined with a high failure count usually means the model is aggressive on hard problems and unstable on basic ones.
4.2 Diagnosing the Gap Between Team and Individual Performance
If a model performs well individually but drops sharply in team settings, the problem usually lies in the collaboration protocol: subtask decomposition granularity, completeness of context passing, and missing result verification steps.
4.3 Anti-Contamination Evaluation Discipline
- Isolate training data and evaluation tasks by repository, avoiding leakage between different issues in the same repository;
- Fix random seeds and execution timeouts;
- Repeat multiple times, take the mean, and report variance;
- Keep manual spot checks to confirm patches are real fixes rather than special-casing for tests.
5. Engineering Implementation Recommendations
- Build the data loop first: Construct “problem description—fix patch—test” triples from historical commits in real repositories.
- Layer the rewards: Use result rewards as primary and process rewards as secondary to avoid reward hacking.
- Align companion model capabilities: Choose stable small models for retrieval, localization, and verification subtasks to reduce collaboration overhead.
- Control costs: Push high-frequency, low-difficulty subtasks down to low-cost models, and let the primary model focus on planning and key modifications.
- Continuous regression: After each training run, run a fixed benchmark set to observe whether capability regression occurs.
6. Conclusion
The essence of doubling the success rate is moving the evaluation standard forward into the training objective: using executable, verifiable engineering results as the reward signal, combined with long context and tool calling, to transform the model from a “text generator” into a “deliverer.” Supported by the general-purpose containers, object storage, and monitoring/alerting capabilities of cloud platforms such as Baidu AI Cloud, this kind of training and evaluation loop has reproducible engineering conditions, and teams can use it to build their own continuously evolving coding agent system.
