Skip to main content

What is Constitutional AI?

Constitutional AI (CAI) is a prompting technique that guides AI behavior through explicit principles or rules that serve as “constitutional” guidelines. The AI is instructed to evaluate and improve its own outputs against these principles, promoting ethical, safe, and aligned responses without requiring human feedback for each interaction.

Why Use Constitutional AI?

  • Ethical Alignment: Ensures AI responses adhere to defined ethical standards
  • Safety Improvement: Reduces harmful, biased, or misleading outputs
  • Self-Correction: Enables the model to critique and revise its own responses
  • Reduced Oversight: Lessens the need for constant human review
  • Customizable Values: Allows tailoring principles to specific use cases or organizational values

Basic Implementation in Latitude

Here’s a simple constitutional AI example for general conversation:
Basic Constitutional AI

Advanced Implementation with Self-Critique

Let’s create a more sophisticated example that uses Latitude’s chain feature to implement a formal self-critique and revision process:
In this advanced example:
  1. Multi-Step Process: We separate response generation, critique, and revision
  2. Explicit Principles: Clear constitutional guidelines to evaluate against
  3. Structured Review: A formal process for identifying issues
  4. Iterative Improvement: Refinement based on self-critique

Domain-Specific Constitutional AI

Create custom constitutional principles for specific domains:

Multi-Stage Constitutional Review

For critical applications, implement multi-layered constitutional checks:
Subtle detail. Notice the use of as attribute in the <step> tags. This allow to create isolated steps that prevent a step to inherit previous context. So each step analyze initial_draft independently, allowing for a clean separation of concerns.

Best Practices for Constitutional AI

Principle Selection:
  • Focus on core values relevant to your use case
  • Keep principles clear, specific, and actionable
  • Include both positive guidance and restrictions
  • Cover ethical considerations appropriate to your domain
Structure:
  • Group related principles into categories
  • Number principles for easy reference
  • Define ambiguous terms within your constitution
  • Provide examples of adherence and violation for clarity
Single-Pass Review:
  • Best for simple applications
  • Include both principles and review in one prompt
  • Most efficient in token usage
  • Works well for lightweight checks
Multi-Stage Review:
  • Best for critical applications
  • Separate generation and review steps
  • Enables more thorough analysis
  • Allows specialization of review types
Chain-of-Review:
  • Enables cascading levels of checks
  • Each stage builds on previous reviews
  • Best for complex domain requirements
  • Provides trace of reasoning for each principle
Adversarial Testing:
  • Challenge your constitution with edge cases
  • Use prompt injection attempts to test robustness
  • Verify bypassing attempts are caught
  • Test across diverse sensitive topics
Iterative Improvement:
  • Start with basic principles and expand
  • Log cases where principles conflict
  • Address principle ambiguity over time
  • Build a case library of examples
Token Efficiency:
  • Balance detail against token usage
  • Consider summarizing lengthy constitutions
  • Focus on principles most relevant to the query
  • Use model with sufficient context window for complex constitutions
Evaluation Methods:
  • Track constitutional violation rates
  • Test with diverse user queries
  • Evaluate before/after quality of responses
  • Consider automated evaluation against principles

Advanced Techniques

Dynamic Constitutional Selection

Note how we used structured outputs to analyze the query context and dynamically select the appropriate constitutional principles based on the category of the query. This allows for more tailored responses while maintaining constitutional integrity.

Constitutional Governance with Hierarchy

Implement organizational values with weighted principles:

Integration with Other Techniques

Constitutional AI works well combined with other prompting techniques:
  • Role Prompting + Constitutional AI: Assign expert roles with ethical guidelines
  • Chain-of-Thought + Constitutional AI: Apply principles to reasoning steps
  • Few-Shot Learning + Constitutional AI: Provide examples of principle application
  • Self-Consistency + Constitutional AI: Generate multiple responses and select the most constitutionally aligned
The key is embedding the constitutional principles at the right stage of your prompt workflow to ensure alignment without overly constraining helpful responses.

Real-World Applications

Content Moderation

Educational AI with Constitutional Safeguards

Explore these complementary prompting techniques to enhance your AI applications:

Safety & Alignment

Reasoning & Structure

Meta Approaches

External Resources