NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #1875 most downloaded on PyPI
Efficient, Flexible and Portable Structured Generation
Last release 10 days ago
24 Sep 2026
Ships fairly regularly
a new release about every 3 weeks
Most releases are documented
notes for 32 of 37 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
39 releases · first in 2024
One column per month.
Add MiMo-V2.6 Pro and Flash tool-call and reasoning structural tags ( mimo ), aligned with the official chat templates and tokenizers. Fix empty root
Highlights since v0.2.7:
mimo), aligned with the official chat templates and tokenizers. Fix empty root schemas in the shared Qwen XML parameter-list converter (#916).JSONSchemaFormat.excludes to forbid substrings in string values and property names, including nested JSON strings (#912), and enable control-marker exclusions in Kimi-K3 tool arguments by default (#915). Exclusions apply to strings without pattern or format; their minLength / maxLength constraints are dropped with a warning.string="true|false" attributes to the parameter value type across unions and references (#908).max_chars so it no longer grows with the generated prefix length (#913), and mask overridden stop tokens until the grammar can complete (#905).GrammarFSMBuilder::FromRegularGrammar (#910).pattern is combined with unsupported minLength / maxLength constraints (#896).setuptools-scm (#891).Full changelog: v0.2.7...v0.2.8
Add the DeepSeek V4.1 structural tag ( deepseek_v4_1 ) and the deepseek_v4_1_xml schema style for the spaced DSML tags used by DeepSeek-V4.1-Flash, ex
Highlights since v0.2.6:
deepseek_v4_1) and the deepseek_v4_1_xml schema style for the spaced DSML tags used by DeepSeek-V4.1-Flash, exposed through Python, C++, and TypeScript and aligned with the official encoder and tokenizer (#885). Correlate each parameter's string="true|false" attribute with its value type across unions, mixed enums, references, and dynamic properties, and memoize $ref parameter rules so recursive references terminate (#889).minimax_m3_xml) (#713), and a parallel_tool_calls parameter for the builtin structural tags (#892).$ref no longer overflow the stack (#890).additionalProperties value schema when propertyNames is also present (#836).FromLark under C++20 (#878).Full changelog: v0.2.6...v0.2.7
Harden input validation, deserialization, and worker-thread error handling so invalid inputs raise exceptions instead of crashing the process ( #869 )
Highlights since v0.2.5:
GrammarCompiler.compile_lark API.max_tokens / max_chars support for AnyTextFormat and AnyTokensFormat.prefixItems handling, NUL regex rejection, repeat-edge metadata, and grammar serialization keys.Full changelog: v0.2.5...v0.2.6
Note: this is not the release version of the prior v0.2.6rc1 and v0.2.6rc2. Instead, it covers all the updates in the main branch since v0.2.5. Their official version will be released in the next version.
Preview release for early testing. This release is cut from the preview/v0.2.6rc2 branch, not from main .
Preview release for early testing. This release is cut from the preview/v0.2.6rc2 branch, not from main.
Highlights over v0.2.6rc1:
minLength / maxLength) no longer cause per-step token-mask slowdowns or latency cliffs (#853, fixing #805 and #852).Install with:
pip install xgrammar==0.2.6rc2Note: pip does not pick up pre-releases by default; pin the exact version as above or use pip install --pre xgrammar.
v0.2.6rc2 (preview) Pre-release
Pre-release
Compare
Preview release for early testing. This release is cut from the preview/v0.2.6rc1 branch, not from main.
Preview release for early testing. This release is cut from the preview/v0.2.6rc1 branch, not from main.
Highlights:
pattern / minLength / maxLength semantics fixes, using the ECMAScript regex dialect (\d/\w are ASCII) as required by JSON Schema, while Lark keeps Unicode character classes.Install with:
pip install xgrammar==0.2.6rc1
Note: pip does not pick up pre-releases by default; pin the exact version as above or use pip install --pre xgrammar.
v0.2.6rc1 (preview) Pre-release
Pre-release
Compare
Packaging-only follow-up to v0.2.5. This release uses the exact v0.2.5 source code and rebuilds the complete wheel matrix after the original PyPI uplo
Packaging-only follow-up to v0.2.5. This release uses the exact v0.2.5 source code and rebuilds the complete wheel matrix after the original PyPI upload was interrupted by the former project storage limit. Consumers requiring these wheels should pin xgrammar==0.2.5.post1.
perf: store FSM end states sparsely to remove quadratic memory in FSM building by @Ubospica in #702
Fix: fix the ci. by @Seven-Streams in #685
\S regex escape wrongly rejected a literal [ by @CaiJohn in #693oneOf schemas by @palios-taey in #672tool_choice="required" to terminate instead of looping. by @Napuh in #695Full Changelog: v0.2.3...v0.2.4
fix: fix the returned type of serialzation. by @Seven-Streams in #666
Full Changelog: v0.2.2...v0.2.3
fix: escape dot in float boundary values for regex generation by @dynamicheart in #642
Full Changelog: v0.2.1...v0.2.2
format: fix the format of the test files. by @Seven-Streams in #624
GrammarMatcher.accept_token with HF processor. by @Seven-Streams in #633emcc -lembind rather than emcc --bind by @kolayne in #608Full Changelog: v0.2.0...v0.2.1
refactor: unify reasoning parameter and rename model keys by @Ubospica in #609
Full Changelog: v0.1.34...v0.2.0
Reapply "refactor: migrate the binding logic into tvm_ffi . ( #550 )"" by @Seven-Streams in #576
tvm_ffi. (#550)"" by @Seven-Streams in #576unlimited. by @Seven-Streams in #585tool_choice for get_builtin_structural_tag. by @Seven-Streams in #586not hf_token_required is explicitly passed. by @Seven-Streams in #604The builtin structural tag in this version is experimental, and the API is subject to change before the next version.
Full Changelog: v0.1.33...v0.1.34
refactor: simplify TagDispatch by removing stop_eos and stop_str by @Ubospica in #554
PlusFormat, OptionalFormat, StarFormat to enhance StructuralTag. by @Seven-Streams in #557structural_tag-level cache. by @Seven-Streams in #553RepeatFormat. by @Seven-Streams in #558builtin_structural_tag by @eraser00 in #562Fork() method for GrammarMatcher. by @Seven-Streams in #556BatchRollback. by @Seven-Streams in #555DispatchFormat and TokenDispatchFormat. by @Seven-Streams in #564get_builtin_structural_tag with downstream software. by @Seven-Streams in #565To copy construct from a tensor, it is recommended to use sourceTensor. clone(). detach() or sourceTensor. clone() warning by @ExtReMLapin in #552tvm_ffi. by @Seven-Streams in #550tvm_ffi. (#550)" by @Seven-Streams in #574Full Changelog: v0.1.32...v0.1.33
Third-party rust support integration by @eugenebokhan in #531
any_text(excludes) without end_str. by @Seven-Streams in #536Full Changelog: v0.1.31...v0.1.32
v0.1.30 will be yanked soon for the issues in apply_token_bitmask_inplace and the Windows OS compatibility of crossing-grammar caching. Please use v0.
v0.1.30 will be yanked soon for the issues in apply_token_bitmask_inplace and the Windows OS compatibility of crossing-grammar caching. Please use v0.1.31 instead.
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.30...v0.1.31
[Feature] Allow empty separator string for tags_with_separator by @ricohasgit in https://github.com/mlc-ai/xgrammar/pull/503
tags_with_separator by @ricohasgit in https://github.com/mlc-ai/xgrammar/pull/503TypeError: apply_token_bitmask_inplace_cpu(): incompatible function arguments by @wjunLu in https://github.com/mlc-ai/xgrammar/pull/507tag format by @ricohasgit in https://github.com/mlc-ai/xgrammar/pull/504Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.29...v0.1.30
Add TraverseDraftTree for speculative decoding bitmask generation by @Ubospica in https://github.com/mlc-ai/xgrammar/pull/490
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.28...v0.1.29
[Fix] Fix JsonSchemaConverter for numbers "-0. ..." by @Seven-Streams in https://github.com/mlc-ai/xgrammar/pull/462
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.26...v0.1.27
v0.1.26 brings a series of batched methods for token mask generation. This version also fixed several issues with improvements in efficiency.
v0.1.26 brings a series of batched methods for token mask generation. This version also fixed several issues with improvements in efficiency.
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.25...v0.1.26
v0.1.25 brings the structural tag. It also fixes a couple of problems regarding JSON schema and py.typed. It enhances the speed of grammar compilation
v0.1.25 brings the structural tag. It also fixes a couple of problems regarding JSON schema and py.typed. It enhances the speed of grammar compilation and mask generation.
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.24...v0.1.25
This verision brings a lot of bugfixes. It also optimizes the speed for the repeat grammar, especially the repeat number is large.
This verision brings a lot of bugfixes. It also optimizes the speed for the repeat grammar, especially the repeat number is large.
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.23...v0.1.24
Significant speedup for grammars with repeat, e.g., a{1, 100}. Now the preprocessing of it is O(1) instead of O(n)
a{1, 100}. Now the preprocessing of it is O(1) instead of O(n)Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.22...v0.1.23
Enhanced Earley Parser with FSM Support - Added FSM support to the Earley parser and improved TagDispatch intrinsic
minProperties, maxProperties, patternProperties, propertyNamesdebug_print warnings in matcher logics. by @hnyls2002 in https://github.com/mlc-ai/xgrammar/pull/360Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.21...v0.1.22
v0.1.21 brings significant performance improvements and resolves previous issues with infinite loops and system freezes. It introduces the Earley pars
v0.1.21 brings significant performance improvements and resolves previous issues with infinite loops and system freezes. It introduces the Earley parser. The preprocessing time is now up to six times faster than before (See #308), and it no longer suffers from the previous problems of exponential growth in the number of states or infinite (or very deep) recursion.
It also fixes the cache corruption problem that occurs when the input is invalid in GrammarCompiler.
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.20...v0.1.21
Fix Windows build flags for Torch extensions
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.19...v0.1.20
Support minItems, maxItems for array by @Ubospica in https://github.com/mlc-ai/xgrammar/pull/296
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.18...v0.1.19
Provides a MLX kernel to support mac devices
LogitsProcessor to accept also list of compiled grammars by @lukaszkolodziejczyk in https://github.com/mlc-ai/xgrammar/pull/275apply_token_bitmask_inplace_cuda.py by @nFunctor in https://github.com/mlc-ai/xgrammar/pull/274Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.17...v0.1.18
Update README.md by @Ubospica in https://github.com/mlc-ai/xgrammar/pull/246
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.16...v0.1.17
This version enhances the compatibility of XGrammar on various platforms. It also provides full support for regex. Now most features are supported. It
This version enhances the compatibility of XGrammar on various platforms. It also provides full support for regex. Now most features are supported. It also enhances the efficiency of the token bitmask application kernel.
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.11...v0.1.12
Nothing published for this version
In this PR we supported the structural tag. This is a new feature that can support strict function calling (and many more flexible patterns).
In this PR we supported the structural tag. This is a new feature that can support strict function calling (and many more flexible patterns).
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.10...v0.1.11
In this version we enhanced the ability of json schema, ebnf, and provided APIs for grammar concat and union.
In this version we enhanced the ability of json schema, ebnf, and provided APIs for grammar concat and union.
Full Changelog: https://github.com/mlc-ai/xgrammar/compare/v0.1.9...v0.1.10
Nothing published for this version
Enhance JSON Schema converter by @Ubospica in #134
Nothing published for this version
The ability of the JSON Schema converter is enhanced to support integer range and regex pattern. Thanks @joennlae
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →