QRS explainer · Large language models
Post-training
How a model that predicts the next word becomes an assistant that answers, follows instructions and reasons.
Pre-training teaches a language model what text looks like. Post-training reshapes what it chooses to say: first by imitating good answers, then by learning which of its own answers people prefer, and most recently by rewarding answers that can be checked.
The pipeline at a glance
The classic recipe runs left to right. The last column shows the two main departures from it.
-
Starting point
Pre-training
Predict the next token on a very large amount of text. Knowledge and skills, but no notion of answering.
History → -
Imitate
Supervised fine-tuning
Train on prompt–response demonstrations with the same next-token loss, counted on the response only.
SFT → -
Compare
Reward model
Fit a scalar score to human comparisons with the Bradley–Terry model: the preferred reply should score higher.
Reward model → -
Optimise
RL with PPO
Sample replies, score them, and push the policy towards high reward while a KL penalty keeps it near the SFT model.
PPO → -
Departures
DPO
Skip the reward model and the RL loop: a classification-style loss on preference pairs, derived from the same objective.
DPO → GRPO →RLVR and GRPO
Replace learned rewards with checkable ones (a correct maths answer, passing tests) and the critic with a group of samples.
What you will learn
- From task models to pre-train and adapt
ULMFiT, GPT-1, BERT, GPT-2, T5 and GPT-3, and the question they leave open.
- Supervised fine-tuning
The objective, derived; chat templates and loss masks; why a little data goes a long way.
- Learning from preferences
Why comparisons, the Bradley–Terry reward model, and reward hacking.
- Reinforcement learning, from scratch
MDPs, returns, policy gradients, value functions, Bellman equations, TD and GAE.
- RLHF in practice
Trust regions, PPO’s clipped objective, the InstructGPT pipeline and its limits.
- Beyond PPO
DPO, verifiable rewards, GRPO and DeepSeek-R1.
- In practice
The methods side by side, reported settings, memory costs, failure diagnosis, evaluation and open questions.
An explainer, not a QRS research project. The toy figures are illustrative; every other claim cites its source in the guide’s references.