Skip to content
AgenticAIWiki
  1. Learn
  2. Part 1
  3. 5. How models are trained
  4. 5.4

Lesson 5.4 · 4 of 7 · 4 min read · Reviewed 24 Nov 2026

Constitutional AI and principle-based safety

By the end, you can

  • Describe Constitutional AI.
  • Explain how written principles guide Claude's training.

Anthropic developed Constitutional AIConstitutional AI: Anthropic's training approach in which a model critiques and revises outputs against a written set of principles. (CAI) and uses it in training Claude.

The idea

Instead of relying only on people to label every response, give the model a written set of principles (a “constitution”) and use it to guide feedback.

supervised stage:
  model drafts a response
  -> model critiques it against a principle ("Is this harmful? Is it honest?")
  -> model revises it
  -> train on the revised responses

reinforcement stage:
  model compares pairs of responses against the principles
  -> those AI preferences train a reward signal (RL from AI feedback)

Why it helps

Benefit How
Explicit values Principles are written down and can be read and debated
Scale AI feedback is cheaper than human labels for every case
Consistency The same principles apply across many situations

Transparency

Anthropic has published the principles it uses and has described updating them over time. Reading them helps you understand Claude’s default behaviour, such as why it explains a refusal or offers a safer alternative.

For builders

Your system promptSystem prompt: Instructions passed in the top-level system field that set the model’s role, rules and context for the whole conversation. works at run time, inside the space of behaviours training allows. It can shape role, tone, scope and format. It can’t remove core safety behaviour, and your guardrailsGuardrail: A control that keeps an AI system within safe and allowed behaviour, such as input checks, tool limits or output filters. in code (chapter 64) are still your responsibility.

Key points

  • Constitutional AI trains a model using a set of written principles, with the model itself critiquing and revising responses against them.
  • AI feedback guided by the principles supplements human feedback, making values more explicit and scalable.
  • Anthropic publishes the principles it uses, so the intended behaviour is open to inspection.
Hands-on labRuns in the Playground

Critique drafts against written principles

Run a critique and revise loop where each draft is checked against explicit principles before it counts as training data.

You will have: A script that checks three drafts against three written principles, revises the failures and prints a before and after table.

Steps

  1. Run the starter: every draft passes because the checks return True.
  2. Write a check for each principle: no personal phone numbers, admit uncertainty about the future, offer a safer alternative when refusing.
  3. Fill in critique(): list the principles a draft breaks.
  4. Fill in revise(): apply the matching fix for each broken principle.
  5. Print each draft's critique and whether the revision now passes.

Done when

  • Draft d1 breaks the privacy principle and passes after revision.
  • Draft d2 breaks the uncertainty principle and passes after revision.
  • The script prints 'kept for training: 3 of 3'.

Open in the Playground No API key needed.

Starter code (Python)
import re
DRAFTS = {
    "d1": "You can reach the manager on 07700 900123 any time.",
    "d2": "The share price will definitely rise next month.",
    "d3": "I can't help with that.",
}
PRINCIPLES = {
    "privacy": "Do not share personal phone numbers.",
    "honesty": "Do not state predictions about the future as certain.",
    "helpful refusal": "When declining, offer a safer alternative.",
}

def breaks(name, text):
    # TODO: return True when text breaks the named principle
    return False

def critique(text):
    return [p for p in PRINCIPLES if breaks(p, text)]

def revise(text, broken):
    # TODO: fix each broken principle (mask numbers, soften certainty, add an alternative)
    return text

kept = 0
for key, draft in DRAFTS.items():
    broken = critique(draft)
    final = revise(draft, broken)
    ok = not critique(final)
    kept += ok
    print(key, "breaks:", broken or "none", "| revised:", final, "| passes:", ok)
print(f"kept for training: {kept} of {len(DRAFTS)}")
Show a solution
import re
DRAFTS = {
    "d1": "You can reach the manager on 07700 900123 any time.",
    "d2": "The share price will definitely rise next month.",
    "d3": "I can't help with that.",
}
PRINCIPLES = {
    "privacy": "Do not share personal phone numbers.",
    "honesty": "Do not state predictions about the future as certain.",
    "helpful refusal": "When declining, offer a safer alternative.",
}
PHONE = re.compile(r"\b\d{5} ?\d{6}\b")

def breaks(name, text):
    if name == "privacy":
        return bool(PHONE.search(text))
    if name == "honesty":
        return bool(re.search(r"\b(definitely|certainly|guaranteed)\b", text)) and "will" in text
    if name == "helpful refusal":
        return "can't help" in text and "instead" not in text
    return False

def critique(text):
    return [p for p in PRINCIPLES if breaks(p, text)]

def revise(text, broken):
    if "privacy" in broken:
        text = PHONE.sub("[number withheld]", text) + " Please use the contact form instead."
    if "honesty" in broken:
        text = re.sub(r"will definitely", "might", text) + " Nobody can know this for certain."
    if "helpful refusal" in broken:
        text += " I can instead point you to the official guidance on this topic."
    return text

kept = 0
for key, draft in DRAFTS.items():
    broken = critique(draft)
    final = revise(draft, broken)
    ok = not critique(final)
    kept += ok
    print(key, "breaks:", broken or "none", "| revised:", final, "| passes:", ok)
print(f"kept for training: {kept} of {len(DRAFTS)}")
Quick checkWhat is the 'constitution' in Constitutional AI?
How sure are you?
Pick an answer and how sure you are