Constitutional AI
Constitutional AI
An AI training methodology developed by Anthropic. Governs AI behavior through constitutional principles.
Constitutional AI
An AI training methodology developed by Anthropic. Governs AI behavior through constitutional principles.
Constitutional AI (CAI) is an AI training methodology developed by Anthropic that controls AI behavior based on explicit principles (a constitution). By having the AI evaluate and revise its own outputs without direct feedback from human labelers, it builds safer and more helpful AI systems.
CAI, published in a December 2022 Anthropic paper, was created to overcome the limitations of RLHF (Reinforcement Learning from Human Feedback). RLHF has high costs for securing human evaluators, evaluator bias can be reflected in the model, and it is difficult to scale. CAI replaces this with AI self-critique, improving scalability and consistency.
CAI consists of two stages. First, in the Supervised Learning stage, the model generates responses to harmful prompts, then critiques and revises them itself according to the constitutional principles. Second, in the RLAIF (Reinforcement Learning from AI Feedback) stage, the AI selects the response that better conforms to the constitution from among multiple responses to train a reward model.
In practice, CAI is a core training technique for the Claude series of models and an important milestone in AI safety research. Explicit principles increase the transparency of AI behavior, and model behavior can be adjusted simply by modifying the principles, which makes maintenance easy. However, it does not guarantee perfect safety, so additional safeguards are needed.
# Constitutional AI 개념적 구현 (의사코드)
# 실제 CAI 훈련은 대규모 컴퓨팅 자원이 필요합니다
class ConstitutionalAI:
def __init__(self, base_model, principles: list[str]):
self.model = base_model
# 헌법 원칙 예시
self.constitution = principles or [
"Choose the response that is most helpful while being safe.",
"Choose the response that sounds most similar to what a wise, ethical expert would say.",
"Choose the response that is least likely to cause harm.",
]
def critique_and_revise(self, prompt: str, initial_response: str) -> str:
"""1단계: 자기 비평 및 수정"""
critique_prompt = f"""
Human: {prompt}
Assistant: {initial_response}
Critique Request: Identify specific ways in which the assistant's
response is harmful, unethical, or unhelpful based on these principles:
{self.constitution}
Critique: """
critique = self.model.generate(critique_prompt)
revision_prompt = f"""
Based on the critique above, please rewrite the response to be
more helpful, harmless, and honest while still addressing the
human's question.
Revision: """
revised_response = self.model.generate(critique_prompt + critique + revision_prompt)
return revised_response
def preference_ranking(self, prompt: str, responses: list[str]) -> int:
"""2단계: RLAIF를 위한 선호도 평가"""
ranking_prompt = f"""
Consider the following responses to: "{prompt}"
Response A: {responses[0]}
Response B: {responses[1]}
Which response better follows these principles?
{self.constitution}
The better response is: """
# AI가 헌법에 더 부합하는 응답을 선택
preference = self.model.generate(ranking_prompt)
return 0 if "A" in preference else 1
# 사용 예시
principles = [
"항상 정확하고 검증 가능한 정보를 제공한다",
"유해하거나 위험한 행동을 조장하지 않는다",
"사용자의 프라이버시를 존중한다"
]
cai = ConstitutionalAI(base_model, principles)
revised = cai.critique_and_revise(user_prompt, initial_output)
"The key insight of Constitutional AI is that an AI can understand and apply principles. RLHF only learns the implicit preference of 'B is better than A,' but CAI specifies the principle of 'why B is better,' so it generalizes better."
"The reason Claude is more consistent than GPT in safety is Constitutional AI. Training based on explicit principles produces more predictable behavior than RLHF, which blends the tastes of thousands of human evaluators."
"The question of who writes CAI's 'constitution' remains open. Whether the principles set by Anthropic are universal, whether there is any cultural bias — governance questions like these cannot be resolved by technical solutions alone."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free
CAI is a technique for improving AI safety, but it does not guarantee perfect safety. It may still be vulnerable to jailbreak attacks, and additional safety layers are needed in production environments.
It is hard for constitutional principles to cover every situation, and conflicts between principles can occur. A trade-off exists between "be helpful" and "be safe."
Implementing CAI yourself requires large-scale computing resources and a high-quality base model. For small organizations, using the Claude API is a more realistic choice.