Part III · Ch. 16 — From Parrot to Partner

Part III · Chapter 16 of 21

From Parrot to Partner

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


The parrot in the room

Ask a base model for France's capital and it might answer “Paris,” or continue with questions about Germany and Spain. Both resemble text it has seen. Post-training shifts the model toward useful assistant responses.

The same France question has several base continuations; after assistant training the Paris response rises from about 0.15 to 0.92.
Post-training favors helpful answers.
Three common stages of a chat model
StageDataObjectiveWhat changes
PretrainingBroad text.Predict observed next tokens.General language representations and knowledge.
Supervised fine-tuningCurated demonstrations.Produce desired responses.Task behavior, format, and potentially knowledge.
Preference trainingResponse comparisons or feedback.Favor preferred behavior.The relative likelihood of possible responses.

This is a common pattern rather than a requirement that every assistant has three distinct runs.

Teaching by demonstration

Fine-tuning reuses learned weights. Supervised fine-tuning, SFT, teaches the desired response through examples.

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 bracket labeled 'assistant turn — graded on every token', shows a 'assistant' marker chip and full-opacity response chips 'Bon jour .'. Above the 'Bon' chip two stacked grades show the shift: 'before: 2.3' with p=0.1 and 'after: 0.11' with p=0.9, joined by a downward arrow. Above 'jour' and '.' a single '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'.
Only assistant targets contribute loss.

A chat template marks user and assistant turns. In this common SFT setup, loss masking excludes the user prompt from the scored targets. Assistant outputs are graded token by token.

Worked example

Take one training conversation. The user turn reads "Translate hello to French." and the assistant turn reads "Bonjour." Look at the first response token, "Bon." Before SFT, in this chat format the base model spreads its belief, so the helpful answer gets about a one-in-ten share and 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 one-in-ten penalty from 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 falls to 0.11, the same landmark as in Chapter 12. The ruler did not change; the model's belief did.

Our example illustrates making an existing French response likelier. Fine-tuning can also add knowledge or damage existing skills; that depends on data, objective, and update size.

The taste problem

Two answers can both resemble helpful demonstrations while differing in accuracy, clarity, or appropriate caution. Comparing them may be easier than writing a perfect answer from scratch. Human judgments can still disagree or favor superficial traits.

Learning from comparisons

Each pair has a chosen response and a rejected response. Preference learning uses those comparisons.

A reward r rates a response. One model of human preference applies the sigmoid σ, “sigma,” to the reward gap.

A plot of the sigmoid preference curve. 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 checkpoint dots sit on the curve at (0, 0.5), (2, 0.88), and (minus 2, 0.12). Two annotation callouts 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 arrow along the curve from (0, 0.5) toward (2, 0.88) is labeled 'descent pushes the scores apart'.
A larger preference gap lowers loss.
$$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, and the sigmoid squashes that into a probability. The gap $r_A - r_B$ plays the role of the sigmoid's input $z$ from Chapter 4.

Worked example

Grade it by hand with Chapter 4's sigmoid landmarks. Before training the scorer cannot tell the two apart and gives both the same score, $r_A = 1$ and $r_B = 1$, so the gap is 0 and the predicted chance of preferring A is a coin flip. Its loss for disagreeing with the human who 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, just above the $p = 0.9 \to 0.11$ landmark. The ruler and the walk downhill are the same as before, and the target is now agreement with human judgment.

Two routes from comparisons to updates
MethodRecipe
RLHFFit a reward model to comparisons, generate responses, and optimize for reward with constraints.
DPOUse comparison pairs directly, favoring the chosen response relative to the rejected response and a reference model.
Preference pairs feed either a reward-model generate-and-grade loop or a direct chosen/rejected likelihood loss, making preferred answers likelier.
DPO uses pairs without a reward model.

Both use gradients, but their objectives are not identical to next-token cross-entropy. DPO's reference-relative probability ratios matter; it is more specific than blindly raising every chosen probability and lowering every rejected one.

Reward hacking can reward flattery or other superficial behaviors. A regularization term can limit drift, though it cannot make a flawed reward perfect.

Why it listens at all

The model still predicts tokens from context. Training makes useful answers more likely after assistant markers. That learned behavior does not add a separate truth checker.

A jailbreak probes weaknesses in those restrictions. Fluent mistakes likewise show that learning a helpful style is not the same as verifying each claim. Preference data rewarding accurate uncertainty can help without eliminating errors.

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 scale bar labeled 'trillions of tokens', leading to a milestone chip 'base model — 14 GB theta'. Phase 2, 'supervised fine-tuning', subline 'imitate good replies (minus ln p, answer only)', has a tiny sliver labeled 'tens of thousands of chats'. Phase 3, 'preference learning', subline 'grade with sigma and minus ln p (RLHF / DPO)', has a small sliver labeled 'millions of comparisons'. It ends at a milestone chip 'the assistant — same 14 GB, nudged'. A 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'.
Later training adapts the pretrained base.

The relative sizes in the figure illustrate a common early training pattern. Post-training can be substantial and can change capabilities; a small dataset does not guarantee that earlier knowledge stays intact.

See it move

Watch (1:52): what to notice. One prompt is carried through three stations: a wall of web text that yields only a plausible continuation, human question-and-answer pairs that turn it into an answer, and a person choosing between two answers while the reward dial turns. Then all three replies to that one prompt, side by side.

Why the LLM cares

Assistant behavior comes from training objectives and data applied to the same parameterized model. Pretraining, demonstrations, and preference feedback contribute different pressures rather than independent “knowledge” and “manners” modules.

We can also adapt a model to a narrower task. Updating every parameter is costly; the next chapter shows how a small structured update can reduce that burden.

What you now know

  • A base model predicts continuations without a guaranteed assistant response.
  • SFT learns from demonstrations in a conversation format.
  • Preference learning uses comparisons between responses.
  • RLHF commonly uses a reward model; DPO uses a direct preference objective.
  • Post-training changes behavior and can change knowledge too.
  • Helpful style and preference scores do not guarantee truth.

Where we're headed

Next we'll ask why a fluent assistant can still be confidently wrong: Why It Makes Things Up traces hallucination to the same sampling step behind every answer. After that, adapting a large model with small matrices keeps the base weights fixed while learning an added change.