Post-training Scaling: Paths to Enhancing Coding and Agent Capabilities
As the returns from scaling pre-training data and compute diminish, the focus of large language model (LLM) development is shifting toward post-training scaling. This article explores how post-training scaling leverages verifiable rewards and long-horizon environments to enhance coding and AI agent capabilities. It covers core concepts, infrastructure requirements, evaluation metrics, implementation checklists, and common pitfalls in deploying this approach.
1. Why Focus on Post-training Scaling?
Historically, enhancing large language model capabilities relied heavily on data and compute investments during the pre-training phase. As base model sizes grow, the marginal gains from simply expanding parameters and corpora are declining, prompting the industry to focus more on the post-training phase.
The advantage of the post-training phase lies in its ability to design interactive tasks for specific capabilities, allowing the model to learn through repeated interactions with an environment. Tasks like coding, terminal operations, software engineering, and security analysis share a common characteristic: their outcomes can be evaluated programmatically. Whether code compiles, tests pass, or the system state is correct after executing a command—all these have explicit standards. Verifiable results provide reliable reward signals for reinforcement learning (RL), which is the fundamental premise of post-training scaling.
2. Core Concepts
Understanding this approach requires aligning on several key terms:
- Post-training Scaling: Increasing the quantity and diversity of training environments, extending the interaction length of individual tasks, and increasing RL compute investment on an existing base model.
- Long-horizon Environment: Task scenarios requiring multi-step operations to complete. The model must sequentially execute actions, read feedback, and revise its plans, rather than outputting a single answer.
- Verifiable Reward: A score given by a program based on objective criteria after a task concludes, such as test case pass rate, output consistency with expectations, or target state achievement.
- Verifier: The program module responsible for making the above judgments. The accuracy of the verifier directly determines the quality of the reward signal.
3. Four Key Stages of the Approach
3.1 Scaling Task Environments
The number of environments is a superficial metric; what truly impacts performance is coverage and difficulty distribution. In practice, note the following:
- Cover multiple programming languages, frameworks, and OS configurations to prevent the model from overfitting to a specific environment.
- Control the difficulty gradient. Tasks that are too simple provide no learning signal, while unsolvable tasks are equally ineffective.
- Run each environment in an isolated sandbox, restricting network access and file system permissions to prevent training processes from affecting external systems.
3.2 Automated Verifier Construction
Manually writing verification logic is costly and struggles to cover long-tail scenarios. A common practice is to extract test cases, build scripts, and execution logs from existing code repositories to automatically generate verification rules.
The verifier itself must be tested. If the verifier has vulnerabilities, the model might learn to exploit the judgment logic to achieve high scores without actually completing the task—a phenomenon often called reward hacking. Countermeasures include manual sampling and reviewing of verification results, cross-validation using multiple independent judgment methods, and continuously monitoring the deviation between reward scores and independent evaluation results.
3.3 Reinforcement Learning Infrastructure
Long-horizon tasks generate lengthy trajectories, making sampling and training significantly less efficient than short-text training. Engineering optimizations generally include:
- Decoupling sampling from parameter updates to enable parallel execution of environments and gradient computation.
- Segmenting long trajectories for storage and supporting asynchronous returns to reduce memory footprint and wait times.
- Monitoring reward curves, task success rates, timeout rates, and abnormal termination rates to detect training degradation promptly.
3.4 Evaluation and Pre-release Review
Training and evaluation datasets must be strictly isolated; otherwise, evaluation scores cannot reflect true capabilities. For high-risk capabilities involving cybersecurity or system operations, red teaming is required before release to clarify access permissions and usage boundaries. The stronger the capability, the more indispensable the review process becomes.
4. Observational Metrics for Capability Improvement
When evaluating post-training effects, it is recommended to track metrics by task category rather than relying on a single total score.
- Terminal Control: Completion rate of multi-step command tasks and error recovery capability (e.g., whether the model can correctly diagnose and retry after a command error).
- Software Engineering: Pass rate of fixing defects in real codebases, along with tracking whether the modification scope is reasonable and if new regression issues are introduced.
- Security Analysis: Accuracy of identifying vulnerabilities and assessing risks in authorized environments, focusing on whether the model distinguishes between defensive and offensive purposes.
- Stability: The variance of results across multiple runs of the same task, reflecting the reproducibility of the model’s behavior.
5. Example Code: Verifiable Reward Loop
The following code illustrates the basic process in RL sampling. The interfaces are illustrative; actual projects need adjustments based on their own frameworks.
def run_episode(policy, env, max_steps=50):"""Execute a complete interaction trajectory and return the reward."""obs = env.reset()for _ in range(max_steps):action = policy.act(obs)obs, done = env.step(action)if done:breakreturn env.verify() # Returns 0/1 or a continuous scoredef collect_batch(policy, task_pool, batch_size):"""Sample a batch of trajectories from the task pool for subsequent parameter updates."""batch = []for task in task_pool.sample(batch_size):env = task.make_sandbox() # Isolated execution environmenttry:reward = run_episode(policy, env)batch.append((env.trajectory(), reward))finally:env.close() # Release resources regardless of success or failurereturn batch
This code features two notable design points. First, finally ensures the sandbox is released even in exceptional cases, preventing resource leaks. Second, the verification result is provided by the environment itself, not output by the policy model, reducing bias caused by the model judging itself.
6. Implementation Checklist
When advancing similar solutions within a team, check the following items:
- Are training variables controllable, and is a control experiment with the unmodified base model retained?
- Has the false positive rate of the verifier been statistically sampled and recorded?
- Do the network access and file permissions of the sandbox follow the principle of least privilege?
- Have training and evaluation data been deduplicated and isolated?
- Are the environment versions, task configurations, and hyperparameters used in each training round traceable?
7. Common Pitfalls
Equating reward scores with capability improvement. Rising rewards might stem from verifier vulnerabilities; an independent evaluation set is needed for confirmation.
Pursuing only environment quantity. When environment duplication is high, the gains from adding more vanish quickly. Diversity matters more than quantity.
Ignoring error accumulation in long horizons. In multi-step tasks, minor errors at each step compound. During evaluation, observe intermediate step states, not just the final result.
Neglecting safety boundaries. As capabilities improve, the risk of misuse increases. Permission controls and release reviews should be planned in tandem with training investments.
