Long-Horizon Agent RL: Reducing Training Costs on a 100-GPU Cluster

    Training long-horizon agents with reinforcement learning is costly because rollouts are lengthy, rewards are delayed, and samples can become stale before training uses them. This article outlines five engineering priorities for roughly 100-GPU clusters: task selection, rollout scheduling, sample correction, efficient full-parameter training, and a shared training and evaluation harness. Together, they help teams improve the performance–cost trade-off without relying on massive GPU fleets.

    Why Long-Horizon Agent Reinforcement Learning Is Expensive and Difficult

    Long-horizon agents are evolving from short tasks, such as fixing a single bug, to hours of continuous terminal interaction and programming work. As tasks grow longer, reinforcement learning (RL) costs rise sharply. A single training sample may represent an attempt lasting several hours and involving hundreds of tool calls.

    Any failure—an unstable environment, an unexpected tool response, or interrupted inference—can therefore waste hours of cluster time rather than just one forward pass.

    Frontier labs can scale RL across thousands of GPUs. Most teams, however, have budgets closer to a hundred GPUs. The central question is: How can a roughly 100-GPU cluster approach the Pareto frontier for performance and cost?

    The answer is not simply more GPUs. It is engineering optimization across the entire post-training pipeline.

    Three Sources of Cost in Long-Horizon Agent RL

    Before optimizing the pipeline, identify where the costs originate:

    • Long trajectories: Each rollout contains far more tokens and tool interactions than a typical conversation. Sampling accounts for most of the wall-clock time.
    • Sparse, delayed signals: Success or failure becomes known only after the task ends. Rewards arrive at the end of a long sequence, making credit assignment difficult.
    • Stale samples: Long rollouts take time to generate. By the time one finishes, the current policy may already have undergone several updates. The sample is stale relative to the training policy, and lower-precision generation can introduce an additional mismatch.

    These constraints mean that recipes designed for short-task RL cannot simply be reused. The pipeline must explicitly accommodate long, stale, and low-precision rollouts.

    1. Select Environments and Stratify Task Difficulty

    A 100-GPU cluster cannot afford large amounts of unproductive sampling. The first priority is to carefully select agent RL environments so that tasks have an appropriate difficulty level and provide reliable learning signals.

    Practical steps include:

    • Remove tasks at both extremes: those that are almost always solved and contribute little gradient signal, and those that are nearly impossible and consume compute while producing persistent zero rewards.
    • Group tasks by pass rate and prioritize those in the middle range, where reward variance and learning information are highest.
    • Ensure environments are reproducible and tool responses are stable, so the model does not mistake environmental noise for learnable patterns.

    2. Design Sampling and Scheduling for Long Rollouts

    Long trajectories dominate sampling costs, making scheduling a direct determinant of cluster utilization.

    • Asynchronous or pipelined sampling: Overlap inference generation with training updates so that training GPUs do not sit idle waiting for rollouts.
    • Early termination and partial reuse: Stop trajectories that are clearly off track to reclaim compute, and cache reusable intermediate states.
    • Precision and memory trade-offs: Use lower-precision inference during sampling to improve throughput, then return to the target precision for training. The goal is to gain throughput while keeping the effects of low-precision rollouts under control.

    3. Correct for Stale and Low-Precision Samples

    Sample correction is a key distinction between long-horizon RL and short-task RL. Using stale rollouts directly for policy-gradient updates introduces bias. Corrections such as importance sampling are therefore needed to address the mismatch between rollout generation and the current training policy.

    Set a threshold for acceptable staleness and discard samples that exceed it rather than forcing them into training. Lower-precision rollouts also require attention to the mismatch between sampling and training.

    The engineering trade-off is between sample utilization and training stability. More aggressive correction can allow more samples to be used, but it can also increase variance and the risk of training collapse.

    4. Improve Compute Efficiency for Full-Parameter Training

    One option is a sparse mixture-of-experts (MoE) base model with a large total parameter count but relatively few active parameters per token.

    For full-parameter RL, train all language-model parameters, including auxiliary heads such as multi-token prediction heads, while freezing non-core modules such as the vision encoder and sparse-attention indexer. This concentrates limited compute on the components that directly affect agent capabilities.

    General memory and compute optimizations include:

    1. - Parameter and optimizer-state sharding, such as ZeRO-style partitioning,
    2. to reduce per-GPU memory requirements
    3. - Activation recomputation to trade compute for memory
    4. - Separate sampling and training deployments, scaled independently
    5. according to their bottlenecks
    6. - Mixed precision and gradient accumulation for stable long-sequence training

    Together, these measures can help a roughly 100-GPU cluster approach frontier-level training efficiency. The important factor is not just GPU count, but how consistently each GPU performs useful work.

    5. Use One Agent Harness for Training and Evaluation

    An often-overlooked optimization is to use the same coding-agent harness for model optimization, training, and evaluation.

    Tool invocation, response parsing, and success criteria should follow the same logic in training and evaluation. This reduces discrepancies that can make measured performance appear artificially high or low, producing a more trustworthy assessment of the performance–cost Pareto frontier.

    Implementation and Cloud Infrastructure

    Building and tuning this entire pipeline in-house can be expensive. General-purpose cloud infrastructure can reduce the operational burden:

    • Container platforms can orchestrate sampling and training workloads elastically.
    • Object storage can retain large volumes of rollouts and checkpoints.
    • Monitoring, alerting, and logging services can help locate failures within long-running tasks.

    Cloud platforms, including Baidu AI Cloud, offer general infrastructure capabilities in these categories that can help teams focus on training recipes and algorithms. Teams should assess the relevant services and availability for their deployment requirements.

    Conclusion

    Reducing the cost of long-horizon agent RL means replacing brute-force scaling with careful optimization at every stage.

    Select tasks at useful difficulty levels, schedule sampling around long trajectories, correct stale and low-precision samples rather than using them blindly, maximize GPU utilization during full-parameter training, and share one harness across training and evaluation.

    With these five priorities in place, teams operating roughly 100 GPUs can work toward the Pareto frontier for performance and cost without depending on a much larger cluster.