Boosting Coding Agent Benchmark Scores with Reinforcement Learning Post-Training
This article breaks down how reinforcement learning post-training, agent engineering, and model pairing optimization significantly improved a coding agent's score rate in a two-team collaborative adversarial simulation benchmark—from 21.5% to 58.2% (about 2.7x) under a combined configuration. It covers score-rate definitions, reward function design, curriculum learning, self-play, trajectory filtering, sandbox execution, sub-agent routing, and a reproducible practice checklist, while clearly explaining the limits of these internal benchmark results.
Boosting Coding Agent Benchmark Scores with Reinforcement Learning Post-Training
In coding agent and software engineering automation scenarios, “doubling the benchmark score” is easily misread as a doubling of a model’s general coding ability. A more accurate interpretation: under a specific evaluation protocol, reinforcement learning post-training, agent engineering wrappers, and model pairing optimization can dramatically raise an agent’s score rate in a two-team collaborative adversarial simulation benchmark. Using an internal simulation evaluation as an example, this article abstracts the improvement path and offers a reusable methodology. Note that the data below comes from a fixed environment, fixed rules, and internal pairing configurations—it is for methodological illustration only and does not constitute a claim of general capability.
1. Define the Score First: Pairing Protocol and Score Rate
The original evaluation included both a team competition and a solo competition. The team competition is a two-team collaborative adversarial simulation task; the solo competition is a single-agent track. The team score rate is calculated as “win = 3 points, draw = 1 point, loss = 0 points”:
Score Rate = (Wins * 3 + Draws * 1) / (Total Matches * 3)
For example, one new pairing achieved 439 wins, 66 draws, and 287 losses over 792 total matches, yielding:
(439 * 3 + 66) / (792 * 3) = 58.2%
This clarifies a key point: the “more than 2x” figure refers not to a same-protocol comparison of a single model, but to the ratio between the “new pairing at 58.2%” and a “strong base + low-cost partner pairing at 21.5%”—about 2.7x. Although both were measured on the same simulation benchmark, the partner configuration, routing strategy, and cost constraints differed, so this cannot be extrapolated into general coding ability. The table below shows an abstracted excerpt of the internal evaluation; all pairing names are internal codenames.
| Rank | Team Pairing (Codename and Role Configuration) | Score Rate | W-D-L | Scored:Conceded |
|---|---|---|---|---|
| 1 | Reference T1: Dual ultra-large model pairing | 99.5% | 787-4-1 | 9642:1035 |
| 2 | Reference T2: Strong base + ultra-large model partner | 84.5% | 658-33-101 | 8290:2290 |
| 3 | Reference T3: General strong pairing | 65.0% | 495-60-237 | 4565:2792 |
| 4 | Reference T4: Strong reasoning + general pairing | 60.1% | 455-63-274 | 4188:3558 |
| 5 | New pairing T5: Long-context base + RL-enhanced version | 58.2% | 439-66-287 | 3980:3052 |
| 6 | Control T6: Long-context base + basic post-trained version | 38.9% | 284-73-435 | 2897:4583 |
| 7 | Control T7: Strong base + low-cost partner A | 21.5% | 140-92-560 | 1885:6173 |
| 8 | Reference T8: General pairing | 20.3% | 145-48-599 | 3237:8074 |
| 9 | Control T9: Strong base + lightweight secondary model routing | 20.3% | 135-77-580 | 2577:5716 |
| 10 | Reference T10: Lightweight pairing | 19.1% | 125-78-589 | 2384:6372 |
Solo competition excerpt:
| Rank | Solo Pairing Codename | Score Rate | W-D-L | Scored:Conceded |
|---|---|---|---|---|
| 1 | Reference P1: Ultra-large model single agent | 95.3% | 570-28-107 | 586:467 |
| 2 | Reference P2: General strong single agent | 91.4% | 550-18-40 | 7840:871 |
| 3 | Reference P3: General strong single agent | 89.4% | 534-29-45 | 6833:761 |
| 4 | Reference P4: General strong single agent | 86.1% | 512-34-62 | 4660:656 |
| 5 | Reference P5: General strong single agent | 79.8% | 477-24-107 | 4608:1102 |
| 6 | New P6: RL-enhanced single agent | 66.0% | 391-30-187 | 3213:1803 |
Three comparisons stand out. First, the new pairing T5 raised the score rate from 38.9% (basic post-trained T6) to 58.2%, a relative improvement of about 49.6%. Second, T5 versus the low-cost partner pairing T7 at 21.5% is a ratio of about 2.7x. Third, solo agent P6 reached 66.0%, showing the enhanced version also delivers standalone performance on the single-agent track—though it remains below the top reference groups, so it should not be overstated as across-the-board leadership.
2. Technical Pipeline Overview: Base Model, Post-Training, Wrapping, Pairing
The improvement is not a single trick but the combined effect of four layers:
- Base model selection: Choose a base model with code understanding, long-context, and tool-calling capabilities so the agent can read repository context, understand task constraints, and generate executable actions.
- Reinforcement learning post-training: On top of the basic post-trained model, construct rewards from simulation environment feedback, execution results, unit tests, collaboration signals, and cost constraints, then run multi-round policy optimization.
- Agent engineering wrapper: Combine planning, execution, reflection, tool calling, sandbox verification, context compression, and sub-agent routing into a stable workflow.
- Pairing and routing optimization: In team competitions, a strong base complements a specialized enhanced version; in cost-sensitive scenarios, configure lightweight secondary models sensibly to avoid a weak partner dragging down the main model.
Abstracted as pseudocode:
base = load_base_model()sft = supervised_finetune(base, code_and_agent_data)rl = reinforce(sft, env=sim_env, reward=reward_fn, curriculum=curriculum)agent = wrap_agent(rl, tools=[code_exec, test_runner, retrieval], planner=plan_reflect)score = evaluate(agent, benchmark=team_and_solo, seeds=fixed_seeds)
3. How the RL Works: Rewards, Curriculum, and Anti-Gaming
3.1 Reward functions must cover both outcomes and process
Rewarding only the final win/loss gives sparse training signals and tends to teach ineffective stalling or risky actions; rewarding only the process invites score farming. A more robust approach combines outcome rewards, execution correctness, collaboration contribution, and cost penalties:
def reward(traj):r = 0.0r += 3.0 if traj.win else 1.0 if traj.draw else 0.0r += 0.30 * traj.unit_test_pass_rater += 0.15 * traj.collab_scorer += 0.10 * traj.plan_validityr -= 0.05 * traj.normalized_token_costr -= 0.50 * traj.illegal_actionr -= 1.00 * traj.reward_hack_flagreturn r
Collaboration contribution can be built from generic metrics such as observable teammate gains, handoff success rate, and the ratio of conflicting actions. Cost penalties suppress meaningless long contexts and repeated tool calls. The key is to keep some weight on the final outcome reward so the agent doesn’t optimize only local metrics.
3.2 Curriculum learning and self-play
Simulation tasks should be layered from easy to hard: single-step code fixes, short tool-call chains, multi-turn collaboration, adversarial pressure, and long-horizon planning. Set pass-rate thresholds at each level before advancing. Self-play lets the enhanced version practice with partners of varying capability tiers, improving robustness against weak partners, strong partners, and unpredictable behavior. Keep a fixed-seed validation set during training to avoid curriculum overfitting.
3.3 Trajectory filtering and failure mining
Not all match trajectories are suitable for training. Filter out three types: rule-violating trajectories, obvious reward-hacking trajectories, and low-information draw trajectories. Meanwhile, attribute failures: planning errors, tool-call errors, context loss, or collaboration strategy errors. Failure mining improves policy stability more than simply adding more winning samples.
4. Agent Engineering: From “Writes Code” to “Completes Tasks”
4.1 Plan–execute–reflect loop
The agent should first decompose the task, then call tools to execute, and finally reflect and correct based on tests and logs. Reflection is not restating errors but generating a verifiable correction plan, such as “add boundary-condition tests,” “narrow the change scope,” or “roll back the ineffective patch.”
4.2 Sandbox execution and observability
Code execution must run in an isolated sandbox, recording commands, exit codes, stdout, test results, and resource consumption. For engineering, you can build the evaluation pipeline on general-purpose capabilities such as container platforms, object storage, message queues, log services, and monitoring/alerting (for example, those offered by Baidu AI Cloud); the specific choices should be evaluated against compliance, cost, and team circumstances. Sandbox logs serve both as a reward source for training and as a basis for post-mortems.
4.3 Long context and context compression
A long-context base model can read more repository information, but longer context means more noise and higher cost. In practice, use layered retrieval: first locate relevant files, then read key functions and tests, and finally retain the task summary, failure logs, and change plan. When compressing historical trajectories, preserve the “decision rationale” rather than the full raw text.
4.4 Sub-agents and secondary model routing
Cost-sensitive scenarios often assign lightweight models as secondary models routed automatically by sub-agents. This reduces cost, but if the lightweight model is underpowered, it drags down the main agent. A more sensible routing rule: send simple retrieval, format conversion, and log summarization to the lightweight model; send patch generation, root-cause analysis, and collaboration decisions to the enhanced version or strong base. Routing thresholds should be determined through offline ablation, not guesswork.
5. Pairing Optimization: Why “Changing the Partner” Matters So Much
Team results show that a pairing’s score is not a simple sum of individual model abilities. When a strong base is paired with a low-cost partner that cannot understand handoff intent or frequently triggers invalid actions, the main model burns extra turns correcting it, and the score rate can drop sharply. The new pairing T5 pairs a long-context base with the RL-enhanced version: the base supplies context and tool capabilities, while the enhanced version supplies stronger task decomposition, execution-feedback utilization, and collaboration strategy. Control T6, using the basic post-trained version, scored only 38.9%—showing that “whether RL post-training was applied” is a key variable. The low scores of controls T7 and T9 show that partner quality and routing strategy matter just as much.
6. Interpreting the Results and Their Limits
The new pairing T5’s 58.2% is a significant improvement over T6’s 38.9%, and about 2.7x over T7’s 21.5%—but it must be clear: these are results under an internal simulation benchmark, a specific pairing protocol, and fixed rules. They demonstrate the effectiveness of RL post-training and agent engineering, but cannot be equated directly with real-world repository development, cross-language transfer, or open-world coding ability. Solo agent P6’s 66.0% shows the enhanced version has independent capability, but it remains below the top reference groups—better positioned as a “cost-controlled specialized enhancement” than a “full replacement for strong baselines.”
7. Reproducible Practice Checklist
- Fix the evaluation protocol: define team/solo competitions, the scoring formula, seeds, rule versions, and pairing configurations.
- Build a sandbox and logging: every execution traceable, every reward recomputable.
- Layer the reward function: record final outcome, test pass rate, collaboration contribution, cost penalties, and violation penalties separately.
- Run curriculum and self-play in parallel: layer difficulty, and use a fixed validation set to prevent overfitting.
- Attribute failure trajectories: classify by planning, tools, context, and collaboration.
- Run ablations: basic post-trained vs. enhanced, strong partner vs. weak partner, full routing vs. secondary model routing.
- Monitor reward hacking: illegal actions, repeated calls, hollow draws, abnormally long trajectories.
- Put cost constraints up front: fold tokens, tool-call counts, and latency into rewards and routing.
- Report confidence intervals: repeat with multiple random seeds so a single fluctuation isn’t amplified.
- Keep external claims restrained: internal simulation scores describe performance on specific tasks and do not replace real engineering acceptance.
Conclusion
A sharp rise in coding agent benchmark scores is usually not the result of a single model “getting smarter,” but the combined effect of RL post-training, reward design, curriculum self-play, sandbox execution, context management, sub-agent routing, and pairing configuration. The ~2.7x improvement from 21.5% to 58.2% should be understood as a pairing-optimization gain under a specific internal simulation protocol. What is truly reusable is the methodology: first define the evaluation clearly, then make the rewards and sandbox solid, and finally prove each component’s contribution through ablation experiments. That is how you reach an explainable balance among cost, stability, and effectiveness.
