4.4.5 · D1Alignment, Prompting & RAG

Foundations — Constitutional AI overview

3,368 words15 min readBack to topic

This page introduces every symbol the parent note assumes, in the order that each one leans on the one before it. Nothing is used before it is drawn.


0. The cast of symbols (what you will meet)

Before we build them, here is the full alphabet the parent note throws at you. If any of these look like hieroglyphics right now, that is exactly why this page exists.

Symbol Said aloud Built in section
"the prompt" §1
, , "a response" §1
, "winner / loser response" §2
"is preferred over" §2
"reward / quality score" §3
"exponential of the slot" §4
"sigmoid / logistic of the slot" §4
"probability of the slot" §4
"natural logarithm (base )" §5
"loss" §5
"expected value / average of the slot" §6
, "policy / reference policy" §7
"KL divergence between two slots" §8
"leash strength" §8
"make as big as possible by tuning " §7

We now earn each row.


1. and — prompt and response

The picture: think of a vending machine. You press a button — that press is . A snack drops out — that snack is . Press the same button twice and you might get slightly different snacks (, ) because the model has some randomness.

Why the topic needs it: the whole method is a factory of pairs — first good revised pairs (Stage 1), then pairs of competing answers to be judged (Stage 2). Everything downstream is a function of these two letters.

Figure — Constitutional AI overview
Recall If the model gives two answers to one question, what do we call them?

and — two responses to the same prompt .


2. , and the symbol — winner, loser, "is preferred"

Once a judge looks at and and picks a favourite, we rename them by their role, not their number.

The picture: a talent show with exactly two contestants. The judge raises a paddle toward one of them. The paddled one is ; the other is . The arrow-like is the paddle pointing left-to-right: this beats that.

Why the topic needs it: the parent note's Bradley–Terry model is entirely about "how likely is the winner to beat the loser?" We can't write that until "winner" and "loser" have names.


3. — the hidden quality score

The judge said " beats " — a yes/no fact. To do maths we want a number measuring how good each answer is.

The picture: a judge's scorecard. Feed in (question, answer); a needle swings to a number. As we train, we tighten the internal screws so the needle agrees with the observed winners.

Why this tool and not just "good/bad"? A raw label ("winner") gives no magnitude. With a number we can say answer A is far better than B, or only slightly — and, crucially, we can take derivatives of a number to train. This is why we invent . See Reward modeling.

Figure — Constitutional AI overview
Recall What does the subscript

in mean? The current settings of all the tunable weights (dials) inside the scoring model.


4. , , and — turning a score difference into a probability

We have two numbers, and . We want a probability — a number between 0 and 1 — saying "how likely is the winner to actually win?" We need a machine that takes any real number and squashes it into .

4a. The exponential

Why this tool? Scores can be negative. Probabilities can't. Exponentiating forces positivity, so a ratio of exponentials is guaranteed to sit safely in .

4b. The sigmoid

Before the formula, let us give the two scores short names so the algebra stays readable.

The picture: a smooth "S" ramp. Far left it hugs , far right it hugs , and it crosses exactly at .

Now watch the parent note's key identity fall out. Let be the score gap:

What we did: divided top and bottom by . Why: it reveals the whole thing depends only on the difference , not the two raw scores. What it looks like: the S-curve of §4a, read at the point .

Figure — Constitutional AI overview

This is exactly the Bradley-Terry preference model the parent uses.

Recall Why exponentiate the scores before comparing them?

To guarantee positivity so their ratio is a valid probability in ; algebra then shows it equals of the score gap.


5. and — from probability to a loss to minimise

We can now predict how likely each observed win was. Training means: tune so the wins we actually saw come out as likely as possible. Multiplying many probabilities together gives tiny unwieldy numbers, so we take logarithms to turn products into sums.

The picture: a curve that is at (certain, no surprise) and plunges to a deep pit as (a thing we said was likely but that failed — huge penalty).

Recall Why take the log of the probability instead of using the probability directly?

Logs turn products of many probabilities into sums, and heavily punish confident-but-wrong predictions.


6. — the averaging bracket

The loss above was for one comparison. A dataset has thousands. We need the average loss over all of them.

The picture: a giant bin of scorecards; reach in, read a card's loss, repeat many times, take the average. That average is what we actually minimise.

Why the topic needs it: it lets the parent note write one clean formula that stands for "do this over the whole dataset and average," instead of a messy sum with indices.

So the parent's reward-model loss reads, fully decoded:

Every piece is now something you built by hand. This is the same machinery used in RLHF and DPO Direct Preference Optimization — only the source of the pairs differs.


7. , , and — the policy we steer

The reward model scores answers. But the thing we ultimately want to improve is the answer-generator itself.

The picture: a dartboard where each possible answer is a spot, and the policy is a heat-map of where the dart is likely to land. Training reshapes the heat-map to favour high-reward answers.

Recall What is the difference between

and ? is trained and changes; is a frozen anchor (the SL-CAI model) we must not drift too far from.


8. and — the leash

If we only maximise reward, the policy will find cheap tricks that fool the score machine (the parent's "As an AI, I strictly comply!!!" example). We need a term that punishes drifting away from sane, fluent language. That penalty — hinted at in §7 — is built now.

The picture: a dog () on a leash held at the anchor post (). Reward is a tasty treat pulling the dog forward; the leash tension is pulling it back. The dog settles where treat-pull balances leash-pull.

Figure — Constitutional AI overview

Now the two halves — the reward pull from §7 and the leash from §8 — combine into the parent's full objective, fully readable:

This is the same PPO Proximal Policy Optimization objective used in RLHF; see also Red teaming and harmlessness for how the harmful prompts that feed this pipeline are sourced.


Prerequisite map

Prompt x and response y

Winner yw and loser yl

Reward score r-theta

Exponential and sigmoid

Probability of preference

Log and loss L

Average with expectation E

Reward model loss

Policy pi-phi and reference

KL divergence and beta

RLAIF objective

Constitutional AI overview

Each box is one section above; the two chains (reward-model chain and policy chain) meet at the RLAIF objective, which is what the parent Constitutional AI overview page assumes you already own.


Equipment checklist

Cover the right side and test yourself. If any answer is fuzzy, reread that section before the parent note.

What do and stand for?
The prompt you give the model, and the response it returns.
What is the difference between and ?
compares preferences between whole answers; compares plain numbers.
What does the placeholder dot mean in or ?
An empty slot waiting for a real input — "of whatever you drop in here."
What do and abbreviate?
(winner's score) and (loser's score).
What does output, and what does mean?
A single quality-score number for that answer; is the set of tunable weights of the scoring model.
Why exponentiate scores before forming a probability?
Exponentials are always positive, so their ratio is a valid probability in .
What does do to any input ?
Squashes it onto an S-curve between and ; .
Which base does use on this page?
Base (the natural logarithm, ).
Why do we use in the loss?
It turns products of probabilities into sums and heavily penalises confident wrong predictions.
What does mean?
The average of the bracketed quantity over examples drawn from dataset .
What is a policy ?
The model's probability of producing response given prompt .
What does measure and when is it zero?
How different two distributions are; zero when identical, always non-negative.
What role does play?
It sets leash length — how strongly we punish drifting from the reference policy.
Why does the RL objective subtract the KL term?
So reward-hacking that grows KL also grows the subtracted penalty, making the net objective fall.