High-Performance Agentic RL on 100 GPUs in Five Days: A Cost-Efficient Recipe
This article breaks down a public open recipe for long-horizon agentic reinforcement learning, focusing on how to approach the Pareto frontier of task success rate versus cost per task using a 100-GPU cluster within a five-day budget. It covers full-parameter RL on a sparse MoE base model, three key levers (environment filtering, an algorithm recipe for long and stale rollouts, and a shared execution harness for training and evaluation), and reported results with notes on reproducibility. A reusable checklist is included at the end.
1. Background: The Performance–Cost Dual Constraint for Agents
Over the past year, agents for terminal operation and software engineering have moved rapidly from demos into production. The metric that matters is no longer task success rate alone, but the joint distribution of “success rate / cost per task.” Long-horizon tasks often involve dozens of tool calls in a single reasoning chain, so token consumption and the cost of failed retries rise nonlinearly. Simply increasing reasoning intensity pushes cost to an unacceptable level.
As a result, the industry has started to focus on the Pareto frontier: plotted with average cost per task on the horizontal axis (usually on a log scale) and task pass rate on the vertical axis, only solutions in the upper-left region offer a genuine cost-performance advantage. This article uses a public “open recipe for long-horizon agentic reinforcement learning” as source material, abstracts its technical skeleton, and discusses three key paths for approaching that frontier within a budget on the order of 100 GPUs over five days.
2. Starting Point: Full-Parameter RL from a Cost-Efficient Base
This practice does not pretrain from scratch. Instead, it starts from a sparse (Mixture-of-Experts) base model with roughly 321B total parameters and about 17.4B activated parameters per token, and applies full-parameter reinforcement learning to the language parameters, including the multi-token prediction layers. The vision encoder and the sparse attention indexer remain frozen. The engineering implications of these choices are worth unpacking:
- Full-parameter updates let the model genuinely “learn to use tools” rather than merely shaping behavior at the prompt level. Freezing the vision and indexer modules avoids parameter drift in the multimodal and retrieval paths, reducing training instability and peak memory usage.
- The sparse activation structure keeps inference cost controllable during the rollout phase, which is a prerequisite for long-horizon agent training: sampling is the most expensive part of RL.
- Costs are calculated from the base model’s public pricing, so the comparison is not “beautified” by self-hosting advantages, making the conclusions more credible.
3. Three Key Levers
3.1 Environment Filtering: Reliable Gradients from Every Task
The biggest waste in long-horizon agentic RL is sampling a large number of tasks that are “all correct or all wrong”: the former carry no information, the latter provide no gradient. The approach here is to bucket tasks by the current policy’s pass rate, keep the intermediate difficulty range, and periodically re-test so tasks move in and out dynamically, forming a curriculum-style sampling pool. Illustrative logic:
def select_tasks(tasks, pass_rate, lo=0.1, hi=0.9):# Keep only tasks that discriminate for the current policykeep = [t for t in tasks if lo <= pass_rate[t.id] <= hi]# Down-weight tasks with no long-term progress to avoid wasted computefor t in keep:t.weight = 1.0 / (1.0 + t.stale_rounds)return keep
At the same time, the environment itself must be “verifiable”: unit tests, compilers, and static checks provide objective rewards, avoiding the drift and reward hacking that come with a reward model.
3.2 An Algorithm Recipe for Long, Stale, Low-Precision Rollouts
Rollouts for long-horizon tasks have three characteristics: long trajectories, stale data (the generating policy differs from the current policy), and low numerical precision (low-precision inference for throughput). The corresponding strategies are: relax the clipping bounds on the importance sampling ratio to accommodate stale data, use length normalization and a group baseline to suppress variance amplification from long trajectories, and normalize reward scales so that a few extremely long tasks do not let their advantage values dominate the gradient. Pseudocode:
ratio = exp(logp_new - logp_old)ratio = clamp(ratio, 1 - eps_low, 1 + eps_high) # Asymmetric clipping to tolerate stalenessadv = (reward - group_mean) / (group_std + 1e-6) # Group baseline for variance reductionloss = -min(ratio * adv, clamp(ratio, 0.8, 1.2) * adv)
On the engineering side, “asynchronous sampling + periodic weight synchronization” decouples generation from training and keeps GPU utilization high.
3.3 A Shared Programming Execution Framework for Training and Evaluation
A unified harness is an implicit deciding factor: if the training environment, validation environment, and online evaluation are inconsistent, you get the illusion of “training gains that don’t show up in evaluation.” Sharing one sandbox, toolset, and timeout policy keeps the reward signal strictly aligned with the evaluation criteria. The sandbox needs filesystem isolation, a network allowlist, and resource limits to prevent long-horizon tasks from contaminating each other.
4. Results and Transferability
With this recipe, the model reaches a Pass@1 of 46.2% on terminal-oriented benchmarks, on par with first-tier closed-source solutions, while cost per task is more than an order of magnitude lower under a high-reasoning-intensity baseline. The capability also transfers to two software engineering benchmarks (bug-fixing tasks), indicating that what was learned is a general “explore–verify–fix” loop rather than overfitting to a benchmark. Note that these numbers come from a specific team’s in-house evaluation framework; when reproducing, re-test with your own harness.
5. Reusable Checklist
- Define the cost basis first, then talk about scores; plot the Pareto frontier on a log scale.
- Choose a sparse-activation base and freeze non-target modules to control sampling overhead.
- Build a curriculum sampling pool bucketed by difficulty, and use executable checks for rewards where possible.
- Use asymmetric clipping, a group baseline, and length normalization to stabilize long-horizon RL.
- Share the harness between training and evaluation, with sandboxed isolation.
- If you use general capabilities such as cloud container platforms, object storage, and monitoring/alerting to host the sandbox and tracing, consume them only as needed and avoid lock-in.
Closing note: 100 GPUs over five days is not magic; it means spending compute on samples that provide gradients, on a stable algorithm, and on consistent evaluation. Baidu AI Cloud’s accumulated capabilities in areas such as heterogeneous compute scheduling and containerized sandboxes can serve as an engineering foundation reference for similar long-horizon agent training.
