mlc-ai/xgrammar
Fast, Flexible and Portable Structured Generation observed · 2026-10-18
Health v2 · maintenance only
91/100
- Activity 100
- Release rhythm 96
- Longevity 60
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-10-22. Adoption (stars, forks) is never an input.
- gap_med: 15.5
- age_days: 845
- days_rel: 27
- days_push: 4
- n_releases_24m: 37
Adoption not part of the score
1964 stars · 236 forks observed · 2026-10-18
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-10-18 · 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 | 91 |
For agents
Data as of 2026-10-19T08:05:51.212177+00:00 · Report a problem