Building a Terminal Agent on a 100-GPU Cluster in Five Days

    This article explains how a research team trained a 300B-class terminal and coding agent with full-parameter reinforcement learning on 64 high-end accelerators in under five days, reaching a 46.2% Pass@1 on terminal benchmarks at over an order of magnitude lower cost per task. It breaks down the three engineering pillars behind the result: environment filtering to keep task success rates in a reliable 10%–70% band, an RL recipe tuned for long, stale, low-precision rollouts, and a unified harness shared by optimization, training, and evaluation. Readers will find actionable criteria, pseudocode, a monitoring checklist, and a reusable deployment checklist for running long-horizon agentic RL on limited compute.

    1. Background: The Bottleneck Has Shifted From Answering to Doing

    Over the past two years, the focus of LLM evaluation has gradually moved from single-turn question answering to multi-step execution: a model has to read files, modify code, run tests, inspect errors, and iterate inside a real or simulated terminal. Tasks like these are known as long-horizon tasks, characterized by many steps, sparse feedback, scattered failure causes, and a heavy dependence on the consistency of intermediate state.

    In this setting, simply scaling up pretraining yields diminishing returns. The real gains come from letting the model repeatedly try things in an environment and get scored correctly. That is the core premise of agentic reinforcement learning (agentic RL): not teaching the model more knowledge, but teaching it to make verifiable, cumulative progress under uncertainty.

    Long-horizon agentic RL is, however, expensive to run in practice. A single rollout can span dozens of tool calls, and any timeout, formatting error, or environment drift along the way pollutes the training signal. Whether frontier-level results can be achieved on a hundred-GPU-class cluster is therefore fundamentally a systems engineering question, not purely an algorithmic one.

    2. Core Result: Three Levers for Approaching the Performance–Cost Frontier With Limited Compute

    Starting from an open-source base model with roughly 321B total parameters and about 17.4B activated per token, a research team ran full-parameter reinforcement learning, training all ~320B language parameters (including the multi-token prediction layers) while freezing the vision tower and the sparse indexer. In under five days on 64 high-end accelerator cards, they produced a 300B-class terminal and coding agent. It reaches a 46.2% Pass@1 on terminal-oriented benchmarks, on par with first-tier closed-source agents, while the cost per task is more than an order of magnitude lower under a high-inference-intensity comparison; the capability also transfers to two software engineering benchmarks.

    The team attributes the result to three points, which are also the engineering threads this article develops:

    1. Environment filtering: carefully selecting agentic RL environments so that every task falls in a band of “appropriate difficulty, reliable signal.”
    2. Recipe design: tailoring the RL recipe to long, stale, low-precision rollouts.
    3. Framework unification: one harness serving model optimization, training, and evaluation alike, eliminating behavioral differences between training and deployment.

    Each is unpacked below, with practical criteria and illustrative implementations.

    3. Lever One: Environment Filtering Sets the Ceiling on RL Signal Quality

    3.1 Why Task Difficulty Is the First-Order Problem in RL

    In supervised learning, sample noise mainly affects convergence speed; in RL, reward noise directly changes the optimization direction. If a task is too easy, the model almost always succeeds, the advantage approaches zero, and the gradient contribution is negligible. If a task is too hard, the model almost always fails, which is equally uninformative and invites pseudo-signals where blind guessing occasionally succeeds.

    The ideal band is a per-task success rate of roughly 10%–70% across repeated samples. Within that band, intra-group variance is largest and the advantage estimate is most stable.

    3.2 A Practical Filtering Workflow

    • Profile capabilities first: sample each candidate task N times with the base model (for example, 8–16) and record the success rate p.
    • Bucket by p: keep tasks with 0.1 ≤ p ≤ 0.7 as the training set; downweight or remove tasks with p > 0.9; move tasks with p < 0.05 into a “locked pool.”
    • Adjust difficulty dynamically: re-estimate p periodically as training progresses, returning tasks from the locked pool that have become easier and retiring old tasks that have become too easy, forming a curriculum.
    • Verify reliability: the same task should produce consistent results across different random seeds and different container images. Large variance means the environment itself is unstable, and the environment should be fixed before training.

    Illustrative code (pseudo-implementation):

    1. def bucket_tasks(tasks, model, n=12, lo=0.1, hi=0.7):
    2. easy, mid, hard = [], [], []
    3. for t in tasks:
    4. p = success_rate(model, t, n)
    5. if p > 0.9: easy.append((t, p))
    6. elif p >= lo and p <= hi: mid.append((t, p))
    7. else: hard.append((t, p))
    8. return mid, easy, hard # mid becomes the main training set

    3.3 The Limits of Environment Diversity

    More diversity is not always better. Terminal and coding tasks need to cover filesystem operations, dependency installation, builds, unit tests, static checks, and version-control conflict resolution. But if base images differ too much across environments, the observation distribution drifts and training becomes less stable. In practice, keep the base image and tool versions fixed and vary the task semantics rather than the environment semantics.

    4. Lever Two: An RL Recipe for Long, Stale, Low-Precision Rollouts

    4.1 Three Coupled Problems

    Long-horizon rollouts have two natural properties: they are long (dozens of interactions) and stale (the policy at sampling time has already diverged from the currently updated policy). Add low-precision training (such as bf16 or mixed precision) and its numerical noise, and the three together make the importance ratio swing violently, leading to training collapse or entropy collapse.

    4.2 Key Design Choices

    • Group-relative advantage: sample a group of trajectories per task and use the group mean as the baseline, avoiding an extra value network and substantially reducing memory and tuning costs.
    • Ratio clipping and trust region: clip the policy update ratio to limit single-step drift; segment updates for very long trajectories when necessary.
    • Length normalization and penalties: normalize the loss by token or by step so long trajectories do not dominate the gradient; apply a small penalty for unproductive loops (repeating the same command).
    • Staleness control: bound the policy version gap between sampling and updating (the degree of off-policyness), for example by syncing weights every K collected steps, or by downweighting old samples.
    • Numerical stability: accumulate key reductions (sum/mean) in fp32; clamp log-probabilities to a range; monitor entropy and gradient norm.

    Illustration (group advantage plus clipped objective):

    1. # Returns of a group of G trajectories
    2. R = [r1, r2, ..., rG]
    3. base = sum(R) / len(R)
    4. adv = [(r - base) for r in R]
    5. # Clipped policy objective (per token)
    6. ratio = exp(logp_new - logp_old)
    7. surr = min(ratio * adv, clamp(ratio, 1-e, 1+e) * adv)
    8. loss = -mean(surr) + beta * grad_norm_penalty

    4.3 The Monitoring Dashboard: Observability Matters More Than the Algorithm

    Monitor at least: mean success rate, intra-group success-rate variance, mean trajectory length, share of clipped tokens, entropy, KL divergence between old and new policies, gradient norm, and environment error rate. If the clipped share keeps rising while the success rate stalls, staleness is usually too high or the learning rate too large.

    5. Lever Three: A Unified Harness to Close the Gap Between Training and Evaluation

    5.1 The Most Common Hidden Bug: One Executor for Training, Another for Evaluation

    Many teams use their own tool wrappers during training but a separate official scaffold during evaluation, so the action space the model learns differs from the one it faces at evaluation time (different parameter names, return formats, error codes). This systematically under- or overstates real performance.

    The goal of a unified harness is to have optimization, training, and evaluation share the same coding execution interface: the same tool signatures, the same truncation policy, the same error-return format.

    5.2 The Minimum Elements of a Harness

    • Tool contracts: command execution, file read/write, search, and test runs, with unified inputs and return structures (including structured errors).
    • Context management: deterministic truncation and summarization of overly long output, keeping training and inference consistent.
    • Replayability: log each step’s action and a summary of the environment snapshot so failures can be reproduced.
    • Sandboxing and resource limits: caps on CPU, memory, and duration so a single task cannot take down the whole sampling cluster.

    Illustrative tool return structure:

    1. {
    2. "ok": false,
    3. "code": "TEST_FAILED",
    4. "stdout_tail": "...",
    5. "stderr_tail": "...",
    6. "duration_ms": 8123
    7. }

    6. The Cost Perspective: Why “Cheap” Usually Means “More Stable”

    An order-of-magnitude lower cost per task rarely comes from shorter prompts. It comes from three things together: fewer wasted turns (clear environment signal), shorter average trajectories (a more efficient policy), and less inference redundancy (no runaway chains of thought).

    The engineering implication is direct: cost is a by-product of reliability. When task filtering, the recipe, and the harness are all in place, the model completes tasks in fewer steps and cost falls naturally. Conversely, if cost is high, suspect environment noise and inconsistent tool contracts first, rather than switching models.

    On the deployment side, general-purpose cloud capabilities can carry this kind of workload: a container platform for an elastic sampling cluster, object storage for trajectories and checkpoints, and logging plus monitoring and alerting to track success and error rates, turning “train–evaluate–regress” into a closed-loop pipeline.

    7. A Reusable Implementation Checklist

    1. Establish an evaluation baseline first: fix the harness, fix the images, fix the random-seed policy, and run the base model to obtain the p distribution.
    2. Bucket tasks and build a curriculum: use the 0.1–0.7 success-rate band as the main training set and re-estimate periodically.
    3. Pick a lightweight RL objective: group-relative advantage plus clipping plus length normalization; get it running before adding complexity.
    4. Control staleness: sync in small steps, downweight old samples, and monitor the clipped share and KL.
    5. Unify tool contracts: the same executor and error format for training and evaluation.
    6. Treat cost as a metric: put mean steps, mean tokens, and error rate on the dashboard alongside success rate.
    7. Iterate in small steps: validate stability on a single machine with multiple GPUs first, then scale to a hundred-GPU-class cluster for long training runs.

    8. Conclusion

    A hundred-GPU-class cluster, under five days, and a 300B-class agent reaching first-tier levels: taken together, these three numbers do not say that compute is unimportant. They say that the leverage of methodology is rising. Environment filtering determines signal quality, recipe design determines training stability, and a unified harness determines whether results are real and transferable. With all three in place, limited compute can approach the performance–cost frontier; without them, more GPUs are just Brownian motion in the noise.