Prompting won't guarantee pure JSON: why teams use grammar-guided decoding

dotey · x · 2026-09-11

The author recounts an AI infra interview where he answered "use strong prompting" to force pure JSON output from LLMs — and was told that under probabilistic sampling, the model will occasionally slip in preamble or Markdown, breaking parsers at 2am. The production answer is grammar-guided decoding: tools like Outlines and Jsonformer, or native Structured Outputs APIs, zero out the probabilities of non-conforming tokens at the logits stage, guaranteeing valid output by construction.

Original post →

More from coding & agent

coding & agent channel →