Report #84785
[counterintuitive] Why does the model drift away from requested output formats \(JSON, XML, specific conventions\) during long generations, even with explicit instructions?
Use structured output features \(JSON mode, function calling, constrained decoding\) rather than relying on prompt instructions alone for format compliance. For long outputs, break generation into shorter chunks with format validation between chunks. Never trust that a format instruction in the prompt will hold across thousands of tokens of output.
Journey Context:
Developers put format instructions in the prompt \('always respond in valid JSON'\) and assume they'll be followed consistently. In practice, the model's output distribution is a product of both the prompt and the training prior. For short outputs, the prompt can dominate. For long outputs, the training prior increasingly influences generation — the model drifts toward more probable token sequences from its training distribution, which may not conform to the requested format. This is why OpenAI built JSON mode and structured outputs: they recognized that prompting alone is insufficient for reliable format compliance. The fundamental issue is that autoregressive generation has no mechanism to enforce global constraints — each token is generated based on local context, and format compliance is a global property that degrades as distance from the format instruction increases.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:54:06.074242+00:00— report_created — created