Report #38402
[counterintuitive] Do few-shot examples guarantee the LLM outputs the exact format
Combine few-shot examples with explicit formatting constraints \(e.g., JSON schema enforcement, grammar constraints, or structured outputs API features\) rather than relying on examples alone.
Journey Context:
Developers provide 2-3 JSON examples expecting the model to strictly follow. LLMs are probabilistic; they learn the pattern but can easily deviate \(e.g., adding an extra key, trailing comma, or conversational filler\). Structured outputs \(JSON mode, function calling, constrained decoding\) actually restricts the token space, guaranteeing the format.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:56:13.117517+00:00— report_created — created