I’m a user that tries to utilize guided decoding with a DSL, and there had been some improvements in the decoding by utilizing guidance over xgrammar, nearly it got 2x faster but it’s still taking 20 seconds. I’ve read previous posts on this forum that up to 2025, and both xgrammar and llguidance seem to have been upgraded a lot after the last post. How’s it being improved on vllm’s side and what are some general ways to optimize guided decoding in terms of the gbnf syntax? I also want to know the performance improvement using json schema instead of bnf is still valid now.
vLLM has recently improved structured output performance by supporting multiple backends, notably xgrammar and guidance/llguidance, with xgrammar as the default for grammar and JSON schema decoding. Benchmarks show xgrammar is significantly faster than outlines, and guidance/llguidance is also highly optimized, especially for JSON schema (structured outputs docs, xgrammar API). However, performance can still vary depending on grammar complexity and backend choice.
For best performance, use JSON schema constraints instead of complex BNF/EBNF grammars when possible—JSON schema is much faster to compile and decode, especially with guidance/llguidance or xgrammar (structured outputs example). To further optimize, simplify your grammar (avoid deeply nested or ambiguous rules), minimize the use of negative lookaheads or complex regex, and prefer schema-based constraints for structured data. Backend selection (--guided-decoding-backend guidance or xgrammar) and tuning backend-specific options (like disabling additionalProperties for guidance) can also impact speed (engine args reference). The performance gap between JSON schema and BNF remains: JSON schema is still faster, especially for large or complex constraints.
Would you like more detail on backend configuration or grammar optimization strategies?
Sources:
Hint: Mention @Herald in the post for followups.
yeah sure, what are some possible improvements with additionalProperties?