AWS Logo
Menu
Exploring Claude 3.7 Sonnet's Hybrid Reasoning on Amazon Bedrock

Exploring Claude 3.7 Sonnet's Hybrid Reasoning on Amazon Bedrock

Discover how to leverage Claude 3.7 Sonnet's hybrid reasoning capabilities on Amazon Bedrock with practical Python examples comparing standard and extended thinking modes.

Bhavin Patel
Amazon Employee
Published Feb 26, 2025
Anthropic's Claude 3.7 Sonnet has arrived on Amazon Bedrock, bringing with it a groundbreaking new capability: hybrid reasoning. This innovative model can now perform detailed step-by-step thinking before responding, giving you unprecedented insight into its problem-solving process.
In this article, we'll explore Claude 3.7 Sonnet's reasoning capabilities through practical Python examples. You'll see how to enable reasoning, compare standard and extended thinking modes, and even combine reasoning with tool use.

✨ What Makes Claude 3.7 Sonnet Special?

Claude 3.7 Sonnet represents a significant advancement in generative AI. As the first hybrid reasoning model in the Claude family, it can work through complex problems using careful, step-by-step reasoning while maintaining the ability to provide quick responses when appropriate.
Key features include:
  • Hybrid Reasoning - A single model that can toggle between standard responses and detailed reasoning
  • Extended Thinking Mode - Analyses problems in detail with transparent step-by-step thinking
  • Adjustable Reasoning Budget - Control how many tokens are allocated to the thinking process
  • Massive Output Capacity - Up to 15x longer output than predecessor models (up to 128K tokens)
  • Enhanced Coding Capabilities - Industry-leading performance on coding benchmarks

🛠️ Prerequisites

Before getting started with the examples in this article, make sure you have:
  1. An AWS account with access to Amazon Bedrock
  2. AWS CLI installed and configured with appropriate permissions
  3. Python 3.x installed
  4. The latest version of boto3 and AWS CLI
To install or upgrade boto3 and the AWS CLI:
Most importantly, you need to request access to Claude 3.7 Sonnet in your AWS account:
  1. Navigate to the Amazon Bedrock console
  2. Go to "Model access" under "Bedrock configurations"
  3. Select "Modify model access" and request access for Claude 3.7 Sonnet
Claude 3.7 Sonnet is currently available in the following regions:
  • us-east-1 (N. Virginia)
  • us-east-2 (Ohio)
  • us-west-2 (Oregon)

🧠 Example 1: Comparing Standard and Extended Thinking Modes

Our first example compares Claude 3.7 Sonnet's responses with and without reasoning enabled. This helps illustrate the difference between standard mode and extended thinking mode.

Output Analysis: Standard vs. Extended Thinking

When I ran this example with the prompt What would be the impact on global sea levels if all ice in Greenland melted? I received two distinctly different responses:

Standard Mode Response:

Extended Thinking Process:

Extended Thinking Mode Response:

Analysis:

What's fascinating about these responses is how the extended thinking mode reveals Claude's internal reasoning process, which contains several elements that don't appear in the final response:
  1. Detailed quantification: The thinking process references "2.85-3 million cubic kilometers of ice" - a detail not included in either final response.
  2. Structured approach: Claude organises its thoughts into numbered points (timeframe, global
    impact, current situation, comparison) before synthesising a more readable response.
  3. Self-instruction: Claude tells itself "In providing my answer, I'll focus on the estimated sea level rise..." showing how it plans its final response.
  4. Tone differences: The standard mode response is more direct and confident, while the extended thinking shows a more deliberative, academic approach weighing facts.
  5. Token usage: Extended thinking used 532 output tokens compared to 161 for standard mode - more than 3 times as many tokens.
  6. Different final format: The extended thinking mode response uses a different structure with a more conversational ending, asking if the user would like more elaboration on any aspect.
This transparency into the reasoning process helps us better understand how Claude reaches its conclusions and allows us to verify its thought process for accuracy.

🔧 Example 2: Tool Use with Reasoning

Our second example combines Claude 3.7 Sonnet's reasoning capability with its ability to use tools. This demonstrates how the model thinks through a problem before determining that it needs to use a tool to solve it.

Output Analysis: Tool Use with Reasoning

I ran this example with a prompt asking for a compound interest calculation: I need to calculate the compound interest on an investment of $5,000 with an annual interest rate of 6.5% compounded monthly for 8 years.
Claude 3.7 Sonnet first thought through the problem, then requested the calculator tool to perform the computation.

Thinking Process:

Tool Request:

Final Response:

Analysis:

This example demonstrates how Claude 3.7 Sonnet's reasoning capability integrates with tool use:
  1. Structured Problem Solving: Claude first breaks down the problem, identifies the formula and values needed, and realises it needs computational help.
  2. Appropriate Tool Selection: It correctly determines that the calculator tool is needed to evaluate the complex expression.
  3. Formula Translation: Claude correctly translates the mathematical formula A = P(1 + r/n)^(nt) into a calculable expression.
  4. Complete Response: After receiving the calculation result, Claude formats a clear, comprehensive response that explains both the result and how it was calculated.
  5. Tool Use Steps: The code demonstrates the full life cycle of tool use - from thinking, to tool request, to result processing, to final response.
Crucially, the reasoning process here shows that Claude isn't blindly using a tool but is thinking through why the tool is needed and what to do with the result afterwards.

🔍 Important Implementation Details

When working with Claude 3.7 Sonnet's reasoning capability, keep these technical details in mind:
  1. Reasoning and Inference Parameters: Reasoning is not compatible with temperature, top_p, or top_k modifications, as well as forced tool use. When comparing standard and reasoning modes, I used default values for these parameters to ensure a fair comparison.
  2. Budget Tokens: You must specify how many tokens to allocate for reasoning via the budget_tokensparameter. The minimum is 1,024 tokens, but 4,000+ tokens are recommended for complex problems.
  3. Max Tokens Requirement: The maxTokens value must be higher than budget_tokens. A good rule of thumb is to set maxTokens at least twice as high as budget_tokens.
  4. Filtered Content in Follow-ups: When using tool results in a follow-up request, you must filter out the reasoningContent blocks from the previous response to avoid validation errors.
  5. Tool Config in Follow-ups: When sending tool results back to the model, you must include the same toolConfig in the follow-up request.
  6. Python Exponentiation: Note that Claude uses ^ for exponentiation in mathematical expressions, but Python uses **. The code handles this conversion automatically.

💡 Use Cases for Extended Thinking

The hybrid reasoning capability of Claude 3.7 Sonnet opens up exciting possibilities:
  1. Educational Tools: Showing students the step-by-step reasoning process for solving complex problems
  2. Research Assistance: Breaking down complex research questions into logical components
  3. Math and Science Problem Solving: Tackling multi-step calculations with transparent working
  4. Decision Making Transparency: Understanding how AI arrives at recommendations or conclusions
  5. Complex Planning: Creating detailed plans with clear reasoning behind each step

🚀 Best Practices

To get the most out of Claude 3.7 Sonnet's reasoning capabilities:
  1. Adjust Budget Based on Complexity: Use higher reasoning budgets (6,000+ tokens) for very complex problems and lower budgets for simpler ones.
  2. Explicitly Request Step-by-Step Thinking: When you want detailed reasoning, phrases like "Think step by step" or "Show your work" can help guide the model.
  3. Consider Performance Trade-offs: Extended thinking increases token usage and response time, so use it strategically when deeper reasoning is valuable.
  4. Examine Thinking Process for Verification: The thinking process can reveal potential issues in the model's reasoning that might not be apparent in the final response.
  5. Code Defensively: Handle different response structures and potential errors when working with reasoning and tool use in production code.

🌐 Conclusion

Claude 3.7 Sonnet's hybrid reasoning capability represents a significant advancement in making AI thinking more transparent and trustworthy. By providing insight into its step-by-step reasoning process, Claude allows developers and users to better understand, verify, and trust the outputs it produces.
The examples we've explored show how reasoning can be used both standalone and in combination with tools to solve complex problems while maintaining transparency throughout the process.
As you build with Claude 3.7 Sonnet on Amazon Bedrock, consider how the reasoning capability might enhance your applications by providing deeper insights, better explanations, and more transparent
problem-solving.

Have you tried Claude 3.7 Sonnet's reasoning capabilities? What interesting use cases have you found? Share your experiences in the comments below!
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

1 Comment