Skip to content

mlc-ai/xgrammar

Repository files navigation

XGrammar

Documentation License PyPI

Efficient, Flexible and Portable Structured Generation

Get Started | Documentation | Blogpost | Technical Report

News

  • [2025/01] XGrammar has been officially integrated into TensorRT-LLM.
  • [2024/12] XGrammar has been officially integrated into vLLM.
  • [2024/12] We presented research talks on XGrammar at CMU Catalyst, Berkeley SkyLab, MIT HANLAB, THU IIIS, Ant Group, SGLang Meetup and Qingke AI. The slides can be found here.
  • [2024/11] XGrammar has been officially integrated into SGLang.
  • [2024/11] XGrammar has been officially integrated into MLC-LLM.
  • [2024/11] We officially released XGrammar v0.1.0!

Overview

XGrammar is an open-source library for efficient, flexible, and portable structured generation. It supports general context-free grammar to enable a broad range of structures while bringing careful system optimizations to enable fast executions. XGrammar features a minimal and portable C++ backend that can be easily integrated into multiple environments and frameworks, and is co-designed with the LLM inference engine and enables zero-overhead structured generation in LLM inference.

Get Started

Please visit our documentation to get started with XGrammar.