The stages, at a glance
- Base modelFresh from pretraining: knows a lot, continues any text
- Supervised fine-tuning (SFT)Learn from examples of good conversations
- Preference tuningLearn which of two answers people (or a judge model) prefer
- Reinforcement learning with checkable rewardsPractise on problems with right answers: maths, code, instructions
- 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.
-
System prompt
You are a helpful assistant. Answer briefly.
-
You
How many minutes are in a day?
-
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
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.
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.82The reward model is 82 % sure that people prefer A.
- 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.
- 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”.
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?
-
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.
| Task | The check |
|---|---|
| A maths word problem | Does the final number match the known answer? |
| A coding problem | Do the hidden tests pass? |
| “Answer in exactly three bullet points, without the letter z” | Count the bullets, search for z |
| A logic puzzle | Does the solution satisfy every rule? |
| An agent task in a sandbox | Is 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.
- 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.
- 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.
- Simulate the work. Models play the agent, the user and the tools, producing long multi-step conversations.
- 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
- Long chain-of-thought cold start. SFT on carefully checked examples of long, step-by-step reasoning in maths, code and logic.
- Reasoning RL. Reinforcement learning with checkable rewards on hard maths and coding problems.
- 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.
- General RL. RL across many everyday tasks: following instructions, formats, agent use, and preferences.
- 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.
-
Training language models to follow instructions with human feedback (InstructGPT)
The paper behind the first ChatGPT-style models. Figure 2 shows SFT, reward model and PPO in three panels.
-
LIMA: Less Is More for Alignment
1,000 examples, and a clear argument that knowledge comes from pretraining.
-
Direct Preference Optimization: Your Language Model is Secretly a Reward Model
Read the derivation in Section 4 slowly: it is the most elegant idea in post-training.
-
Tülu 3: Pushing Frontiers in Open Language Model Post-Training
A complete, fully open recipe with data and code: SFT, DPO and RLVR.
-
The Llama 3 Herd of Models
Section 4 is a detailed industrial post-training pipeline, round by round.
-
Qwen3 Technical Report
Section 4: the four stages, thinking mode fusion and on-policy distillation.
-
Kimi K2: Open Agentic Intelligence
Section 3: synthetic tools and agents, verifiable rewards and self-critique rubrics.
Check yourself
6 questions. Tap the answer you think is right.
0 of 6 answered
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