Availit World How AI really works, in your language

Lesson 20 of 4616 minFacts checked October 20, 2026

Post-training: from text predictor to assistant

A base model knows a lot but behaves like autocomplete. Post-training turns it into something you can talk to: it follows instructions, uses tools, writes in a steady style and thinks before it answers. It takes far less computation than pretraining, but it is where a model’s usefulness is shaped, and its recipes are the most closely guarded part of AI.

In this lesson you will

  • Name the main stages of post-training and what each one teaches
  • Explain supervised fine-tuning, and why the loss covers only the assistant’s words
  • Explain reward models, RLHF and DPO in plain words, with their formulas
  • Explain distillation, and how agent skills are trained with synthetic tools
On this page
  1. The stages, at a glance
  2. Supervised fine-tuning: learning by example
  3. Preferences: learning what people like
  4. Rewards you can check
  5. Distillation: the big model teaches the small ones
  6. Training agents: synthetic tools and worlds
  7. A real recipe: Qwen3
  8. Remember
  9. Check yourself

The stages, at a glance

A typical post-training pipeline
  1. Base modelFresh from pretraining: knows a lot, continues any text
  2. Supervised fine-tuning (SFT)Learn from examples of good conversations
  3. Preference tuningLearn which of two answers people (or a judge model) prefer
  4. Reinforcement learning with checkable rewardsPractise on problems with right answers: maths, code, instructions
  5. DistillationThe finished big model teaches smaller ones

Labs combine and repeat these steps differently. Meta ran six rounds for Llama 3, each time collecting new data from the latest model. DeepSeek-V3.2 spent more than 10 % of its pretraining cost on post-training, a share that keeps growing because reinforcement learning keeps paying off.

Supervised fine-tuning: learning by example

Supervised fine-tuning (SFT, also called instruction tuning) continues training the base model on example conversations, each written in the chat template you met in the tokens lesson. The training is the same next-token prediction as before, with one change.

One SFT example
  1. System prompt

    You are a helpful assistant. Answer briefly.

  2. You

    How many minutes are in a day?

  3. Model

    24 hours × 60 minutes = 1,440 minutes.

The loss is counted only on the assistant’s tokens. The model reads the system prompt and the question, but it is not trained to predict them: it is trained to predict the answer. It learns to respond, not to imitate users.

Quick check

In SFT, why is the loss counted only on the assistant’s part?

Show the answer

Answer: So the model learns to write answers, not to predict what users will type The goal is a model that answers well. Training on the user’s words would teach it to write questions too.

Today most SFT data is written by models, not people. A common method is rejection sampling: let a strong model write many answers to each prompt, score them with checks or a judge model, and keep only the best.

Preferences: learning what people like

Writing a perfect answer is hard. Choosing the better of two answers is easy, and fast. So labs collect preference pairs: a prompt, two answers, and which one a person preferred.

A reward model learns to score answers
P(A is preferred over B) = σ(r(A) − r(B))

r gives each answer one score. σ (the sigmoid) turns the gap between two scores into a chance. Training pushes the preferred answer’s score above the other’s.

r(A) = 2.0, r(B) = 0.5 → σ(1.5) ≈ 0.82

The reward model is 82 % sure that people prefer A.

  1. RLHF (reinforcement learning from human feedback): the assistant writes answers, the reward model scores them, and an RL algorithm (usually PPO) nudges the assistant towards higher scores. A penalty keeps it close to where it started, so it does not drift into strange text that only fools the reward model. InstructGPT’s 1.3B model trained this way was preferred to the 175B GPT-3: over 100 times smaller.
  2. DPO (direct preference optimisation, 2023) skips the reward model and the RL loop. It trains directly on the pairs: make the preferred answer more likely and the rejected one less likely, compared with a frozen copy of the starting model. It is simple and stable, and became widely used for open models. Llama 3 used SFT, rejection sampling and DPO rather than PPO, which Meta found “less stable and harder to scale”.
DPO in one line
loss = −log σ( β × [ (log π(good) − log π_ref(good)) − (log π(bad) − log π_ref(bad)) ] )

π is the model being trained, π_ref the frozen copy. The loss falls when the model raises the good answer’s probability, relative to where it started, more than the bad one’s. β sets how far it may move.

Which kind of training data is each one?

0 of 6 sorted
  • A prompt with one well-written answer

    Answer: SFT example

  • Two answers to the same prompt, with the better one marked

    Answer: Preference pair

  • A maths problem whose final answer can be compared with the right one

    Answer: Checkable reward

  • A coding task with tests that pass or fail

    Answer: Checkable reward

  • A conversation written in the chat template, to imitate

    Answer: SFT example

  • A person’s choice between two summaries

    Answer: Preference pair

Rewards you can check

For many tasks, there is no need to ask anyone’s opinion: the answer can be checked. The Allen Institute named this reinforcement learning with verifiable rewards (RLVR) in its fully open Tülu 3 recipe: the model gets a reward only when its answer is verifiably correct.

Checkable rewards
TaskThe check
A maths word problemDoes the final number match the known answer?
A coding problemDo the hidden tests pass?
“Answer in exactly three bullet points, without the letter z”Count the bullets, search for z
A logic puzzleDoes the solution satisfy every rule?
An agent task in a sandboxIs the file, database or web page in the right state at the end?

Because checks need no people, this kind of training can be scaled almost without limit. It is the engine behind reasoning models like DeepSeek-R1, and the whole of the next lesson.

Distillation: the big model teaches the small ones

Training every small model through every stage is expensive. Instead, labs finish one big model, then let it teach smaller ones. This is distillation.

Off-policy distillation

  • The teacher writes answers; the student learns to copy them, like SFT
  • Simple, and works with only the teacher’s text
  • How DeepSeek made its R1-distilled Qwen and Llama models

On-policy distillation

  • The student writes its own answer; the teacher scores every token
  • The student learns from its own mistakes, as in RL
  • Needs the teacher’s full next-token probabilities

Training agents: synthetic tools and worlds

To use tools well, a model needs practice with tools, and there are not many real conversations of agents using tools. So labs build them. Kimi K2’s pipeline is a good example.

  1. Collect tools. Over 3,000 real MCP tools from GitHub, plus more than 20,000 synthetic tools invented across domains such as finance, software and robot control, each with a clear description and interface.
  2. Make agents and tasks. Thousands of different agents, each with its own system prompt and set of tools, and tasks with rubrics that say what success looks like.
  3. Simulate the work. Models play the agent, the user and the tools, producing long multi-step conversations.
  4. Filter. A judge model checks each run against its rubric; only the successful ones become training data. Coding tasks run in real sandboxes instead of simulations.

A real recipe: Qwen3

  1. Long chain-of-thought cold start. SFT on carefully checked examples of long, step-by-step reasoning in maths, code and logic.
  2. Reasoning RL. Reinforcement learning with checkable rewards on hard maths and coding problems.
  3. Thinking mode fusion. SFT on a mix of answers with and without reasoning, so one model can do both: think hard when asked, reply instantly when not.
  4. General RL. RL across many everyday tasks: following instructions, formats, agent use, and preferences.
  5. Distillation into the smaller models, as above.

Remember

  • Post-training turns a base model into an assistant. It costs much less than pretraining, but shapes almost all of the behaviour.
  • SFT trains on example conversations, with the loss counted only on the assistant’s tokens.
  • Reward models learn from preference pairs; RLHF optimises against them; DPO learns from the pairs directly.
  • Rewards can be fooled (reward hacking); checkable rewards (RLVR) avoid this where answers can be verified.
  • Distillation lets one big model teach smaller ones far more cheaply than training each one fully.
  • Agent skills come from synthetic tools, tasks and environments, filtered by judges and tests.

Words to know

Post-training
Everything done to a model after pretraining: SFT, preference tuning, RL and distillation.
Supervised fine-tuning (SFT)
Training on example conversations so the model learns to answer in the right way.
Rejection sampling
Generating many answers and keeping only the best ones as training data.
Preference pair
Two answers to the same prompt, with the better one marked.
Reward model
A model trained to score answers the way people would.
RLHF
Reinforcement learning from human feedback: improving a model against a reward model trained on human preferences.
PPO
Proximal policy optimisation: the classic RL algorithm used for RLHF.
DPO
Direct preference optimisation: learning from preference pairs without a separate reward model.
RLVR
Reinforcement learning with verifiable rewards: rewards only for answers that can be checked as correct.
Reward hacking
When a model learns to please the reward rather than to do the task well.
Distillation
Training a smaller student model to match a bigger teacher model.

Go to the source

This lesson is built on these papers and documents. Paper links open arxiv.org, a separate site.

Check yourself

6 questions. Tap the answer you think is right.

0 of 6 answered

What does a base model usually lack?

Show the answer

Answer: The habit of answering and following instructions Pretraining gives knowledge. Post-training teaches the model to act as an assistant.

What is a preference pair?

Show the answer

Answer: Two answers to the same prompt, with the better one marked Choosing between two answers is much easier for people than writing a perfect one.

How is DPO different from RLHF with PPO?

Show the answer

Answer: DPO learns directly from the preference pairs, without a separate reward model or RL loop It turns the preference problem into a simple loss on the pairs, which is easier and more stable to train.

A reward model slightly prefers long answers. What may happen after training against it?

Show the answer

Answer: The assistant learns to write needlessly long answers This is reward hacking: the model optimises what the reward measures, not what we meant.

Which reward is “verifiable”?

Show the answer

Answer: Whether a program passes its tests Tests pass or fail, with no opinion involved.

What did Qwen gain by distilling its small models from the flagships?

Show the answer

Answer: Better scores with about a tenth of the GPU hours Learning from a strong teacher was both better and far cheaper than the full four-stage process for each small model.

Lesson complete

Answer every question above to complete this lesson.

Your progress is saved on this device only.

Next lessonReasoning models: teaching AI to think before it answers
Previous lesson All lessons

Choose your language