Agent skill · research science · davila7
constitutional-ai
Anthropic's method for training harmless AI through self-improvement. Two-phase approach - supervised learning with self-critique/revision, then RLAIF (RL from AI Feedback). Use for safety alignment, reducing harmful outputs without human labels. Powers Claude's safety system.
Why this skill is useful
Adds executable scripts for self-critique and revision workflows that enhance AI safety alignment capabilities.
What it needs
Requires torch, transformers, trl installed locally. About 4k tokens when loaded. Last updated 2026-08-06. 30,138 stars on the source repository.
What this skill does
Constitutional AI - Harmlessness from AI Feedback Quick start Constitutional AI (CAI) trains models to be harmless through self-critique and AI feedback, without requiring human labels for harmful outputs. Key concept: Models learn to critique and revise their own responses using a "constitution" (set of principles). Two phases: 1. Supervised Learning (SL): Self-critique + revision 2. Reinforcement Learning (RL): RLAIF (RL from AI Feedback) Constitution example: Common workflows Workflow 1: Supervised learning phase (self-critique + revision) Step 1: Generate initial responses: Step 2: Self-critique with constitution: Step 3: Revision based on critique: Step 4: Fine-tune on revised responses: Workflow 2: RL phase (RLAIF - RL from AI Feedback) Step 1: Generate comparison pairs: Step 2: AI preference evaluation: Step 3: Train preference model (reward model): Step 4: RL training with RLAIF: Workflow 3: Chain-of-thought critique Enable reasoning transparency: When to use vs alternatives Use Constitutional AI when: Want safety alignment without human labels Need explainable AI decisions Want to avoid evasive refusals Have a clear set of principles/constitution Need scalable safety training Principles: RLAIF: AI-generated preferences (scalable, no human labels) RLHF: Human preferences (more accurate, expensive) Self-critique: Iterative improvement Chain-of-thought: Reasoning transparency Use alternatives instead: RLHF (PPO): Need human-validated safety DPO/SimPO: Have human preference data NeMo Guardrails: Need runtime content filtering LlamaGuard: Need pre-trained moderation model Common issues Issue: Model refuses too much (evasive) Add constitution principle: Issue: Self-critiques are weak Use stronger critique prompts: Issue: Revisions don't improve quality Iterate multiple times: Issue: RLAIF preferences are noisy Use multiple AI evaluators: Advanced topics Constitution design: See references/constitution-design.md for principle selection, trade-offs between helpfuln …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills davila7/safety-alignment-constitutional-ai