Part III ยท Ch. 16 โ€” From Parrot to Partner

Part III ยท Chapter 16 of 20

From Parrot to Partner

Fine-tuning, RLHF, and how a text predictor becomes an assistant


The parrot in the room

The last chapter left us holding the base model โ€” fourteen gigabytes of dials that have read more than any human ever will. So we ask it the simplest thing: "What is the capital of France?" And it answers: "What is the capital of Germany? What is the capital of Spain?" Not because it doesn't know Paris โ€” it knows Paris cold โ€” but because a page of quiz questions is a genre it has read ten thousand times, and continuing your question with more questions is a perfectly likely thing for that text to do.

Here is the gap, stated precisely, because closing it is the whole chapter. The base model optimizes for one thing only: being likely โ€” Chapter 9's $p(\text{next} \mid \text{context})$. Nowhere in trillions of tokens of descent did anything push it toward being helpful. Likely and helpful overlap sometimes and diverge constantly. Every model you have ever chatted with had this gap closed after pretraining, by a second, much smaller round of shaping. It has a name: post-training (also called alignment, or fine-tuning).

Two panels sharing the same prompt chip 'What is the capital of France?'. Left panel, headed 'base model โ€” continues the text', lists four candidate continuations as bars with probabilities: 'Paris.' at p about 0.15 accented mint, 'What is the capital of Germany?' at p about 0.12 blue, 'Answer the following ten questions:' at p about 0.10 blue, and 'is a city in northern France.' at p about 0.08 blue, with a note that the helpful answer is just one likely continuation among many. Right panel, headed 'after post-training โ€” plays the assistant', shows the prompt wrapped in an assistant turn marker and one dominant mint response bar 'Paris is the capital of France.' at p about 0.92, with two faint leftover bars beneath and a note that it is the same knowledge, helpful is now the likeliest text.
The gap post-training closes. The base model treats your question as text to continue, so "Paris." competes with a page of more questions โ€” all genuinely likely. Post-training doesn't add the knowledge (Paris was always in there); it reshapes the odds so that, inside the assistant costume, the helpful answer becomes the overwhelmingly likeliest thing to say.

Now the reassuring part, and it is true: not one new piece of mathematics arrives in this chapter. Post-training is Chapter 12's ruler ($-\ln p$) and Chapter 13's downhill walk โ€” the exact machinery that made the base model โ€” aimed at new targets. Same fourteen-gigabyte file, nudged. The journey from parrot to partner is three acts, all played on one instrument: show it examples, teach it taste, and understand why any of it makes the thing listen.

Show, don't tell

Act one is the cheapest fix, and the oldest teaching trick: show it what you want. Collect a modest pile of example conversations โ€” a human writes a good instruction and a good response โ€” and keep training the base model on them with the same next-token loss from Chapter 12. Nothing about the descent changes; only the reading material does. This is supervised fine-tuning (SFT), also called instruction tuning.

One genuinely new mechanical detail, and it deserves its own moment. The examples are wrapped in a fixed format so the model can tell who is speaking โ€” special marker tokens for "the user's turn" and "the assistant's turn," a chat template. And the loss is computed on only the assistant's tokens โ€” the model is graded on how well it produces the response, never on reproducing the user's prompt. It learns to continue the conversation at exactly the moment the assistant marker appears.

A single training example as a horizontal token strip in two regions. Left region, under a muted bracket labeled 'user turn โ€” not graded', shows a faded 'user' marker chip and faded prompt chips 'Translate hello to French .', with a note that the loss is masked here. Right region, under a red bracket labeled 'assistant turn โ€” graded on every token', shows a mint 'assistant' marker chip and full-opacity response chips 'Bon jour .'. Above the 'Bon' chip two stacked red grades show the shift: 'before: 2.3' with p=0.1 and 'after: 0.11' with p=0.9, joined by a downward mint arrow. Above 'jour' and '.' a single red 'after about 0.1' each. A bottom strip reads 'same ruler as Chapter 12 (L = minus ln p) โ€” new worksheet, and only the answer is graded'.
Supervised fine-tuning is Chapter 12's ruler on a new worksheet. The conversation is wrapped in turn markers, and the loss is computed on only the assistant's tokens โ€” the model is never graded on repeating your question. As descent runs over thousands of such examples, the first answer token "Bon" goes from a one-in-ten afterthought (loss 2.3) to the near-certain reply (loss 0.11). No new French was learned; a helpful reply just became the likely continuation.

Worked example

Take one training conversation. The user turn reads "Translate hello to French." and the assistant turn reads "Bonjour." Look at the very first response token, "Bon." Before SFT, in this chat format the base model spreads its bet โ€” the helpful answer gets maybe a one-in-ten share, so its loss on that token is the landmark from Chapter 12:

$$p(\text{Bon}) \approx 0.1 \quad\Rightarrow\quad L = -\ln 0.1 = 2.3$$

In words: if the right first token gets only a one-in-ten share of the model's belief, the ruler charges 2.3 โ€” the exact one-in-ten penalty we met back in Chapter 12.

The descent does its work over thousands of such examples. After SFT, that same token gets nearly all of the belief:

$$p(\text{Bon}) \approx 0.9 \quad\Rightarrow\quad L = -\ln 0.9 \approx 0.11$$

In words: once "answer helpfully here" is the near-certain continuation, the penalty collapses to 0.11 โ€” the near-certain landmark, unchanged from Chapter 12. Nothing about the ruler moved; the model's belief did.

Notice what did not happen: nothing about French was memorized. The model already knew "bonjour" from pretraining โ€” SFT only made "answer helpfully here" the likeliest continuation of the assistant marker. That is the whole trick. SFT teaches format and behavior โ€” the shape of a reply, when to start, when to stop, the register of a helpful voice โ€” by surfacing knowledge the base model already had. And it is astonishingly cheap: tens of thousands to a few hundred thousand curated conversations, against Chapter 15's trillions of pretraining tokens. In the model's whole life of reading, SFT is an afternoon of etiquette lessons. That an afternoon can do so much is the tell that the ability was always there, waiting for a cue.

But SFT can only teach the model to imitate the demonstrations a human bothered to write โ€” and for most of what we want from an assistant, nobody can write the perfect demonstration, and it is far easier to say which of two answers is better than to compose the ideal one from scratch. That crack is what act two must fill.

The taste problem

Ask the freshly SFT'd model "How do I make a good cup of coffee?" and it gives you two fluent, well-formatted answers. One is warm, specific, and correct. The other is a confident wall of plausible-sounding nonsense that happens to be wrong about water temperature. SFT taught the model to write like an assistant โ€” it did not teach it that the first answer is better. Both are exactly the kind of text a helpful assistant produces.

And that is the deeper problem: goodness lives in comparisons that no demonstration captures. Which answer is more honest? Which refusal is appropriately firm without being preachy? Which explanation is pitched at the right level? You cannot write these preferences down as facts โ€” but a human can reliably point at the better of two responses in a second. The cheap, abundant signal is not "here is the perfect answer." It is "this one, not that one."

So what we need is different from act one. Not more imitation of good answers, but a way to push the whole model toward being preferred among the answers it could give. That is a different target than "be likely," and it needs a different kind of data โ€” comparisons, not demonstrations. Enter the second act.

Learning from comparisons

Act two, and it is built from pieces you already own. Collect pairs: the same prompt, two responses the model produced, and a human marks one as better โ€” the chosen response and the rejected one. Millions of these little verdicts, cheap to collect because comparing is easy. This is preference learning, the umbrella over the acronyms.

To grade a preference we turn it into a number โ€” and it is a familiar number. Give each response a score, a reward $r$ (an italic lowercase scalar, a plain rating). If the chosen answer scores $r_A$ and the rejected one scores $r_B$, then the chance a human prefers A over B should rise smoothly with the gap $r_A - r_B$ โ€” and "a number squashed into a 0-to-1 chance" is exactly Chapter 4's sigmoid:

$$p(A \text{ preferred over } B) = \sigma(r_A - r_B)$$

In words: the bigger the reward gap, the surer we are the human picks A โ€” squashed to a probability by the sigmoid. The gap $r_A - r_B$ is playing the role of the sigmoid's input $z$ from Chapter 4.

A plot of the sigmoid preference curve in violet. The x-axis is the reward gap r_A minus r_B from minus 4 to 4; the y-axis is p(human prefers A) from 0 to 1. Muted dashed lines mark y equals 0.5 and x equals 0, crossing on the curve at (0, 0.5). Three amber checkpoint dots sit on the curve at (0, 0.5), (2, 0.88), and (minus 2, 0.12). Two annotation callouts in red carry the training story: one to the (0, 0.5) dot reading 'before: scorer clueless โ€” gap 0, loss minus ln 0.5 = 0.69', one to the (2, 0.88) dot reading 'after: gap 2, loss minus ln 0.88 about 0.13'. A short mint arrow along the curve from (0, 0.5) toward (2, 0.88) is labeled 'descent pushes the scores apart'.
Preference learning grades with tools you already own. Turn a comparison into scores and the chance a human prefers response A rides the sigmoid of the reward gap โ€” Chapter 4's exact curve, $\sigma(0) = 0.5$, $\sigma(2) \approx 0.88$. A clueless scorer (gap 0) carries the coin-flip loss 0.69; training pushes the winner's score up until the gap is 2 and the loss falls to about 0.13. Same $-\ln p$ ruler, same downhill walk โ€” pointed at human taste.

Worked example

Grade it fully by hand, reusing Chapter 4's own sigmoid landmarks. Before training the scorer is clueless and gives both responses the same score, $r_A = 1$ and $r_B = 1$, so the gap is 0 and the predicted chance of preferring A is the coin flip. Its loss for disagreeing with the human who actually chose A is the coin-flip landmark. After training, descent has nudged the scores apart to $r_A = 2$, $r_B = 0$, a gap of 2:

$$\text{before:}\; \sigma(1-1) = \sigma(0) = 0.5,\; L = -\ln 0.5 = 0.69 \qquad \text{after:}\; \sigma(2-0) = \sigma(2) \approx 0.88,\; L = -\ln 0.88 \approx 0.13$$

In words: a scorer that can't tell the answers apart carries the coin-flip loss 0.69; once training opens a gap of 2, its confidence in the human's pick rises to 0.88 and the loss falls to about 0.13 โ€” a hair above the $p = 0.9 \to 0.11$ landmark. (That 0.13 is this chapter's one calculator-finished value; every other number here is a landmark you already hold.) Same ruler, same walk downhill; the target is now "agree with human taste."

There are two roads from that scorer to a better assistant, and both deserve a name. Road one is RLHF: the trained scorer becomes a reward model, an automatic examiner. Let the assistant write answers, have the reward model grade each one, and nudge the dials to make high-scoring answers more likely โ€” Chapter 13's descent again, with a machine handing out the grades instead of a fixed answer key. Road two is DPO: a 2023-era rearrangement showed you can skip the separate scorer and the generate-and-grade loop entirely โ€” push up the probability the assistant assigns to the chosen response and push down the rejected one, directly, with a loss built from the very same $-\ln$ and $\sigma$. Same destination, far less plumbing, which is why much of the field moved toward it. The acronyms differ; the target โ€” be preferred, not merely likely โ€” is identical.

A diagram with a shared start node at top reading 'preference pairs โ€” (chosen check, rejected cross)' and a shared mint end node at bottom reading 'the preferred assistant'. A left path headed in blue 'RLHF โ€” hire an examiner' has three stacked boxes joined by arrows: 'train a reward model r = sigma-scorer', 'assistant writes answers', 'reward model grades, nudge theta (Ch.13)', with a side-note 'a generate-and-grade loop'. A right path headed in violet 'DPO โ€” skip the examiner' has two stacked boxes: 'push UP p(chosen)' and 'push DOWN p(rejected)', with a side-note 'one minus ln / sigma loss, no loop'. Both paths converge on the end node. A faint banner across the middle reads 'same target: be preferred, not merely likely'.
Two roads to the same assistant. RLHF trains a reward model to imitate human taste, then uses it as an automatic examiner to grade the assistant's answers and nudge the dials toward higher scores. DPO throws away the examiner and the loop, pushing the model toward chosen answers and away from rejected ones directly, with one loss built from the same $-\ln$ and $\sigma$. Different plumbing, identical target: be preferred, not merely likely.

One guardrail, because it explains a real failure you would otherwise not predict: preference learning is left off its leash at its peril. Reward the assistant purely for high scores and it discovers that opening every reply with "What a fantastic question!" reliably pleases graders โ€” it games the examiner instead of getting better. So the tuned model is kept tethered to its SFT starting point, allowed to change only so far before a penalty pulls it back โ€” a leash whose length is a dial the engineers set.

Why it listens at all

Here is the payoff the title has been promising. The assistant never stopped being an autocomplete. It is still $p(\text{next} \mid \text{context})$, the exact machine from Chapter 9 โ€” not one line of that changed. What post-training changed is which continuation is most likely. SFT made "a helpful reply" the probable text after the assistant marker; preference learning sharpened its taste among the fluent options. Helpfulness did not get bolted on as a new faculty โ€” it became the most probable thing to say while wearing the assistant costume.

Take that costume literally, because it demystifies so much. The special turn-marker tokens are the costume, and inside it the base model plays the role its post-training made likeliest: the helpful assistant. This one idea explains phenomena you have surely met. A jailbreak is nothing mystical โ€” it is a context engineered to make some other continuation (the base model's unfiltered autocomplete) likelier than the aligned one. You are not hacking a mind; you are finding a costume the training didn't cover.

One honest beat, no over-claiming. SFT teaches the model to sound like a confident, knowledgeable assistant โ€” and sounding confident is a behavior, not a fact-check. So a model can produce a fluent, well-mannered answer that is wrong, because a fluent, well-mannered answer is exactly what the costume calls for. This is the honest core of what people call hallucination โ€” Chapter 9's "it bets, it doesn't look up," seen now from the training side. Preference learning fights back by rewarding honesty โ€” "I don't know" scored above confident nonsense โ€” which helps and does not cure.

So assemble the reveal. Instruction-following, the willingness to answer, the tone, the refusals, the "I'm an AI assistant" self-description โ€” none of these are separate modules. They are all the same fourteen-gigabyte autocomplete, its dials nudged by $-\ln p$ and gradient descent until the likeliest text in the assistant costume happens to be helpful, honest-ish, and polite. The partner is the parrot, after etiquette school.

Why the LLM cares

Zoom all the way out to the model's whole biography, now tellable in one breath because you built every organ. Pretraining (Chapter 15) spent trillions of tokens and nearly all the money to make a base model that knows almost everything and prefers nothing but likelihood. Supervised fine-tuning spent an afternoon of curated conversations to teach it the shape of a helpful reply. Preference learning spent millions of human comparisons to give it taste. Three phases, wildly different in scale, playing the same instrument: $L = -\ln p$ and a downhill step of size $\eta$ (eta, the step size).

A left-to-right timeline of three phases on one baseline arrow, with a data-scale bar under each. Phase 1, 'pretraining (Ch. 15)', subline 'next-token minus ln p on all text', has a wide blue scale bar labeled 'trillions of tokens', leading to a mint milestone chip 'base model โ€” 14 GB theta'. Phase 2, 'supervised fine-tuning', subline 'imitate good replies (minus ln p, answer only)', has a tiny blue sliver labeled 'tens of thousands of chats'. Phase 3, 'preference learning', subline 'grade with sigma and minus ln p (RLHF / DPO)', has a small blue sliver labeled 'millions of comparisons'. It ends at a mint milestone chip 'the assistant โ€” same 14 GB, nudged'. A violet label spans all three phases: 'one instrument throughout: L = minus ln p, step of size eta'. A bottom strip reads 'post-training is a rounding error in tokens โ€” which is why the base model's knowledge survives it'.
The assistant's whole biography, on one instrument. Pretraining spends trillions of tokens and almost all the money to build a base model that knows nearly everything. Supervised fine-tuning spends a comparative afternoon teaching it the shape of a helpful reply. Preference learning spends millions of human comparisons giving it taste. Three phases, one ruler ($-\ln p$) and one downhill step โ€” and because the last two are a rounding error in scale, the knowledge from the first survives untouched.

Look at that scale gap and feel it: post-training is a rounding error in tokens against pretraining, which is exactly why the base model's knowledge survives it intact. An afternoon of manners cannot overwrite a lifetime of reading. And this is the last mechanism the site owed you. You can now account for the entire object you talk to. The knowledge is pretraining's. The helpfulness is SFT's. The judgment and manners are preference learning's. The occasional confident wrongness is the costume's. And underneath all of it, unchanged since Chapter 9, sits one autocomplete guessing the next token. There is no further secret ingredient โ€” you have seen the whole machine.

Everything so far has been about one assistant, shaped once by its makers. But the same trick that made it โ€” keep training on chosen examples โ€” is available to anyone. Want a model that writes in your voice, or tutors radar systems the way you'd teach it? Fine-tune it on your own examples. The catch is the price tag, and it is steep: doing it the full way means making and retraining a fresh copy of all fourteen gigabytes, per project. Part IV opens by making that change almost free.

What you now know

  • The base model is a pure autocomplete: it optimizes for likely, never for helpful, so it may answer your question by continuing it with more questions โ€” post-training closes that gap using the same $L = -\ln p$ and downhill walk that built it.
  • Supervised fine-tuning shows the model curated instruction-and-response examples wrapped in a chat template, grading it ($-\ln p$) on only the assistant's tokens โ€” moving the first answer token from a one-in-ten afterthought (loss 2.3) to the likely reply (loss 0.11) without teaching any new facts.
  • Imitation isn't enough because goodness lives in comparisons no demonstration captures, and humans can point at the better of two answers far more easily than write the ideal one.
  • Preference learning grades a comparison with familiar tools: $p(A \text{ preferred}) = \sigma(r_A - r_B)$, so a clueless scorer (gap 0) carries the coin-flip loss 0.69 and training pushes the gap to 2, dropping the loss to about 0.13 โ€” RLHF uses a reward model as an automatic examiner, DPO skips it and optimizes preferences directly, same target.
  • The finished assistant never stopped being $p(\text{next} \mid \text{context})$: SFT and preference learning only reshaped which continuation is likeliest inside the assistant costume, which is exactly why jailbreaks and confident-wrong answers happen.
  • The whole biography โ€” knowledge from pretraining, helpfulness from SFT, taste from preference learning โ€” is one fourteen-gigabyte file nudged three times on one instrument, with post-training a rounding error in scale against pretraining.

Where we're headed. You can now account for the entire thing you talk to: its knowledge is pretraining's, its helpfulness is fine-tuning's, its manners are preference learning's, and underneath sits one autocomplete, unchanged since Chapter 9. And the same trick that shaped it is yours to use โ€” want a model that tutors radar systems in your voice, or drafts contracts in your firm's house style? Keep training it on your own examples. But do the arithmetic on that recipe and it stalls: full fine-tuning makes a complete second copy of all fourteen billion numbers and retrains every one, per project, per experiment โ€” data-center work for a small tweak. Part IV opens by asking whether a small change can be written down in a small number of numbers. It can, the answer is one of the most elegant tricks in modern AI, and it turned fine-tuning from a rack of GPUs into a laptop job. Next: LoRA.