LLM Post-Training and AI Agent Runtime: A Technical Deep Dive
This article examines two core tracks in LLM capability evolution: post-training, which reshapes the model's probability distribution, and the agent runtime, which organizes model capabilities into actions. It explains supervised fine-tuning, reinforcement learning, and online policy distillation from a distribution-reconstruction perspective, discusses reusing a base model to scale post-training, and outlines a layered, pluggable runtime design with practical deployment advice.
1. Introduction: Two Fronts for Capability Gains
The evolution of LLM capabilities is increasingly unfolding along two relatively independent paths. The first is post-training on the weights side, which unlocks the base model’s potential by further reshaping its parameter distribution. The second is the runtime on the system side, which organizes existing capabilities into a usable agent through scheduling, tool calls, and context management. The former determines what the model knows how to do; the latter determines whether it can actually get things done.
Discussing both in one article makes sense because they often appear together in engineering practice. A new model produced by post-training needs a stable, scalable runtime to carry it, while the failure modes exposed by the runtime in turn define the data and reward design for the next round of post-training.
2. What Post-Training Really Does: Reconstructing a High-Dimensional Sequence Distribution
Viewing a language model as a high-dimensional probability distribution defined over token sequences is the simplest starting point for understanding the differences among post-training paradigms. After pre-training, a base model already has a “broad and flat” distribution: it can generate a bit of anything, but the peaks do not necessarily land where humans expect. Post-training is not simply about “adding new knowledge” to the model; it is a targeted reshaping of this distribution that changes how probability mass is allocated.
2.1 Supervised Fine-Tuning: Shifting Density Toward the Target Distribution
Supervised fine-tuning provides a set of positive samples, and its optimization objective is equivalent to maximizing the log-likelihood of the model on those samples. From a distribution perspective, it moves probability mass toward the regions covered by the labeled data while pushing down other regions. Its strengths are stable convergence and simple implementation. Its weaknesses are equally clear: it only tells the model where to go, not where not to go, so the model can become overconfident outside the labeled distribution and is highly sensitive to the labeling style.
2.2 Reinforcement Learning: Reordering Peaks with Relative Preferences
Reinforcement learning based on human or rule-based feedback no longer relies on a token-by-token ground truth. Instead, it assigns a scalar evaluation to an entire output. It optimizes expected return and is usually paired with a divergence constraint against a reference model to keep the distribution from becoming too peaked. In distribution terms, the model keeps the overall support set unchanged while readjusting the relative height of each region so that high-return regions become the new peaks. These methods excel at objectives that are hard to express with token-level labels, such as format, preference, and verifiable correctness.
2.3 Online Policy Distillation: Using an External Distribution as the Teacher
The third paradigm has the current model fit the distribution given by a stronger teacher model on trajectories sampled from itself, typically aligned token by token. Its defining feature is that it is online: the student generates its own samples, the teacher immediately provides a better conditional distribution, and the student moves toward it. Compared with offline imitation, it covers the states the student will actually reach, mitigating the mismatch between training and inference distributions. Compared with pure reinforcement learning, it provides higher information density because the teacher gives a full distribution rather than a single score.
2.4 Engineering Trade-Offs Among the Three Paradigms
A common combination in practice is to first run instruction fine-tuning to establish a usable baseline, then apply reinforcement learning with verifiable rewards to raise accuracy and format stability, and finally use online distillation to transfer the reasoning habits of a stronger model into a smaller one to control cost. It is worth stressing that no paradigm should fabricate gains: real results depend on data quality, whether the reward design is verifiable, and whether the training and inference configurations are consistent.
# Pseudocode: an abstraction of three post-training objectives in one training loopfor batch in loader:if stage == "sft":loss = -logprob(model, batch.prompt, batch.target)elif stage == "rl":loss = -advantage(batch) * logprob(model, batch.prompt, batch.response)elif stage == "distill":loss = kl(logprob(model, batch.prompt, batch.sampled),logprob(teacher, batch.prompt, batch.sampled))loss.backward(); optimizer.step()
3. Scaling Post-Training by Reusing the Base Model
One notable engineering trend is that the capability leap of a new-generation model does not necessarily come from retraining the base model. Reusing the same large-scale sparse mixture-of-experts base architecture (for example, a total parameter count in the hundreds of billions, with only a small fraction activated per forward pass) and concentrating the compute budget on post-training often yields more controllable cost-performance. This approach requires a base model that is already strong enough and a mature post-training pipeline. The risk is that a base-model bottleneck limits the ceiling of all downstream tasks at once, so evaluations need to separate the gains from post-training from the base model’s inherent capabilities.
4. The Agent Runtime: Organizing Model Capabilities into Actions
4.1 Why a Separate Runtime Layer Is Needed
A model only decides what to output next, while an agent needs loops, state, tools, and permissions. Hard-coding this logic into business code leads to a three-way bind: switching models requires a rewrite, adding tools changes the main flow, and reproducing a failure is nearly impossible. The value of a runtime layer is to extract these cross-cutting concerns into stable contracts.
4.2 Layered Design
A lightweight, pluggable runtime typically has five layers: a session and context management layer (handling history compression, summarization, and retrieval injection), a model adapter layer (unifying calls and streaming output across different inference interfaces), a tool registration and execution layer (declarative tool descriptions, parameter validation, timeouts, and retries), a policy and permission layer (deciding when write operations are allowed and whether human confirmation is needed), and an observability layer (structured logs, tracing, metrics, and alerts).
interface Tool { name: string; schema: object; run(input: unknown): Promise<string>; }interface Runtime { register(t: Tool): void; step(session: Session): Promise<Step>; }// Key constraint: tool execution must support timeouts, retries, and auditing
4.3 Criteria for True Pluggability
To judge whether a runtime is truly pluggable, look at three things: whether adding a tool requires no change to the main loop, whether swapping the model requires only a configuration change, and whether a failure can be reliably reproduced by replaying fixed inputs. If any one is missing, pluggability is merely tidiness in the directory structure.
5. Deployment Advice and Common Cloud Capabilities
On the training side, it is advisable to first establish a reproducible evaluation baseline and then gradually introduce more complex paradigms, avoiding a one-time stack that makes attribution difficult. On the system side, object storage can hold datasets and checkpoints, a message queue can decouple tool calls from the main flow, a container platform can host elastic inference, and logging and monitoring services can support problem diagnosis. In these scenarios, Baidu AI Cloud provides exactly these general-purpose capability categories, helping teams refocus on data and algorithms.
6. Conclusion
Post-training and the runtime are two sides of the same coin: the former reshapes the model’s distribution, and the latter organizes the model’s actions. Understanding the unified lens of “distribution reconstruction” takes the guesswork out of paradigm selection, while sticking to lightweight, pluggable, and observable runtime principles turns model iteration into real business usability.
