mlc-ai/xgrammar
Fast, Flexible and Portable Structured Generation observed · 2026-08-28
Health v2 · maintenance only
88/100
- Activity 98
- Release rhythm 94
- Longevity 56
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 16.0
- age_days: 796
- days_rel: 43
- days_push: 13
- n_releases_24m: 33
Adoption not part of the score
1843 stars · 192 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
XGrammar is an open-source library for efficient, flexible, and portable structured generation in LLM inference via constrained decoding. It guarantees structurally correct outputs (JSON, regex, context-free grammars) with near-zero overhead and integrates into engines like vLLM, SGLang, and TensorRT-LLM.
Use cases
- force an LLM to output valid JSON matching a schema
- constrain model outputs to a regex or context-free grammar
- reliable tool calling and function calling for LLMs
- add structured output support to a custom LLM inference engine
- guarantee 100% syntactically correct model generations
- generate structured outputs with low latency overhead
When to choose
- you need guaranteed-valid structured output from an LLM
- you want near-zero overhead constrained decoding at scale
- you need portability across platforms, languages, and inference engines
- you support general grammars beyond simple JSON schemas
When to avoid
- you only need unconstrained free-form text generation
- you want a full LLM serving stack rather than a structured generation library
- your use case is simple prompt-based formatting without hard guarantees
Facets
library · maturity active
llm-inference parser serialization sdk large-language-models machine-learning developer-tools python cpp cross-platform wasm constrained-decoding structured-output json-schema grammar ebnf tool-calling llm-engine-integration gpu javascript
3 sources
- readme: https://github.com/mlc-ai/xgrammar · fetched 2026-08-28 · 2406a2e6c7f1
- homepage: https://xgrammar.mlc.ai/docs · fetched 2026-08-29 · 999a463d2590
- site_page: https://xgrammar.mlc.ai/docs/latest · fetched 2026-08-29 · 7e00539616a3
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| mlc-ai/xgrammar | main | 88 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem