From the free course Start building with Claude on Lykke

The Claude Model Family

Key concepts: Claude 3 Opus · Claude 3.5 Sonnet · Claude 3 Haiku · Model Selection

An introduction to the different versions of Claude and how to choose the right model for your specific use case.

The Claude Model Family

The Claude model family, developed by Anthropic, represents a frontier in Large Language Model (LLM) engineering, characterized by a unique focus on Constitutional AI, high-context reasoning, and a tiered architectural approach. Unlike monolithic model releases, the Claude 3 and 3.5 lineages are designed as a specialized ecosystem, where each model is optimized for a specific point on the Pareto frontier of intelligence, speed, and cost.

AI_IMAGEI_IMAGE## Overview and Philosophy The Claude family is built upon the principle of Helpfulness, Honesty, and Harmlessness (HHH). This is achieved through a process called Constitutional AI, where the model is trained to follow a set of high-level principles (a "constitution") during the Reinforcement Learning from AI Feedback (RLAIF) phase. This differs from traditional Reinforcement Learning from Human Feedback (RLHF) by reducing the reliance on human labelers and instead using a "teacher" model to evaluate outputs based on the defined constitution.

Technically, the Claude models are Decoder-only Transformers that have been heavily optimized for long-context recall and multimodal processing. With the introduction of the Claude 3 family, Anthropic moved to a "multimodal-first" architecture, allowing all models in the suite to process both text and visual data (images, charts, screenshots) with high precision.

The Tiered Hierarchy

The Claude ecosystem is divided into three distinct classes, each serving a different segment of the computational market:

Model Class Primary Value Proposition Typical Use Case
Opus Maximum Intelligence Complex research, strategy, and intricate coding.
Sonnet Balanced Performance Enterprise automation, high-throughput RAG, and coding assistance.
Haiku Near-Instant Speed Real-time moderation, simple classification, and high-volume data extraction.

Claude 3 Opus: The Reasoning Engine

Claude 3 Opus is the flagship model of the Claude 3 family. It is engineered for tasks that require deep "system 2" thinking—logical deduction, complex mathematical reasoning, and nuanced linguistic understanding.

Technical Characteristics

Opus excels in GPQA (Graduate-Level Google-Proof Q&A) and MMLU (Massive Multitouch Language Understanding) benchmarks, often outperforming human experts in specialized domains. Its architecture is likely the largest in terms of parameters within the family, allowing for a higher degree of "emergent properties" in reasoning.

Definition: Needle In A Haystack (NIAH) A performance metric measuring a model's ability to retrieve a specific piece of information (the "needle") embedded within a massive corpus of irrelevant data (the "haystack"). Claude 3 Opus maintains >99% accuracy across its entire 200k token context window.

Implementation Example: Multi-Step Reasoning

When implementing Opus, developers typically leverage its ability to handle complex system prompts that define multi-step "Chain of Thought" (CoT) requirements.

import anthropic

client = anthropic.Anthropic(api_key="my_api_key")

# Opus is used here for a complex financial analysis task requiring 
# cross-referencing multiple data points in a single prompt.
response = client.messages.create(
    model="claude-3-opus-20240229",
    max_tokens=4096,
    system="You are a senior financial analyst. Deconstruct the provided 10-K report. "
           "Identify non-obvious risks related to supply chain volatility and "
           "quantify the potential EBITDA impact using a Monte Carlo simulation framework.",
    messages=[
        {"role": "user", "content": "Analyze the attached fiscal report for Q3."}
    ]
)

print(response.content[0].text)

Claude 3.5 Sonnet: The Efficiency Frontier

Claude 3.5 Sonnet represents a significant leap in the "middle" tier. Released after the initial Claude 3 launch, 3.5 Sonnet notably outperforms Claude 3 Opus on several key benchmarks while operating at the speed and cost of the previous Sonnet generation.

Why it Matters

3.5 Sonnet is currently considered the "Goldilocks" model for software engineering. It features enhanced spatial reasoning and vision capabilities, making it adept at interpreting architectural diagrams or UI/UX mockups and converting them into functional code.

Performance Metrics

The following table compares 3.5 Sonnet against its predecessor and the flagship Opus model:

Benchmark Claude 3 Opus Claude 3 Sonnet Claude 3.5 Sonnet
MMLU (Knowledge) 86.8% 79.0% 88.7%
HumanEval (Coding) 84.9% 73.0% 92.0%
GPQA (Reasoning) 50.4% 40.4% 59.4%
Vision (MathVista) 50.5% 53.1% 67.7%

AI_DEMOI_DEMO--

Claude 3 Haiku: The Real-Time Processor

Claude 3 Haiku is optimized for latency. It is designed to be the fastest model in its intelligence class, capable of reading a dense research paper (approx. 10k tokens) with charts and graphs in less than three seconds.

Mechanics of Speed

Haiku achieves its performance through a combination of weight quantization, optimized KV (Key-Value) caching, and a likely smaller parameter count that allows for higher throughput (tokens per second) on standard H100/A100 GPU clusters.

Use Cases

  1. Content Moderation: Scanning user-generated content in real-time.
  2. Log Analysis: Sifting through millions of lines of server logs to find anomalies.
  3. Customer Support: Powering chatbots that require sub-second response times to maintain conversational flow.

Mathematical Representation of Cost-Latency Tradeoff

To select the optimal model, engineers often use a cost-function $J$ that balances latency ($L$), cost ($C$), and accuracy ($A$):

$$J(m) = w_1 \cdot L(m) + w_2 \cdot C(m) - w_3 \cdot A(m)$$

Where:

  • $m$ is the model choice (Haiku, Sonnet, Opus).
  • $w_i$ are weights determined by business requirements.
  • For a real-time trading bot, $w_1$ (latency) would be maximized, favoring Haiku.
  • For a legal discovery tool, $w_3$ (accuracy) would be maximized, favoring Opus.

Model Selection Strategy

Choosing the right model is not a one-time decision but a dynamic optimization problem. Anthropic provides a unified Messages API, allowing developers to swap models by changing a single string parameter.

Selection Matrix

Requirement Recommended Model Rationale
Low Latency (<1s) Claude 3 Haiku Optimized for TTFT (Time to First Token).
Complex Coding Claude 3.5 Sonnet Highest HumanEval scores and fast iteration.
Large-Scale RAG Claude 3.5 Sonnet High context window with superior retrieval logic.
Nuanced Creative Writing Claude 3 Opus Better grasp of subtext and complex character arcs.
Cost Minimization Claude 3 Haiku Lowest price per million tokens.

Implementation: Model Routing Logic

In production systems, a "Router" pattern is often used to send simple queries to Haiku and complex queries to Opus/Sonnet.

// Pseudocode for an Intelligent Model Router
async function routeQuery(userInput) {
    const complexityScore = await assessComplexity(userInput); // Fast heuristic or Haiku call

    const config = {
        model: complexityScore > 0.8 ? "claude-3-opus-20240229" : "claude-3-haiku-20240307",
        max_tokens: 1024,
        messages: [{ role: "user", content: userInput }]
    };

    return await anthropic.messages.create(config);
}

Advanced Features: Tool Use and Context Management

The Claude family supports Tool Use (also known as function calling), allowing the models to interact with external APIs, databases, or local code execution environments.

Tool Use Workflow

  1. Definition: The developer defines a set of tools in JSON schema.
  2. Planning: Claude determines which tool is needed to answer the user query.
  3. Call: Claude outputs a structured JSON object containing the tool name and arguments.
  4. Execution: The developer executes the tool and feeds the result back to Claude.
  5. Final Response: Claude incorporates the tool output into a natural language answer.

Example: Tool Definition (JSON)

{
  "tools": [
    {
      "name": "get_stock_price",
      "description": "Retrieves the current stock price for a given ticker symbol.",
      "input_schema": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string",
            "description": "The stock ticker symbol (e.g., AAPL)"
          }
        },
        "required": ["ticker"]
      }
    }
  ]
}

Prompt Caching

A critical feature for enterprise applications is Prompt Caching. This allows developers to "freeze" a large prefix of a prompt (like a 50,000-token technical manual) and reuse it across multiple requests without re-processing the tokens.

  • Cost Reduction: Cached tokens are significantly cheaper (up to 90% discount).
  • Latency Reduction: Bypasses the initial computation phase for the cached prefix.

Infrastructure and API Reference

Anthropic provides several ways to access the Claude family, including the direct Anthropic API, Amazon Bedrock, and Google Cloud Vertex AI.

API Request Structure (cURL)

curl https://api.anthropic.com/v1/messages \
     --header "x-api-key: $ANTHROPIC_API_KEY" \
     --header "anthropic-version: 2023-06-01" \
     --header "content-type: application/json" \
     --data '{
         "model": "claude-3-5-sonnet-20240620",
         "max_tokens": 1024,
         "messages": [
             {"role": "user", "content": "Explain the difference between a GRU and an LSTM."}
         ]
     }'

Pricing Structure (Per 1M Tokens)

Pricing is bifurcated into Input and Output tokens, reflecting the asymmetric computational cost of processing context versus generating new text.

Model Input Cost (per 1M) Output Cost (per 1M)
Claude 3 Opus $15.00 $75.00
Claude 3.5 Sonnet $3.00 $15.00
Claude 3 Haiku $0.25 $1.25

Common Pitfalls and Best Practices

1. The "System Prompt" Misconception

Many developers treat the system prompt as a simple instruction set. In the Claude family, the system prompt is a powerful steering mechanism. Placing complex constraints or large context data in the system prompt rather than the first user message often results in better adherence to formatting and tone.

2. Over-reliance on Opus

A common mistake is using Opus for all tasks "just to be safe." This leads to unnecessarily high latency and costs.

Pro-tip: Use Claude 3.5 Sonnet as your default starting point. Only upgrade to Opus if Sonnet fails on specific reasoning edge cases, and only downgrade to Haiku if latency is the primary bottleneck.

3. Token Limits and Truncation

While Claude supports a 200k context window, the max_tokens parameter controls the output length. If a model stops mid-sentence, check the stop_reason. If it is max_tokens, you need to increase the limit or implement a recursive generation strategy.

4. Handling Multimodality

When sending images, ensure they are base64 encoded and follow the supported media types (image/jpeg, image/png, image/gif, image/webp). Claude 3 models perform best when images are high-resolution and text within images is legible.


Safety and Constitutional AI

The Claude family is unique in its approach to safety. Instead of a "black box" of human preferences, Claude's behavior is guided by a transparent set of principles. This reduces "refusal sensitivity"—the tendency of a model to refuse a harmless prompt because it superficially resembles a harmful one.

The Constitutional Cycle

  1. Supervised Learning: The model is trained to generate responses based on the constitution.
  2. Evaluation: The model critiques its own responses based on constitutional principles.
  3. Preference Modeling: A reward model is trained on these AI-generated critiques.
  4. Reinforcement Learning: The final model is fine-tuned to maximize the reward from the preference model.

This process ensures that Claude 3 models are not only safe but also more resilient to "jailbreaking" attempts compared to models trained solely on human feedback.

AI_STUDY_GUIDEI_STUDY_GUIDE## Summary Table: The Claude 3 Family at a Glance

Feature Claude 3 Opus Claude 3.5 Sonnet Claude 3 Haiku
Context Window 200,000 Tokens 200,000 Tokens 200,000 Tokens
Max Output 4,096 Tokens 8,192 Tokens 4,096 Tokens
Vision Support Yes Yes Yes
Tool Use Yes Yes Yes
Best For Deep Reasoning Coding & General Purpose Speed & Scale
Training Cutoff Aug 2023 Apr 2024 Aug 2023

The Claude model family continues to evolve, with the "3.5" generation signaling a shift toward higher intelligence at lower price points. For the modern AI engineer, mastering the selection and implementation of these models is essential for building scalable, intelligent, and cost-effective applications.

The Claude Model Family - Start building with Claude - image 1
The Claude Model Family - Start building with Claude - image 1

Source Materials

Study Start building with Claude on Lykke

This course page is free to open: signed out, you can read its first two sections, and signing in, on any plan, opens the rest. The free Lykke Chrome extension syncs your own Canvas courses, so ChatGPT, Claude and Muse can answer from your classes and deadlines. It only reads Canvas.

Add the free extensionSign in to open every section

All sections of Start building with Claude · Browse more course pages