Low-Cost Training of a 300B Coding Agent: Engineering Practices and Evaluation

    This article analyzes a recent case in which a research team trained a 300B-parameter terminal and coding agent using full-parameter reinforcement learning on 64 high-end data center accelerators in under five days. It breaks the case down into three general engineering problems: obtaining a usable agent with less compute, designing trustworthy evaluation, and converting training gains into lower inference cost. The discussion covers why terminal and software engineering tasks suit reinforcement learning, key cost drivers such as base model choice, sandbox environments, task curricula, and reward design, as well as a four-layer evaluation framework and a minimal reproducible practice path. Readers will find practical guidance on reducing per-task cost by an order of magnitude while keeping Pass@1 flat.

    1. The Problem: The Agent Capability Race Is Becoming a Cost-Efficiency Race

    Over the past year, terminal-operation and software-engineering agents have become one of the core scenarios for large model deployment. Unlike single-turn question answering, these agents must make multi-step decisions in real or simulated environments: reading repository structure, locating defects, writing patches, running tests, and iterating on errors until the task is complete. The capability ceiling is determined jointly by model reasoning and tool calling, but real-world usability is determined by cost per task.

    A representative piece of work from industry recently sent a strong signal. A research team started from an open-source-style general-purpose base model and used full-parameter reinforcement learning to train a 300B-parameter-class terminal and coding agent. The model reached 46.2% Pass@1 on a mainstream terminal task benchmark, putting it in the same range as several of the strongest closed-source general models. More importantly, under the highest reasoning-effort configuration, its cost per task was more than 30x lower than the compared approach. Transferability was also validated: the model achieved comparable gains on two additional software engineering benchmarks focused on real repository-level defect repair.

    The training resource consumption is equally notable. The entire pipeline used only 64 high-end data center accelerators and took less than five days, and the team published the complete training recipe. This article does not evaluate any specific product. Instead, it abstracts the case into three general engineering questions: how to obtain a usable agent with less compute, how to design trustworthy evaluation, and how to turn training gains into an inference cost advantage.

    2. Why Terminal and Coding Tasks Are an Ideal Testbed for Reinforcement Learning

    2.1 Verifiable outcomes and naturally available reward signals

    Software engineering tasks have relatively objective acceptance criteria: whether unit tests pass, whether static checks report errors, and whether commands return the expected exit code. This means reinforcement learning does not depend on large amounts of human preference annotation. Execution results can serve as the reward source, which significantly reduces labeling cost and leaves less room for reward models to be gamed.

    2.2 Long trajectories and sparse feedback, but clear structure

    A typical task may involve dozens of tool calls. The reward is given only at the final stage, which makes this a sparse-reward problem. However, the trajectory itself has a clear phase structure (explore, locate, modify, verify), which provides entry points for reward shaping, curriculum learning, and process supervision.

    2.3 High demands on executability

    Unlike text generation, a patch produced by an agent must be accepted by a real interpreter, compiler, and test framework. This hard constraint gives the training process a built-in error-correction loop, and the model quickly converges to an executable format through repeated failures.

    3. Key Engineering Elements of Low-Cost Training

    3.1 Base model selection and full-parameter reinforcement learning

    The approach did not pretrain from scratch. It selected a base model with roughly 300B parameters and already strong general capability, then applied full-parameter reinforcement learning. Compared with training only a few adapter layers, full-parameter training allows deeper changes in long-trajectory decision making, tool-call formatting, and error recovery strategies. The cost is higher memory and communication overhead, which requires careful parallel and scheduling design.

    The illustrative training loop logic is as follows (pseudocode, expressing the flow only):

    1. for step in range(total_steps):
    2. batch = rollout(policy, env_pool, n_samples=8) # parallel sampling across multiple environments
    3. rewards = run_tests(batch) # use execution results as the reward
    4. advantages = normalize(whiten(rewards))
    5. loss = policy_loss(batch, advantages) + kl_penalty(policy, ref)
    6. loss.backward()
    7. optimizer.step()

    In engineering practice, success is usually determined not by the formula but by sampling throughput, environment concurrency, failed-trajectory reuse, memory sharding strategy, and checkpoint frequency.

    3.2 Environments and sandboxes: an underestimated cost center

    Terminal-style training requires many isolated environments: containerized repository snapshots, preinstalled dependencies, restricted networking, and one-click rollback. If environment preparation is slow, accelerators sit idle much of the time. Common optimizations include layered image caching, pre-baked dependencies, per-task pool scheduling, timeout and resource quota limits, and including environment startup time in the overall cost model.

    3.3 Data and task curriculum

    The difficulty distribution of tasks directly determines the learning curve. An easy-to-hard curriculum works well: start with single-file defect repair, then move to cross-file refactoring, and finally to tasks that require running a full test suite. Set sampling caps for overly long or overly difficult tasks to avoid wasting compute.

    3.4 Reward design: avoiding “tests pass but the implementation is poor”

    Using test passage alone as the reward can lead to overfitting the tests or hardcoding inputs and outputs. A common approach is to add a patch-size penalty, a repeated-modification penalty, static-check constraints, and a small amount of human or rule-based validation, forming a multi-objective reward.

    4. Evaluation: Why a Single Score Is Not Enough

    The work used one terminal task benchmark and two repository-level software engineering benchmarks for cross-validation, which is well worth borrowing. Evaluation design should focus on four layers of metrics:

    • Effectiveness layer: Pass@1 and Pass@k, reflecting single-attempt success rate and the ceiling of multiple samples;
    • Efficiency layer: average number of tool calls, average elapsed time, and context consumption;
    • Cost layer: variable inference cost per task, which is strongly correlated with sample count, context length, and reasoning effort;
    • Robustness layer: variance across different repository sizes and language ecosystems.

    It is important to note that a higher Pass@1 does not automatically mean lower cost. If effectiveness is bought by increasing the number of samples, cost rises linearly. The value of this case is that effectiveness stayed flat while cost dropped substantially, indicating that the optimization focus was on the inference strategy and the decision efficiency of the post-trained model itself, rather than on piling up samples.

    5. General Approaches to Cutting Per-Task Cost by an Order of Magnitude

    1. Reduce wasted trajectories: the post-trained model tends to go directly to key files and searches less blindly;
    2. Control reasoning effort and context: summarize repository information in layers and expand file content on demand;
    3. Caching and reuse: dependency resolution, index building, and test environment initialization results can be cached;
    4. Batching and concurrent scheduling: turn sampling, execution, and evaluation into a pipeline to improve resource utilization;
    5. Cost observability: record token usage, execution time, and environment overhead for each task to build a cost dashboard that supports regression tracking.

    To deploy this on your own platform, you can combine general cloud capabilities: use a container platform to host isolated environments, object storage to keep repository snapshots and checkpoints, logging and monitoring with alerting to track task success rate and cost fluctuations, and a message queue for task distribution and peak shaving.

    6. A Minimal Reproducible Practice Path

    1. Pick one or two executable evaluation sets and first run a “zero-training” baseline, recording effectiveness and cost;
    2. Build a sandbox pool and measure the share of time spent on environment startup and execution;
    3. Start with small-scale full-parameter training or efficient fine-tuning to verify that the reward signal is learnable;
    4. Introduce a curriculum and multi-objective rewards, and watch how Pass@1 and average step count change together;
    5. Establish cost regression: any effectiveness gain must come with a change in per-task cost.

    7. Conclusion

    The core lesson from this case is not a specific model score but the methodology: on verifiable tasks, using execution results as the reward, an engineered sandbox as the foundation, and full-parameter reinforcement learning as the method, it is possible to obtain near-top-tier agent capability within a very small compute budget and convert that advantage into a substantial reduction in per-task cost. For enterprises, the real barrier has shifted from “whether compute is available” to “whether there are high-quality executable tasks, stable sandboxes, and a cost-observability system”.