Full-Parameter Reinforcement Learning with Limited Compute: An Open Training Recipe for High-Performance Terminal and Coding Agents

    This article examines how full-parameter reinforcement learning can improve terminal and software engineering agents without relying on extremely large models or prohibitively expensive inference. It explains the rationale for choosing reinforcement learning over distillation and parameter-efficient fine-tuning, then covers verifiable rewards, long-horizon trajectory processing, training stability, and the economics of success rate versus per-task cost. It concludes with practical guidance for engineering teams building terminal automation, coding, and infrastructure agents.

    1. The Performance–Cost Challenge in Agent Training

    In recent years, terminal-use and software engineering agents have become important applications for large language models. These agents must complete long-horizon tasks through repeated interaction with real environments: understanding requirements, planning steps, executing commands, reading feedback, and recovering from errors.

    The industry faces a persistent trade-off:

    • Performance-oriented approaches rely on very large foundation models and expensive inference, resulting in high per-task costs.
    • Cost-oriented approaches use smaller distilled models or prompt engineering to reduce expenses, but often suffer from lower task success rates.

    The practical value of an agent should not be measured by benchmark scores alone. It should be evaluated by its position on the two-dimensional success rate–per-task cost curve: whether it achieves the highest success rate at a given cost, or the lowest cost at a given success rate. In other words, the goal is to approach the Pareto frontier.

    A recent public study demonstrated another path. Starting with a general-purpose foundation model in the mid-to-large parameter range—from several billion to several hundred billion parameters—the researchers applied full-parameter reinforcement learning to a specialized task domain. Using only several dozen high-end accelerators over less than a week, they brought the agent’s first-attempt pass rate on terminal-operation benchmarks close to that of leading closed-source models, while reducing per-task cost by more than an order of magnitude.

    More importantly, the research team released the complete training recipe, giving the work significant value for reproducibility.

    2. Why Choose Full-Parameter Reinforcement Learning Over Distillation?

    Agent training currently follows three major technical approaches, each with different trade-offs.

    2.1 Behavioral Cloning: SFT and Distillation

    This approach learns from trajectories generated by a stronger model.

    Its advantages include stable training and relatively low cost. However, the performance ceiling is constrained by the teacher model. It is also difficult to learn robust error recovery, even though unexpected failures are common in long-horizon tasks.

    2.2 Parameter-Efficient Fine-Tuning

    Methods such as LoRA update only a small number of parameters, reducing the computational barrier.

    In practice, agent tasks often require simultaneous adaptation across several dimensions, including tool-call formatting, environment-state understanding, and multi-step planning. Low-rank adapters may not provide enough capacity for all of these changes.

    2.3 Full-Parameter Reinforcement Learning

    Full-parameter RL uses task completion as the primary reward signal, allowing the model to experiment and improve through interaction with the real environment.

    This approach can exceed the capability of the teacher model and naturally encourages the development of error-recovery behaviors.

    The central premise of the study is that full-parameter RL is particularly valuable for terminal and coding tasks because these tasks have:

    • Clear rewards: task completion can be verified automatically;
    • Dense interaction: the agent must repeatedly act and observe feedback;
    • Long trajectories: successful completion may require many steps.

    For this class of problems, the benefits of full-parameter RL can outweigh the additional training complexity. The results support this view: after RL training, the model achieved a substantial improvement over the base model on the same benchmark, and the gains transferred to multiple software engineering benchmarks.

    3. Key Technical Components of the Training Recipe

    3.1 Building Verifiable Rewards with RLVR

    Terminal tasks are naturally suited to verifiable rewards because they usually include test scripts that can automatically determine whether the task was completed successfully.

    This helps avoid a common problem in RLHF: reward hacking, where the model discovers ways to exploit weaknesses in the reward model instead of solving the intended task.

    Important implementation principles include:

    • Use binary rewards as the default: assign 1 when the task passes and 0 otherwise. This avoids introducing bias through overly complicated intermediate rewards.
    • Add anti-cheating checks: prevent the model from modifying test scripts, skipping validation, or using other shortcuts to obtain rewards. Verification logic should be isolated within the environment.
    • Handle timeouts and failures explicitly: infinite loops, environment crashes, and similar conditions should be marked as failed samples and terminated to prevent contaminated training signals.

    3.2 Processing Long-Horizon Interaction Trajectories

    A single terminal-task trajectory may contain dozens or even hundreds of interaction turns. This creates challenges for RL infrastructure and data handling.

    Key techniques include:

    • Segmented trajectory sampling: split complete environment interactions by turn or segment and decouple them from the model-training loop, preventing environment execution from blocking training.
    • Experience replay and asynchronous environments: use many parallel sandbox environments to generate trajectories asynchronously and increase sample throughput.
    • Context management: when a trajectory exceeds the model’s context window, use summarization or state-compression strategies to preserve critical information instead of simply truncating intermediate steps.

    A simplified training loop can be represented as follows:

    1. for step in range(total_steps):
    2. # Sample interaction trajectories asynchronously from sandbox environments
    3. trajectories = env_pool.sample(batch_size)
    4. # Compute verifiable rewards using task test scripts
    5. rewards = [verify(task, traj) for traj in trajectories]
    6. # Perform full-parameter policy-gradient updates, such as PPO or GRPO
    7. loss = policy_gradient_update(model, trajectories, rewards)
    8. # Periodically evaluate on held-out tasks to monitor generalization and reward hacking
    9. if step % eval_interval == 0:
    10. evaluate(model, heldout_tasks)

    3.3 Maintaining Training Stability

    Full-parameter RL can cause training collapse or capability degradation. The public recipe highlights several engineering techniques for controlling these risks:

    • A small learning rate and gradient clipping: compared with SFT, the learning rate during the RL stage is typically lower by an order of magnitude.
    • KL regularization: constrain the policy from drifting too far from the reference model, helping preserve general capabilities such as code understanding and instruction following.
    • Curriculum-based task difficulty: begin with short trajectories and lower-complexity tasks, then gradually introduce longer-horizon tasks to increase the proportion of useful training samples.

    4. The Economics of Performance and Cost

    One of the most instructive aspects of the study is that it includes deployment cost in the evaluation framework.

    The approximate per-task cost of an agent can be expressed as:

    Per-task cost ≈ average number of interaction turns × tokens per turn × price per token

    Because the team deployed the model themselves, its inference price was substantially lower than the API pricing of closed-source models. In addition, RL training helped the agent complete tasks in fewer turns and produce less redundant output.

    As a result, per-task cost was reduced by more than 30 times compared with a leading closed-source model operating at its highest inference-effort setting, while the first-attempt pass rate remained at a comparable level.

    This leads to several important conclusions:

    • A stronger foundation model is not necessarily the best solution for agent workloads. Targeted RL training can create an order-of-magnitude advantage in cost.
    • Self-hosting combined with a mid-sized model can provide differentiated advantages in latency, throughput, and cost compared with extremely large models.

    These findings should still be interpreted carefully. The comparison depends on pricing assumptions based on publicly available rates. Actual costs will vary across deployment environments according to hardware utilization, concurrency, and workload patterns. Teams should recalculate the economics using their own operating conditions.

    5. Practical Lessons for Engineering Teams

    1. Start with task domains that have verifiable outcomes. Terminal operation, automated testing, and code repair all provide relatively clear reward signals and are among the most cost-effective starting points for RL training.

    2. The compute barrier may be lower than expected. Several dozen high-end accelerators and a training cycle measured in days suggest that mid-sized teams may be able to reproduce this type of work. Container platforms, monitoring, and alerting can support a sustainable training pipeline.

    3. Evaluate both success rate and cost. Reporting only success rate or only cost can lead to misleading decisions. Teams should build a joint success-rate and cost dashboard and average results across multiple trials to reduce the effect of randomness.

    4. Focus on the complete recipe rather than isolated tricks. Verifiable reward design, long-trajectory processing, and stability control are all essential. Weakness in any one of these areas can cause training to fail.

    5. Treat transfer learning as a hypothesis to validate. The study indicates that RL improvements on terminal tasks can transfer to software engineering benchmarks. Teams should nevertheless evaluate held-out data from their own business domain to avoid overestimating generalization.

    6. Conclusion

    This public training recipe demonstrates that competition in the agent era is not simply about building the largest foundation model. It is also about making the reinforcement-learning loop for verifiable task domains faster, more stable, and more cost-efficient.

    For teams developing terminal automation, intelligent operations, coding agents, or related applications, a combination of clear reward signals, full-parameter RL, and self-hosted inference may create a meaningful engineering advantage across both performance and cost.

    A practical starting point is to select a small, well-defined task domain, reproduce the core training process, and use measured results to determine how well this approach fits the team’s own environment.