Trie Automata for Constrained Decoding over Large Finite Sets
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 25 of its 35 references that are in the map. First posted on arXiv 12 Aug 2026.
Builds on
25 of 35 references.
References · 25
- 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIscited by 1,947
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,141
- 2020Efficient Intent Detection with Dual Sentence Encoderscited by 433
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
- 2019An Evaluation Dataset for Intent Classification and Out-of-Scope Predictioncited by 386
- 2020Autoregressive Entity Retrievalcited by 334
- 2023Efficient Guided Generation for Large Language Modelscited by 200
- 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 197
- 2018Fast Lexically Constrained Decoding with Dynamic Beam Allocation for Neural Machine Translationcited by 182
- 2021NeuroLogic A*esque Decoding: Constrained Text Generation with Lookahead Heuristicscited by 154
- 2020NeuroLogic Decoding: (Un)supervised Neural Text Generation with Predicate Logic Constraintscited by 149
- 2022MASSIVE: A 1M-Example Multilingual Natural Language Understanding Dataset with 51 Typologically-Diverse Languagescited by 146
13 more
- 2022Prompting Is Programming: A Query Language for Large Language Modelscited by 110
- 2016Guided Open Vocabulary Image Captioning with Constrained Beam Searchcited by 105
- 2024XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Modelscited by 75
- 2025JSONSchemaBench: A Rigorous Benchmark of Structured Outputs for Language Modelscited by 71
- 2024SynCode: LLM Generation with Grammar Augmentationcited by 69
- 2024Automata-based constraints for language model decodingcited by 51
- 2025MCP-Zero: Active Tool Discovery for Autonomous LLM Agentscited by 33
- 2025Efficient Beam Search for Large Language Models Using Trie-Based Decodingcited by 10
- 2025Dynamic ReAct: Scalable Tool Selection for Large-Scale MCP Environmentscited by 6
- 2026Vectorizing the Trie: Efficient Constrained Decoding for LLM-based Generative Retrieval on Acceleratorscited by 6
- 2024Tokenization as Finite-State Transductioncited by 5
- 2025Zero-shot Context Biasing with Trie-based Decoding using Synthetic Multi-Pronunciationcited by 3
- 2025WGRAMMAR: Leverage Prior Knowledge to Accelerate Structured Decodingcited by 2
Built on by
Not cited yet.