Report #29992
[frontier] LLM outputs malformed JSON or invalid schema
Use grammar-based constrained decoding \(Outlines, llama.cpp grammars, or OpenAI structured outputs\) to force valid syntax at token generation time rather than parsing post-hoc.
Journey Context:
Post-hoc parsing with regex or retries is fragile and wastes tokens. Constrained decoding masks the logits to only valid next tokens, guaranteeing schema compliance. This eliminates parsing errors entirely but requires runtime support \(not just prompt engineering\). Choose this when schema strictness is critical over minor latency costs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:43:53.789128+00:00— report_created — created