▶ Sign up free for the video, slides & prompts
The lesson below is open to all. Enter your email once to unlock every video, slide deck, prompt and code example on this device.
Checking…
How LLMs Really Work · Lesson 5 of 15 · 2 min read · 5 min video
Pre-training, fine-tuning and RLHF
The three stages that turn raw internet text into a helpful assistant.
📄 Download slides (PDF)· free sign-upA raw transformer starts with random weights and knows nothing. Three stages turn it into a helpful assistant, and knowing them explains a lot about how models behave.
Stage 1: Pre-training
The model reads a huge amount of text (web pages, books, code, papers) and practises one task: predict the next token.
- Every sentence becomes thousands of free practice questions, with no human labels needed
- To get good at prediction, the model has to absorb grammar, facts, style and reasoning patterns
- This takes thousands of GPUs for weeks or months, and most of the total cost
The result is a base model. It's knowledgeable but not helpful. Ask it "What is the capital of Andhra Pradesh?" and it might continue with three more quiz questions, because that's what text on the internet often looks like.
Stage 2: Supervised fine-tuning (SFT)
Next, the model trains on tens of thousands of example conversations written or checked by people: a question, then an ideal answer.
- It learns the format of being an assistant: answer the question, follow instructions, stay on topic
- It's far cheaper than pre-training, since the knowledge is already there
Stage 3: Preference tuning (RLHF and friends)
Some qualities are easier to judge than to write: helpfulness, honesty, safety, tone. So:
- The model writes several answers to the same prompt
- People (or a trained judge) rank them
- A reward model learns to predict those rankings
- The assistant is tuned with reinforcement learning to produce answers the reward model scores highly
This is RLHF: reinforcement learning from human feedback. Simpler variants such as DPO learn directly from the preference pairs without a separate reward model. Newer reasoning models also use reinforcement learning on problems with checkable answers, such as maths and code, to learn longer step-by-step thinking.
What this explains
- Knowledge cutoff: the model knows only what was in its pre-training data
- Confident mistakes: pre-training rewards fluent text, not truth
- Politeness and refusals: largely shaped in stages 2 and 3
- Why your fine-tuning is cheap: you're doing a small extra stage 2 on top of someone else's very expensive stage 1
In one line
Pre-training gives knowledge, supervised fine-tuning teaches the assistant format, and preference tuning (RLHF, DPO) shapes it to be helpful, honest and safe.
Share with a friend