Report #77487
[counterintuitive] prompt instructions guarantee valid JSON schema output
Use structured output features \(e.g., JSON mode, function calling, or grammar-constrained decoding like Outlines/Llama.cpp grammars\) instead of relying on prompt instructions for JSON formatting.
Journey Context:
Developers write 'Output strictly in JSON format following this schema...' and assume the model will comply. LLMs are probabilistic text generators; they will eventually hallucinate a missing comma, add a conversational prefix \('Here is your JSON:'\), or invent a field not in the schema. Prompting for JSON is fragile and breaks silently. Constrained decoding forces the model's token generation to strictly adhere to a formal grammar, guaranteeing 100% schema compliance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:39:35.802761+00:00— report_created — created