RLHF & Alignment
6 min read.
Walk through the full alignment pipeline — supervised fine-tuning, reward model training, and PPO — then see how DPO simplifies this by removing the RL loop entirely, and explore the failure modes that can make aligned models misbehave.
Think of it this way: Pretraining produces a brilliant but unconstrained intern. SFT gives them a style guide. RLHF is running thousands of simulated performance reviews — the intern maximizes for your feedback score. DPO skips the simulation: you directly express preferences ("I liked answer A better than B") and math does the rest.
- 1PretrainingNext-token prediction on internet-scale text.A raw language model: fluent but uncontrolled.
- 2SFTSupervised fine-tuning on high-quality (instruction, response) examples.A well-behaved baseline policy, π_SFT.
- 3Reward modelTrain a reward model on human preference pairs: σ(RM(yw) − RM(yl)).RM(x, y) gives a scalar reward.
- 4PPO / RLHFMaximize E[RM(x, y)] − β·KL(πθ || π_SFT).An aligned policy: helpful, harmless, honest.
Check your understanding
Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.
The RLHF pipeline
Order the three training stages and what feeds them.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
- 6Drop a step here
Quiz
20 questionsWhat does RLHF stand for?
Done with this lesson?
Sign in free to keep your progress, streak and quiz scores.