Foundations — Reinforcement Learning from Human Feedback (RLHF)
This page assumes you have seen nothing. Before RLHF makes sense, we must earn every symbol the parent note throws at you — , , , , , , and the strange word policy. We build them one at a time, each with a picture, in an order where every new symbol only uses ones already defined.
0. What is a "language model" really? — the symbol
We give this whole guessing machine a name: (the Greek letter "pi", here it has nothing to do with — it is just the traditional letter for a policy, defined below).
- reads: "the probability the model assigns to producing the full answer , given the prompt ." The vertical bar means "given" / "assuming we already saw."
- = the input text (prompt). = a candidate answer (a whole sentence).

Related: this trained-to-chat model is what Supervised Fine-Tuning (SFT) produces, written .
1. Probability, and why and are special
A probability is a number in the range :
- means "never,"
- means "certain,"
- means "coin-flip."
The model spreads a total of across all possible next words — it is dividing up a full pie. If it hands "the" a slice of , that word gets of its confidence. We will constantly compare two models' slices for the same word, so hold that picture: two pies, same slice, different sizes.
2. The logarithm — turning "how many times bigger" into a plain number
The parent note writes and . Why does a log appear at all?
Two facts we need, both visible in the figure:
- turns a ratio into a difference. . This is why comparisons (which are naturally ratios/differences) become clean sums.
- punishes small probabilities hard. As a probability slides toward , its dives toward . So is a "surprise meter": tiny probability = huge penalty.

3. The reward — a judge that scores answers
Picture a judge at a talent show holding up a scorecard. But — crucial — this judge was never taught absolute scores. It was only ever shown pairs and told which one won. So only differences between its scores mean anything (see Section 5). This is the Bradley-Terry Model at work.
4. The sigmoid — squashing any number into a probability
The parent note computes . What is this ("sigma")?
Why do we need this exact shape? Because the reward difference can be any real number, but "probability the human prefers the winner" must live in . The sigmoid is the S-curve that bridges those two worlds:
- (a tie — no preference),
- big positive (winner clearly preferred),
- big negative (we got the ranking backwards).

5. Why only differences of reward matter
The Bradley-Terry Model says the probability a human prefers winner over loser is . Because only the difference appears, adding the same constant to every reward changes nothing: So the reward's "zero point" is arbitrary. That is why "the RM outputs an absolute quality" is a listed mistake — it doesn't. It outputs a ruler with no marked origin, only spacing. This limitation is the seed of Goodhart's law.
6. Expectation and KL divergence — the leash
Expectation means "the average value, weighted by how likely each case is." When the parent writes , the means " is sampled from" — i.e. "average this over answers the policy actually produces." It is just a careful word for average.
Now the leash. is the policy we are training ( = "phi" labels its knobs, distinct from the judge's ). We want it to stay near the trusted .
Picture two pies again (Section 1). If the new policy's slices match the trusted model's slices, KL — no leash tension. If the new policy shouts "!" where the trusted model whispered "," the log-ratio shows up as tension pulling it back. Deep dive: KL Divergence.
7. Putting the symbols in order
Each box uses only boxes that feed into it — that is the whole promise of "every symbol earned before use."
8. One numerical walkthrough, symbol by symbol
Reusing the parent's Worked Example 1 with our fresh definitions, so you feel each symbol fire.
- , — the judge's two scores (Section 3).
- — only the difference counts (Section 5).
- — squash difference into "probability we ranked correctly" (Section 4).
- loss — the surprise meter; low because we were right (Section 2).
If the judge had it backwards (): , , loss — a big penalty demanding a big correction. Every symbol on this page just did a job.
Equipment checklist
Cover the right side and answer out loud before revealing.