Passer au contenu

How to Optimize Workload Performance When Using Anthropic Models on Bedrock

Lecture de 12 minute(s)
Niveau du contenu : Avancé
0

Actionable performance optimization techniques for IT teams deploying Anthropic models on Amazon Bedrock in production environments

Amazon Bedrock provides a powerful platform for deploying and optimizing Anthropic models for your generative AI workloads. By leveraging the right combination of features and best practices, you can significantly improve both the performance and cost efficiency of your applications. This article explores key strategies for optimizing workload performance when using Anthropic models on Amazon Bedrock.

1. Use the Latest Available Model Versions

The foundation of optimal performance starts with using the most current model versions available in your model family. Amazon Bedrock continuously introduces newer model versions with improved capabilities, accuracy, and safety features. As of late 2026, the Claude 5.5 family represents the latest generation of Anthropic models on Bedrock.

Understanding Model Lifecycle States

Amazon Bedrock models exist in three lifecycle states⁴:

  • Active: Current, fully supported models with the latest features and optimizations
  • Legacy: Older models that remain available but are scheduled for deprecation (minimum 6 months notice)
  • End-of-Life (EOL): Models no longer available for new usage

Current Recommended Claude Models (2026)

Anthropic models on Bedrock are organized across several tiers, each optimized for different workloads⁶:

TierBest for
HaikuClassification, extraction, high-volume tasks, real-time moderation
SonnetCoding, analysis, most enterprise workloads (best balance of capability/cost)
OpusComplex reasoning, research synthesis, long-running agentic workflows
FableAmbitious coding, long-horizon agents, enterprise knowledge work
MythosCybersecurity defense, life sciences research, threat intelligence

Current generation (Claude 5.5 — recommended for new workloads):

  • Claude Haiku 5.5: anthropic.claude-haiku-5-5 — fastest and most efficient, clear step up over Haiku 4.5 on coding and agent tasks
  • Claude Sonnet 5.5: anthropic.claude-sonnet-5-5 — smarter, more efficient Sonnet; clear leap forward from Sonnet 5 on coding and knowledge work at lower cost per task
  • Claude Opus 5.5: anthropic.claude-opus-5-5 — most capable Opus model; better at coding, knowledge work, and long-running tasks
  • Claude Fable 5.1: anthropic.claude-fable-5-1 — frontier model for ambitious coding, long-horizon agents, and enterprise knowledge work
  • Claude Mythos 5.1: anthropic.claude-mythos-5-1 — specialized for cybersecurity defense and life sciences research

Previous generation (Claude 5.0 — still active and widely used):

  • Claude Sonnet 5: anthropic.claude-sonnet-5 — currently at promotional pricing ($2/$10 per million input/output tokens)
  • Claude Opus 5: anthropic.claude-opus-5 — advanced Opus model for long-running agents

Stable 4.x models (active lifecycle):

  • Claude Sonnet 4.6: anthropic.claude-sonnet-4-6 — 1M token context window, improved computer use and long-context reasoning
  • Claude Opus 4.8: anthropic.claude-opus-4-8 — optimized for coding, agents, and deeper reasoning
  • Claude Haiku 4.5: anthropic.claude-haiku-4-5-20251001-v1:0 — lightweight, speed-optimized with strong coding performance

⚠️ Important lifecycle note: Claude Sonnet 4 (anthropic.claude-sonnet-4-20250514-v1:0) reached End-of-Life on October 14, 2026. If you are still using this model ID, migrate immediately — it is no longer available for new usage. Claude Sonnet 4.5 and Claude Sonnet 4.6 are the current replacements.

Benefits of Using Latest Models

  • Enhanced accuracy and reasoning capabilities
  • Improved safety and reduced harmful outputs
  • Better cost efficiency through optimized architectures
  • Access to newest features like extended context windows, improved computer use, and advanced agentic capabilities
  • Longer support lifecycle ensuring business continuity

Key Compatibility Considerations When Upgrading

When upgrading to newer model generations, ensure compatibility by addressing these changes:

1. New Stop Reasons

Claude 4.x and 5.x models introduce new stop reasons that your application should handle¹:

  • refusal: When Claude declines to generate content for safety reasons
  • model_context_window_exceeded: When generation stops due to context window limits (not max_tokens)

Update your error handling logic:

if response.stop_reason == "refusal":
    # Handle safety refusal
elif response.stop_reason == "model_context_window_exceeded":
    # Handle context window limit

2. Expanded Context Windows

Newer models (Sonnet 4.6 and above) support up to 1M token context windows, compared to 200K for the 4.5 generation. If you currently use chunking or windowing strategies to work around context limits, review whether they are still necessary.

3. Model ID Format Change

Models launched after the 4.5 generation use a suffix-less ID format — no date stamp or version suffix⁶:

# Older format (4.5 generation and earlier)
"anthropic.claude-haiku-4-5-20251001-v1:0"

# Newer format (4.6 generation and above)
"anthropic.claude-sonnet-4-6"
"anthropic.claude-sonnet-5"
"anthropic.claude-opus-4-8"

# Global CRIS prefix works with both formats
"global.anthropic.claude-sonnet-5"
"global.anthropic.claude-opus-4-8"

4. Extended Thinking (Available Across Generations)

Extended thinking remains available for complex tasks across all 4.x and 5.x models:

import boto3

bedrock_runtime = boto3.client('bedrock-runtime')

# Enable extended thinking — works with current-gen models
response = bedrock_runtime.converse(
    modelId="anthropic.claude-sonnet-5",
    messages=[{"role": "user", "content": [{"text": "Your complex prompt here"}]}],
    additionalModelRequestFields={
        "thinking": {
            "enabled": True,
            "budget": 10000  # Optional: control thinking token budget
        }
    }
)

Note: Extended thinking impacts prompt caching efficiency but significantly improves performance on complex tasks¹.

Implementation Example

import boto3

bedrock_runtime = boto3.client('bedrock-runtime')

# For high-performance workloads (current recommended default)
response = bedrock_runtime.converse(
    modelId="anthropic.claude-sonnet-5",  # Or claude-sonnet-5-5 for latest
    messages=[{"role": "user", "content": [{"text": "Your prompt here"}]}],
)

# For complex reasoning with extended thinking
response = bedrock_runtime.converse(
    modelId="anthropic.claude-opus-5",
    messages=[{"role": "user", "content": [{"text": "Your complex prompt here"}]}],
    additionalModelRequestFields={
        "thinking": {"enabled": True}
    }
)

# For cost-effective, high-throughput workloads
response = bedrock_runtime.converse(
    modelId="anthropic.claude-haiku-4-5-20251001-v1:0",  # Or haiku-5-5 for latest
    messages=[{"role": "user", "content": [{"text": "Your prompt here"}]}]
)

Avoid using legacy model IDs like anthropic.claude-3-sonnet-20240229-v1:0, anthropic.claude-v2:1, or anthropic.claude-sonnet-4-20250514-v1:0 (EOL).

2. Implement Prompt Caching for Repeated Contexts

Immediate Impact: Up to 85% latency reduction and 90% cost savings² for workloads with repeated context.

Low-Hanging Fruit - Cache These Immediately:

  1. System prompts - Cache your role definitions and instructions
  2. Documentation/context - Cache large documents, code bases, or knowledge that gets referenced repeatedly
  3. Few-shot examples - Cache your example sets for consistent formatting
  4. Tool definitions - Cache function schemas and descriptions

Implementation Pattern:

# Structure: Static content → Cache → Dynamic content → Cache → Variable content
response = bedrock_runtime.converse(
    modelId="anthropic.claude-sonnet-5",
    system=[
        {"text": "You are a senior software architect. Follow these coding standards..."},
        {"cachePoint": {"type": "default"}},  # Cache system prompt
        {"text": f"Current codebase context:\n{large_codebase_content}"},
        {"cachePoint": {"type": "default"}},  # Cache codebase
    ],
    messages=[
        {"role": "user", "content": [{"text": f"Review this specific function: {user_code}"}]}
    ]
)

Cache Hit Rate Monitoring:

# Check cache performance in CloudWatch
cache_hit_rate = (cache_read_tokens / total_input_tokens) * 100
# Target: >70% cache hit rate for optimal ROI

Quick Win: If you have any system prompts >500 tokens that repeat across requests, implement caching immediately - it's a 5-minute change with massive impact.

Important: Prompt cache is local to the serving Region and not shared across Regions. Any Region move (including cross-region inference failover) cold-starts the cache. Plan for a one-off re-warm cost at any cutover, especially given the 5-minute default TTL. Extended TTL (1 hour) is available if your traffic pattern needs it.

3. Manual Model Selection Strategy

With the expanded model lineup, implementing a routing strategy that matches task complexity to the right model tier is the most impactful cost optimization available.

Decision Matrix:

  • Simple tasks (summaries, basic Q&A, formatting, classification): Use Haiku 4.5 or Haiku 5.5 — lowest cost and highest speed
  • Standard workloads (coding, analysis, document processing): Use Sonnet 5 or Sonnet 5.5 — best balance (Sonnet 5 at promotional pricing is especially cost-effective)
  • Complex reasoning / long-running agents (multi-step research, complex coding, agentic tasks): Use Opus 4.8, Opus 5, or Opus 5.5
  • Specialized domains: Use Fable 5.1 for coding/agents; Mythos 5.1 for cybersecurity or life sciences

Implementation:

def select_claude_model(prompt_text, task_complexity="auto"):
    if task_complexity == "auto":
        # Heuristics for auto-detection
        complexity_indicators = ["analyze", "explain why", "step by step", "reasoning", "complex", "agent", "plan"]
        is_complex = any(indicator in prompt_text.lower() for indicator in complexity_indicators)
        estimated_tokens = len(prompt_text.split()) * 1.3  # Rough token estimate

        if is_complex or estimated_tokens > 1500:
            return "anthropic.claude-sonnet-5"   # Or sonnet-5-5 for highest quality
        else:
            return "anthropic.claude-haiku-4-5-20251001-v1:0"  # Or haiku-5-5

    model_map = {
        "high": "anthropic.claude-opus-5",
        "medium": "anthropic.claude-sonnet-5",
        "low": "anthropic.claude-haiku-4-5-20251001-v1:0"
    }
    return model_map.get(task_complexity, "anthropic.claude-sonnet-5")

# Usage
model_id = select_claude_model(user_prompt)
response = bedrock_runtime.converse(modelId=model_id, messages=[...])

Cost Impact: Proper model selection can reduce costs by 60-80% for mixed workloads while maintaining quality.

4. Combine Prompt Caching with Intelligent Prompt Routing

For maximum optimization, you can combine prompt caching with Intelligent Prompt Routing⁵. This approach allows you to:

  • Reduce costs through intelligent model selection
  • Further decrease latency and costs with prompt caching
  • Create highly efficient, scalable AI applications

When using both features together, ensure your cache checkpoints are placed appropriately in prompts that will be routed to different models. Check the Intelligent Prompt Routing documentation for the current list of supported model pairs, as support has expanded significantly with newer model generations.

5. Use Cross-Region Inference for broader model access

Cross-Region inference (CRIS) serves two distinct purposes that are equally important:

Cross-Region Inference gives you access to supported Claude models without tying model choice to the calling Region. Global inference profiles also provide approximately 10% savings on input and output token pricing compared with geographic inference profiles

⚠️ Important: CRIS is a capacity and access mechanism, not a failover or disaster recovery mechanism. It does not automatically protect against model or service disruptions. Resilience to a Regional impairment must be designed explicitly at the application or gateway layer.

Two Profile Types: Geographic vs. Global

Amazon Bedrock offers two types of cross-Region inference profiles, each designed for different requirements³:

FeatureGeographic CRISGlobal CRIS
Data residencyWithin geographic boundaries (US, EU, APAC, AU, JP)Any supported commercial AWS Region worldwide
CostStandard pricing (no routing surcharge)~10% savings vs. geographic pricing
ThroughputHigher than single-regionHigher than geographic
Best forData residency requirementsCost optimization without geographic restrictions

Key pricing clarification: Geographic cross-Region inference incurs no additional routing cost — you pay standard rates calculated from your source Region. Global inference profiles go a step further: they offer approximately 10% savings on both input and output token pricing compared to geographic profiles³. This makes the global profile the cost-optimal choice for workloads without geographic data restrictions.

Using Cross-Region Inference Profiles

# ✅ Recommended: Global profile for maximum throughput and ~10% cost savings
# (no data residency requirements)
response = bedrock_runtime.converse(
    modelId="global.anthropic.claude-sonnet-5",
    messages=[{"role": "user", "content": [{"text": "Your prompt"}]}]
)

# ✅ Geographic profile for EU data residency requirements
response = bedrock_runtime.converse(
    modelId="eu.anthropic.claude-sonnet-5",
    messages=[{"role": "user", "content": [{"text": "Your prompt"}]}]
)

# ✅ Access a model not yet available in-region via global CRIS
response = bedrock_runtime.converse(
    modelId="global.anthropic.claude-opus-4-8",
    messages=[{"role": "user", "content": [{"text": "Your prompt"}]}]
)

Profile ID format: Geographic profiles use a geography prefix (us., eu., ap., au., jp.); global profiles use global.. Verify supported models and current profile IDs in the Bedrock inference profiles documentation, as availability changes with each model launch.

Practical notes:

  • CloudTrail logs all CRIS requests in your source Region, regardless of where inference runs — use additionalEventData.inferenceRegion to identify the destination
  • Inference profiles do not support Provisioned Throughput — these are separate mechanisms
  • All cross-Region data transmission stays on the AWS network; data is encrypted in transit and never traverses the public internet

6. Use Provisioned Throughput for Consistent Workloads

For production workloads with predictable traffic patterns, Provisioned Throughput can provide better performance and cost optimization compared to on-demand inference. Provisioned Throughput offers:

  • Consistent, low-latency inference
  • Up to 60% cost savings compared to on-demand pricing³
  • Dedicated compute capacity for your models

To use Provisioned Throughput, purchase it through the Amazon Bedrock console or API, then specify the provisioned model ARN when making inference calls.

Note: Provisioned Throughput is provisioned against a specific base model ID and does not combine with cross-Region inference profiles. Use Provisioned Throughput for predictable baseline traffic and CRIS for burst traffic and access to additional models — they are complementary strategies for different scenarios.

Conclusion

Optimizing workload performance with Anthropic Claude models on Amazon Bedrock requires a strategic combination of features and best practices. The model landscape has expanded significantly — from the Claude 4.5 generation to the current Claude 5.5 family — and selecting the right tier for each task remains the highest-leverage optimization available.

The key is to match the right optimization strategy to your specific workload characteristics:

  • Use the latest model generation appropriate to your task tier (Haiku for speed, Sonnet for balance, Opus for complexity)
  • Use prompt caching for workloads with repeated context
  • Apply manual routing or Intelligent Prompt Routing for varied complexity workloads
  • Use global CRIS profiles to access models not yet in-region and to save ~10% vs geographic profiles
  • Use geographic CRIS profiles when data residency within a specific geography is required
  • Combine caching with routing for maximum optimization
  • Monitor performance metrics to validate improvements

Regular monitoring and continuous optimization based on actual usage patterns will help you maintain peak performance while controlling costs. As new model generations become available on Amazon Bedrock, use lifecycle state (Active / Legacy / EOL) as your signal to migrate — and stay ahead of EOL dates to avoid unplanned disruptions.

References

  1. Anthropic. (2025). What's new in Claude 4.5. Claude Documentation. https://docs.claude.com/en/docs/about-claude/models/whats-new-claude-4-5

  2. Amazon Web Services. (2025). Amazon Bedrock Prompt Caching Documentation. AWS Documentation.

  3. Amazon Web Services. (2026). Route model inference requests across AWS Regions with cross-Region inference. Amazon Bedrock User Guide. https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html

  4. Amazon Web Services. (2025). Model lifecycle. Amazon Bedrock User Guide. https://docs.aws.amazon.com/bedrock/latest/userguide/model-lifecycle.html

  5. Subramanian, S., Ding, H., Srinivasan, B., & Zhou, Y. (2025). Use Amazon Bedrock Intelligent Prompt Routing for cost and latency benefits. AWS Machine Learning Blog. https://aws.amazon.com/blogs/machine-learning/use-amazon-bedrock-intelligent-prompt-routing-for-cost-and-latency-benefits/

  6. Amazon Web Services. (2026). Anthropic models available in Amazon Bedrock. Amazon Bedrock User Guide. https://docs.aws.amazon.com/bedrock/latest/userguide/model-cards-anthropic.html

  7. Li, M., Choo, D., et al. (2025). Unlock global AI inference scalability using new global cross-Region inference on Amazon Bedrock with Anthropic's Claude Sonnet 4.5. AWS Machine Learning Blog. https://aws.amazon.com/blogs/machine-learning/unlock-global-ai-inference-scalability-using-new-global-cross-region-inference-on-amazon-bedrock-with-anthropics-claude-sonnet-4-5/

AWS
EXPERT

publié il y a un an2,3 k vues