AI / Claude Sonnet5 Interview questions
1. What is the difference between Claude Sonnet 5 and Claude Sonnet 4.6?
Claude Sonnet 5 is a drop-in upgrade for Sonnet 4.6, with three specific breaking API changes: adaptive thinking now runs by default on unconfigured requests, manual extended thinking (a fixed budget_tokens configuration) is rejected with an HTTP 400 error, and non-default sampling parameters (temperature, top_p, top_k) also return HTTP 400.
It also ships with a new tokenizer that produces roughly 30% more tokens for the same input text, an added xhigh effort level between high and max, and real-time cyber safeguards designed to detect and block dangerous cyber usage.
Feature-wise, everything else carries over unchanged - the 1M token context window, 128k max output, prompt caching, batch processing, the Files API, PDF support, vision, and the full tool set - except Priority Tier, which Sonnet 5 doesn't support.
2. How does Claude Sonnet 5 compare to Claude Opus 5 in capability and cost?
Both models share the same 1M token context window, 128k max output, and five-level effort framework (low/medium/high/xhigh/max, default high), but Opus 5 is priced meaningfully higher per token and generally scores higher on the hardest, longest-horizon reasoning and coding benchmarks.
Sonnet 5 is described as approaching Opus-class performance on many everyday coding and knowledge-work tasks, and on at least one major coding benchmark it has been reported to edge out Opus 4.8, but on the most demanding long-horizon benchmarks it trails both Opus 4.8 and Opus 5 by a wider margin.
The practical framing many teams land on is workload-based rather than purely benchmark-based: Sonnet 5 at low-to-medium effort for high-volume, well-scoped work, escalating to Opus 5 at high effort specifically when a task needs deeper reasoning, self-verification, or long-context judgment that Sonnet 5 struggles with even at its own higher effort settings.
3. Why does Claude Sonnet 5 run with thinking on by default?
On Sonnet 4.6, a request that didn't include a thinking field ran without any reasoning step at all; on Sonnet 5, that same unconfigured request now runs with adaptive thinking automatically, reflecting Anthropic's broader shift toward reasoning-by-default across its current model generation.
This change is framed as raising the baseline quality of unconfigured requests - rather than requiring every integration to explicitly opt in to reasoning to get its benefit, Sonnet 5 assumes reasoning is generally worth the extra tokens unless a request explicitly opts out.
The tradeoff is that requests which previously ran cheaply and quickly with no reasoning at all now consume additional tokens and time by default, which is why Anthropic's guidance specifically calls out revisiting max_tokens budgets and explicitly disabling thinking, via thinking: {"type": "disabled"}, for latency-sensitive workloads like streaming chat or simple classification where reasoning adds little value.
4. What is the difference between adaptive thinking and manual extended thinking?
Adaptive thinking is the mode Claude Sonnet 5 uses by default: the model itself decides how much to reason based on the task's apparent difficulty and the configured effort level, rather than following a fixed, developer-specified token budget for reasoning.
Manual extended thinking, by contrast, was the older pattern where a request explicitly set thinking: {"type": "enabled", "budget_tokens": N} to give the model a fixed reasoning budget - this mode is no longer supported on Sonnet 5 and returns an HTTP 400 error if attempted.
The practical migration path is to remove any manual budget_tokens configuration entirely and instead use the effort parameter (low through max) to influence how much the model reasons, letting adaptive thinking handle the actual moment-to-moment decision of how much reasoning a given request needs.
5. Why does Claude Sonnet 5 reject non-default sampling parameters?
Setting temperature, top_p, or top_k to anything other than their default values now returns an HTTP 400 error on Sonnet 5, a constraint that had already been introduced for Opus-class models earlier and is now extended to the Sonnet tier for the first time with this release.
This affects two different groups of prior use cases identically: developers who raised these parameters for more creative, varied output, and developers who lowered them, often to zero, for more deterministic output - both patterns now fail the same way.
The recommended replacement path is to control output behavior through prompting instead - explicit system prompt instructions describing the desired style, creativity, or determinism - rather than through sampling-level knobs, reflecting a broader move toward controlling behavior at the prompt and effort level rather than through low-level generation parameters.
6. How does the effort parameter differ between Claude Sonnet 5 and Claude Sonnet 4.6?
Claude Sonnet 5 introduces a full five-level effort scale, low through max, including a new xhigh level added between high and max that didn't exist as an option on Sonnet 4.6's more limited effort framework.
On Sonnet 5, effort now works together with adaptive thinking to determine reasoning depth, whereas on Sonnet 4.6 the old distinction was closer to extended thinking on with a fixed budget versus thinking off entirely, without an integrated effort dial spanning both dimensions in the same way.
This means teams tuning Sonnet 4.6 workloads around explicit thinking budgets need to re-map that tuning onto the new effort scale rather than assuming a numeric budget_tokens value translates directly to an equivalent effort level.
7. What is the difference between the xhigh and max effort levels?
Both xhigh and max sit at the top of Sonnet 5's five-level effort scale, above high, and both are associated with deeper reasoning and correspondingly higher token cost than lower levels.
In practice, reporting from early usage suggests max effort on Sonnet 5 can approach costs comparable to Opus 4.8 while sometimes performing slightly worse on certain benchmarks - at that point, switching to an Opus-class model, rather than pushing Sonnet 5 to its own ceiling, tends to be the better-value choice.
The general guidance is to treat xhigh as the level worth reaching for when a specific task genuinely needs deeper reasoning than high provides, and to treat max on Sonnet 5 with more caution, testing carefully rather than assuming it's simply the best setting by default.
8. Why does Claude Sonnet 5's tokenizer change matter for migration?
Sonnet 5 uses a new tokenizer that maps the same input text to roughly 30% more tokens than Sonnet 4.6's tokenizer did, meaning token counts, cost estimates, and context-window capacity calculations calibrated against Sonnet 4.6 don't transfer directly.
Because per-token pricing itself is separate from this change, the practical effect is that an equivalent request costs more in absolute terms even without any pricing change, and a max_tokens value that was generous on Sonnet 4.6 can become tight on Sonnet 5 purely from this token-count shift, independent of the separate thinking-by-default change.
The recommended fix is mechanical but essential: re-run token counting against Sonnet 5 specifically, using the token counting API on representative prompts, rather than reusing figures measured against Sonnet 4.6 or assuming the tokenizer change is negligible.
9. How does Claude Sonnet 5's context window differ from Claude Sonnet 4.6's in practice?
The nominal context window figure, 1 million tokens, is the same maximum on both models, so on paper nothing has changed about the ceiling.
In practice, because Sonnet 5's tokenizer produces more tokens for the same text, that 1M-token window holds meaningfully less actual text than it did on Sonnet 4.6 - reporting suggests it's closer to holding the equivalent of around 770,000 Sonnet-4.6-token-equivalents worth of content.
This matters most for workloads that were already pushing close to the context limit on Sonnet 4.6, since the same document set or conversation history that fit comfortably before could now approach or exceed the window on Sonnet 5, purely due to the tokenizer change rather than any actual content growth.
10. When should you disable thinking on Claude Sonnet 5?
Disable thinking, using thinking: {"type": "disabled"}, for latency-sensitive workloads where reasoning adds delay without a corresponding quality benefit - streaming chat, simple classification, routing, or straightforward lookups are commonly cited examples.
It's worth noting that setting effort to low does not reliably achieve the same effect - the model can still reason on genuinely hard problems even at low effort, so low effort alone isn't a substitute for explicitly disabling thinking when the goal is truly no reasoning step at all.
Because thinking tokens draw from the same max_tokens budget as the visible response, disabling it also simplifies budgeting for these latency-sensitive workloads, since the full max_tokens allocation goes to the response text with no reasoning overhead to account for.
11. What is the difference between disabling thinking on Sonnet 5 and on Opus 5?
On Claude Opus 5, thinking: {"type": "disabled"} is only accepted at effort high or below - attempting to combine it with xhigh or max effort returns an HTTP 400 error, since Opus 5 requires thinking to stay enabled at its two highest effort levels.
On Claude Sonnet 5, by contrast, thinking: {"type": "disabled"} is accepted regardless of the configured effort level, without that same restriction tying disabling thinking to a specific effort ceiling.
This is a concrete API-level difference worth checking specifically when porting request-building logic between the two models, since code that correctly disables thinking at any effort on Sonnet 5 could hit an unexpected 400 error if the same pattern is reused unchanged against Opus 5 at xhigh or max.
12. Why does max_tokens now behave differently on Claude Sonnet 5?
On Sonnet 4.6, an unconfigured request produced no thinking tokens at all, so the full max_tokens budget was effectively reserved for the visible response text by default.
On Sonnet 5, because adaptive thinking now runs by default on the same kind of unconfigured request, thinking tokens draw from that same max_tokens budget before the visible response gets its share - so the identical max_tokens value now has to cover both.
The practical risk is that a max_tokens setting comfortably sized for Sonnet 4.6's text-only output can leave too little room for Sonnet 5's response once thinking tokens are subtracted from the same shared budget, potentially truncating the answer even though nothing about the request itself changed.
13. How does Claude Sonnet 5's prompting guidance differ from Claude Sonnet 4.6's for verbosity?
Claude Sonnet 5's response length is calibrated to the perceived complexity of the task rather than defaulting to a fixed verbosity level regardless of how simple or complex the request actually is.
This is a more adaptive framing than treating verbosity as a single constant setting, and it means testing Sonnet 5's output length across a range of task complexities is more informative than testing it on one type of request and assuming the result generalizes.
Anthropic's own guidance notes that Sonnet 5 performs well out of the box on existing Sonnet 4.6 prompts, so this shift in verbosity behavior is framed as an underlying model characteristic to be aware of during testing, not necessarily something that requires immediate prompt rewrites unless a specific product's output length expectations are being missed.
14. What happens when you set effort to low on a genuinely complex problem?
Setting effort to low does not guarantee shallow, wrong, or skipped reasoning outright - Sonnet 5 can still recognize that a problem warrants more careful thought and reason accordingly even at low effort, though generally less thoroughly than it would at a higher effort level.
What's more likely to be visible is a quality gap on genuinely hard problems: if you observe shallow reasoning specifically on complex tasks run at low effort, Anthropic's guidance recommends raising effort to high or xhigh directly, rather than trying to compensate purely through more elaborate prompting.
If latency requirements mean effort has to stay at low even for a task with real multistep reasoning involved, the recommended workaround is to add explicit guidance in the prompt itself, describing the task as involving multistep reasoning and asking the model to think carefully before responding, rather than relying on effort level alone to signal that.
15. When should you raise effort instead of prompting around shallow reasoning?
Raise effort directly, rather than adding compensating prompt instructions, when the observed problem is genuinely a reasoning-depth issue - the model is missing steps or reaching a shallow conclusion on a task that's objectively complex enough to warrant deeper reasoning.
Prompting around the issue, adding more explicit reasoning instructions without touching effort, is the better-suited fallback specifically when effort is constrained for other reasons, such as a hard latency requirement that makes raising effort impractical for that particular workload.
The underlying principle is that effort is the primary lever actually built for controlling reasoning depth, so it should be the first thing adjusted when reasoning quality is the issue, with prompt-level compensation treated as a secondary option for cases where the effort lever specifically can't be moved.
16. How does Sonnet 5's agentic capability compare to Sonnet 3.5-3.7?
Sonnet 3.5, 3.6, and 3.7 were the models widely credited with kicking off the broader agentic AI era for Sonnet-class models - the first Sonnet generation to show genuinely impressive coding and tool-use skills at that price point.
In the generations that followed, the clearest gains in agentic capability shifted more toward Opus-class models, with Sonnet's relative position on agentic benchmarks slipping somewhat behind Opus during that period.
Sonnet 5 is explicitly framed as narrowing that gap back - a substantial improvement over its immediate predecessor Sonnet 4.6 on reasoning, tool use, coding, and knowledge work, with performance described as closer to Opus 4.8 than any prior Sonnet generation had achieved.
17. Why is Claude Sonnet 5 described as narrowing the gap with Opus-class models?
Anthropic's own comparisons show Sonnet 5 posting a substantial improvement over Sonnet 4.6 across reasoning, tool use, coding, and knowledge work, with its overall performance profile described as close to Opus 4.8's despite the significant price difference between the two tiers.
On at least one specific coding-related benchmark, reporting describes Sonnet 5 outperforming Opus 4.8, which is notable since historically the Opus tier has generally led the Sonnet tier on capability, not the other way around.
Anthropic's own framing draws a distinction worth remembering, though: Opus 4.8 remains positioned as the choice for higher accuracy on the hardest tasks, while Sonnet 5's contribution is offering a much higher-quality option than was previously available at Sonnet-level pricing, narrowing the gap rather than closing it outright.
18. What is the difference between Claude Sonnet 5's cyber safeguards and its predecessor's?
Claude Sonnet 5 ships with real-time cyber safeguards enabled by default, specifically designed to detect and block dangerous cybersecurity-related usage as it happens, a capability called out explicitly as part of this release.
Anthropic has stated it did not deliberately train Sonnet 5 for cybersecurity tasks, and that the model has a much lower ability to perform dangerous cyber operations than the company's current Opus-class models - the safeguards are a defensive layer on top of a model that isn't itself optimized for that domain.
A practical migration consideration flagged in reporting is that these safeguards may cause certain cybersecurity-adjacent prompts that ran successfully on Sonnet 4.6 to now be refused on Sonnet 5, which is worth explicitly testing for teams whose workloads touch that domain, even tangentially, before completing a migration.
19. How does Claude Sonnet 5's alignment profile compare to Claude Sonnet 4.6's?
Anthropic's safety assessment reports an overall lower rate of undesirable behaviors on Sonnet 5 compared to Sonnet 4.6, including specifically lower rates of hallucination, sycophancy, and cooperation with misuse attempts.
Sonnet 5 is also described as generally safer to use in agentic contexts than its predecessor, which matters given how much more autonomous, tool-using work the model is designed to handle compared to earlier Sonnet generations.
That said, Sonnet 5 is still reported to trail Opus 4.8 and Anthropic's most capable alignment-focused systems on certain specific alignment evaluations, so the improvement over Sonnet 4.6 doesn't put it on the same alignment footing as the top of Anthropic's current model lineup.
20. When should you choose Claude Sonnet 5 over Claude Opus 5 for a coding task?
Choose Sonnet 5 for high-volume, well-scoped coding work - routine bug fixes, test generation, straightforward refactors, and feature builds - where the task doesn't require deep multi-file architectural reasoning and where per-request cost adds up meaningfully at scale.
Sonnet 5 has also been reported to perform strongly, and in some specific benchmarks even favorably compared to Opus 4.8, on everyday coding tasks, which supports using it as a first-line default for common coding work rather than reserving Opus-class models exclusively for that purpose.
The signal to escalate to Opus 5 instead is typically task-shape, not task-category: complex multi-file refactors, long-running agentic coding sessions, or debugging that spans many files and requires holding more architectural context in mind tend to be where Opus 5's deeper reasoning capability actually pays for itself.
21. What is the difference between Claude Sonnet 5's Priority Tier support and Claude Sonnet 4.6's?
Claude Sonnet 4.6 supported Priority Tier, while Claude Sonnet 5 does not support it at all - a direct capability gap between the two versions, mirroring the same gap that exists between Opus 4.8 and Opus 5.
This is a hard regression rather than a behavioral shift that can be worked around through prompting or configuration, so any workload that specifically depended on Priority Tier for Sonnet 4.6 traffic needs an explicit decision about how to handle that traffic before or during migration.
Because this is a binary capability difference rather than a nuanced tradeoff, it's one of the more straightforward items to check off during a Sonnet 4.6-to-Sonnet-5 migration audit, compared to the more open-ended tuning work involved in adjusting for thinking defaults or verbosity changes.
22. How does prompt caching behavior change when migrating to Claude Sonnet 5?
Prompt caching itself remains a supported feature on Sonnet 5, carried over unchanged from Sonnet 4.6 as part of the broader feature parity between the two versions.
What does change is the underlying token counts: because Sonnet 5's new tokenizer maps the same text to a different number of tokens than Sonnet 4.6's tokenizer did, cached token counts for a given prompt will differ between the two models even if the prompt text itself is byte-for-byte identical.
The practical implication is that cache breakpoints and minimum-length thresholds sized against Sonnet 4.6 token counts need to be re-verified against Sonnet 5's actual token counts, rather than assumed to carry over directly, since a prompt's token length relative to any caching threshold can shift purely from the tokenizer change.
23. Why should you re-run token counting before migrating to Claude Sonnet 5?
Because the new tokenizer changes how the same text maps to tokens, any cost estimate, context-budget calculation, or max_tokens setting derived from Sonnet 4.6 token counts is no longer a reliable guide for Sonnet 5 - the underlying numbers have shifted independent of anything else about the migration.
This matters even for teams whose code requires zero other changes, since a request with no sampling parameters, no manual thinking configuration, and no prefilling can still be affected purely by the tokenizer difference, making it easy to overlook if migration testing focuses only on functional correctness rather than cost and budget behavior.
The concrete action is to use the token counting API against representative prompts on Sonnet 5 specifically, rather than reusing figures measured against Sonnet 4.6 or estimating the difference informally, since the actual multiplier can vary somewhat depending on the type of content being counted.
24. What is the difference between migrating from Sonnet 4.6 versus from Sonnet 4.5 or earlier?
Migrating specifically from Sonnet 4.6 only requires handling the changes introduced with Sonnet 5 itself: adaptive thinking on by default, manual extended thinking rejected, non-default sampling parameters rejected, and the new tokenizer.
Migrating from Sonnet 4.5 or an earlier version requires applying those same Sonnet-5-specific changes plus an additional set of older breaking changes that were already introduced between Sonnet 4.5 and Sonnet 4.6 - specifically, assistant message prefilling being rejected and differences in how tool parameters are JSON-escaped.
This distinction matters because code still running on a pre-4.6 Sonnet version has more total ground to cover during migration than code already running on 4.6, even though both end up on the same Sonnet 5 model - the older codebase simply has a longer list of accumulated changes to work through.
25. How does Claude Sonnet 5 handle assistant message prefilling?
Assistant message prefilling - constructing a request that starts the assistant's response with predetermined text - returns an HTTP 400 error on Claude Sonnet 5, the same rejection behavior that was already true on Claude Sonnet 4.6.
This means prefill rejection isn't a new Sonnet-5-specific breaking change to account for during a straightforward Sonnet-4.6-to-Sonnet-5 migration - it was already in place before Sonnet 5 shipped, for teams already running on 4.6.
For teams migrating from an older, pre-4.6 Sonnet version where prefilling was still accepted, this is one of the additional changes that needs to be handled as part of that longer migration path, using structured outputs, system prompt instructions, or the platform's output-format configuration as alternatives instead.
26. When would you choose Claude Sonnet 5's xhigh effort over Claude Opus 5 entirely?
Choose Sonnet 5 at xhigh when a task needs meaningfully deeper reasoning than Sonnet 5's high effort provides, but the task still fits comfortably within Sonnet-class capability and doesn't specifically require Opus-level judgment on long-context or highly novel problems.
This is generally the more cost-efficient path when the underlying task type is one Sonnet 5 handles well at lower effort already - pushing the effort dial up on a model that's fundamentally well suited to the task, rather than switching to a more expensive model tier entirely.
The signal to switch models instead of continuing to raise Sonnet 5's effort is when xhigh, or max, still isn't producing the needed quality, or when cost at that effort level is already approaching Opus-tier pricing without a corresponding quality payoff - at that point, an Opus-class model is likely to be the better-value choice rather than squeezing more out of Sonnet 5's ceiling.
27. What is the difference between Claude Sonnet 5's response-length calibration and a fixed verbosity default?
A fixed verbosity default means a model tends toward roughly the same response length and level of detail regardless of whether the underlying task is trivial or genuinely complex, which can mean over-explaining simple requests or under-explaining complex ones.
Claude Sonnet 5's response length instead scales with the perceived complexity of the task itself, so a simple factual question and a genuinely multistep problem are expected to produce meaningfully different response lengths by default, without needing separate prompt instructions to achieve that difference.
The practical implication for prompt engineering is that length-control instructions on Sonnet 5 are more about setting an explicit ceiling or floor for a specific product's needs, rather than correcting a uniformly-miscalibrated default the way they might be needed on a model with fixed verbosity behavior.
28. How does Claude Sonnet 5's tool-use behavior differ from Claude Sonnet 4.6's?
Anthropic frames Sonnet 5 as its most agentic Sonnet model yet, specifically calling out improved planning, tool use - including browsers and terminals - and the ability to run autonomously at a level that previously required larger, more expensive models.
This reflects a substantive capability shift rather than just an API-level change: the same categories of tools that Sonnet 4.6 could call are still supported, but Sonnet 5 is reported to plan and execute multi-step tool-use sequences more reliably, finishing tasks that earlier Sonnet versions would sometimes stall on partway through.
Because the underlying tool definitions and response shapes are documented as unchanged from Sonnet 4.6, this improvement shows up as better decision-making about when and how to use tools within an existing integration, not as a change to how tools themselves need to be defined or wired up.
29. Why doesn't lowering effort guarantee that Claude Sonnet 5 skips thinking?
Effort and the disabled/adaptive thinking setting are two separate, independently-configurable controls: effort influences how much the model reasons when it does reason, while whether it reasons at all is governed by whether thinking is left on (adaptive) or explicitly disabled.
Because adaptive thinking is genuinely adaptive, the model can still recognize that a specific problem warrants some reasoning even at low effort, meaning a low-effort request on a hard problem may still incur some thinking tokens rather than none at all.
For workloads where the actual requirement is guaranteed zero thinking, regardless of how hard a given request turns out to be, the correct control is explicitly setting thinking: {"type": "disabled"} rather than relying on a low effort setting to produce that same guarantee indirectly.
30. What is the difference between Sonnet 5 and Opus 5 on long-horizon coding?
On the hardest, longest-horizon coding benchmarks - the kind involving extended multi-step work across many files or a long agentic session - reporting shows Sonnet 5 trailing both Opus 4.8 and Opus 5 by a meaningfully wider margin than the gap seen on shorter, everyday coding tasks.
This is consistent with the broader framing that Sonnet 5 narrows the gap with Opus-class models specifically on typical, well-scoped work, while the gap remains more pronounced specifically on tasks that stress long-horizon planning, deep multi-file reasoning, and sustained autonomous execution.
Practically, this supports the pattern of defaulting to Sonnet 5 for everyday coding work and escalating specifically when a task's shape, not just its category, involves this kind of extended, high-complexity, multi-step execution where the capability gap is largest.
31. Explain the execution flow of a Claude Sonnet 5 request that omits the thinking field?
The request reaches Sonnet 5 without any explicit thinking configuration, and because adaptive thinking is on by default for this model generation, the model automatically evaluates the task and decides how much reasoning it needs before producing a visible response, rather than skipping straight to output generation the way the same unconfigured request would have on Sonnet 4.6.
The amount of reasoning performed is shaped by the configured effort level, defaulting to high if also unspecified, so the actual depth of thinking on this particular request is a function of both the adaptive decision the model makes about the task's difficulty and the effort ceiling that bounds how far it can reason.
As reasoning proceeds, thinking tokens are generated and counted against the same max_tokens budget that also covers the eventual visible response text - there's no separate token allowance carved out for thinking specifically, so the two draw from one shared pool over the course of the request.
Once the model concludes its reasoning process, it produces the final visible response, and the completed API response includes both the thinking content and the response text, with the request's total token usage reflecting the combined cost of both stages rather than the response text alone.
If a developer wants to restore the old Sonnet 4.6 behavior for a specific request, the fix is to explicitly pass thinking: {"type": "disabled"}, which skips this entire reasoning stage and routes the request straight to response generation, similar to how every request behaved by default before this model generation.
flowchart LR A[Request sent, no thinking field set] --> B[Adaptive thinking on by default] B --> C[Model evaluates task difficulty vs effort level] C --> D[Thinking tokens generated, drawn from max_tokens budget] D --> E[Visible response generated, same shared budget] E --> F[Response returned: thinking content + response text]
32. How can you optimize Claude Sonnet 5 costs given the new tokenizer?
Start by re-baselining, not assuming: run the token counting API against your actual representative prompts on Sonnet 5 specifically, since the roughly 30% token-count increase varies somewhat by content type, and an assumed flat multiplier can under- or overestimate the real impact for your specific workload.
Use thinking: {"type": "disabled"} deliberately on request types that don't benefit from reasoning - simple classification, routing, straightforward lookups - since this removes an entire category of token consumption that's on by default but not always adding value, rather than letting every request pay the reasoning-token cost by default.
Tune effort deliberately per request type rather than leaving every request at the high default: many workloads are meaningfully more capable at medium effort on Sonnet 5 than the equivalent task was on Sonnet 4.6 at any setting, so testing at medium before assuming high or xhigh is needed can directly reduce reasoning-token spend without a corresponding quality loss.
For agentic workloads spawning many subagent calls, consider setting a lower effort specifically on subagent-level calls rather than the top-level orchestrating call, since thinking-token overhead compounds quickly across a fleet of parallel or sequential subagent invocations if left at a high default throughout.
33. How do you troubleshoot a new HTTP 400 error after migrating to Sonnet 5?
Check the request for non-default sampling parameters first - temperature, top_p, or top_k set to anything other than default values is one of the most common causes, and the fix is simply removing those fields rather than adjusting their values, since Sonnet 5 doesn't accept them at any non-default setting.
Check for manual extended thinking configuration next - a thinking field set to {"type": "enabled", "budget_tokens": N} is rejected outright on Sonnet 5; the fix is either removing the thinking field entirely, to get default adaptive thinking, or explicitly setting thinking: {"type": "disabled"} if no reasoning is wanted at all.
Check for assistant message prefilling, constructing a request that pre-fills the start of the assistant's response, since this is rejected with a 400 error - though it's worth confirming whether this is actually new to your integration or was already true on the Sonnet version you migrated from, since prefill rejection predates Sonnet 5 itself.
If none of these three specific patterns match, review whether the request is hitting the effort-and-thinking interaction in some other way, or whether an entirely unrelated issue, like a malformed request body unrelated to the migration, is coincidentally surfacing at the same time as the migration and creating a false attribution to the model change itself.
34. Explain the internal difference between Claude Sonnet 5's effort parameter and its adaptive thinking mechanism?
Adaptive thinking is the mechanism that determines whether and how much the model reasons on a per-request basis, dynamically responding to what it perceives about the specific task's difficulty rather than following a fixed, pre-configured amount every time.
The effort parameter functions as a ceiling or scaling factor applied to that adaptive process - it doesn't force a fixed amount of reasoning on every request regardless of difficulty, but it bounds how far the model's adaptive judgment is allowed to go, so the same task run at different effort levels can produce meaningfully different reasoning depth even though the adaptive mechanism itself is making the moment-to-moment decisions within that boundary.
This two-layer design is why effort doesn't behave like a simple linear cost dial: a very easy request at high effort may still reason only lightly, since the adaptive layer judged that little reasoning was actually needed, while a genuinely hard request at a lower effort level may still reason more than a simpler request would at that same level, within whatever ceiling that effort setting allows.
Practically, this means tuning effort is about setting the right ceiling for a given workload's typical task difficulty, while trusting adaptive thinking to handle the actual per-request variation within that ceiling, rather than treating effort as a direct, request-by-request override of reasoning depth.
35. Which is better for a high-volume coding pipeline: Sonnet 5 or Opus 5?
For this specific workload shape - many requests, individually well-defined and bounded in scope, like routine bug fixes, test generation, or standard refactors - Sonnet 5 is generally the better fit, since its lower per-token cost compounds meaningfully at high request volume, and reporting suggests it handles this category of task well, in some cases matching or slightly exceeding Opus 4.8 on specific coding benchmarks.
Opus 5's advantage is concentrated in a different task shape: complex, open-ended, or long-horizon work where deeper reasoning materially changes the outcome - for a pipeline made up of many individually well-scoped tasks, that advantage is less likely to be the deciding factor on most individual requests, even though it would matter more on the harder subset.
The recommended pattern for exactly this situation is a tiered pipeline rather than a single-model choice: run Sonnet 5 as the default across the high-volume pipeline, and add automatic or manual escalation to Opus 5 specifically for the subset of requests that fail, need multiple retries, or are flagged as unusually complex - capturing Sonnet 5's cost efficiency across the bulk of volume while still reaching for Opus 5's deeper capability exactly where it's actually needed.
Effort tuning on the Sonnet 5 side of this pipeline is also worth optimizing specifically, since a well-scoped, high-volume pipeline is exactly the situation where testing medium effort before defaulting to high can meaningfully reduce cost across the full volume without necessarily costing much in output quality for tasks that were already well within Sonnet 5's comfortable capability range.
36. How do you troubleshoot a Claude Sonnet 5 response truncated at max_tokens after migration?
First determine whether the request is running with thinking enabled, which it will be by default unless explicitly disabled, since the most likely cause of new truncation after migration is thinking tokens now consuming part of a max_tokens budget that was previously reserved entirely for the visible response on Sonnet 4.6.
Check the actual thinking-versus-response token split in the response object for this specific request type, rather than assuming a fixed proportion, since how much of the budget thinking consumes depends on both the configured effort level and how much reasoning the adaptive mechanism judged the specific task actually needed.
If confirmed, address it either by raising max_tokens to account for the added thinking budget, lowering effort so the adaptive mechanism reasons less and consumes less of the shared budget, or, for request types where reasoning genuinely isn't needed, explicitly disabling thinking so the full max_tokens allocation goes to the response.
As a broader validation step, since the tokenizer change independently affects how much of max_tokens gets consumed by a given amount of visible content, re-check whether a truncation issue is actually a combination of both factors, the shared thinking budget and the tokenizer's higher token-per-character rate, rather than assuming only one of the two migration changes is responsible.
37. Explain the lifecycle of a migration from Claude Sonnet 4.6 to Claude Sonnet 5?
The lifecycle begins with an audit of existing request-building code for the three specific breaking patterns: non-default sampling parameters, manual extended thinking configuration with a fixed budget_tokens value, and assistant message prefilling, since code containing none of these three patterns may genuinely need only a model-ID swap.
Next comes parameter remediation: removing sampling parameters entirely, replacing manual thinking budgets with the effort parameter, and replacing prefilling with an alternative like structured outputs or explicit system prompt instructions, addressing each of the concrete 400-error-causing patterns identified in the audit.
Following that, token and budget recalibration takes place: re-running token counting against Sonnet 5 specifically using representative prompts, and revisiting max_tokens limits to account for both the tokenizer's higher token-per-text rate and thinking now drawing from that same shared budget by default.
With the mechanical changes addressed, the process moves into behavioral validation: testing prompts as-is first, since Sonnet 5 generally performs well on existing Sonnet 4.6 prompts, then specifically checking verbosity calibration, effort-level behavior, and, if the workload touches cybersecurity-adjacent territory even tangentially, whether new cyber safeguards affect any previously-successful prompts.
The lifecycle concludes with staged rollout: shifting a small slice of production traffic first, comparing cost, latency, and output quality against the Sonnet 4.6 baseline on real production traces rather than isolated test prompts, and only expanding to full traffic once that comparison confirms the migration behaves as expected at production scale.
flowchart TD
A[Audit code for 3 breaking patterns] --> B[Remediate: remove sampling params, migrate thinking config, replace prefill]
B --> C[Recalibrate tokens: recount, revisit max_tokens]
C --> D[Validate behavior: test as-is, check verbosity/effort/cyber safeguards]
D --> E[Staged rollout: small slice first]
E --> F{Metrics acceptable?}
F -- Yes --> G[Expand traffic in stages]
F -- No --> H[Hold, keep Sonnet 4.6 fallback active]
38. How can you optimize Claude Sonnet 5's effort setting across a fleet of subagents?
Set a lower default effort, such as low or medium, on individual subagent calls specifically, reserving higher effort for the top-level orchestrating call that's actually making the higher-stakes planning and coordination decisions, since subagent-level work is often narrower in scope and less likely to need the deepest reasoning available.
Measure whether raising a specific subagent's effort actually changes its output quality on the type of narrow task it's typically assigned, rather than uniformly raising effort across the whole fleet preemptively, since thinking-token overhead compounds multiplicatively across many parallel or sequential subagent calls in a way that a single top-level call's effort setting doesn't.
Consider whether some subagent roles are well suited to having thinking disabled entirely, particularly for narrow, mechanical subtasks like formatting, simple lookups, or routing decisions where reasoning is unlikely to change the outcome, since this removes an entire category of token spend across every instance of that subagent role rather than just reducing it via a lower effort level.
Periodically re-audit this configuration against actual production outcomes as the fleet's task distribution evolves, since a subagent role that started out narrow and mechanical can drift toward handling more complex cases over time, at which point an effort setting that was originally well-tuned may need to be raised again for that specific role.
39. How do you troubleshoot degraded reasoning quality on Claude Sonnet 5 at low effort?
First confirm whether low effort is actually appropriate for the task category involved, since low effort is specifically intended for tasks that don't require deep reasoning - if the observed degradation is on genuinely complex, multistep problems, this may not be a bug to troubleshoot so much as a mismatch between the task's actual difficulty and the effort level chosen for it.
If the task category genuinely fits low effort but quality still seems degraded relative to expectations, test whether raising effort to medium or high resolves the issue on a representative sample of the affected requests, since Anthropic's own guidance frames raising effort as the primary fix for observed shallow reasoning, rather than compensating through prompt engineering alone.
If effort must stay at low specifically for latency reasons even though the task involves real multistep reasoning, add explicit guidance in the prompt describing the task as involving multistep reasoning and instructing the model to think carefully before responding, which is the documented workaround for this specific latency-versus-quality tension.
Distinguish this from a scenario where thinking has been explicitly disabled rather than just set to low effort, since those are different configurations with different implications - confirm which one is actually in play on the affected requests before concluding that effort tuning, rather than the thinking toggle itself, is the relevant lever to adjust.
40. Explain the execution flow of Claude Sonnet 5's cyber safeguards during a request?
As a request comes in, before or alongside normal processing, Sonnet 5's real-time cyber safeguards evaluate whether the content involves dangerous cybersecurity-related usage - this runs as part of the model's default behavior rather than as an opt-in feature a developer has to separately enable.
If the safeguards determine the request falls into a flagged category of dangerous cyber usage, the request can be refused at that point, even if a similarly-shaped prompt would have been processed normally on Sonnet 4.6, since these safeguards are new to this release and specifically tuned for cyber-related risk.
If the request doesn't trigger the safeguards, processing continues through the model's normal reasoning and response pipeline as usual, with the safeguard check functioning as an additional layer rather than replacing or altering the model's standard reasoning and generation process for non-flagged requests.
Because Anthropic has stated Sonnet 5 wasn't deliberately trained for cybersecurity capability and has a much lower ability to perform dangerous cyber operations than current Opus-class models, these safeguards function as a defensive control layered onto a model that isn't itself optimized for that domain, rather than a capability constraint on an otherwise cyber-capable model.
flowchart TD
A[Request received] --> B{Cyber safeguard check}
B -- Flagged as dangerous cyber usage --> C[Request refused]
B -- Not flagged --> D[Normal reasoning and response pipeline]
41. Which is more cost-efficient on simple tasks: Sonnet 5 max or Opus 5 low effort?
Neither is actually the recommended choice for this scenario - for a short, simple task, the better move on either model is using a low effort setting on the model that's already well suited to simple tasks, rather than maxing out effort on the smaller model or reaching for the larger, pricier model at all.
Sonnet 5 at max effort specifically is flagged in reporting as a poor value pattern: it can roughly double cost relative to lower effort settings without a correspondingly large quality improvement, which is a bad trade specifically on a task that didn't need that much reasoning depth in the first place.
Opus 5 at low effort is a more defensible pattern in general, since Opus 5's effort dial is specifically designed to let it stay cheaper and faster on easy requests without switching models entirely, but for a genuinely short, simple task, this still isn't obviously better than simply using Sonnet 5 at an appropriately low effort level, given Sonnet 5's lower baseline per-token price.
The more useful framing than picking one of these two specific configurations is to match effort to actual task difficulty on whichever model is already the right tier for the task category, and to treat both maxing effort on the smaller model and using the larger, pricier model for a task that didn't need it as patterns worth avoiding, rather than as a genuine two-option tradeoff.
42. How can you optimize prompts migrating from Sonnet 4.6 to Sonnet 5?
Start by testing existing Sonnet 4.6 prompts largely as-is, since Anthropic's own guidance indicates Sonnet 5 performs well out of the box on them - the goal is a targeted tuning pass on known behavior shifts, not a full prompt rewrite from scratch.
Review response-length expectations specifically, since Sonnet 5 calibrates verbosity to perceived task complexity rather than a fixed default, and adjust length-control instructions only where a specific product's output-length requirements actually diverge from that adaptive behavior, rather than assuming every prompt needs new length constraints.
Where you observe shallow reasoning on genuinely complex requests, raise effort to high or xhigh as the primary fix, reserving prompt-level step-by-step-style instructions specifically for cases where effort is constrained by a hard latency requirement and can't simply be raised.
Remove any prompt language written around the old manual thinking-budget model, if present, since that configuration no longer applies, and replace it conceptually with effort-level guidance instead, testing at medium effort before assuming high is required, since Sonnet 5 is reported to be meaningfully more capable at medium effort than Sonnet 4.6 was at any comparable setting.
43. Explain the internal working of Claude Sonnet 5's new tokenizer relative to Claude Sonnet 4.6's?
A tokenizer is the component that converts raw input text into the discrete token units a model actually processes and that usage is billed and budgeted against - changing the tokenizer changes how many of these units a given piece of text maps to, without necessarily changing anything about the meaning or content of that text itself.
Sonnet 5's tokenizer maps the same input text to a different, generally larger, number of tokens than Sonnet 4.6's tokenizer did - reporting places the increase at roughly 30% on average, though the actual multiplier varies by content type, meaning code, prose, and structured data may each shift by somewhat different amounts.
Because this is purely a tokenization-layer change rather than a change to the model's context window ceiling or per-token price, its effects ripple into every token-denominated aspect of the system indirectly: the 1M-token context window holds less actual text than before, a fixed max_tokens value covers less actual response content, and cost per equivalent request rises even though the advertised per-token price may be unchanged or even temporarily discounted.
This is why Anthropic's own migration guidance treats the tokenizer change as a distinct item from the other breaking changes - unlike the sampling-parameter and manual-thinking rejections, which cause explicit, loud 400 errors, the tokenizer change causes no errors at all and instead silently shifts cost, budget headroom, and effective context capacity, making it the kind of change that's easy to miss without deliberately re-measuring token counts.
44. How do you troubleshoot silent cost increases after migrating to Claude Sonnet 5?
Separate the two independent contributors before assuming a single cause: the tokenizer producing more tokens for the same text, and thinking now running by default and consuming additional tokens on requests that previously ran with none at all - both can contribute simultaneously, and conflating them makes the actual cost driver harder to isolate.
Compare token usage on a matched sample of requests, run against both Sonnet 4.6 historically and Sonnet 5 currently, broken down by input tokens, output tokens, and, on Sonnet 5 specifically, the thinking-versus-response split within output tokens, to see which component is actually driving the increase for your specific workload.
If the tokenizer is the dominant factor, the remediation is mainly about re-baselining expectations and budgets rather than changing request configuration, since the underlying content and behavior haven't actually changed, just how it's counted and billed.
If thinking-by-default is the dominant factor, remediation is more actionable: explicitly disable thinking on request types that don't need it, or lower effort on request types where less reasoning depth is an acceptable tradeoff, targeting the specific request categories where the cost increase is concentrated rather than applying either change uniformly across the entire application.
45. Explain the execution flow of a Sonnet 5 to Opus 5 escalation pipeline?
An incoming task first routes to Claude Sonnet 5 as the default handler, typically configured at a moderate effort level appropriate to the pipeline's typical task difficulty, since most requests in a well-scoped, high-volume pipeline are expected to be within Sonnet 5's comfortable capability range.
As Sonnet 5 processes the request, the pipeline monitors for escalation signals: an explicit failure or error, a low-confidence or incomplete result, a request for retry, or a classification of the task as unusually complex either by the application logic or by signals surfaced during Sonnet 5's own processing.
When an escalation signal fires, the same task, potentially with additional context accumulated during the failed Sonnet 5 attempt, gets re-routed to Claude Opus 5, typically at a higher effort level, to take advantage of its deeper reasoning capability specifically for the subset of tasks that Sonnet 5 struggled with.
Successfully completed tasks, whether resolved at the Sonnet 5 stage or after Opus 5 escalation, return through a common response path, while the pipeline separately logs which stage actually resolved each task - valuable both for cost and quality monitoring and for periodically re-tuning the escalation criteria as the task distribution or either model's capabilities evolve over time.
flowchart TD
A[Task arrives] --> B[Route to Sonnet 5, default effort]
B --> C{Escalation signal? Failure, low confidence, high complexity}
C -- No --> D[Return Sonnet 5 result]
C -- Yes --> E[Re-route to Opus 5, higher effort]
E --> F[Return Opus 5 result]
D --> G[Log resolving stage]
F --> G
46. How can you optimize Claude Sonnet 5's context window usage given the tokenizer change?
Recognize that the practical, usable capacity of the 1M-token window has effectively shrunk in text terms, since the same amount of actual content now consumes more tokens than it did on Sonnet 4.6 - budgeting context usage by document count or character count rather than by token count can significantly misjudge how much room is actually left.
Re-measure your typical context payloads - system prompts, retrieved documents, conversation history - against Sonnet 5's tokenizer specifically, rather than reusing a rough percentage-of-window estimate that was calibrated against Sonnet 4.6's token counts.
For workloads that were already operating close to the context ceiling on Sonnet 4.6, consider whether some previously-included content can be trimmed, summarized, or retrieved more selectively, since the same content mix may now push closer to, or past, the effective capacity than it did before, purely from the tokenizer shift.
Combine this with awareness of the shared thinking-and-response max_tokens budget on the output side, since a request that's both context-heavy on the input side and thinking-heavy on the output side compounds the tokenizer's effect from two different directions within the same request.
47. Which is better for agentic multi-file refactoring: Sonnet 5 or Opus 5?
For agentic multi-file refactoring specifically, reporting consistently points toward Opus 5 as the stronger fit, since this task shape stresses exactly the capabilities where Opus 5's advantage over Sonnet 5 is reported as largest: holding more architectural context across files, making fewer errors on work spanning many files, and sustaining coherent multi-step execution over a longer agentic session.
Sonnet 5 remains capable of handling refactoring work, and is well suited to smaller-scope refactors, but the gap between the two models is described as widening specifically as refactor scope and session length increase, rather than being a constant, fixed gap across all refactoring tasks regardless of size.
A practical approach for teams uncertain which category a given refactor falls into is to start with Sonnet 5 at an appropriate effort level and treat repeated failures, incomplete multi-file changes, or excessive retries as the signal to escalate to Opus 5, rather than trying to predict scope perfectly in advance and always defaulting to one model for all refactoring work.
This mirrors the general pattern across the two models: Sonnet 5 is the reasonable default given its lower cost, with escalation to Opus 5 reserved specifically for the subset of tasks - here, larger and more architecturally complex refactors - where the capability gap is largest and most likely to actually change the outcome.
48. How do you troubleshoot manual extended thinking left over from Sonnet 4.6?
Locate every place in the codebase where a request sets thinking: {"type": "enabled", "budget_tokens": N}, since this specific configuration is rejected outright on Sonnet 5 with an HTTP 400 error - this is a search-and-remediate task rather than a subtle behavioral issue, since the failure mode is a hard, deterministic error rather than degraded output.
Replace each instance by removing the manual budget_tokens configuration and instead setting an appropriate effort level for that specific request's typical task difficulty, recognizing that effort and a manual token budget aren't a one-to-one mapping - a budget value that was tuned empirically for Sonnet 4.6 doesn't translate directly to a specific effort level on Sonnet 5.
Test each remediated request type against representative tasks to confirm the new effort-based configuration produces comparable or better reasoning depth to what the old manual budget achieved, since silently under-provisioning reasoning depth by picking too low an effort level would be a functional regression even though it wouldn't surface as an obvious error.
Audit for any downstream code that specifically expected a fixed thinking-token count based on the old manual budget, such as cost estimation logic or logging that assumed a predictable thinking-token ceiling, since that logic likely also needs updating now that thinking token usage varies adaptively rather than being pinned to a configured fixed value.
49. Explain the lifecycle of test-time compute scaling on Sonnet 5's effort levels?
Test-time compute scaling refers to converting additional computational effort, spent at the moment a request is actually being processed, into better output quality, as opposed to improvements that come from changes made during the model's training process itself.
On Sonnet 5, this happens through the effort parameter's five levels, low through max, where each step up allows the adaptive thinking mechanism a larger ceiling to reason within, translating into deeper analysis, more thorough consideration of edge cases, or more careful tool-use planning at the cost of additional tokens and latency for that specific request.
This scaling isn't perfectly linear in either direction: very easy tasks may not benefit meaningfully from a higher effort ceiling, since the adaptive mechanism doesn't need to use all the headroom available to it, while very hard tasks can show diminishing returns at the very top of the scale, where reporting suggests max effort sometimes underperforms relative to its cost compared to simply switching to a more capable model tier.
Because this scaling happens per-request rather than being fixed at model-deployment time, it gives developers a live, request-by-request lever to trade cost and latency against output quality, which is the practical reason effort tuning, rather than picking a single fixed configuration for an entire application, is emphasized throughout Sonnet 5's prompting guidance.
50. How can you optimize a rollout plan from Sonnet 4.6 to Sonnet 5?
Begin with a small, representative slice of production traffic rather than a full cutover, selecting traffic that spans your typical range of task complexity and request patterns so the initial signal reflects real-world behavior rather than an unrepresentative subset.
Instrument the rollout to separately track the specific dimensions most likely to shift: token usage split between thinking and response content, max_tokens truncation incidents, any new HTTP 400 errors from the three known breaking-change patterns, and output quality on a representative evaluation set, rather than relying on a single aggregate success metric that could mask a problem in one dimension while looking fine overall.
Keep Sonnet 4.6 available as an active fallback route throughout the rollout rather than decommissioning it immediately, so that if an issue surfaces at a larger traffic percentage than your initial test slice, traffic can be shifted back without an emergency rollback under production pressure.
Expand the traffic percentage in stages, validating each stage's cost, latency, and quality metrics against both the Sonnet 4.6 baseline and your own acceptance thresholds before advancing further, and only fully decommission the Sonnet 4.6 path once the full-traffic stage has run long enough to have reasonable confidence across your actual production task distribution, not just the initial representative sample.
