0:00Intro: MOFUSA Tech Academy
Welcome to MOFUSA Tech Academy. Beyond learning, towards mastery.
0:09Hook: a rambling base model vs an assistant
Here's a customer's message: "My mug arrived cracked. What should I do?" A pre-trained base model might drift off into what looks like a forum thread, or a product listing. It continues text; it doesn't help. After the first stage of post-training, it gives a polite, on-topic answer. After the second, it's concise and empathetic, offers the right next step, and doesn't make up policies it doesn't know. Post-training is so powerful that, in one well-known study, people preferred the answers of a tuned model with one point three billion parameters over a base model more than a hundred times larger.
Today: how it works. Supervised fine-tuning, reinforcement learning from human feedback, and a newer shortcut called D-P-O. Season Three, Module Eleven, stop three: post-training.
1:07The three-stage pipeline
Building an assistant usually takes three stages. Pre-training, from the last two episodes, gives a base model a broad knowledge of language from trillions of tokens. Supervised fine-tuning teaches it to follow instructions, using a much smaller set of high-quality example conversations. And preference tuning refines its behaviour using judgements about which answers are better. Think of it like training a new support agent. First they read everything in the library. Then they shadow an expert and copy good examples.
Then a coach reviews their answers and tells them which ones were better.
1:47Supervised fine-tuning (SFT)
Stage two, supervised fine-tuning, or S-F-T. We collect example conversations: a prompt, and an ideal response, written or checked by skilled people. Helpful explanations, clear support replies, working code, and polite refusals of harmful requests. Each conversation is wrapped in a chat template, with special tokens marking who's speaking: system, user, assistant. Then we train with exactly the same next-token loss as pre-training, but with one twist: we only count the loss on the assistant's words. We want the model to learn how to answer, not how to imitate the customer.
Quality matters enormously here. A relatively small set of excellent examples can teach the model the style and behaviour we want, because the knowledge is already there from pre-training. SFT mostly teaches the model how to use it.
2:46Why demonstrations aren't enough
Supervised fine-tuning has a limit: it can only be as good as the examples we can write, and writing the perfect answer to every possible question is slow and expensive. People also disagree about what "perfect" looks like. But people are much better, and more consistent, at comparing than at writing. Show someone two answers to the same question and ask which is better, more helpful, more honest, more appropriate in tone, and they can decide in seconds. So the next stage collects preferences: a prompt, a chosen answer and a rejected answer, many thousands of times.
3:27RLHF: reward model and reinforcement learning
The classic way to use preferences is reinforcement learning from human feedback, or R-L-H-F, and it has two steps. First, train a reward model: a copy of the language model with its output replaced by a single score, trained to give the chosen answers higher scores than the rejected ones. The standard formula says the probability that answer A is preferred over B is the sigmoid of the difference in their scores. If A scores two and B scores a half, the reward model says A wins with probability zero point eight two.
If people really did prefer A, the loss is small, zero point two. If they preferred B, it would be large, and the scores would be pushed the other way. Second, reinforcement learning. The assistant is the agent from Season One. It writes an answer, the reward model scores it, and a policy-gradient method, often P-P-O, nudges the model to make high-scoring answers more likely. Rewards, policy gradients, P-P-O: everything from episodes twenty-one and twenty-two, applied to language. There's one crucial safety rope: a penalty for drifting too far from the original fine-tuned model, measured by a quantity called KL divergence.
Without it, the model would quickly learn to exploit the reward model.
4:53Reward hacking and sycophancy
Remember reward hacking from episode twenty-one, the robot that drove back and forth to collect points? Language models do their own versions. If labellers tend to prefer longer answers, the model learns to pad its replies. If people like being agreed with, it learns to tell users they're right, even when they're not. That's called sycophancy. If confident-sounding answers win comparisons, it learns to sound sure even when it shouldn't be. The reward model is only an imperfect stand-in for what people actually want.
So teams use the KL penalty, careful guidelines for labellers, more diverse preference data, and, crucially, independent evaluations, which are the subject of Season Four.
5:43DPO: preferences without a reward model
RLHF works, but it's complicated: a separate reward model, a reinforcement learning loop that generates answers during training, and many settings to tune. In two thousand twenty-three, researchers showed a shortcut called direct preference optimisation, or D-P-O. The key insight is mathematical: the RLHF objective has a known best solution, which lets us write the reward in terms of the model's own probabilities, compared with the reference model's. So we can skip the reward model entirely and train directly on the preference pairs.
The DPO loss looks at how much more likely the model now makes the chosen answer, compared with the reference model, and the same for the rejected answer. It pushes the first up and the second down. Let's try numbers. Say the chosen answer's log-probability ratio is plus two and the rejected one's is minus one, with a strength beta of zero point one. The margin is zero point one times three, which is zero point three. The sigmoid of zero point three is zero point five seven, so the loss is about zero point five five.
Training keeps widening that margin. No reward model, no reinforcement learning loop. It's simpler and more stable, and DPO and its variants are now widely used.
7:11Feedback from AI, and what post-training can do
Preferences don't always come from people. Models can also be asked to judge answers against a written set of principles, producing feedback at a scale humans couldn't. This is sometimes called reinforcement learning from AI feedback, and it works alongside, not instead of, human oversight. What can post-training achieve? It shapes format, tone and instruction-following, teaches the model to decline harmful requests and to say when it isn't sure, and adds specialised skills like using tools. What it mostly doesn't do is add large amounts of new knowledge.
That comes from pre-training, or from giving the model information at the time of the question, as we'll do with retrieval in Season Five. Making models reliably helpful, honest and harmless, often called alignment, is still an active area of research.
8:08Try it yourself: the reward model's maths
Let's test the reward model's formula. If two answers get exactly the same score, what's the probability that the first is preferred? Pause. One half: the reward model can't tell them apart. Now answer A scores three and answer B scores zero.
The probability that A is preferred is about ninety-five percent. And if the human labeller actually preferred B, the loss is about three, a large correction that pushes the reward model to fix its mistake. That's how thousands of comparisons slowly teach it what people prefer.
8:55What makes good demonstration data?
What makes good demonstration data? Every example should be correct, written in the tone you want, in a consistent format, and honest about uncertainty, saying "I can't see that order, but here's how to check" instead of inventing an answer. Quality matters more than quantity: some studies found that around a thousand carefully chosen examples could teach a strong base model a good response style. And bad examples are dangerous, because a model fine-tuned on answers with errors will learn the errors too. One caveat: this corner of AI moves quickly.
These examples were current when we made this video, and they may look different on the day you watch it.
9:41Predict: why not learn the user's words?
During supervised fine-tuning, the loss is usually computed only on the assistant's reply, not the user's message. Why? Pause and think about what would happen otherwise. The model would spend effort learning to imitate customers: their typos, their complaints, even their mistaken claims. We want it to learn how to respond, not how to ask. So the chat template marks each role with special tokens, and only the assistant's tokens count towards the loss.
10:17The KL leash, by hand
Let's put a number on the leash. The fine-tuned reference model starts its replies with "Sure" or "Certainly", fifty-fifty. After reinforcement learning, the policy says "Sure" ninety percent of the time. The KL divergence, which measures how far the new distribution has drifted, works out to about zero point three seven. The training objective subtracts this, times a weight, from the reward. So drifting further from the reference has a price, which helps stop the model chasing quirks of the reward model.
10:53Sycophancy: a Brightcart example
Here's sycophancy in action. A customer insists that Brightcart's refund window is ninety days. It's actually thirty. A sycophantic assistant agrees: "You're absolutely right!" A good one stays polite but accurate, and offers to check the options. Why would training produce the first? Because people rating answers sometimes prefer being agreed with, and the reward model learns that preference. The fix is preference data that rewards polite correction, and tests designed to catch this behaviour, which we'll build in Season Four.
11:31Rewards you can check
For some tasks, you don't need a human or a reward model at all, because the answer can be checked. A maths answer can be compared with the known result. Code can be run against tests. The model attempts many problems, and the successful attempts are reinforced. These verifiable rewards are a key ingredient of the reasoning models we'll meet in episode forty-two. But the checker must be robust: if a test can be passed by a trick, the model may learn the trick.
12:04Will Brightcart do its own post-training?
Will Brightcart run its own reinforcement learning? Probably not, at least not at first. There's a ladder of options. Start with better prompts, the cheapest and fastest. Then give the model Brightcart's own documents to read, which we'll build in Season Five. Then fine-tune on Brightcart examples, in Season Five. Preference tuning comes last, only with plenty of comparison data and a clear need. Meera's rule: start at the top of the ladder, and only climb when your measurements say you must.
12:39Myth vs Fact
Myth: R-L-H-F teaches a model the truth. Fact: it teaches the model what raters preferred. If raters reward confidence or agreement, the model learns those too. Honesty has to be deliberately valued in the guidelines and the data, and then checked with careful evaluation.
12:59Recap
Let's recap. Post-training turns a base model into an assistant. Supervised fine-tuning trains on example conversations, with the loss counted only on the assistant's replies. Preference data compares answers. RLHF trains a reward model, using the sigmoid of score differences, then improves the assistant with reinforcement learning, held on a leash to the original model. Reward hacking, like verbosity and sycophancy, is a constant risk. And DPO learns from preference pairs directly, without a separate reward model.
One sentence to remember: show it good answers, then teach it which answers people prefer.
13:46Next: sampling and temperature
Mission complete. Brightcart's assistant now follows instructions, answers concisely and kindly, and is trained to prefer honest answers over invented ones. But Dev has noticed something odd. Ask the same question twice, and the assistant gives different answers. Why? Because at every step, the model doesn't just pick a word. It samples one. Temperature, top-k and top-p, next. See you on the map.