Training Long-Horizon Agents on a Hundred-GPU-Scale Cluster: Optimizing Both Performance and Cost
This article presents an engineering approach for training long-horizon agents with full-parameter reinforcement learning on a 300B-class model and a hundred-GPU-scale cluster. It explains how environment selection, long and partially stale rollouts, low-precision inference, and a shared programming harness can improve training stability and efficiency. The resulting system achieved 46.2% Pass@1 on an end-to-end agent benchmark in less than five days, while reducing per-task cost by more than 30 times compared with a frontier model operating at its highest reasoning intensity. The article also discusses software engineering transfer, cost-efficiency evaluation, implementation priorities, and remaining risks.
1. The Cost Wall of Long-Horizon Agents
Long-horizon agents differ fundamentally from standard conversational models. Instead of producing a single response, they must perform a sequence of actions in a real or realistic environment: read files, run commands, inspect outputs, revise plans, and continue execution until the task is complete.
As a result, these systems are usually evaluated by end-to-end task success metrics such as Pass@1, rather than by the quality of a single response. Their trajectories are long, their states are numerous, and their failure modes are complex. Reinforcement learning therefore requires a large number of rollout samples. If every trial-and-error cycle relies on a high-reasoning-intensity model, the cost of each task can quickly become prohibitive.
The real challenge is not simply increasing the success rate. It is achieving a high success rate and a low per-task cost within a controllable compute budget—in other words, moving closer to the performance-cost Pareto frontier.
The reported results provide a useful signal. A model with approximately 300B parameters completed full-parameter reinforcement learning in less than five days on a hundred-GPU-scale cluster equipped with high-memory accelerators. It achieved 46.2% Pass@1 on an end-to-end agent benchmark, reaching a level comparable to frontier models while reducing per-task cost by more than 30 times compared with a frontier model running at its highest reasoning intensity.
This demonstrates that a hundred-GPU-scale cluster is not limited to small experiments. With the right training recipe and engineering pipeline, it can also support highly efficient, frontier-level training.
2. Overall Approach: From a 300B-Class Base Model to Full-Parameter RL
The approach starts with a base model containing approximately 321B total parameters, with about 17.4B parameters activated per token. Full-parameter reinforcement learning is then applied to the language model.
Training updates all approximately 320B language parameters, including the multi-token prediction layers. The vision tower and the sparse-attention indexer remain frozen. This design balances capability transfer and training cost:
- Updating the full set of language parameters allows the agent policy to fully absorb feedback from the environment.
- Freezing the vision tower and indexer avoids spending excessive compute on non-core modules and helps reduce training instability.
The overall process can be summarized in four stages:
- Environment construction and difficulty filtering: Build executable environments for terminal operations, code modification, engineering validation, and related tasks, then divide tasks into difficulty levels.
- Policy rollouts: Allow the current policy to execute multiple actions in each environment and collect trajectories, rewards, and failure signals.
- Trajectory filtering and reward shaping: Remove invalid trajectories, normalize and truncate rewards for long sequences, and retain reliable learning signals.
- Full-parameter policy updates: Update the language parameters using the filtered trajectories and run periodic evaluations to prevent overfitting to a single environment.
A simplified version of the process is shown below:
for iteration in range(max_iterations):tasks = sample_tasks_by_difficulty(env_pool)trajectories = []for task in tasks:traj = policy.rollout(task, max_steps=long_horizon)traj = sanitize_and_truncate(traj)trajectories.append(traj)reliable = filter_by_reward_and_difficulty(trajectories,min_signal_threshold=threshold)batch = build_training_batch(reliable)loss = rl_objective(batch, old_policy, current_policy)update_all_language_parameters(loss)if iteration % eval_interval == 0:evaluate_with_shared_harness(policy)
This is illustrative pseudocode rather than a concrete interface. The main challenges lie in the engineering details of each stage: whether task difficulty is appropriate, whether rollouts are sufficiently long and fresh, whether noise from low-precision inference is controlled, and whether the training and evaluation harnesses are aligned.
3. Three Critical Levers: Environments, Rollouts, and a Shared Harness
3.1 Environment Selection: Ensuring Reliable Learning Signals
Agent RL is especially vulnerable to two types of environments:
- Overly simple environments, where the policy quickly succeeds on nearly every task and the reward signal becomes saturated.
- Overly difficult environments, where the policy fails for a long time, rewards remain sparse, and gradient noise becomes large.
The key practice is to carefully select environments so that tasks remain challenging but attainable. Each task should be within a range where the policy can improve with additional learning.
This can be understood through three principles:
- Difficulty stratification: Divide tasks according to historical success rate, trajectory length, number of tool calls, and error-recovery complexity. During training, dynamically mix easy, medium, and difficult tasks.
- Signal reliability: Validate rewards through multiple sources, such as final-answer checks, test-case validation, and environment-state verification. This avoids relying solely on model self-evaluation, which can produce false rewards.
- Reproducibility: Environment startup, dependency installation, and initial-state resets must be deterministic and reproducible. Otherwise, reward variance for the same policy on the same task can overwhelm the learning signal.
3.2 RL Recipes for Long, Stale, and Low-Precision Rollouts
Rollouts for long-horizon agents typically have three properties:
- They are long, making credit assignment difficult.
- They may be generated by stale policy versions, weakening the on-policy assumption.
- They may use low-precision inference to reduce cost, which introduces numerical noise.
A stable training recipe should address all three issues:
- Segmented sampling and truncation: Split extremely long trajectories into manageable segments while preserving critical states and reward information. This prevents individual trajectories from growing without bound.
- Importance correction and clipping: Apply importance weighting to trajectories generated by stale policies and use clipping thresholds to prevent excessively large updates.
- Asynchronous pipelines: Decouple rollout generation from policy updates. Use an offline buffer and version management to balance throughput with policy freshness.
- Reward normalization: Normalize, discount, and truncate cumulative rewards for long sequences so that an accidental late success does not dominate the gradient.
- Low-precision noise control: Use higher-precision validation at critical decision points or apply consistency filtering to low-precision rollouts.
3.3 A Shared Programming Harness for Training, Evaluation, and Optimization
Many agent-training failures are not caused by the algorithm itself. They result from inconsistencies between training and evaluation environments. For example, tool-call formats may be permissive during training but strict during evaluation, or dependency versions may differ between the two settings.
This approach therefore uses a shared programming harness for model optimization, training, and evaluation. Its main benefits include:
- Consistent signals: Tool responses, error messages, timeout behavior, and other environmental feedback remain consistent between training and evaluation, reducing distribution shift.
- Reproducibility: The same task uses the same container image, initial state, and timeout policy in both settings.
- Lower engineering cost: A shared harness reduces duplicated environment construction and debugging. It also makes it easier to implement common caching, concurrency, and retry mechanisms.
- Auditability: Trajectories, rewards, and environment states can be recorded consistently, making it easier to identify failure patterns and regression issues.
In an implementation, a container platform can host training and evaluation jobs, object storage can retain trajectories and checkpoints, and logging and monitoring services can support long-horizon observability. These are general infrastructure categories. The central requirement is consistent management of environments, trajectories, rewards, and evaluation criteria.
4. Training and Evaluation: More Than Success Rate
On an end-to-end agent benchmark, the approach achieved 46.2% Pass@1, a result comparable to similar frontier models. The more notable result was the per-task cost. At the highest reasoning intensity, the frontier model had a substantially higher per-task cost, while this approach reduced the cost by more than 30 times.
Because the model was deployed by the team itself, cost was calculated using the public pricing reference for the starting model. This makes the comparison closer to real deployment cost rather than a simple comparison of API invocation prices.
The gains were also not limited to a single benchmark. They transferred to two software engineering benchmarks: one focused on code repair and engineering validation, and another representing real-world software engineering tasks. Each evaluation used the average of five trials to reduce the effect of random variation.
The important conclusion is not simply that one score was higher than another. Rather, the training recipe enabled capability transfer. Skills learned in terminal environments—such as multi-step planning, tool use, error recovery, and state management—could transfer to software engineering tasks.
From a Pareto perspective, the horizontal axis represents average per-task cost on a logarithmic scale, while the vertical axis represents Pass@1. An ideal system lies on the frontier: it achieves a higher success rate at the same cost or a lower cost at the same success rate.
The significance of this approach is that it treats training efficiency and inference cost as joint optimization targets instead of optimizing only for a single success-rate number.
5. Engineering Implications: How a Hundred-GPU-Scale Cluster Can Approach the Frontier
A hundred-GPU-scale cluster has limited compute and cannot depend on adding more hardware or extending training time indefinitely. To approach the frontier, compute must be spent on samples with high information density.
- Environment selection improves learning efficiency per sample.
- A carefully designed rollout recipe improves the stability and throughput of long trajectories.
- A shared harness reduces environment drift and debugging overhead.
Together, these factors made it possible to train with 64 high-memory accelerators in less than five days.
For teams implementing a similar system, the following priorities are useful:
- Unify the harness before optimizing the algorithm: Inconsistency between training and evaluation can amplify every algorithmic problem.
- Stratify task difficulty before expanding task volume: A large number of low-signal tasks can slow training rather than improve it.
- Control rollout cost before pursuing extremely long trajectories: Long-horizon does not mean infinitely long. Preserving critical states can be more valuable than retaining every step.
- Establish cost accounting before comparing models: Inference, environment execution, and retry costs should be measured under a consistent definition.
- Run small-scale ablations before full-parameter training: Freezing non-core modules and progressively unfreezing parameters can reduce the cost of failed experiments.
6. Limitations and Risks
This practice still has important limitations.
First, benchmark success rates do not fully represent real production environments. Long-tail tasks, access control, exception recovery, and security or compliance requirements require separate evaluation.
Second, cost comparisons depend on the billing model and deployment method. Self-hosted inference and managed API access have different cost structures.
Third, although a shared harness reduces environment drift, it can also create overfitting risks. Unseen environments should be retained for generalization testing.
Fourth, reward design remains a major challenge for long-horizon RL. Incorrect rewards can be amplified across multi-step trajectories and lead the policy in the wrong direction.
The broader lesson is that competition in long-horizon agents is not only a contest of model scale. It is also a systems competition involving training environments, rollout pipelines, evaluation harnesses, and cost engineering. With careful design, a hundred-GPU-scale cluster can also occupy a meaningful position on the performance-cost Pareto frontier.
