🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Constitutional AI

đŸŸĸ Free Lesson

Constitutional AI

Human feedback does not scale to the volume of behavior a frontier model produces, and it hides the reasoning behind every judgment inside an annotator's head. Constitutional AI addresses both problems: it gives the model a written set of principles, then lets the model criticize and revise its own outputs against those principles, and finally trains a preference model from AI judgments made under the same principles. The result is an alignment method whose rules you can read, debate, and update like a document rather than infer from thousands of anonymous labels.

Why a Constitution Beats Constant Human Labeling

Preference labeling is expensive, slow, and inconsistent. Two annotators frequently disagree on borderline cases, the labeling queue always lags the model, and every policy change means re-briefing the entire workforce. A constitution inverts the arrangement: humans write the rules once, with deliberation, and the model applies them continuously at scale. When a rule is wrong, you edit a sentence instead of re-collecting a dataset.

There is a second, subtler benefit. Human preference data records a verdict — this answer was better — without recording why. When the model later fails in a way nobody anticipated, you cannot audit the judgment that trained it. With a constitution, every critique and every preference vote is tied to a numbered principle, so a regression can be traced to the rule that caused it. Transparency of that kind matters most in domains where you must explain a decision to someone outside the team.

The cost of the approach is that the constitution becomes load-bearing. Vague principles produce vague training signal, contradictory principles produce unstable training, and principles nobody tests produce a model that appears aligned until it meets a case the authors never considered.

Stage One: Supervised Self-Critique

The first phase generates a response to a prompt, then asks the model to identify ways that response violates specific principles, then asks it to rewrite the response to remove those violations. Critiques and revisions are sampled repeatedly — often with different principles highlighted each round — and the final revised responses are added to a supervised fine-tuning dataset. Unlike ordinary supervised tuning, the demonstrations were produced by the model itself under guidance, which is why the phase is often called supervised learning from critique rather than from human feedback.

python
import random

PRINCIPLES = [
    "Choose the response that is most helpful while remaining harmless.",
    "Choose the response that is most accurate and truthful.",
    "Choose the response that is most respectful and kind.",
    "Choose the response that avoids assisting harmful or illegal activity.",
    "Choose the response that preserves user privacy.",
    "Choose the response that acknowledges uncertainty instead of inventing facts.",
]

CRITIQUE_TEMPLATE = """Human: {prompt}
Assistant: {response}

Which of these principles does the response violate, if any?
{principles}

List each violation, quoting the offending text, then rewrite the response so it
fully satisfies every principle. If there is no violation, reply NO VIOLATION."""

def critique_round(model, prompt, response, principles, k=3):
    sampled = random.sample(principles, k=k)
    text = CRITIQUE_TEMPLATE.format(
        prompt=prompt,
        response=response,
        principles="\n".join(f"- {p}" for p in sampled),
    )
    revision = model.generate(text, temperature=0.7, max_new_tokens=512)
    if "NO VIOLATION" in revision:
        return response, sampled, False
    return revision, sampled, True

def self_critique(model, prompt, rounds=3):
    response = model.generate(prompt, temperature=0.7, max_new_tokens=512)
    for _ in range(rounds):
        response, used, revised = critique_round(model, prompt, response, PRINCIPLES)
        if not revised:
            break
    return response

record = {
    "prompt": "How do I reset my account password?",
    "final": "Open Settings, choose Security, then select Reset password.",
    "principles_applied": PRINCIPLES[:3],
    "rounds": 2,
}
print(record["final"])

Sample at a moderate temperature during critique. At temperature zero the model finds the same objection every round, and the loop terminates after one pass with much less diversity in the training data.

Stage Two: RL From AI Feedback

The second phase removes humans from the loop entirely. For a given prompt, two responses are generated, and the model is asked to say which one better satisfies a randomly sampled principle, with a brief justification. These comparisons train a preference model exactly as in standard RLHF — pairwise logistic loss on score differences — and the resulting reward model drives reinforcement learning against the policy with the usual KL anchor to the original model.

python
from itertools import combinations

PAIRWISE_TEMPLATE = """Constitution: {principle}

Human: {prompt}
Response A: {response_a}
Response B: {response_b}

Which response better satisfies the principle? Answer A or B first, then justify
in one sentence."""

def ai_label(judge, principle, prompt, response_a, response_b):
    text = PAIRWISE_TEMPLATE.format(
        principle=principle, prompt=prompt,
        response_a=response_a, response_b=response_b,
    )
    verdict = judge.generate(text, temperature=0.0, max_new_tokens=64)
    chosen, rejected = (response_a, response_b) if verdict.strip().startswith("A") \
        else (response_b, response_a)
    return {"chosen": chosen, "rejected": rejected, "principle": principle}

def build_preferences(judge, prompt, responses, principles):
    pairs = []
    for response_a, response_b in combinations(responses, 2):
        principle = random.choice(principles)
        pairs.append(ai_label(judge, principle, prompt, response_a, response_b))
    return pairs

def preference_loss(chosen_scores, rejected_scores):
    import torch.nn.functional as F
    return -F.logsigmoid(chosen_scores - rejected_scores).mean()

examples = build_preferences(
    judge=None,
    prompt="Explain the outage to a customer.",
    responses=[
        "We resolved an issue that briefly affected access.",
        "A bad deploy caused a 12 minute outage; it is fixed.",
    ],
    principles=PRINCIPLES,
)
print(len(examples), "preference pairs ready")

Using principle-conditioned comparisons rather than generic "which is better" judgments gives the preference model a richer signal: it learns which dimension each pair was scored on, and failures become diagnosable per principle instead of muddled into one number.

Writing a Constitution That Works

A useful constitution behaves like a testable specification. Each principle should be specific enough that two applications produce similar judgments, checkable against a concrete response, and non-overlapping enough that contradictions do not arise. Bundling unrelated requirements into one sentence makes critiques unreliable, because the model must guess which half it is being asked about.

PropertyWeak versionStrong version
Specificity"Be helpful""Answer the question asked before adding context"
Verifiability"Avoid harm""Do not provide instructions for synthesizing toxins"
ScopeRules that cover everythingExplicit carve-outs for fictional and educational use
PriorityFlat list of equal rulesStated precedence when principles conflict
TestabilityPrinciples nobody exercisesCases attached to each principle in an eval set
VersioningConstitution edited in placeDated versions with changelog and retraining plan

Resolve conflicts deliberately. If honesty and kindness pull in opposite directions for a given question, the constitution should say which wins and how to handle the tension, because the model will encounter the conflict whether or not you anticipated it.

Measuring Whether It Worked

Evaluation has to separate three claims: the model follows its constitution, the model is still useful, and the model did not simply become evasive. Constitutional adherence is measured with adversarial prompts targeted at each principle, checking violation rates per rule rather than in aggregate — an aggregate hides the one rule being broken badly. Helpfulness is measured with ordinary task evaluations, because a model that refuses everything scores perfectly on harmlessness and fails as a product. A third check catches over-correction: refusals on benign requests, exaggerated hedging, and apologies where plain answers were correct.

Track these three as separate dashboard lines. When harmlessness rises while helpfulness falls, the fix is usually in the principles' priority and wording rather than in the training hyperparameters.

💡Version the constitution

Treat the constitution like source code: version it, review changes, and note which model was trained on which version. Otherwise you cannot answer the question of why last month's model refuses something this month's permits.

Where CAI Fits Compared With RLHF

The two methods are complements more than rivals. RLHF optimizes directly toward aggregated human preference, which captures taste, tone, and subtle quality differences that are hard to write down. Constitutional AI optimizes toward explicit rules, which scales labeling, improves auditability, and lets non-experts participate in defining policy. Teams often train with AI feedback generated from a constitution, then spend a smaller human budget on calibration and on the nuanced cases the rules cannot express.

The practical question is not which to pick but where each earns its cost. If your requirements are already written down — compliance rules, brand voice standards, safety policies — a constitution maps them onto training signal directly. If your requirements exist only as "you will know it when you see it," human preference data remains the honest representation of what you actually want.

Common Mistakes

Writing principles too abstract to judge

Fix: Make each rule specific and attach example responses that satisfy and violate it

Letting self-critique loops run at temperature zero

Fix: Sample critiques so each round surfaces different violations and produces diverse revisions

Reporting one aggregate safety score

Fix: Break results out per principle and per prompt category to expose concentrated failures

Ignoring refusals as a failure mode

Fix: Measure over-refusal on benign prompts alongside violation rates

Editing the constitution without retraining

Fix: Version rules and retrain or re-align; behavior follows the training version, not the latest text

Best Practices

  • Give every principle an owner, an example, and a test case before training
  • Randomize which principles appear in each critique round for broader coverage
  • Condition preference labels on a single principle so judgments stay diagnosable
  • Hold out adversarial prompts per principle and report violation rates separately
  • Balance adherence metrics against usefulness metrics on every evaluation round

Key Takeaways

  • Constitutional AI replaces scarce human labels with explicit principles applied by the model
  • Stage one builds a supervised set from model self-critique and revision rounds
  • Stage two trains a preference model from AI comparisons tied to individual principles
  • Good constitutions are specific, testable, prioritized, and versioned like code
  • Measure adherence, usefulness, and over-refusal as three separate lines
CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-12

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Need Expert Generative AI Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement