Training High-Performance Coding Agents on a 64-GPU Cluster: An Open-Source-Style Recipe for Balancing Pass@1 and Cost

    This article breaks down an open recipe for training a 300B-class terminal and coding agent via full-parameter reinforcement learning on just 64 accelerators in under five days. It covers environment curation for reliable RL signals, an RL formulation designed for long, stale, low-precision rollouts, a shared training/evaluation runtime framework, and how the resulting agent reaches 46.2% Pass@1 on terminal benchmarks while cutting per-task cost by more than 30x versus high-inference-effort baselines. It also offers practical guidance for small teams aiming to reproduce this performance-cost Pareto frontier approach.

    1. Background: Terminal Agents Are Now Competing on Performance and Cost

    A terminal or coding agent differs from an ordinary conversational model in one fundamental way: it must execute multi-step operations in a real file system, command-line environment, codebase, and toolchain, and revise its strategy based on intermediate feedback. These tasks are typically long-horizon, have sparse rewards, exhibit strong state dependency, and fail easily. The model must not only “write code” but also observe its environment, plan steps, invoke tools, and recover from mistakes.

    Evaluating such an agent therefore requires more than a single capability metric. Two dimensions matter:

    1. Task pass rate, e.g., Pass@1.
    2. Average cost per completed task.

    Cost includes not only inference-side token consumption but also hidden overheads from multi-turn tool calls, retries, timeouts, and failed rollbacks. For enterprise adoption, a solution with a slightly higher pass rate but an order of magnitude higher cost per task is hard to scale; conversely, an extremely cheap solution with insufficient pass rate cannot enter production.

    The core finding of the original work: starting from a sparse base model with roughly 321B total parameters and about 17.4B parameters activated per token, full-parameter reinforcement learning yields a ~300B-parameter terminal and coding agent that achieves 46.2% Pass@1 on a terminal-task benchmark—the same performance tier as frontier peers—while costing more than 30x less per task than high-inference-effort approaches. The gains also transfer to two software engineering benchmarks. Critically, the entire training run used only 64 accelerators and under five days, with the complete recipe published openly. This demonstrates that a ~100-GPU-class cluster is not limited to small experiments: with the right methodology, it can approach the performance-cost Pareto frontier.

    2. Approach Overview: Full-Parameter RL + Three Engineering Pillars

    The overall recipe can be summarized as follows:

    1. Start from a sparse base model at the ~300B scale—approximately 321B total parameters, with about 17.4B activated per token.
    2. Apply full-parameter reinforcement learning to all ~320B language parameters, including the multi-token prediction layers.
    3. Freeze the vision tower and sparse attention indexing structures, avoiding wasted training budget on non-critical modules.
    4. Train on 64 accelerators in a ~100-GPU-class cluster, completing in under five days.
    5. Improve training efficiency and evaluation consistency through environment curation, a long-trajectory RL formulation, and a shared runtime framework.

    The key tension here is between full-parameter RL and 100-GPU-class efficiency. Full-parameter training means higher memory, communication, and state-management overhead, but it lets the policy adapt fully to the agent task distribution. Rather than relying on a massive cluster, the team decomposed efficiency into three controllable variables: training-signal quality, rollout data quality, and runtime-framework consistency.

    3. Pillar 1: Environment Curation Determines RL Signal Quality

    The first-order question in agent RL is not “is the model big enough?” but “are the rewards from the environment reliable?” If tasks are too hard, the model rarely earns positive reward and gradients become sparse and noisy. If tasks are too easy, the model saturates quickly and training gains collapse. The goal of environment curation is therefore not to maximize task count, but to place each task in a suitable difficulty band while providing verifiable, reproducible feedback.

    Four design dimensions matter:

    • Difficulty stratification. Layer tasks by required step count, number of tool invocations, number of state branches, and error-recovery difficulty, so each training batch mixes foundational and challenging tasks.
    • Reliable verifiers. Prefer executable validation, unit tests, file-state checks, and command-output comparison over subjective scoring, minimizing reward noise.
    • Reward hacking prevention. Verifiers must cover boundary conditions so the model cannot “cheat” by deleting tests, modifying assertions, or bypassing checks.
    • Failure-trajectory utilization. Failed trajectories are not waste—they can be used for contrastive learning, error attribution, and negative-sample constraints—but they must be kept separate from successful trajectories to avoid polluting policy updates.

    A practical curation pipeline looks like this:

    1. Candidate task pool
    2. -> Static checks: environment starts, dependencies complete, timeout controllable
    3. -> Difficulty estimation: steps, tool calls, branches, historical failure rate
    4. -> Signal validation: verifier stability, repeatability across reruns
    5. -> Stratified sampling: allocate batches by difficulty and task type
    6. -> In-training monitoring: pass rate, average steps, failure-cause distribution

    The direct payoff: the same amount of rollout produces more valid gradients, eliminating the waste of “running a lot but learning little.” On a 100-GPU-class cluster, rollout typically dominates total cost, so curation effectively moves budget toward informative tasks before training even starts.

    4. Pillar 2: An RL Formulation Built for Long, Stale, Low-Precision Rollouts

    Rollouts from terminal agents have three characteristic properties: long trajectories (a single sample can contain dozens or even hundreds of tool calls), stale data (a time gap between the policy that generated the data and the policy being trained), and low precision (higher throughput often requires lower-precision inference or approximate sampling). Directly applying a short-conversation RL recipe leads to policy drift, exploding importance-weight variance, and unstable training.

    The work emphasizes designing the RL formulation around these properties:

    1. Asynchronous pipelines with staleness correction. Rollout generation and training updates run in parallel, inevitably creating version gaps between behavior and training policies. Control bias via importance-sampling clipping, version-window limits, and eviction of stale trajectories.
    2. Long-horizon credit assignment. Don’t rely solely on the final reward; combine process rewards, step-level verification, and failure-position backpropagation so the model learns which step caused failure.
    3. Low-precision stability. Under low-precision rollout, tool outputs and probability distributions can differ subtly. The training side needs more robust normalization, clipping, and KL constraints to prevent variance amplification.
    4. Curriculum-style data mixing. Sample more medium-difficulty tasks early, then gradually increase long-tail and complex tasks. Cap budgets for high-cost long trajectories so a few tasks don’t consume training throughput.
    5. Fault tolerance and checkpointing. Long-trajectory environments are prone to timeouts, crashes, and hangs. The training pipeline needs interrupt-on-timeout, sandbox rebuilding, checkpoint recovery, and retry strategies.

    A schematic training loop:

    1. for batch in rollout_stream:
    2. traj = run_agent(env, policy, max_steps, timeout)
    3. reward = verify(traj)
    4. if valid(reward) and not stale(traj):
    5. buffer.add(traj, reward, behavior_logprob)
    6. train_step(policy, buffer, clip=..., kl=...)

    The valid and not stale checks are the engineering crux: the former filters untrustworthy rewards, the latter controls policy-version drift. Many agent-RL failures stem not from the algorithm but from a data pipeline treating noise as signal.

    5. Pillar 3: One Shared Runtime Framework for Training and Evaluation

    Agent tasks are highly sensitive to the runtime framework. The same model can behave very differently under different tool interfaces, timeout settings, and file-system states. If training and evaluation use different frameworks, metrics become incomparable, producing the illusion of “training gains that don’t show up online.”

    The approach uses a single programming runtime framework, optimized for the model and shared between training and evaluation. Its value:

    • Interface consistency. Tool-call format, observation format, error codes, and retry semantics are identical in training and evaluation.
    • State consistency. File-system snapshots, working directories, environment variables, and dependency versions are reproducible.
    • Budget consistency. Maximum steps, timeouts, token budgets, and tool-call limits are aligned.
    • Log consistency. Every step’s action, observation, reward, and failure reason is traceable, enabling offline analysis.
    • Security isolation. Sandboxed execution restricts network access, file writes, and resource usage so evaluation environments aren’t compromised.

    A shared framework also yields a hidden benefit: failure modes discovered during training can be converted into evaluation diagnostics, and long-tail evaluation failures can flow back as new training-environment filters. The two form a closed loop instead of two disconnected pipelines.

    6. Evaluation and Cost: The Pareto Frontier Matters More than a Single Score

    On the terminal-task benchmark, the approach reports a Pass@1 of 46.2% (averaged over five trials), placing it in the same performance tier as frontier peers, with transfer gains on software engineering benchmarks. Because the model is self-deployed, cost is computed from the base model’s published unit prices. The result: per-task cost is more than 30x lower than high-inference-effort approaches.

    This result should be read through the lens of the Pareto frontier: the x-axis is average cost per task (log scale), the y-axis is Pass@1. The ideal is not maximum pass rate at any cost, but maximum pass rate at a given cost—or minimum cost at a given pass rate. The 64-GPU, sub-five-day training cycle means teams can iterate recipes quickly at low training cost; the 30x per-task cost reduction makes inference-side scaling economically viable.

    That said, cost accounting must go beyond visible token fees. A complete picture includes:

    • Inference tokens and tool-call overhead;
    • Multi-turn retries and timeout waste;
    • Sandbox startup and file-system snapshot costs;
    • Evaluation and monitoring costs;
    • Manual review costs for failed tasks.

    Only with all of these included under a unified accounting standard does the performance-cost curve support real decisions.

    7. Practical Recommendations for Small Teams

    For teams hoping to reproduce this path:

    1. Build a reliable evaluation and runtime framework first. Without a consistent, reproducible sandbox and verifiers, RL signals cannot be trusted.
    2. Then do task stratification and difficulty calibration. Use historical pass rates, step counts, and failure causes to profile tasks and control batch distribution.
    3. Validate RL recipes at small scale first. Verify reward design, clipping strategy, and staleness correction on a smaller model or subset before scaling to full-parameter training.
    4. Treat rollout cost as a first-class metric. Monitor valid rewards per 10k steps, average trajectory length, timeout rate, and retry rate—not just training loss.
    5. Maintain a shared training/evaluation framework. Unify tool interfaces, timeouts, budgets, and logging fields to prevent metric drift.
    6. Pay attention to long tails and safety. Terminal agents have real execution power; enforce sandboxing, permissions, and limits on network and file writes.

    8. Conclusion

    The core lesson of this recipe is not simply “train a bigger model with fewer GPUs.” It is that agent RL can be decomposed into three engineerable pillars: high-quality environments provide reliable signals, a long-trajectory RL formulation digests asynchronous and low-precision rollouts, and a shared runtime framework keeps training and evaluation consistent. It is the combination of all three that makes a 64-accelerator, sub-five-day training run possible and pushes the resulting agent toward the performance-cost Pareto frontier on terminal and coding tasks. For enterprises, the truly reusable asset is this environment–recipe–framework methodology, not any single metric.