← all repositories

mlc-ai/xgrammar

A C++ library enabling fast, portable constrained decoding and structured JSON/regex generation for large language models.

xgrammar
Velocity · 7d
+2.4
★ / day
Trend
steady
star history

XGrammar is a structured generation library designed for efficient and flexible constrained decoding during LLM inference. It enables models to produce valid JSON, regex-constrained, or user-defined structured outputs by constraining the token selection space at each generation step. The library is implemented in C++ with bindings for Python and integrates natively into popular inference runtimes like vLLM, TensorRT-LLM, and Modular MAX.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.