Summary audio
No audio recap for this lesson.
Study notes
Overview
- Extended thinking allows Claude to reason about queries before generating final responses
- Displayed as a separate thinking process that users can optionally view
- Enables tackling complex tasks with greater accuracy
Trade-offs
- Cost: You are charged for tokens generated during the thinking phase
- Latency: The thinking phase takes additional time to complete
When to Enable Extended Thinking
- Use prompt evaluations to determine if extended thinking is needed
- Enable it only after spending effort improving your prompt and accuracy is still insufficient
- Decision should be based on eval results, not used by default
Response Structure with Extended Thinking
- Normal responses contain: user message (text block) → assistant message (text block)
- With extended thinking enabled, responses contain: thinking block + text block
- Thinking block contains the text generated during Claude's reasoning process
Thinking Block Signature
- Each thinking block includes a cryptographic signature
- Signature ensures the thinking text has not been modified
- Claude relies heavily on thinking text during response generation
- Developers cannot modify thinking text to prevent unsafe steering
Redacted Thinking Blocks
- Sometimes Claude flags thinking text through internal safety systems
- Response contains a redacted thinking block with encrypted content instead
- Redacted content preserves context when sending the message back to Claude
- Useful for testing application handling of unexpected responses
Implementation Parameters
- thinking: Boolean parameter (default false) to enable extended thinking
- thinking_budget: Number of tokens allocated for thinking phase (minimum 1024 tokens)
- max_tokens: Must be greater than thinking_budget (e. g. , if budget is 1024, max_tokens must be at least 1025)
- Best practice: Set max_tokens significantly larger than thinking_budget to allow adequate response generation
Testing Redacted Thinking
- Use special test string: "anthropic magic string triggered redacted thinking" followed by special characters
- Sending this exact string guarantees a redacted thinking block response
- Useful for verifying application handles redacted blocks without crashing
Takeaways
- Extended thinking enables Claude to reason through complex queries before responding, with costs for thinking tokens and added latency
- Enable extended thinking only after improving prompts and eval results show accuracy is still insufficient—not by default
- Responses with extended thinking contain a thinking block (Claude's reasoning) plus a text block (final response), with thinking blocks cryptographically signed to prevent modification
- Set thinking_budget (minimum 1024 tokens) and ensure max_tokens is significantly larger to allow adequate response generation after the thinking phase
- Redacted thinking blocks may appear when internal safety systems flag content; they preserve context for continued conversation without exposing the flagged reasoning
Flashcards 10 cards
Question
click to reveal · ←/→
Answer
click to flip back
Knowledge check 6 questions