How constrained decoding guarantees valid LLM output: grammars, FSAs, token masking, JSON-schema enforcement, and where structured generation breaks in production.
A 2026 benchmark of LLM JSON mode and constrained decoding: throughput, latency, and accuracy across grammar-based methods, with reproducible methodology.