Report #57904
[cost\_intel] Small models produce invalid JSON 5-15% of the time when format is only specified in the prompt
Use structured output features \(JSON mode, function calling, response\_schema\) rather than relying on prompt instructions for format compliance. Without enforcement, small models have 2-5x higher format violation rates than frontier models. With schema enforcement, the compliance gap narrows to near-zero across all model tiers.
Journey Context:
A common pattern: prompting Haiku or Flash to 'return valid JSON' and getting markdown-wrapped JSON, trailing commas, mixed quote styles, or conversational preamble before the JSON object. This silently breaks downstream parsers and requires retry logic. The instinct is to upgrade to a frontier model for better compliance, but the real fix is structural enforcement. OpenAI structured outputs and Anthropic tool use both guarantee valid output against a schema. This eliminates format errors regardless of model size, meaning you can safely use the cheapest model that produces correct content without worrying about format.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:41:00.356131+00:00— report_created — created