UTF-8 Plumbing: Byte-level Tokenizers Unavoidably Enable LLMs to Generate Ill-formed UTF-8
Not on the map. Why?
Abstract (arXiv)
Subword tokenization segments input text according to a pre-defined vocabulary to feed it into a language model; the language model, in turn, generates a sequence made from this same vocabulary. The members of the vocabulary can be built of code points or bytes. Using code points means that all members of the vocabulary are valid UTF-8 characters. However, it also requires thousands of initial members to achieve acceptable coverage of inputs. Beginning with bytes, on the contrary, avoids out-of-vocabulary errors with only 256 initial members of the vocabulary, but the members of the vocabulary and sequences of them are not guaranteed to be valid UTF-8. Sequences that are not valid UTF-8 break code that assumes its input to be valid UTF-8. Applications of language models must account for the breakage thereby introduced. In this paper, we formalize tokenization using monoid theory and prove that tokenizers whose vocabularies contain tokens that are ill-formed UTF-8 can always produce sequences that are ill-formed UTF-8. We demonstrate formally that attempting to incrementally convert tokens back to a string and interpret the results as UTF-8 gives different results than converting the whole sequence of tokens at once. This formal result predicts real-world bugs: we evaluate mitigations for the problem identified and provide case studies of major foundation models, serving engines, and constrained generation systems.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 40 of its 75 references that are in the map. First posted on arXiv 5 Nov 2025.
Builds on
40 of 75 references.
References · 40
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
- 2018SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processingcited by 1,989
- 2024Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phonecited by 1,917
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2018Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidatescited by 639
- 2025Phi-4-Mini Technical Report: Compact yet Powerful Multimodal Language Models via Mixture-of-LoRAscited by 521
- 2021ByT5: Towards a token-free future with pre-trained byte-to-byte modelscited by 509
- 2020TweetEval: Unified Benchmark and Comparative Evaluation for Tweet Classificationcited by 417
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
- 2021CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language Representationcited by 232
- 2023Language Model Tokenizers Introduce Unfairness Between Languagescited by 214
28 more
- 2023Efficient Guided Generation for Large Language Modelscited by 200
- 2020Byte Pair Encoding is Suboptimal for Language Model Pretrainingcited by 192
- 2023Do All Languages Cost the Same? Tokenization in the Era of Commercial Language Modelscited by 192
- 2021Charformer: Fast Character Transformers via Gradient-based Subword Tokenizationcited by 160
- 2022Synchromesh: Reliable code generation from pre-trained language modelscited by 156
- 2021Between words and characters: A Brief History of Open-Vocabulary Modeling and Tokenization in NLPcited by 132
- 2023Tokenizer Choice For LLM Training: Negligible or Crucial?cited by 108
- 2024Coercing LLMs to do and reveal (almost) anythingcited by 89
- 2024Tokenization Is More Than Compressioncited by 89
- 2024SynCode: LLM Generation with Grammar Augmentationcited by 69
- 2023Tokenization and the Noiseless Channelcited by 59
- 2022Language Modelling with Pixelscited by 55
- 2024Automata-based constraints for language model decodingcited by 51
- 2021Robust Open-Vocabulary Translation from Visual Text Representationscited by 47
- 2024Fishing for Magikarp: Automatically Detecting Under-trained Tokens in Large Language Modelscited by 46
- 2024MYTE: Morphology-Driven Byte Encoding for Better and Fairer Multilingual Language Modelingcited by 40
- 2025CRANE: Reasoning with constrained LLM generationcited by 38
- 2023A Formal Perspective on Byte-Pair Encodingcited by 36
- 2024IterGen: Iterative Semantic-aware Structured LLM Generation with Backtrackingcited by 29
- 2021Why don't people use character-level machine translation?cited by 27
- 2024Tokenization Falling Short: On Subword Robustness in Large Language Modelscited by 20
- 2024Two Counterexamples to Tokenization and the Noiseless Channelcited by 13
- 2025Adversarial Tokenizationcited by 11
- 2024Autoregressive Pre-Training on Pixels and Textscited by 10
- 2024Improbable Bigrams Expose Vulnerabilities of Incomplete Tokens in Byte-Level Tokenizerscited by 7
- 2024Tokenization as Finite-State Transductioncited by 5
- 2024Byte BPE Tokenization as an Inverse string Homomorphismcited by 3
- 2024Towards Linguistically-Aware and Language-Independent Tokenization for Large Language Models (LLMs)cited by 2
Built on by
Citing papers per year: 2026: 3.
3 papers.