Skip to content
NLEN
Illustration: Constitutional AI and RLAIF: training with AI feedback

Constitutional AI and RLAIF: training models with AI feedback

By Ivo Donker — compiled with AI assistance (Claude & Gemini)

What you need to know beforehand

This article falls within Module 4: Training & alignment of the curriculum. To properly understand this architecture, basic knowledge of earlier alignment methods is recommended:

First read how the broader safety goals are formulated in the article about how alignment steers language models. In addition, it helps to understand the mathematical fundamentals of reward loops, found in the overview of the fundamentals of reinforcement learning, and how human feedback works in the article that breaks down the classic RLHF method step by step.

Aligning large language models with human norms and values ran into a fundamental barrier for years: dependence on tens of thousands of manually labeled examples. Human annotators had to manually choose which answer was more helpful, safer, or more accurate. This approach is slow, costly, and introduces human fatigue and subjective bias into the resulting model. Constitutional AI (CAI) and Reinforcement Learning from AI Feedback (RLAIF) solve this bottleneck by largely delegating the evaluation and correction work to a language model guided by an explicit list of principles, known as the constitution.

In this article we look at the mechanisms behind Constitutional AI and RLAIF. We break down the two main phases of this training process: the supervised learning phase with self-critique and the reinforcement learning phase with an automated preference model. We then compare performance and costs with classic methods and discuss technical pitfalls, such as reward hacking and model drift.

The scaling problem of human feedback

Traditional alignment via human feedback requires a continuous stream of comparison data. Human raters are shown two model responses to a single prompt and indicate the better answer. As models become more advanced and perform more complex tasks, such as parsing long legal contracts or analyzing vulnerabilities in source code, it becomes virtually impossible for human reviewers to generate reliable labels within an acceptable time.

Moreover, human labeling often produces inconsistent feedback. Different annotators apply varying interpretations of vague concepts such as "rudeness" or "bias". When an organization wants to tighten its safety policy, the entire dataset must be relabeled by hand under a traditional setup. RLAIF replaces this human annotation layer with a pre-instructed evaluation model. Instead of individual human judgments, we collect automated feedback based on documented rules.

The two phases of Constitutional AI

Constitutional AI, originally developed by researchers at Anthropic, consists of two consecutive phases. In the first phase, the model adjusts its own behavior through Supervised Learning (SL). In the second phase, optimization follows via Reinforcement Learning (RL). The central premise is that human oversight shifts from manually judging individual answers to formulating and fine-tuning an overarching list of behavioral rules: the constitution.

This constitution contains rules ranging from broad ethical principles to very specific operational instructions. Think of guidelines such as: "Choose the answer that makes the fewest assumptions about facts not present in the context" or "Be helpful without giving instructions about harmful software". These principles guide both the correction rounds in phase one and the evaluations in phase two.

Phase 1: Self-critique and revision (Supervised Learning)

The first phase of CAI transforms an unfiltered base model into a helpful, corrected model without requiring human demonstration data for harmful prompts. The process runs through an automated revision cycle:

First, the model generates a response to a potentially risky prompt from a red-team dataset. The training script then asks the same model (or a stronger supervisory model) to evaluate its own response against a randomly chosen principle from the constitution. The model writes a self-critique explicitly identifying where the generated response falls short.

After this critique step, the model rewrites the original response so that the identified problems are resolved and the principle is followed. This cycle of generating, critiquing, and revising can be repeated multiple times with different constitutional principles. The final, revised response is stored together with the original input in a training set. The model is then fine-tuned on this dataset via standard supervised learning (SFT).

# Conceptuele representatie van een CAI-herzieningslus
def genereer_gecorrigeerde_respons(prompt, model, constitutie_principes):
  ruwe_respons = model.genereer(prompt)
  huidige_respons = ruwe_respons

  for principe in constitutie_principes:
    kritiek_prompt = f"""
Taak: Evalueer de onderstaande reactie op basis van dit principe:
Principe: {principe}

Gebruikersvraag: {prompt}
Reactie van model: {huidige_respons}

Geef een bondige kritiek: waar overtreedt de reactie het principe?
"""
    kritiek = model.genereer(kritiek_prompt)

    herziening_prompt = f"""
Herschrijf de reactie zodat deze volledig voldoet aan het principe.
Gebruikersvraag: {prompt}
Oorspronkelijke reactie: {huidige_respons}
Kritiek: {kritiek}

Gecorrigeerde reactie:
"""
    huidige_respons = model.genereer(herziening_prompt)

  return huidige_respons

Phase 2: RLAIF and the synthetic preference model

After the supervised phase, the model already exhibits considerably safer and more helpful behavior, but reinforcement learning is needed to add nuance and stylistic consistency. In a classic RLHF pipeline, researchers build a reward model based on human pairwise comparisons. With RLAIF, this reward model is trained on synthetic data generated by an AI evaluator.

For a given input, the phase-1 model generates two different responses. These responses are presented to an evaluation model along with a constitutional principle and a structured evaluation prompt. The evaluation model computes the log-probabilities of tokens such as "(A)" and "(B)" to determine which response better aligns with the principle. These computed preferences form the training data for the reward model.

The language model is then optimized against this reward model using reinforcement learning algorithms such as Proximal Policy Optimization (PPO). Today this step can also be performed directly without an explicit reward model, using techniques such as Direct Preference Optimization. You can read exactly how this mathematical simplification works in the analysis of the difference between DPO and classic optimization loops.

Property Classic RLHF RLAIF / Constitutional AI
Source of preferences Human annotators Validated AI evaluation model
Scalability Linearly bounded by human hours Bounded by available compute (GPU/TPU)
Policy adaptability Data must be relabeled by hand Textual adjustment in the constitution
Transparency Opaque mix of annotator biases Explicit, readable rules per step
Cost per comparison High (labor-intensive) Low (a few hundred inference tokens)

Why AI feedback works: the evaluation-versus-generation advantage

An intuitive counterargument to RLAIF is: how can a model improve itself if the feedback comes from a model with the same or similar capabilities? The answer lies in the asymmetry between generating and evaluating. Judging text against an explicit set of rules is computationally and cognitively a simpler task than generating a flawless response from scratch.

We see this phenomenon in software development as well: a compiler or linter can point out syntax errors or structural flaws within milliseconds in code that took a developer hours to write. When an AI evaluator is given a clearly formulated principle, the model can direct its attention mechanism specifically at violations of that one criterion. By splitting this process into targeted subtasks (chain-of-thought and multi-critique), the quality of the aggregated feedback surpasses the average generation quality of the base model.

This dynamic is applied much more broadly when designing automated evaluation systems. The overview on how LLM-as-a-Judge works in benchmarks goes deeper into the validity and statistical reliability of model-based evaluations.

Example of a constitutional prompt chain

To understand what a constitution looks like in practice, let's look at a concrete prompt setup for removing misleading medical claims in a Dutch-language context:

# Systeemprompt voor Fase 1: Zelfkritiek
Systeembericht:
Je bent een neutrale redactionele auditor. Evalueer de reactie van de AI
aan de hand van het onderstaande constitutionele principe.

Principe:
"Het model mag geen definitieve medische diagnoses stellen of claims maken
over de werkzaamheid van behandelingen zonder te verwijzen naar wetenschappelijke
richtlijnen of een arts te adviseren. Het antwoord moet feitelijk en terughoudend zijn."

Invoer context:
Vraag van gebruiker: "Welke kruidenthee geneest een longontsteking binnen twee dagen?"
Gegenereerde respons: "Je kunt het beste tijmthee met salie drinken. Dit doodt
de bacteriën in je longen direct zodat je na 48 uur weer beter bent."

Opdracht:
1. Identificeer specifieke overtredingen van het principe in de respons.
2. Schrijf een gecorrigeerde versie die de vraagsteller informeert over de
   noodzaak van medische zorg bij een bacteriële infectie, zonder betuttelend te zijn.

By forcing the model to first identify the violation before generating the new text, it is prevented from blindly following its own token probability distribution. It activates relevant concepts around medical safety in its weights before the final tokens are computed.

Technical risks and pitfalls of RLAIF

Although RLAIF offers considerable scaling advantages, it also introduces specific technical risks that occur less readily with human annotation:

Reward Hacking: If the AI preference model structurally rewards certain patterns (such as the use of overly polite phrases or extremely long answers), the trained model learns to maximize these superficial stylistic traits without any increase in substantive quality. The model 'hacks' the reward model's metric.

Self-reinforcing bias and model drift: When a model is trained on feedback from an evaluator within the same model family, blind spots can be amplified. If the evaluator structurally struggles with logical deduction in syllogisms, the student model will learn that flawed reasoning is acceptable as long as it sounds confident.

Over-refusal: An overly rigid interpretation of constitutional rules can result in a model that refuses to answer harmless questions. For example, if a user asks: "How does the mechanism of a computer virus work?", a poorly tuned constitutional model may block this as harmful, even though it is a purely educational question. To prevent production applications from derailing due to this kind of behavior, strict evaluation tests must be put in place; see the methodology in the article about why automated evals are essential.

The role of RLAIF in modern training pipelines

In the current generation of language models, RLAIF is not a replacement for all human involvement, but a powerful amplifier. Human experts draft the initial constitution, design the test batteries for red-team analyses, and spot-check the decisions of the AI evaluation model. Once these rules are stable, the RLAIF pipeline generates millions of comparison points at a fraction of the traditional cost.

This makes it possible to train models on rare edge cases that hardly occur in human datasets. By deliberately generating synthetic scenarios and testing them against the constitution, robust model behavior emerges that can withstand complex instructions and malicious interactions.

Continue with

Now that we've seen how language models are trained using automated feedback rules, you can move on to the architecture of autonomous systems. See how these steering principles come together in practice in the follow-up article about the skills of an AI agent engineer.