src-dong-2024-xgrammar source
XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Models
locator
notes
CFG-constrained decoding; vocabulary split into context-independent tokens prechecked and context-dependent tokens checked at runtime with a persistent stack; grammar work overlapped with GPU execution; up to 100x faster than prior solutions, near-zero end-to-end overhead.