Efficient Long-Horizon Agentic Reinforcement Learning Training on Hundred-GPU Clusters
This article examines how a long-horizon agentic reinforcement learning recipe can achieve frontier-level training efficiency on a hundred-GPU cluster. It covers three core challenges—sparse and unreliable rewards, stale and low-precision rollouts with memory pressure, and gaps between training and evaluation environments—and describes the corresponding practices: carefully filtered RL environments, an RL recipe tailored for long-context low-precision rollouts, and a unified programming harness shared by training and evaluation. The article also reports the resulting performance and cost characteristics, including strong terminal-operation benchmark results and a large reduction in per-task inference cost.
Introduction: The Compute and Cost Dilemma of Agentic Reinforcement Learning
As large language model (LLM) capabilities continue to improve, their application forms are evolving from simple conversational interaction toward agents that can execute long-horizon complex tasks. Terminal operation and software engineering (SWE) are two core application scenarios. However, training an agent with strong code-writing and terminal-operation capabilities often requires substantial compute support and long training cycles. For most enterprises and research teams, the cost of obtaining thousand-GPU or even ten-thousand-GPU clusters is extremely high, which has become a major bottleneck for making agent technology more widely accessible.
A recent technical practice challenges this assumption: a research team used only dozens of general-purpose high-performance GPUs and less than five days to complete full-parameter reinforcement learning (RL) training of a foundation model with over 300 billion total parameters and about 17.4 billion activated parameters. On multiple mainstream code and terminal-operation benchmarks, the agent achieved performance comparable to leading closed-source models at a very low per-task inference cost, successfully reaching the Pareto frontier of performance and cost. The core of this result is a carefully designed long-horizon agentic RL recipe.
1. Core Challenges and the Approach to Breaking Through
Achieving frontier-level training efficiency on a hundred-GPU cluster does not rely on hardware alone. It requires comprehensive optimization across algorithms, environments, and engineering architecture. Long-horizon agentic RL faces three core pain points:
- Sparse rewards and unreliable signals: In long-horizon tasks, a model often needs to perform multiple steps before receiving feedback, making early training difficult to converge.
- Stale rollout states and GPU memory pressure: Long-horizon context accumulation can cause memory overflow, and low-precision rollouts may introduce numerical instability.
- Separation between training and evaluation environments: If the agent runtime framework used during RL training differs from the final evaluation framework, serious overfitting or evaluation bias can occur.
To address these pain points, the key is threefold: carefully filter agentic RL environments to provide reliable signals; design an RL recipe specifically for long, stale, and low-precision rollouts; and build a unified programming harness shared by training and evaluation.
2. Carefully Filtering Agentic RL Environments to Ensure Reliable Signals
The efficiency of reinforcement learning depends heavily on the quality of environment feedback. In terminal-operation and coding tasks, not all tasks can provide effective gradient signals for the model.
1. Tiered task difficulty design
The research team abandoned traditional one-size-fits-all data sampling and instead strictly filtered task environments. If a task is too easy, the model can complete it effortlessly and cannot produce effective gradients; if a task is too difficult, the model receives no positive feedback for a long time and training stalls. By building a reasonable task difficulty distribution, the model is ensured to receive challenges in the “learning zone” at every stage of training.
2. Combining dense and delayed rewards
In terminal-operation tasks, using only whether the final code runs successfully as the reward is too sparse. Through environment design, small positive feedback is given when the model generates reasonable intermediate steps, such as successfully calling a specific API or creating the correct file structure, while a large reward is given when the final task is completed. This design greatly accelerates convergence for a model at the 300-billion-parameter level.
3. An RL Recipe Tailored for Long-Horizon and Low-Precision Rollouts
The agent undergoes full-parameter RL based on a MoE foundation model with 321B total parameters and 17.4B activated parameters. In terms of training strategy, the team demonstrates strong engineering skill.
1. Selective full-parameter RL
Unlike traditional parameter-efficient fine-tuning (PEFT), this approach performs full-parameter reinforcement learning on all 320B language parameters, including multi-token prediction (MTP) layers, while freezing the vision tower and the DSA (dynamic sparse attention) indexer. This preserves the model’s basic world knowledge while giving it strong long-horizon decision-making capabilities.
2. Handling stale and low-precision rollouts
In long-horizon task rollouts, context length increases sharply, and low precision such as INT8/FP8 is usually required for inference to save GPU memory. However, accumulated low-precision errors can cause deviations in advantage function calculation during policy updates. To address this, the RL recipe introduces a compensation mechanism for low-precision rollouts and makes targeted clipping design at the loss function level, ensuring numerical stability of RL training at large parameter scale.
The following pseudocode illustrates the customized RL training flow and shows the core update logic:
def custom_agentic_rl_step(model, env, optimizer):# 1. Sample a task with suitable difficulty for the current capabilitytask = env.sample_task_by_difficulty(model.current_capability)# 2. Execute a long-horizon rollout with low-precision inferencerollout_history, final_reward = env.execute(model, task, precision="low")# 3. Compute advantages and compensate for low-precision errorsadvantages = compute_advantages(rollout_history, final_reward, precision_compensation=True)# 4. Update only language parameters and MTP layers; freeze vision and indexerwith model.freeze_modules(['vision_tower', 'dsa_indexer']):loss = compute_ppo_loss(model, rollout_history, advantages, clip_range=0.2)optimizer.step(loss)return loss
4. Building a Unified Programming Harness: Connecting Training and Evaluation
Many agent projects use a simplified sandbox during training and a different, more complex environment during evaluation, leading to the problem of performing well in training but frequently failing in real use. This approach abandons that practice entirely and builds a programming harness, or agent runtime framework, shared by training and evaluation.
1. Ensuring environment consistency
Whether during the countless rollouts in RL training or final evaluation on various benchmarks, the model runs in exactly the same harness. This means that the interfaces and behavior logic for accessing the file system, executing terminal commands, and catching exceptions are fully consistent between training and inference.
2. Efficient sandbox scheduling
Running hundreds of concurrent long-horizon task rollouts on a hundred-GPU cluster places high demands on sandbox scheduling. The harness integrates containerized isolation and resource limits to ensure that different rollouts do not interfere with each other while minimizing context-switching overhead. In cloud-native practice, this type of architecture can integrate with container platforms and cloud-native compute resources similar to Baidu AI Cloud, enabling elastic scheduling and scaling for large-scale concurrent tasks.
5. Breaking Through the Pareto Frontier of Cost and Performance
Thanks to the three core optimizations above, the agent achieved notable results on multiple key benchmarks. On terminal-operation benchmarks, its single-pass success rate reached 46.2%, averaged over five trials, placing it on par with current leading closed-source models. More importantly, from an economic perspective, its per-task inference cost is more than 30 times lower than that of leading models under their highest inference settings.
This sharp cost reduction is due not only to the reduction in activated parameters brought by the MoE architecture, but also to the RL recipe enabling the model to find the correct path within a limited number of steps, reducing ineffective long-horizon exploration. This capability also transferred successfully to other software engineering benchmarks, demonstrating the generality of the RL recipe.
Conclusion
Reinforcement learning for long-horizon agents is not an unattainable technical barrier. Through precise task-environment filtering, an RL recipe designed for long-context and low-precision rollouts, and an engineering architecture that keeps training and evaluation consistent, a hundred-GPU cluster can also reach the Pareto frontier of performance and cost. This technical practice offers valuable reference for developers and enterprises: on the path toward general-purpose agents, careful algorithm design and rigorous engineering implementation are often more important than simply stacking compute. With mature cloud-native infrastructure, enterprises can train specialized agents that meet their own business needs within a controlled cost.
