Skip to content

Releases

v0.2.9

Choose a tag to compare

@Seven-Streams Seven-Streams released this 09 Nov 15:14
8f9a127

What's Changed

  • feat: support Gemma 4 tool calling with the <|"|> string delimiter by @asanomitakanori in #923
  • fix: keep built-in formats within valid JSON strings by @RanaPriyansh in #927
  • fix: bound DeepSeek V4.1 auto tool calls by @mashiro01 in #936
  • fix: preserve shortest JSON numbers in schema literals by @RanaPriyansh in #926
  • perf: cut bounded-string token-mask fills by classifying the repetition body with its parent by @0z5a in #903
  • perf: extend the counted-repetition fast path to strings with minLength by @Seven-Streams in #938
  • fix: fix the rendering of xgrammar's version on the website. by @Seven-Streams in #941
  • ci: remove the nightly Routine Unit Test workflow by @Seven-Streams in #944
  • fix: rule-level cache hash collisions between different character ranges and repeat bounds by @Seven-Streams in #943
  • build: update dependencies by @Seven-Streams in #950
  • fix: resolve JSON Schema references through array indices by @adimalkar in #929
  • fix: let a token that starts in a literal finish in a token-level free-text region by @Seven-Streams in #942
  • [Python] Add opt-in token_markers to get_model_structural_tag by @JRJRJPRO in #940
  • fix: preserve separators in generic JSON rules by @RanaPriyansh in #948
  • fix: fix the benchmark script by @Seven-Streams in #962
  • fix: compile large regex repetitions with caching enabled by @Seven-Streams in #963
  • fix: fix the import of mlxlm. by @Seven-Streams in #976
  • Add jump-forward tokens while preserving accepted boundaries by @Ubospica in #980
  • fix: match the ECMAScript whitespace class in \s and \S by @jinwukong in #977
  • fix: CI Hugging Face rate limiting with shared offline tokenizer assets by @a68lin in #982
  • Bugfix: avoid collisions in JSON Schema cache keys by @izhuhaoran in #985
  • docs: document any_whitespace interaction with permissive schemas by @davidchung29 in #953
  • fix: release erased values in List so cache evictions free memory by @stu-cao in #1003
  • feature: Add opt-in JIT grammar compilation by @a68lin in #1017
  • fix: accept stop token when it completes the grammar by @n0gu-furiosa in #710
  • feat: support Lark syntax in structural tag grammar formats by @BugenZhao in #1015
  • fix: keep find_jump_forward_string to whole UTF-8 characters by @Shakhtar-Sankur in #1012
  • ci: migrate macOS 14 runners to macOS 15 by @a68lin in #1044
  • fix: preserve forbidden bytes across counted repeat lowering by @HengYangDS in #949

New Contributors

Full Changelog: v0.2.8...v0.2.9

v0.2.8

Choose a tag to compare

@Ubospica Ubospica released this 24 Sep 18:02
9778737

Highlights since v0.2.7:

  • 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 schemas in the shared Qwen XML parameter-list converter (#916).
  • Add 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.
  • Improve DeepSeek V4.1 token-mask performance and fix root object literals, schema/reference cache isolation, and overlapping text exclusions (#900). Bind DeepSeek V4 XML string="true|false" attributes to the parameter value type across unions and references (#908).
  • Reduce token-mask overhead with max_chars so it no longer grows with the generated prefix length (#913), and mask overridden stop tokens until the grammar can complete (#905).
  • Fix Unicode character-class ranges, negated classes, and UTF-8 encoding boundaries (#909), plus start-state merging and nested unbounded repetitions (#911). Enforce FSM state limits (#906) and add GrammarFSMBuilder::FromRegularGrammar (#910).
  • Warn when JSON Schema string pattern is combined with unsupported minLength / maxLength constraints (#896).
  • Fix native binding discovery in installed packages (#893), and derive Python package versions from Git tags with setuptools-scm (#891).

Full changelog: v0.2.7...v0.2.8

v0.2.7

Choose a tag to compare

@Ubospica Ubospica released this 15 Sep 15:17

Highlights since v0.2.6:

  • 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, 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).
  • Add the MiniMax M3 tool-call structural tag (minimax_m3_xml) (#713), and a parallel_tool_calls parameter for the builtin structural tags (#892).
  • Add canonical recursive Any support for Cohere XML (#872), and memoize Cohere parameter wrappers so unions that refer back to themselves through $ref no longer overflow the stack (#890).
  • Honor the additionalProperties value schema when propertyNames is also present (#836).
  • Compile FromLark under C++20 (#878).
  • Document project governance and the release policy (#887).

Full changelog: v0.2.6...v0.2.7

v0.2.6

Choose a tag to compare

@Ubospica Ubospica released this 09 Sep 00:59

Highlights since v0.2.5:

  • Harden input validation, deserialization, and worker-thread error handling so invalid inputs raise exceptions instead of crashing the process (#869). Preserve tokenizer JSON round trips, including binary vocabulary and token-grammar compilation (#879).
  • Extend EBNF and Lark grammars with capture, lazy matching, suffix/stop conditions, token and character budgets, and sampling temperature options. Add Lark regex flags, structured substring expressions, and a cached GrammarCompiler.compile_lark API.
  • Improve grammar compilation with direct JSON Schema AST construction, shared FSM construction, in-place optimizer passes, and cached parser-state properties.
  • Add Cohere XML, Kimi K3, and EXAONE 4.0 structural tags, plus max_tokens / max_chars support for AnyTextFormat and AnyTokensFormat.
  • Fix JSON carriage-return whitespace, positional prefixItems handling, NUL regex rejection, repeat-edge metadata, and grammar serialization keys.
  • Add an NPU token-bitmask backend and Windows ARM64 wheels. Reduce Python wheel size and expand the documentation.

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.

v0.2.5.post1

Choose a tag to compare

@Ubospica Ubospica released this 03 Sep 06:30

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.

v0.2.6rc2 (preview)

v0.2.6rc2 (preview) Pre-release
Pre-release

Choose a tag to compare

@Ubospica Ubospica released this 29 Aug 09:19
8d9679c

Preview release for early testing. This release is cut from the preview/v0.2.6rc2 branch, not from main.

Highlights over v0.2.6rc1:

  • Dynamic JSON Schema compilation and token-mask generation optimizations (#846), including reuse of vocabulary common prefixes in token mask generation (#856).
  • JSON Schema string length constraints (minLength / maxLength) no longer cause per-step token-mask slowdowns or latency cliffs (#853, fixing #805 and #852).
  • Generalized dynamic token-boundary masks beyond JSON strings, with correctness proofs replacing the earlier shape heuristics (#854).
  • Correctness fixes: mask cache key, FSM aliasing, and lazy metadata race (#855); JSON string masking issues (#856); repeat-edge auxiliary data preserved in JSON string regex FSMs (#864, fixing #863); local-completion crossing-token bitset preserved on the lazy compilation path and rule-own lookahead assertions enforced in local-completion masks (#867).
  • Documentation for the dynamic compilation option (#843) and a multi-version documentation site.

Install with:

pip install xgrammar==0.2.6rc2

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)

v0.2.6rc1 (preview) Pre-release
Pre-release

Choose a tag to compare

@Ubospica Ubospica released this 15 Aug 06:49

Preview release for early testing. This release is cut from the preview/v0.2.6rc1 branch, not from main.

Highlights:

  • Lark grammar compatibility with llguidance v1.8 (hex escapes, terminal set operations, complements, byte/Unicode patterns, text anchors, capture names, grammar options), plus faster Lark compilation. Thanks to the llguidance team for designing these Lark grammar extensions.
  • JSON Schema string 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.
  • Correctness fixes: indirectly nullable repetition ranges, compilation cache size accounting, structurally invalid compiled-grammar cache deserialization now reports an error, raw jump-forward bytes preserved for invalid UTF-8, partial three-byte UTF-8 range handling.
  • Performance: dynamic JSON Schema compilation and token-mask generation improvements; token-mask hot path stack usage reduced.

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.5

Choose a tag to compare

@Ubospica Ubospica released this 22 Jul 01:04

What's Changed

  • perf: store FSM end states sparsely to remove quadratic memory in FSM building by @Ubospica in #702
  • prevent XML whitespace state explosion by @Ubospica in #704
  • add Lark grammar frontend by @Ubospica in #703

Full Changelog: v0.2.4...v0.2.5

v0.2.4

Choose a tag to compare

@Ubospica Ubospica released this 18 Jul 13:09
dd729e7

What's Changed

  • Fix: fix the ci. by @Seven-Streams in #685
  • [feat] support whitespace control for structural tag by @izhuhaoran in #660
  • fix: fix the ci. by @Seven-Streams in #689
  • refactor: remove specialized XML tool calling EBNF converter functions by @Ubospica in #686
  • perf: deduplicate identical repetition expansions in RepetitionRangeExpander by @Ubospica in #691
  • fix: \S regex escape wrongly rejected a literal [ by @CaiJohn in #693
  • feat: warn when apply_token_bitmask_inplace leaves logits unmasked (undersized bitmask) by @whycoming in #694
  • fix: make JSON Schema multipleOf sound for integers, warn for numbers by @palios-taey in #670
  • fix: reject unsupported overlapping oneOf schemas by @palios-taey in #672
  • fix(structural_tag): fix several models with tool_choice="required" to terminate instead of looping. by @Napuh in #695
  • Bugfix(fsm): resolve trie back edges via Aho-Corasick failure links by @izhuhaoran in #697
  • Bump to v0.2.4. by @Ubospica in #700

New Contributors

Full Changelog: v0.2.3...v0.2.4

v0.2.3

Choose a tag to compare

@Seven-Streams Seven-Streams released this 27 Jun 03:34
v0.2.3
557becf

What's Changed

New Contributors

Full Changelog: v0.2.2...v0.2.3