Long-Horizon Agent RL Recipe: Training a 300B Agent on 100 GPUs in Five Days
This article breaks down a published recipe for training a 300B-class terminal and coding agent with full-parameter reinforcement learning on 64 next-generation accelerators in under five days. It explains why expected cost per task matters more than single benchmark scores, then details the three engineering pillars behind the result: difficulty-bucketed environment filtering with continuous rebalancing, an algorithm recipe designed for long, stale, low-precision rollouts, and a unified framework shared by training and evaluation. It also covers cost-control levers and a reproducibility checklist for teams working with limited compute.
1. Where the Problem Starts: Matching Capability Is Easy, Matching Cost Is Hard
In long-horizon tasks such as terminal use and coding, the industry has repeatedly confirmed one thing: simply making a model larger does not automatically deliver better cost efficiency. The real dividing line is the expected cost of completing a task, not a single score on a leaderboard. The original work sends a clear signal: a 300B-class terminal and coding agent reaches a Pass@1 of 46.2% on mainstream terminal benchmarks, placing it in the same range as the strongest general-purpose reasoning approaches available today. Yet under a comparison against the highest reasoning-effort configuration, its cost per task is more than an order of magnitude lower. This capability is not confined to a single benchmark either; it transfers to two real-world software engineering benchmarks.
The training investment is just as notable: the entire run consumed only 64 next-generation accelerator cards over less than five days, and the full recipe was published. Frontier-level agent capability is therefore no longer the exclusive domain of thousand-GPU clusters. Hundred-GPU teams also have a chance to reach the inflection point of the performance-cost curve through engineering optimization.
2. Why a Hundred-GPU Cluster Can Reach the Pareto Frontier
The team starts from a sparsified base model with 321B total parameters and 17.4B activated parameters per token, then applies full-parameter reinforcement learning: roughly 320B parameters on the language side participate in updates (including the multi-token prediction layers), while the vision tower and the sparse attention indexer stay frozen. This trade-off—freezing what should be frozen and training what should be trained—is key to sustaining throughput under a limited memory and communication budget.
The efficiency gains are attributed to three sources, which form the engineering backbone of this article:
- Environment filtering: keeping every task inside a difficulty band that is informative and discriminative.
- Algorithm recipe: designed specifically for long-horizon, stale, low-precision rollouts.
- Unified framework: one coding-agent runtime shared by training, optimization, and evaluation.
3. Pillar One: More Tasks Is Not Better; Higher Gradient Density Is
The most common failure mode in long-horizon agent training is a task pool that looks large while most samples are either solved instantly or fail outright, contributing almost no gradient. A practical approach is to bucket tasks by historical pass rate, keep only the middle difficulty band, and continuously apply difficulty rebalancing:
# Illustration: bucket by rolling pass rate and adjust sampling weights dynamicallydef rebalance(bucket, lo=0.15, hi=0.85):keep = {k: v for k, v in bucket.items() if lo <= v <= hi}total = sum(keep.values()) or 1return {k: v / total for k, v in keep.items()}
Supporting engineering details include: defining a decidable terminal state for each task (tests passing, command return code, assertions) to avoid reward ambiguity; setting timeouts and resource caps for long-tail tasks so a few samples cannot drag down the throughput of an entire batch; and pre-baking environment images and dependencies to reduce cold-start jitter. Together, these practices raise the effective gradient output per GPU hour.
4. Pillar Two: An Algorithm Recipe for Long, Stale, Low-Precision Rollouts
Rollouts for long-horizon tasks routinely span tens of thousands of tokens, and asynchronous execution makes policy data inherently stale, while low-precision inference introduces distribution shift. Applying classic synchronous, full-precision recipes directly can cause training to diverge or sample efficiency to collapse. The recipe points worth borrowing:
- Use clipped importance sampling to control the variance introduced by staleness.
- Apply length-stratified normalization to rollouts so extra-long trajectories do not dominate the gradient.
- Share the same tool-calling semantics between evaluation and training to eliminate train-deploy skew.
- Tune for throughput rather than single-step optimality, accepting some approximation in exchange for overall convergence speed.
Advantage estimation: group-relative baseline (mean over multiple samples of the same task)Clipping range: adaptively relaxed or tightened based on stalenessLength handling: bucket-wise normalization to suppress extra-long trajectory bias
5. Pillar Three: One Framework Across Training, Optimization, and Evaluation
For many teams, inefficiency comes not from the algorithm but from having three codebases with three sets of semantics. Making the coding-agent runtime shared by training and evaluation pays off in three ways: consistent reward signals, reproducible regressions, and iteration cycles compressed from weeks to hours. The practical recommendation is to make the tool set, sandbox policy, logging, and tracing pluggable components, and to manage differences through configuration rather than branches.
6. Engineering Levers on the Cost Side
Cost per task is determined jointly by token volume × unit price × failed retries. Beyond model-side optimization, engineering can stack additional levers: quantization and batching on the inference side, result caching and reuse across similar tasks, and early stopping on failures plus budget guardrails. If the workload runs in the cloud, container platforms can provide elastic sandboxes, object storage can hold trajectories, and logging plus monitoring with alerting can close the observability loop—general-purpose capabilities that are enough to support a low-cost, reproducible agent training pipeline.
7. Reproducibility Checklist
- Fix the base model and freezing policy first, specifying which layers are updated.
- Bucket environments by difficulty and rebalance dynamically, with decidable terminal states.
- Handle staleness, length bias, and low-precision shift on the algorithm side.
- Share one runtime framework and tool semantics between training and evaluation.
- Control cost with budget guardrails and early stopping, and guarantee reproducibility with unified tracing.
8. Closing Thoughts
The essence of long-horizon agent competition is shifting the entire capability-cost curve to the left. Completing a 300B-class full-parameter agent training run on a hundred GPUs in five days shows that the real moat lies in engineering detail: environment filtering determines signal quality, the algorithm recipe determines stability, and the unified framework determines iteration speed. For most teams, getting these three things solid first brings them closer to the Pareto frontier than blindly adding more GPUs.
