Training Long-Horizon Agent RL on a ~100-GPU Cluster: A Practical Recipe
This article explains how to run full-parameter reinforcement learning for long-horizon agents on a modest ~100-GPU cluster, starting from a sparse ~320B-parameter (17B active) model. It breaks down where the real costs of long-horizon agent RL come from, presents three pillars for reaching frontier-level sample efficiency at this scale, and details five key engineering practices: difficulty-calibrated environment filtering, segmented returns for long trajectories, handling stale and low-precision rollouts, selective freezing of vision/indexing components, and a shared train/eval agent runtime. It also discusses how to interpret performance and cost results together and offers a transferable checklist for teams with limited compute.
Training Long-Horizon Agent RL on a ~100-GPU Cluster: A Practical Recipe
Long-horizon agents are pushing programming assistants beyond “fix one local bug” toward workflows that span hours of terminal operations, code changes, verification, and regression. These tasks resemble real engineering environments: the agent must call tools across many turns, observe results, revise its plan, and keep its goal consistent over a long context. That is also why reinforcement learning training becomes exceptionally expensive. A single training sample can correspond to a complete attempt lasting hours and involving hundreds of tool calls; a failure at any point wastes hours of accelerator time and environment execution cost.
Frontier teams can scale RL with thousands of accelerators, while most teams only have a ~100-GPU cluster. The question becomes: under limited compute, can recipe optimization push long-horizon agent RL to the performance-cost Pareto frontier? One practical reference implementation starts from a sparse model with roughly 320B total parameters and about 17B activated per token, trains all language parameters while freezing the vision encoder and sparse index components, and completes full-parameter RL using only 64 high-spec accelerators in under 5 days. It achieves Pass@1 comparable to same-tier frontier closed-source models on terminal-agent and software-engineering benchmarks, while cutting per-task cost by more than an order of magnitude. The key is not stacking more GPUs, but systematically restructuring training data, rollout management, and the runtime framework.
1. Where the Cost of Long-Horizon Agent RL Actually Goes
The cost structure of long-horizon agent RL differs from short-conversation RL. Short tasks typically complete in a single generation with limited rollout length; long-horizon tasks involve planning, tool calls, environment feedback, error recovery, and final verification. Costs come from at least four sources:
- Model inference cost: Decision tokens must be generated before and after every tool call, and long trajectories accumulate large contexts.
- Environment execution cost: Terminal commands, compilation, tests, and code retrieval require real or high-fidelity sandboxes whose execution time and resource consumption are non-trivial.
- Failure-retry cost: After a mid-task error, subsequent turns may all be invalid, creating long-tail waste.
- Train/eval mismatch cost: If the training runtime and evaluation runtime differ, tool-calling habits learned in training do not transfer, effectively wasting the training.
Simply increasing the number of rollouts does not necessarily improve sample efficiency. A better approach: make each task provide reliable signal at an appropriate difficulty level, attribute effective steps correctly within long trajectories, let low-precision inference carry acceptable noise, and share the same runtime framework between training and evaluation.
2. Three Pillars for Frontier Efficiency on a ~100-GPU Cluster
Running full-parameter RL on a 300B-class model with ~100 GPUs requires simultaneously solving memory, communication, sample efficiency, and evaluation consistency. Three pillars:
- Environment filtering and difficulty calibration: Not every task is worth training on. Too-easy tasks give weak signal; too-hard tasks have zero success rate; both waste rollouts. Maintain a task difficulty window, sample dynamically according to the model’s current capability, and preserve verifiable failure modes.
- An RL recipe for long trajectories, stale data, and low-precision rollouts: Long trajectories need segmented returns and credit assignment; asynchronous rollouts introduce policy staleness; low-precision inference reduces cost but adds noise. The recipe must explicitly handle all three.
- A shared agent runtime for training, optimization, and evaluation: Tool interfaces, timeout policies, sandbox state, log formats, and success criteria should be as homogeneous as possible, minimizing distribution shift between training and evaluation.
3. Engineering Breakdown of Five Key Components
3.1 Environment Filtering: Make Every Task Provide Reliable Signal
The quality of long-horizon environments directly determines whether RL works. Filter environments along four dimensions:
- Verifiability: Tasks must have clear success criteria, such as passing tests, correct file state, or expected command output.
- Difficulty stratification: Classify tasks into easy/medium/hard windows based on historical success rates, and prioritize sampling tasks in the middle range.
- Diagnosable failures: Record tool-call trajectories, error types, and final states, rather than only a scalar success/failure label.
- Contamination and leakage prevention: Keep training tasks isolated from evaluation tasks so the model learns general operational strategies instead of memorizing fixed answers.
Environment filtering is not a one-time job; it must adapt as policy capability changes. As the model improves, previously hard tasks become useful signal, while previously easy tasks should be down-weighted.
3.2 Long-Trajectory Rollouts: Segmented Returns and Credit Assignment
The core challenge for long trajectories is credit assignment. One success may come from a critical fix or from irrelevant operations; one failure may stem from an early planning error or merely from a wrong final verification command. Use segmented returns: record intermediate states for the planning, modification, execution, and verification stages, combine final returns with stage-level signals, increase weight on critical steps, and down-weight ineffective turns. Also set maximum turns, timeouts, and repeated-action penalties to reduce ineffective long tails.
3.3 Stale and Low-Precision Rollouts: Cut Cost Without Losing Control
In asynchronous training, rollout data may come from a slightly older policy, creating off-policy bias. Control this with importance correction, truncated weights, data-freshness stratification, and expiration of stale data. Low-precision inference is an important cost-saving measure but introduces action-distribution shift. In practice, use it in a layered way: lower precision during exploration to expand sample volume, and higher precision for recomputation of critical decisions or high-value samples; apply confidence filtering and reweighting to low-precision trajectories.
3.4 Full-Parameter Training and Freezing Strategy
Starting from a sparse model with ~320B total parameters and ~17B activated per token, train all language parameters, including the multi-token prediction layers, while freezing the vision encoder and sparse index components. This is a pragmatic trade-off: the language policy is the core of agent decision-making and needs full updates, while keeping vision and index components stable reduces memory and communication pressure and prevents multimodal representation drift. Combined with data parallelism, tensor parallelism, pipeline parallelism, gradient checkpointing, activation recomputation, and communication overlap, a ~100-GPU cluster can support full-parameter RL training.
3.5 Shared Runtime Framework: Train/Eval Homogeneity
If training and evaluation use different tool wrappers, timeout policies, or log parsing, the learned policy will be misaligned with the evaluation environment. A shared runtime framework should unify the tool-call protocol, sandbox lifecycle, filesystem view, command timeouts, error-return format, and success-criterion logic. During evaluation, fix the number of attempts and report means and variances, so a single-run fluctuation is not mistaken for a capability gain.
4. Training Pipeline Pseudocode
for task_batch in task_sampler:envs = select_envs(task_batch, difficulty_window="mid")rollouts = run_agents(envs,policy,max_turns=long_horizon_limit,precision=rollout_precision,shared_runner=True)rollouts = filter_and_reweight(rollouts,staleness_penalty=True,low_precision_confidence=True,segment_return=True)loss = rl_objective(policy, rollouts, kl_coef=kl_coef)update_all_language_params(policy, loss)if step % eval_interval == 0:metrics = shared_runner_eval(policy, suites)log_pass_at_1_and_cost(metrics)
This pseudocode embodies three principles: sample environments by difficulty window; filter rollouts for staleness and low-precision confidence; share one runtime between training and evaluation while logging both Pass@1 and per-task cost.
5. Interpreting Results: Performance and Cost Must Be Read Together
On terminal-agent benchmarks, this implementation achieves roughly 46% Pass@1, on par with same-tier frontier closed-source models, with transfer gains on software-engineering benchmarks as well. The cost story is more important: per-task cost is more than 30x lower than the highest-intensity inference configuration. Because the model is self-deployed, costs can be estimated using public pricing, though readers should still check the billing methodology, average turn count, environment execution costs, and whether failed retries are included.
These results show that a ~100-GPU cluster is not limited to small-scale experiments. With environment filtering, a long-trajectory recipe, low-precision rollouts, and a shared runtime framework, mid-sized clusters can also approach the performance-cost Pareto frontier. But the conclusion has boundaries: differences in evaluation runtimes, task contamination, long-tail failure rates, and cost-accounting methods all affect reproducibility. Engineering teams should first establish unified evaluation and cost logging, then gradually expand task difficulty and rollout scale, rather than treating a single-point result as a general capability.
6. A Transferable Practice Checklist
- Build task-difficulty stratification first; scale rollout count second.
- Record per-stage returns for long trajectories, not just final success/failure.
- Explicitly filter and reweight asynchronous and low-precision data.
- Share tool protocols, timeout policies, and success criteria between training and evaluation.
- Report Pass@1, average turns, per-task cost, and failure distributions together.
- On ~100-GPU clusters, prioritize sample efficiency and communication overlap over adding more GPUs.
The competition in long-horizon agent RL is shifting from “who has more accelerators” to “who can convert each accelerator into effective training signal with a more reliable recipe.” The value of a ~100-GPU cluster lies not in replicating thousand-GPU scale, but in using rigorous environment engineering, trajectory management, and cost accounting to spend limited compute on tasks that are genuinely learnable.
