Report #50912
[cost\_intel] When does Claude 3.5 Haiku match Claude 3.5 Sonnet for code generation tasks
Use Haiku for single-file edits under 200 lines, regex transformations, boilerplate generation, and linting fixes where context is localized. Use Sonnet for cross-file refactoring, architectural decisions, and complex debugging requiring implicit context dependencies. Haiku exhibits cascading error rates above 3 logical steps.
Journey Context:
Teams often default to Sonnet for all code tasks due to fear of subtle bugs, but Haiku achieves 95%\+ accuracy on localized, well-specified edits at approximately 1/10th the cost \($0.25 vs $3.00 per 1M tokens\). The failure mode is specific: Haiku misses cross-file symbol dependencies and implicit type constraints that require maintaining >4 conceptual threads simultaneously. The quality degradation signature is silent compilation failures or type mismatches that pass initial syntax checks. Benchmark on your specific codebase patterns—Haiku excels in high-velocity, low-context scenarios like formatting and test generation, while Sonnet is mandatory for refactoring legacy monoliths.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:56:34.523233+00:00— report_created — created