Visual walkthrough — Constitutional AI overview
We are going to answer one question: after the AI judge has picked winners and losers, what exact number should training push up or down?
Step 1 — A judge that only says "this one"
WHAT. Start with the rawest thing we have. Give the model a prompt — call it (just a name for "the question we asked"). The model produces two answers. We name them and (again, just names — "answer one" and "answer two"). An AI judge reads both and points at one: "this response follows the principle better." The one it points at we rename (winner), the other (loser).
WHY. Everything downstream needs a number to optimise. But a pointing finger is not a number — it is a category, a yes/no. Step 1 just fixes vocabulary so the next steps have something to grip.
PICTURE. The judge is a gate that takes two arrows in and lets exactly one (red) out.

This is exactly the Bradley-Terry preference model setup, and it is identical to RLHF — only the judge is an AI instead of a human.
Step 2 — Give each answer a hidden "goodness" score
WHAT. Imagine every answer secretly carries a single number: how good it is according to the constitution. We write this number and read it as "the reward of answer to prompt ." The little (Greek "theta") just means "this scorer has dials we can tune."
WHY. Why invent a hidden score at all? Because a raw ranking ("A beats B") does not compose — if A beats B and B beats C, how much better is A than C? A number on a line answers that for free: put every answer on a ruler, and distance on the ruler is strength of preference. That is the single most useful reason to convert a choice into a score.
PICTURE. Both answers sit on a number line. sits to the right of ; the gap between them (red) is what matters — not the absolute positions.

Step 3 — Turn the score-gap into a probability with
WHAT. The judge is not perfect; sometimes it would flip. So instead of " always wins," we ask: how likely is to be preferred? We need a machine that eats the score-gap (any real number, from to ) and outputs a probability (a number squeezed into to ). That machine is the logistic function :
WHY this tool and not another? We specifically need something that:
- maps every real number into — a probability can't be negative or above 1;
- gives — a zero gap should mean a coin-flip, total uncertainty;
- is smooth and increasing — a bigger gap should mean higher confidence, always.
The logistic curve is the simplest S-shape with all three properties, which is why Bradley–Terry picks it. Plug the gap in:
The symbol reads "is preferred over."
PICTURE. The S-curve. Mark three spots: gap ; large positive gap near ; large negative gap near (this is the degenerate case where the "winner" actually scores worse — the model is confidently wrong, and training will punish it hard next).

Recall What does
equal, and what does it mean here? . A zero score-gap means the model is totally undecided — a 50/50 coin flip between the two answers.
Step 4 — Score the scorer: the negative-log-likelihood
WHAT. We now have a predicted probability that the winner wins. The judge already told us the winner did win — so we want our predicted probability to be high (close to 1). We measure "how badly did we predict?" with the negative logarithm:
WHY ? Look at what does as (our predicted probability of the correct answer) moves:
- (we were right and confident) : no penalty.
- (we were confidently wrong) : enormous penalty.
So is a pain-meter that is gentle when we're right and vicious when we're confidently wrong. Averaging this pain over the whole AI-labelled dataset gives the reward-model loss:
Minimising = tuning the dials so the winner's score sits reliably above the loser's.
PICTURE. The pain-meter curve: penalty on the -axis, our predicted probability on the -axis — flat near , shooting to the sky near (red).

Step 5 — Use the scorer to steer the actual model (and how PPO really climbs)
WHAT. The reward model only judges text. Now we tune the model that writes text — call it the policy (Greek "pi" for policy, = its own dials). The dream is:
Read it: "adjust the dials so that the answers our model samples tend to score high." But you cannot just do gradient ascent on this directly — and understanding why is the whole point of PPO.
WHY not vanilla policy gradient? Two problems, each with a fix drawn below.
-
Raw reward is a noisy signal. An answer with reward — is that good? Only relative to what this model usually scores on that prompt. So we subtract a baseline (the average reward we'd expect) and keep only the surplus. That surplus is the advantage: Positive = "better than usual, do more of this"; negative = "worse than usual, do less." Subtracting the baseline does not change where the maximum is, but it hugely reduces the variance of the update — without it the gradient jitters so violently that training is useless. The baseline is itself learned by a small value model that predicts expected reward.
-
Big steps blow up. Each update samples answers from the current policy, so a single wild step can push into garbage from which the estimates are worthless. PPO fixes this by optimising a surrogate that only trusts small changes. Let be the probability ratio — how much more (or less) likely the new policy makes an answer versus the old one. PPO maximises the clipped objective:
The + clip together say: reward genuine improvement, but the moment a step tries to move too far, freeze the incentive so the optimiser can't sprint off a cliff. That is PPO's trust region.
PICTURE (5a). The full pipeline PPO actually runs: sample trajectories (answers) → score each → subtract baseline to get the advantage → turn advantages into the clipped gradient that nudges the policy.

PICTURE (5b). The clip in action: the flat red shelves outside are where PPO refuses to reward further movement — the practical "small steps only" leash.

Step 6 — The KL leash: don't wander off into gibberish
WHAT. Even with PPO's per-step clip, over many steps the policy can slowly crawl far from the trusted starting model (the SL-CAI model — fluent, on-topic). So we add a global penalty for how far 's whole distribution of word-choices has drifted. That distance is the Kullback–Leibler divergence. Here is its actual definition — no black box:
Plugging (our current policy) and (the anchor), becomes a single number: how weird has our model's output distribution become versus the trusted one? Now the full objective:
Term by term:
- ::: pulls the policy toward high reward (the pull);
- ::: grows (per its definition above) as the policy's word-choices diverge from the reference (the tether);
- (Greek "beta") ::: sets how strong the tether is — big = short leash (stay safe, gain less reward); small = long leash (chase reward, risk gibberish).
WHY. The KL term converts "don't cheat" from a wish into a cost. If the policy finds a reward hack, its KL shoots up, subtracts, and the total objective can actually drop — so the optimiser refuses the hack.
PICTURE. Same reward hill, but now the policy is on a red rubber band anchored at . It reaches toward the peak but the band tugs it back — it settles at a balanced spot, not the cheating peak.

Step 7 — Two degenerate cases you must be able to handle
WHAT. Real training hits corners. Two matter:
- The judge ties (). Gap , so , and the loss is — the maximum uncertainty penalty. Training receives a strong "you can't tell these apart, learn to" signal. Nothing breaks.
- (no leash). The KL term vanishes; the objective is pure reward-chasing. This is the reward-hacking regime — text degrades into repetitive canned phrases. As the leash is infinitely stiff: the policy can't move at all and never improves. The useful world lives between these extremes.
WHY. A method you can't stress-test at its boundaries is a method you don't understand. These two cases are the boundaries.
PICTURE. A dial for : far left () = "gibberish / reward hack"; far right () = "frozen, no learning"; the red sweet-spot in the middle.

Recall What is the loss on a perfectly tied pair, and why does it make sense?
. It's the largest ordinary penalty because a tie means the scorer has learned nothing useful about which answer is safer — so it gets pushed hard.
The one-picture summary
Everything above, in one flow: prompt → two answers → AI judge picks a winner → Bradley–Terry turns the score-gap into a probability → loss trains the reward model → PPO (advantage + clip) climbs the reward → the KL leash keeps it honest.

Recall Feynman retelling — the whole walkthrough in plain words
A referee looks at two answers and points at the better one. We give every answer a secret score on a ruler; only the gap between the two scores matters. We bend that gap through an S-shaped curve so it becomes a probability — "how sure are we the winner really is better?" — where a zero gap means a coin-flip. Then we grade our own scorer with a pain-meter: no pain when we confidently agree with the referee, screaming pain when we're confidently wrong. Once the scorer is trained, we let it coach the real model to write higher-scoring answers — but carefully: we compare each answer to what the model usually scores (the advantage) so the signal isn't noisy, and we only allow small steps (PPO's clip) so it can't leap off a cliff. On top of that we tie the model to a rubber band anchored on its trustworthy old self — the KL distance — so it can't cheat by babbling one magic phrase. Loosen everything and it talks gibberish; tighten it fully and it never learns. The whole art is finding the middle.
Prerequisites & neighbours: Bradley-Terry preference model · Reward modeling · PPO Proximal Policy Optimization · KL divergence · RLHF · DPO Direct Preference Optimization · Prompt engineering · Red teaming and harmlessness · Hinglish version