Building a Cost-Efficient Coding Agent: Full-Parameter RL on 100 GPUs in Under 5 Days

    This article examines how a research team trained a 300B-class terminal and coding agent from a 321B open-source base model using full-parameter reinforcement learning on 64 high-end accelerators in less than five days, reaching roughly 46% Pass@1 on mainstream terminal benchmarks at more than an order of magnitude lower cost per task than the highest reasoning-effort configuration. It breaks down the engineering trade-offs behind those results: environment filtering for reliable gradients, an RL recipe for long, stale, low-precision rollouts, a shared harness for training and evaluation, the memory and bandwidth accounting of full-parameter training, and the evaluation and cost conventions needed for fair comparison. A reproducibility checklist is included.

    1. Background: Agent Capability Rises, and So Does Cost

    Over the past two years, the capability curve of terminal and coding agents has climbed steeply. But when enterprises try to deploy these systems, the first obstacle is usually not the capability ceiling — it is the cost structure. A complex task can require dozens of tool calls, repeated file reads and writes, test execution, and backtracking on errors. Context keeps expanding, and the token consumption of a single task can be tens of times that of an ordinary conversation. When inference effort is set to the highest level to buy accuracy, the cost per task grows further, creating a situation where capability and cost are hard to obtain at the same time.

    A common way to measure this class of system is to report Pass@1 (the single-attempt pass rate, averaged over multiple trials) on benchmarks, record the average cost per task, and plot both on the same (usually log-scaled) chart. A genuinely valuable system is not the one that tops either metric; it is the one that sits on the Pareto frontier: the highest accuracy at a given cost, or the lowest cost at a given accuracy.

    A recently published technical recipe offers a sample worth studying. Starting from an open-source base with 321B total parameters and about 17.4B activated per token, a research team ran full-parameter reinforcement learning to obtain a 300B-class terminal and coding agent. On mainstream terminal task benchmarks it reaches Pass@1 in the 46% range, on par with the strongest closed-source systems, while the cost per task is more than an order of magnitude lower than the highest reasoning-effort configuration; the capability also transfers to two real software engineering benchmarks. The entire training run used only 64 high-end accelerator cards and took less than 5 days. For developers, what is worth borrowing is not these numbers but the engineering trade-offs behind them.

    2. With Limited Compute, Efficiency Comes From Three Places, Not More Cards

    For a hundred-card-class cluster to reach frontier efficiency, three areas usually have to be right at the same time; a shortfall in any one of them wastes compute.

    1. Environment filtering: make every task provide a reliable gradient

    The largest hidden cost of agentic RL is ineffective sampling. If a task is too easy, the model gets a perfect score early and its gradient contribution is close to zero; if a task is too hard, dozens of consecutive trajectories all fail, the advantage estimate degenerates into noise, and a large amount of inference budget is burned for nothing. A workable approach is to bucket tasks by the pass rate of the current policy, keep only tasks whose pass rate falls in a middle band for training, and dynamically adjust the difficulty distribution as training progresses.

    1. # Example: difficulty bucketing and sampling weights by rolling pass rate
    2. def sample_weight(pass_rate, low=0.1, high=0.7):
    3. if pass_rate < low: # too hard: noisy signal, down-weight
    4. return 0.1
    5. if pass_rate > high: # too easy: small gradient contribution, down-weight
    6. return 0.2
    7. return 1.0 # middle band: most informative

    At the same time, the verification signal must be reliable: test cases themselves should be stable and repeatable, avoiding dependence on external networks and randomness; otherwise reward noise becomes a loophole the policy model will exploit.

    2. A training recipe for long, stale, low-precision sampling

    Rollout trajectories for long-horizon tasks are long, there is a clear delay between generation and consumption, so the data is in a “stale” state; for throughput, sampling often runs at a lower precision than training. These three factors combined can make naive importance-sampling ratios blow up and training diverge. Common industry responses include: clipping and offset correction on probability ratios, normalization by sequence length to keep long trajectories from dominating the gradient, factoring the precision and version differences between the sampling and training engines into the error budget, and monitoring entropy and ratio distributions rather than only the reward curve.

    3. One agent framework shared by training and evaluation

    If the tool set, prompt templates, and context management used in training differ from those used in evaluation, the gains will not transfer, and tuning turns into an exercise in aligning two systems. Converging tool registration, context compression, failure fallback, and result parsing into a single harness — so that training is evaluation and evaluation is training — is a prerequisite for reproducibility.

    3. How to Account for the Resources of Full-Parameter Training

    Take a sparse structure with 321B total parameters and 17.4B activated as an example. The memory and bandwidth pressure of full-parameter RL comes mainly from three sources: parameters and optimizer states, the KV cache during sampling, and activations from long trajectories. Freezing the vision tower and the sparse attention indexer and updating only the language backbone (including the multi-token prediction layers) is a direct way to shrink optimizer states and communication volume.

    Engineering practice usually also requires: pooling sampling and training resources with elastic scheduling so idle cards are reclaimed for sampling; chunking and recomputation for long trajectories, trading compute for memory; and pairing high-precision master weights with low-precision sampling to control drift. If heterogeneous workloads like these run on a cloud container platform with elastic container instances, together with object storage for persisting checkpoints and datasets and logging and monitoring services for tracking reward and throughput, the operational burden can be reduced significantly — these are general-purpose capabilities, and implementations differ across providers.

    4. Evaluation and Cost Accounting: Comparability Is the Lifeline of Any Conclusion

    The place where cross-system comparisons most easily go wrong is the accounting convention. Three things are worth fixing: first, keep the evaluation framework and tool permissions identical, and average over multiple trials instead of taking the best; second, convert cost using the same pricing method, billing self-hosted models at public prices to avoid the illusion that “self-hosted means free”; third, report accuracy and cost separately and give the Pareto frontier rather than a single point. Example:

    1. System Pass@1↑ Cost per task↓
    2. Strong closed (max effort) ~46% 30x baseline
    3. Strong closed (standard) ~40% 8x baseline
    4. This approach (self-hosted) ~46% 1x baseline
    5. Base model (untrained) ~25% 0.9x baseline

    5. Reproducibility Checklist and Conclusion

    To reproduce a similar path with limited compute, proceed in order: first do an environment audit and difficulty bucketing, then unify the training and evaluation frameworks, then validate the stability of the RL recipe at small scale (ratio distributions, entropy, length normalization), and finally scale up to full-parameter training while keeping the complete recipe and random seeds. The conclusion is clear: the cost-effectiveness bottleneck of agent capability depends more on environment quality, sampling–training consistency, and evaluation conventions than on simply stacking more cards.