Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Claude

Overview

Claude is Anthropic’s family of large language models, designed with a focus on safety, helpfulness, and honesty. The Claude family has evolved from Claude 1 through Claude 4, with each generation bringing significant improvements in capability, context length, and safety. Claude’s distinguishing approach is Constitutional AI (CAI) — a training methodology that uses principles rather than human feedback to guide model behavior.

Model Family

graph TD
    A[Claude Family] --> B[Claude 1]
    A --> C[Claude 2]
    A --> D[Claude 3 Family]
    A --> E[Claude 3.5 Family]
    A --> F[Claude 4 Family]
    B --> B1[2023 Mar - First model]
    C --> C1[2023 Jul - 100K context]
    D --> D1[Haiku / Sonnet / Opus]
    E --> E1[Sonnet / Haiku upgrades]
    F --> F1[Sonnet 4 / Opus 4]

Version History

VersionDateContextKey Innovation
Claude 1Mar 20239KConstitutional AI training
Claude 1.3Jul 2023100KFirst 100K context model
Claude 2Jul 2023100KImproved coding, reasoning
Claude 2.1Nov 2023200KReduced hallucination, tool use
Claude 3 HaikuMar 2024200KFast, cheap, efficient
Claude 3 SonnetMar 2024200KBalanced speed/quality
Claude 3 OpusMar 2024200KMost capable (at the time)
Claude 3.5 SonnetJun 2024200KSurpassed Opus, best value
Claude 3.5 HaikuOct 2024200KNear-Sonnet quality, fast
Claude Sonnet 42025200KExtended thinking, improved coding
Claude Opus 42025200KFrontier reasoning, extended thinking

Tier System

Claude uses a tiered approach: fast and cheap (Haiku), balanced (Sonnet), most capable (Opus).

TierSpeedCostBest For
HaikuFastest$0.25/$1.25 per 1MHigh-volume, simple tasks
SonnetFast$3/$15 per 1MBest value, most use cases
OpusSlower$15/$75 per 1MComplex reasoning, research

Constitutional AI (CAI)

Claude’s signature training method. Instead of relying primarily on human labelers for RLHF, CAI uses a set of written principles (a “constitution”) to guide the model.

Traditional RLHF vs CAI

graph LR
    subgraph "Traditional RLHF"
        A1[Pretrain] --> B1[Human Labels Preferences]
        B1 --> C1[Train Reward Model]
        C1 --> D1[RL: Optimize Reward]
    end
    subgraph "Constitutional AI"
        A2[Pretrain] --> B2[Supervised Fine-Tuning]
        B2 --> C2[AI Self-Critique + Revision]
        C2 --> D2[RLAIF: AI Preferences]
    end

CAI Steps

  1. Generate: Model produces responses to prompts
  2. Critique: Model critiques its own response against constitutional principles
  3. Revise: Model rewrites the response based on the critique
  4. RLAIF: Train a preference model using AI-generated comparisons (response A vs revised response B)
  5. RL: Optimize the policy against the AI preference model

Constitutional Principles (Examples)

  • “Choose the response that is most helpful and honest”
  • “Choose the response that is least harmful or offensive”
  • “Choose the response that is most respectful of human autonomy”
  • “Choose the response that is least likely to be used for harmful purposes”

Why CAI Matters

  • Scalable: Doesn’t require thousands of human labelers
  • Transparent: Principles are written down and auditable
  • Iterable: Can update the constitution to address new concerns
  • Consistent: Principles apply uniformly across all training examples

Key Capabilities

Long Context

Claude supports 200K token context windows with strong retrieval accuracy. This enables:

  • Processing entire codebases in a single prompt
  • Analyzing long legal/medical documents
  • Multi-document summarization
  • Maintaining coherent conversations over many turns

Coding

Claude consistently ranks among the top models for coding:

BenchmarkClaude 3.5 SonnetGPT-4o
HumanEval~92%~90%
SWE-bench~49%~38%
MBPP~88%~86%

Strengths: Code generation, debugging, refactoring, code review, explaining complex codebases.

Computer Use

Claude can interact with computer interfaces — clicking, typing, navigating screens. This enables:

  • Automating GUI-based workflows
  • Testing applications
  • Navigating websites
  • Filling forms

Extended Thinking

Claude 4 models support “extended thinking” — visible chain-of-thought reasoning before answering. This improves performance on:

  • Complex math problems
  • Multi-step logic puzzles
  • Code architecture decisions
  • Research analysis

API Features

FeatureDescription
Messages APIChat-based interface with system prompts
Tool UseFunction calling with JSON schema definitions
VisionImage understanding (charts, photos, screenshots)
StreamingServer-sent events for real-time output
Batch APIAsync batch processing at 50% cost
Prompt CachingCache repeated prefixes for 90% cost reduction

Tool Use Example

{
  "name": "get_weather",
  "description": "Get current weather for a location",
  "input_schema": {
    "type": "object",
    "properties": {
      "location": {"type": "string", "description": "City name"},
      "units": {"type": "string", "enum": ["celsius", "fahrenheit"]}
    },
    "required": ["location"]
  }
}

Claude will output structured tool calls that your application executes and feeds back.

Strengths and Weaknesses

Strengths

  • Instruction following: Precise adherence to complex, multi-constraint prompts
  • Coding: Top-tier code generation and understanding
  • Long context: Strong retrieval from 200K context
  • Safety: Designed to be helpful while refusing harmful requests
  • Structured output: Excellent at JSON, XML, and structured formats
  • Nuance: Good at understanding ambiguity and edge cases

Weaknesses

  • Verbosity: Tends toward longer responses than necessary
  • Conservative refusal: Sometimes refuses benign requests
  • No native image generation: Text-only output
  • Smaller ecosystem: Fewer integrations than OpenAI
  • Knowledge cutoff: Less frequently updated than some competitors

Interview Questions

  1. What is Constitutional AI and how does it differ from RLHF? CAI uses a written set of principles (constitution) to guide training. The model critiques and revises its own outputs against these principles, then uses AI-generated preferences for RL (RLAIF). Traditional RLHF relies on human labelers to rank outputs. CAI is more scalable, transparent, and consistent.

  2. How does Claude 3.5 Sonnet compare to Claude 3 Opus? 3.5 Sonnet outperforms Opus on most benchmarks while being 5x cheaper and faster. This demonstrates that architectural improvements and better training can beat raw parameter count. It’s a key lesson: newer smaller models often surpass older larger ones.

  3. What makes Claude good at coding? Claude was trained with emphasis on code understanding and generation. It excels at: reading large codebases (200K context), understanding complex architectures, generating idiomatic code in many languages, debugging, and providing detailed code reviews. The SWE-bench score (~49%) shows strong real-world bug-fixing ability.

  4. How does Claude’s 200K context work technically? The context window supports 200K tokens (~150K words). Claude uses attention mechanisms that can efficiently process long sequences. Key metric: retrieval accuracy — how well the model can find and use specific information within the long context. Claude performs well on “needle in a haystack” tests.

  5. When would you choose Claude over GPT-4?

    • Coding tasks (especially large codebase analysis)
    • Long document processing
    • Tasks requiring precise instruction following
    • Enterprise applications where safety/alignment matters
    • When you need structured output (JSON, XML)
    • When cost efficiency matters (Sonnet is very competitive)
  6. What is “computer use” in Claude? Claude can interact with computer interfaces by taking screenshots, identifying UI elements, clicking, typing, and navigating. It’s an early capability that enables GUI automation, testing, and workflow automation. Still experimental but represents a step toward AI agents that interact with software directly.

  7. How does prompt caching work in Claude? If you send the same prefix (system prompt, long documents) across multiple requests, Claude caches it. Subsequent requests with the same prefix are 90% cheaper and faster. This is ideal for RAG systems where you embed the same document repeatedly with different questions.

Summary

Claude models are Anthropic’s frontier LLMs, distinguished by Constitutional AI training, 200K context windows, and strong coding capabilities. The tiered system (Haiku/Sonnet/Opus) provides flexibility across cost and capability needs. Claude 3.5 Sonnet’s ability to surpass the larger Opus demonstrates that training improvements matter more than raw scale. Constitutional AI represents a principled, scalable approach to alignment that contrasts with traditional RLHF.

Cross-References

References