Constitutional AI overview
WHAT is Constitutional AI (CAI)?
The problem it solves: standard RLHF (Reinforcement Learning from Human Feedback) needs humans to rank model outputs, including harmful ones. That is:
- Expensive (many labels),
- Psychologically harmful to labelers (reading toxic content),
- Opaque (the "values" live only in the label distribution, not written anywhere).
CAI replaces most of that human labeling with the model judging itself against stated principles.
The two stages (this is the 80/20 core — learn this cold)
CAI has two phases. Say them out loud before reading on.
Stage 1 — Supervised Learning (SL) via self-critique
HOW (the loop):
- Prompt the model with a (possibly harmful) query → get an initial response.
- Ask the model: "Critique this response according to principle P." (P sampled from the constitution).
- Ask the model: "Now revise the response to remove that problem."
- Optionally repeat critique→revise a few times.
- Collect the final revised (prompt → good response) pairs.
- Fine-tune the base model on these pairs → we get the SL-CAI model.
This bakes the constitution's behavior directly into the weights.
Stage 2 — RL from AI Feedback (RLAIF)
HOW:
- Take the SL-CAI model; sample two responses to a prompt.
- Feed both to an AI "judge" model with a principle: "Which response better follows principle P?"
- The judge's choice becomes a preference pair.
- Train a preference (reward) model on these AI-generated comparisons.
- Optimize the policy with RL (PPO) against → final RL-CAI model.

WHY write it as a formula? Deriving the RLAIF objective from scratch
We never "just dump" the loss. Let's build it.
Step 1 — What does the judge give us? For a prompt and two responses , the judge picks a winner and loser .
Why this step? We need a numeric target from a categorical choice, so we model "how often is preferred" as a probability.
Step 2 — Model preference with a reward function. Assume each response has a hidden quality score . The probability the judge prefers over follows the Bradley–Terry model:
Why this step? Higher score ⇒ more likely preferred; the logistic turns a score difference into a probability in .
Step 3 — Fit by maximum likelihood (minimize negative log-likelihood over the AI-labeled dataset ):
Why this step? Maximizing the probability of the observed choices = minimizing of them.
Step 4 — Optimize the policy to earn high reward without drifting too far from the reference model (the SL-CAI model):
Why the KL term? Without it the policy would "hack" the reward and produce degenerate text. The KL leash keeps it fluent and on-distribution; controls the leash length.
Worked examples
Common mistakes (Steel-man → fix)
Active recall
Recall What are the two stages of CAI? (think, then reveal)
- SL stage: model critiques + revises its own answers against the constitution; fine-tune on the revisions. 2) RL stage (RLAIF): AI judge produces preference pairs → train reward model → PPO with KL penalty.
Recall Where does human labor go in CAI vs RLHF?
RLHF: humans rank outputs (incl. harmful ones). CAI: humans write the constitution; AI does the per-example feedback.
Recall Why is the KL term in the RL objective essential?
It keeps the policy close to the reference model, preventing reward hacking and degenerate/repetitive text while still maximizing reward.
Recall (Feynman, explain to a 12-year-old)
Imagine a kid writes a rude answer to a homework question. Instead of a teacher correcting every single answer, you give the kid a small rulebook ("be kind, be honest, don't help cheating"). The kid learns to read their own answer, spot what breaks a rule, and rewrite it nicely. Do this thousands of times and the kid just naturally writes good answers. Later, when unsure between two answers, the kid uses the rulebook to pick the better one and learns from that too. That's Constitutional AI — the AI grades itself using a small set of written rules.
Connections
- RLHF — parent method; CAI = RLHF with AI-generated labels.
- Bradley-Terry preference model — the probability model behind the reward loss.
- PPO Proximal Policy Optimization — RL optimizer used in Stage 2.
- KL divergence — the leash keeping the policy near the reference.
- Reward modeling — training from preferences.
- Prompt engineering — critiques/judgments are prompt templates.
- DPO Direct Preference Optimization — an alternative that skips the explicit reward model.
- Red teaming and harmlessness — evaluating CAI outputs.
What does the "constitution" in Constitutional AI consist of?
What are the two phases of CAI?
What does RLAIF stand for and how does it differ from RLHF?
Write the Bradley–Terry preference probability for two responses.
What is the reward-model loss in CAI?
Why include a KL penalty in the RL objective?
In Stage 1, what two operations transform a bad answer into training data?
Does CAI eliminate humans?
If , , what is ?
Is the underlying RL algorithm different in RLAIF vs RLHF?
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Constitutional AI ka core idea simple hai: normal RLHF mein humans ko har answer ko rank karna padta hai, including harmful wale — ye expensive bhi hai aur labelers ke liye mentally draining bhi. CAI bolta hai — chalo ek chhota sa constitution (rules ki list) likh dete hain, aur model ko hi bolte hain ki apne answer ko in rules ke against khud check kare aur galti ho to khud sudhaare.
Do stages hain. Stage 1 (Supervised): model ek initial (shayad rude) answer deta hai, phir hum use bolte hain "is answer ko principle P ke hisaab se critique karo", phir "ab revise karo". Ye critique→revise loop chalta hai, aur final accha answer par model ko fine-tune kar dete hain. Stage 2 (RLAIF): ab do answers generate karke ek AI judge se puchte hain "kaunsa principle P ko better follow karta hai?". Uske choices se ek reward model train hota hai (Bradley-Terry formula se), aur phir PPO se policy ko optimize karte hain — saath mein ek KL penalty taaki model reference se zyada door na bhaage aur bakwaas repetitive text na banaye.
Important baat: RLAIF aur RLHF ka math same hai — sirf label kaun de raha hai (AI vs human) wahi difference hai. Aur ye mat samajhna ki humans hat gaye — humans ab bhi constitution likhte hain, bas per-example labeling ka kaam AI ko de diya. Exam/interview ke liye 80/20: yaad rakho "do stages: self-critique fine-tuning, phir AI-judged reward + PPO with KL". Bas yahi core hai.