Skip to content
Preprint

Trie Automata for Constrained Decoding over Large Finite Sets

Aug 2026 · 0 citations · 35 references
Computer Science

TL;DR

The trie automaton is introduced, a specialized mechanism that exploits finite-set structure via Aho-Corasick multi-pattern matching to precompute per-node token masks, and achieves 7X faster per-step valid-token computation compared to XGrammar and 2.5X faster compilation at K>= 300.

Abstract

Large language models increasingly need to generate structured outputs that conform to predefined schemas, with one common constraint being selection from a finite set of valid strings. Current constrained decoding systems handle this through general-purpose grammar compilation, which becomes prohibitively slow as the number of valid values grows into the thousands, a cardinality wall. We introduce the trie automaton, a specialized mechanism that exploits finite-set structure (shared prefixes, bounded depth, known cardinality) via Aho-Corasick multi-pattern matching to precompute per-node token masks. The trie achieves 7X faster per-step valid-token computation (0.65 us vs. 5.8 us) compared to XGrammar, one of the primary backends in vLLM and SGLang, and 2--6.5X faster compilation at K>= 300. Because precomputed masks enable a stateless serving path that bypasses the guided decoding pipeline, this advantage compounds in batch serving: end-to-end vLLM throughput reaches 219 req/s vs. XGrammar's 7.5 req/s at batch size 256 (29X). The 29X combines the algorithmic speedup with integration-path savings that only precomputed masks can unlock. Across seven tokenizer families (32K--262K vocabulary), the trie maintains sub-100ms compilation up to K = 10,000 and flat per-step cost regardless of set size, while guaranteeing 100% output validity.

View source

Similar papers

Preprint Aug 2026

Efficient Grammar-Constrained Decoding via Parser Stack Classification

LLMs are widely used to generate structured output like source code or JSON. Grammar-constrained decoding (GCD) can guarantee the syntactic validity of the generated output, by masking out tokens that violate rules specified by a context-free grammar. However, the online computational overhead of existing GCD methods,...

Yong-Ming Li, Yihong Dong, Jia Li et al. · 0 citations
#artificial intelligence Preprint Aug 2026

Improving Natural-Language Combinatorial-Optimization Accuracy in Resource-Constrained Language Models via Formal Abstractions

SDDL is introduced, a neuro-symbolic framework that translates natural-language scheduling problems into compact, solver-aligned representations of tasks, resources, constraints, and objectives, while delegating low-level modeling and search to a deterministic compiler and external solver.

Shrenil Shaun Sharma, Avirag Sharma · 0 citations
#edge computing Preprint Sep 2026

Automatic constraints with few subpowers and graphoid recognition

For graphoid automata, these results give polynomial-time recognition without a graph-width restriction, effective boundary composition, and comparison of finite graph relations, and the quadratic boundary bounds are optimal in the worst case.

Antonios Kalampakas · 0 citations
Preprint Sep 2026

Query-Limited RAM Programs and their Applications

Quantum one-time programs (Broadbent, Gutoski and Stebila, CRYPTO 2013) or OTPs for short, enable a functionality to be encoded into a quantum token that can be evaluated on a single chosen input and then becomes unusable. While powerful, this primitive is inherently stateless and tied to a setting in which a quantum t...

Jia-Hui Liu, Justin Raizes, Bhaskar Roberts et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.