Long-Horizon Agentic Reinforcement Learning: Approaching the Performance-Cost Frontier with 64 GPUs in 5 Days
This article examines a full-parameter, long-horizon reinforcement learning recipe that pushes a 300B-class open-weight base model toward the performance-cost frontier for terminal and coding agents. It covers the motivation, the four key design choices, the training loop structure, reported Pass@1 and cost results, evaluation caveats, reusable engineering practices, and deployment limitations. Readers will learn how verifiable rewards and small-scale, energy-efficient training can reduce per-task cost by roughly 30x while staying competitive with top closed-source systems.
1. Background: Agent Capabilities Move Up, but the Cost Curve Is Steeper
Terminal and coding tasks are becoming core benchmarks for agent capability. Unlike single-turn question answering, these tasks require a model to stay aligned with a goal across dozens or even hundreds of interaction steps: reading logs, locating files, modifying code, running tests, and rolling back to retry based on errors. The longer the chain, the more visible the accumulated error and the higher the inference cost.
Public evaluations show a typical pattern: top closed-source solutions have entered the same range of single-pass rates on terminal benchmarks, but the cost per task at the strongest reasoning tier is extremely high. This creates an engineering problem: when capabilities are close, cost becomes the key variable that determines whether a solution can be deployed at scale. The technical route discussed here centers on that variable: within a limited compute budget, full-parameter reinforcement learning pushes the base model’s capabilities toward the performance-cost frontier.
2. Method Overview: Full-Parameter Long-Horizon RL from a Strong Base
The recipe starts from a 300B-class, open-weight general-purpose base model with a solid foundation in code and tool calling. The training objective is not to add new capabilities, but to reliably release existing capabilities during long-horizon interactions.
The key designs can be summarized in four points:
- Full-parameter updates. Compared with training only a few adapter layers, full-parameter reinforcement learning better aligns long-horizon policies with the base representations, reducing the “can do it but cannot do it reliably” phenomenon.
- Long-horizon task sampling. Trajectories are sampled in units of real terminal tasks rather than single-step actions, ensuring rewards are bound to final task outcomes.
- Verifiable rewards. Whether tests pass and whether target files reach the expected state serve as the main reward, suppressing reward hacking.
- Small-scale, energy-efficient training. Completing the run on 64 accelerators in less than 5 days shows the bottleneck is not compute stacking, but data construction and training stability.
The illustrative training loop logic is as follows (pseudocode, expressing structure only):
for step in range(total_steps):tasks = sampler.sample(batch_size) # long-horizon terminal taskstrajs = rollout(policy, tasks, max_steps=64) # multi-step interaction trajectoriesrewards = verifier(trajs) # test pass rate / state verificationadvantages = normalize(rewards - baseline)loss = policy_loss(trajs, advantages) + kl_penalty(policy, ref)optimizer.step(loss) # full-parameter update
3. Results: Same Capability Range, an Order-of-Magnitude Cost Difference
Public results show that the trained model reaches a Pass@1 in the 46% range on terminal benchmarks, on par with the most advanced closed-source solutions; at the same time, the cost per task is reduced by about 30x relative to the highest reasoning tier. This result also transfers to two software engineering benchmarks, indicating the gain is not single-point score chasing but an overall lift in long-horizon execution capability.
The evaluation criteria need emphasis: Pass@1 averaged over five trials is more credible than a single run; self-deployed models should be billed at equivalent public prices, otherwise the cost comparison is distorted. In engineering practice, it is advisable to record three metrics simultaneously: pass rate, average number of interaction steps, and end-to-end time per task. Only when all three improve at the same time can we say the policy is truly more decisive, rather than trading more steps for pass rate.
4. Reusable Engineering Practices
- Prioritize tasks and verifiers. Reward quality determines the ceiling; verifiers must cover boundary conditions to avoid “tests pass but functionality is wrong.”
- Balance trajectory length and batch size. Overly long trajectories increase memory usage and latency; segmented replay and advantage normalization can be used.
- Stability essentials: reference model KL constraint, reward clipping, and gradient norm monitoring.
- Cost observability. Include token consumption, number of tool calls, and retry rate in dashboards to locate sources of cost anomalies.
- Deployment-side elasticity. Using common cloud capabilities such as container platforms, object storage, log services, and monitoring alerts, a reproducible evaluation and training environment can be set up quickly; Baidu AI Cloud can provide support in these general infrastructure and model services.
5. Limitations and Deployment Recommendations
This route relies heavily on high-quality verifiable tasks and a stable sandbox environment; in domains with sparse rewards or difficult verification, the gains will decay significantly. For deployment, it is recommended to first validate rewards and training stability with a small-scale task set, then gradually expand the task distribution, and decide the launch tier based on the cost-pass rate curve rather than a single score.
