Frontier-Scale Long-Horizon Agent RL on 100 GPUs in Five Days

    This article explains how a team trained long-horizon agent reinforcement learning on a roughly 100-GPU cluster in five days, starting from a sparse-activation foundation model with about 321B total parameters and 17.4B activated per token. It covers the full-parameter RL setup, five key optimizations across infrastructure, data and environment design, long-trajectory credit assignment, low-precision numerical stability, and evaluation consistency, plus the resulting performance-cost results and a reusable checklist for compute-constrained teams.

    1. Background: Why Long-Horizon Agents Are Expensive to Train

    Long-horizon agents are pushing task boundaries from “fix a bug” to hours of continuous terminal operations and software engineering collaboration. Their value lies in the ability to plan autonomously, call tools, observe feedback, and recover from errors. The cost is a sharp rise in reinforcement learning (RL) expense: a single training sample can correspond to a complete trajectory of up to three hours and hundreds of tool calls, and any failed step wastes hours of high-end GPU time.

    For frontier labs with thousands of accelerators, scaling RL is feasible. For most teams, however, a 100-GPU-class cluster is the practical ceiling. The real question is therefore not “can we do RL,” but: under limited compute, how do we maximize the information efficiency of every rollout and approach the Pareto frontier of the performance-cost curve?

    2. Overall Approach: Starting from a Large Sparse-Activation Foundation

    The approach starts from a sparse-activation foundation model with roughly 321B total parameters and about 17.4B activated per token, and runs full-parameter RL: all ~320B language parameters are updated (including the multi-token prediction layers), while the vision tower and retrieval indexer stay frozen. The trade-off is clear — language reasoning and tool use are the main battleground for long-horizon tasks, and freezing the vision and indexing components significantly reduces memory and communication pressure.

    The central argument is that a 100-GPU-class cluster can achieve frontier-level training efficiency, and that three things matter:

    1. Environment filtering: keep every task at a “suitable difficulty” so it provides a reliable, non-saturated learning signal.
    2. Rollout recipe: design dedicated training strategies for samples with long trajectories, stale weights, and low-precision decoding.
    3. Unified harness: share one coding-agent runtime across model optimization, training, and evaluation to eliminate train-inference mismatch.

    3. Five Key Optimizations (The Core Recipe)

    3.1 Infrastructure: Don’t Let the Slowest Attempt Set Overall Throughput

    Training and rollout each use a dedicated set of GPUs to avoid resource contention; rollouts up to six weight versions behind are allowed to participate in training in exchange for higher sampling throughput; and multi-token prediction is used to speed up decoding. In engineering terms, this turns “synchronous waiting” into “bounded asynchrony,” trading a controlled degree of off-policyness for throughput.

    Illustrative pseudocode:

    1. # Bounded-staleness asynchronous RL training loop (illustrative)
    2. for step in range(max_steps):
    3. batch = rollout_queue.get() # may be up to 6 versions behind
    4. assert policy.version - batch.version <= 6
    5. loss = rl_loss(policy, batch) # requires importance sampling correction
    6. optimizer.step()
    7. if step % sync_every == 0:
    8. rollout_weights = policy.weights()

    3.2 Data and Environment: A Difficulty-Stratified Curriculum

    Tasks are bucketed by pass rate. Tasks in the middle pass-rate range are prioritized, while samples that are too easy (no gradient) or too hard (no positive samples) are removed, forming a sustainable curriculum.

    3.3 Long-Trajectory Credit Assignment

    With hundreds of tool calls, sparse rewards make credit assignment difficult. Trajectory-level advantage estimation combined with key-step weighting can be used, along with step-level attribution for failed trajectories, to reduce ineffective gradients.

    3.4 Low Precision and Numerical Stability

    Low-precision decoding substantially improves throughput, but it needs loss scaling, gradient clipping, and periodic high-precision checks to prevent numerical drift during long training runs.

    3.5 Evaluation Consistency

    Training and evaluation share the same harness, keeping tool-call formatting, timeouts, and retry policies consistent and avoiding the systematic bias where “it runs in training but fails in evaluation.”

    4. Reading the Results: What the Performance-Cost Frontier Means

    On a terminal benchmark, the model reaches 46.2% Pass@1, on par with same-generation flagship approaches. More importantly, under the highest inference-intensity comparison, cost per task drops by more than 30x, and the advantage carries over to two software engineering benchmarks (averaged over five trials). Because the model is deployed by the team itself, costs are converted using public prices with a transparent methodology.

    This reveals an engineering fact: in the era of long-horizon agents, the shape of the cost function matters as much as accuracy. The point of the Pareto frontier is to choose a cheaper inference configuration at the same accuracy, or a stronger model at the same budget.

    5. A Reusable Practice Checklist

    • Build a difficulty-stratified task pool first, then discuss algorithms.
    • Replace global synchronization with bounded asynchrony and set a maximum staleness version count.
    • Keep the training and evaluation harness from the same source.
    • Combine low-precision rollout with high-precision checks.
    • Use “cost per task” rather than “price per token” as the core metric.

    6. Conclusion

    The value of this recipe is not any single trick, but the joint optimization of infrastructure, data, algorithms, and evaluation as one system. For compute-constrained teams, it offers a reproducible path: trading engineering discipline for frontier-level performance-cost efficiency. Combined with a general-purpose container platform, object storage, and monitoring and alerting capabilities on Baidu AI Cloud, teams can build elastic training and evaluation pipelines and reproduce such long-horizon agent RL practices with a lower barrier to entry.