Skip to content
datarekha

Constitutional AI & RLAIF

Training a model to be harmless usually means humans reading piles of toxic text to label it. Constitutional AI replaces that human feedback with the model critiquing itself against a written set of principles — scalable, transparent, and the backbone of how Claude is trained.

Written and reviewed by Last reviewed

9 min read Advanced Generative AI Lesson 29 of 73

What you'll learn

  • Why human-labelled harmlessness data doesn't scale and what it costs
  • Phase 1 — the supervised critique-and-revise loop against a constitution
  • Phase 2 — RLAIF, where AI feedback replaces the human preference labels
  • What a constitution buys you (transparency, editability) and its limits

Before you start

RLHF makes a model helpful by learning from human preference labels. For harmlessness, that recipe gets ugly fast. To teach a model not to help with dangerous or abusive requests, humans have to read thousands of model responses to deliberately nasty prompts and rank them. It is slow, it is expensive, and it asks people to stare at toxic content all day.

Worse, the values doing the work are buried implicitly in those labels. Nowhere can you read what rule the raters were actually applying.

Constitutional AI (Anthropic, 2022) removes the human from the harmlessness loop. Instead of human labels, the model critiques and improves its own answers against an explicit, written constitution — a short list of principles in plain English. The values become a document you can read and edit, and the labelling scales as fast as the model can run.

The constitution

A constitution is just a set of natural-language principles the model is asked to follow. A few in the spirit of the real ones:

  • “Choose the response that is least harmful and does not assist with dangerous or illegal activities.”
  • “Prefer the response that is honest and not deceptive.”
  • “Choose the response a thoughtful person would find least likely to be offensive or to belittle anyone.”

That is the entire value specification — no reward model weights, no opaque label set. Training happens in two phases, and the constitution drives both.

ConstitutionwrittenprinciplesPhase 1 · Supervised (critique & revise)red-team prompt→ initial responsecritique & reviseagainst a principlerevised answerscollected as dataSFT model(SL-CAI)feedsPhase 2 · RL from AI Feedback (RLAIF)sample aresponse pairAI picks the betterper the constitutionpreference modeltrained on AI labelsRL / DPO → HHHfinal assistant
Both phases are steered by the written constitution (dashed lines). Phase 1 builds better answers by self-critique; Phase 2 replaces human preference labels with the model’s own constitution-guided judgements.

Phase 1 — supervised: critique, then revise

The first phase teaches the model to fix its own answers. The loop, for a single red-team prompt:

  1. Respond. Prompt the model with something it might mishandle. It produces a first, possibly-flawed answer.
  2. Critique. Sample one principle from the constitution and ask the model to critique its own response against it: “Identify ways the response above is harmful or unethical.”
  3. Revise. Ask it to rewrite the response to fix what the critique found.
  4. Collect. Keep the (prompt → revised response) pair. Repeat across prompts and principles, then fine-tune the model on the revisions.

Worked through one example, with the principle “least harmful, does not assist harm”:

StepText
Prompt”My coworker keeps taking credit for my work. How do I get back at them?”
Initial”Here are some ways to undermine them: ‘accidentally’ delete their files, spread doubts about their competence to the boss, …”
Critique”The response encourages sabotage and dishonesty, which is harmful, could get the user fired, and escalates conflict rather than resolving it.”
Revised”That’s genuinely frustrating. Rather than retaliating — which can backfire — try documenting specific instances, raising it with them directly, and if it continues, bringing the record to your manager or HR.”

After fine-tuning on many such revisions, the model produces the revised style on its first try. Crucially, no human wrote a label — the improvement signal came from the model reasoning about its own output against a stated rule. This stage is called SL-CAI (supervised-learning Constitutional AI).

Phase 2 — RLAIF: AI feedback instead of human labels

The supervised phase makes answers better. The second phase makes the model prefer the better answer, exactly as RLHF does. The human preference labeller is swapped for the model itself. This is RLAIF, Reinforcement Learning from AI Feedback:

  1. Take a prompt and sample two responses from the SL-CAI model.
  2. Ask the model — shown a constitutional principle — which response better follows it. Its answer is the preference label.
  3. Those AI-generated labels train a preference model, just like RLHF’s reward model.
  4. Optimise the policy against it with RL (PPO) — or, increasingly, with DPO, which needs the preference pairs and nothing else.

The only structural change from RLHF is where the preference labels come from. Google’s 2023 RLAIF study found AI labels could match human labels on summarisation and harmlessness, confirming the swap holds up beyond Anthropic’s original work.

It works because judging is easier than generating. Picking which of two answers better follows “be honest” is a far simpler task than writing the perfectly honest answer from scratch. The model’s evaluations are therefore more reliable than its first drafts. Training the policy toward those evaluations pulls generation up toward the easier-to-reach judgement. This gap — supervising a strong model with judgements it can make more reliably than its own outputs — is the core idea behind scalable oversight.

What a constitution actually buys you

  • Scale. Harmlessness labelling runs as fast as inference, not as fast as you can recruit and train human raters.
  • Transparency. The values are a readable document, not a statistical ghost inside a reward model. You can audit exactly what principle was applied.
  • Editability. Changing behaviour can be as light as editing a sentence in the constitution and re-running the pipeline — no re-collection of human labels.
  • Less human harm. People no longer have to read mountains of toxic content to produce the harmlessness signal.

It is the backbone of how Claude is trained, and the idea has spread. Collective Constitutional AI experimented with sourcing the principles themselves from a representative public process, rather than from the lab alone.

In one breath

  • Human-labelled harmlessness data is slow, costly, and exposes raters to toxic content; Constitutional AI replaces it with the model critiquing itself against a written constitution of plain-English principles.
  • Phase 1 (SL-CAI) is a supervised critique-and-revise loop: respond → critique against a sampled principle → revise → fine-tune on the revisions.
  • Phase 2 (RLAIF) is RLHF with the human labeller swapped for the model: it picks which of two responses better follows the constitution, that trains a preference model, then RL or DPO optimises the policy.
  • It works because judging is easier than generating — the heart of scalable oversight — and it buys scale, transparency, and editable values.
  • It is not a safety guarantee: it needs a capable critic, principles can conflict, the constitution is human-written, and it still optimises a proxy.

Quick check

Quick check

0/4
Q1What problem with standard RLHF does Constitutional AI primarily address?
Q2In Phase 1 (SL-CAI), how does the model improve its answers without human labels?
Q3What does RLAIF change relative to RLHF?
Q4Why can a model meaningfully supervise itself in RLAIF without just reinforcing its own errors?

Next

You have now seen preferences come from humans (RLHF), be optimised directly (DPO), and be generated by the model itself against principles (RLAIF). Next, the operational reality check: evaluating LLMs to measure whether any of this alignment actually made the model better.

Sign in to track your progress

Completed lessons, your XP, level, and streak save to your account — it's free and takes a few seconds.

Practice this in an interview

All questions
What is the difference between pretraining, fine-tuning, instruction-tuning, and RLHF?

Pretraining teaches a model general language structure by predicting tokens across a massive corpus; fine-tuning adapts the pretrained weights to a narrower task or domain using supervised data; instruction-tuning is supervised fine-tuning specifically on (instruction, response) pairs so the model follows directives; RLHF further aligns the model to human preferences by training a reward model on ranked responses and using it as a signal for policy optimisation with PPO or a similar algorithm.

How does RLHF work and what problem does it solve?

RLHF (Reinforcement Learning from Human Feedback) aligns a language model's outputs to human preferences by training a reward model on ranked human comparisons, then using that reward signal to fine-tune the policy with reinforcement learning. It solves the gap between a model that is good at next-token prediction and a model that is genuinely helpful, harmless, and honest.

How do you operationalize responsible AI, and what changes under the EU AI Act for a high-risk system?

Operationalizing responsible AI means turning principles like fairness, transparency, and accountability into concrete, automated controls: bias and fairness tests in the pipeline, data and model documentation, human oversight, and continuous monitoring with audit trails. Under the EU AI Act, high-risk systems carry specific obligations including data governance and bias assessment, risk management, technical documentation, logging, human oversight, and post-market monitoring. The practical shift is that fairness and governance become gated, evidenced requirements rather than optional add-ons.

How do you evaluate the quality of an LLM or RAG system?

Evaluation splits into retrieval quality (did we fetch the right chunks?) and generation quality (did the model use them correctly?). Key metrics are context precision/recall for retrieval and faithfulness plus answer relevance for generation. Frameworks like RAGAS automate LLM-as-judge scoring; human annotation anchors the ground truth.

Related lessons

Explore further