Report #80370
[cost\_intel] When does Claude 3.5 Haiku match Sonnet for code generation?
Use Haiku for scaffolding/boilerplate \(cyclomatic complexity <10, nesting <3\), Sonnet for algorithmic core. Cost reduction 15-20x for 70% of LOC with <1% quality drop on syntax tasks.
Journey Context:
Teams often default to Sonnet for all code gen, but Haiku matches Sonnet on syntax correctness and API adherence for simple functions. The quality cliff appears at nested conditionals >3 deep or recursive logic. Haiku hallucinates library methods 8% vs Sonnet's 2% on complex tasks, but on boilerplate the gap is <1% while being 15x cheaper. Measure cyclomatic complexity with ast parsing; route >10 to Sonnet.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:30:44.530334+00:00— report_created — created