Report #59739
[cost\_intel] Cheap models fail on nested structured output with conditional schemas causing 5-10x cost from retry loops
Use flat object schemas \(no nesting >2 levels\) with cheap models \(GPT-3.5, Haiku\); for nested or conditional structures \(oneOf/anyOf\), use GPT-4 with strict mode enabled, or pre-validate with a cheap model and post-process with code rather than retrying the LLM.
Journey Context:
The boundary is 'schema complexity'. Cheap models struggle with deeply nested JSON \(>3 levels\) or conditional schemas \(oneOf\) because they lose track of closing braces or select invalid branches. This causes validation failures that trigger retry loops. Each retry burns the full context window again. GPT-4 handles these schemas reliably on the first pass but costs 10x more per token. The degradation signature is 'partial JSON output' \(missing closing braces\) or 'type errors in nested fields' \(e.g., returning a string where an object is expected\). The fix is architectural: flatten schemas for cheap models \(use dot notation: 'user.name' instead of user: \{name\}\), or use a two-stage pipeline: cheap model drafts, deterministic code validates/fills gaps.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:45:34.658571+00:00— report_created — created