Constructing a BPE Tokenization DFA
Martin Berglund, Willeke Martens, Brink van der Merwe

TL;DR
This paper presents an efficient algorithm for constructing deterministic finite automata tailored for byte pair encoding (BPE) tokenizations, enabling advanced analysis and processing of tokenized text in NLP systems.
Contribution
We introduce a novel method for building DFA directly on BPE tokenizations, facilitating pattern matching and language composition in NLP applications.
Findings
Automata construction preserves key properties and bounds state complexity.
The approach enables precise modeling of string-to-tokenization relationships.
Demonstrates practical applications in NLP tokenization analysis.
Abstract
Many natural language processing systems operate over tokenizations of text to address the open-vocabulary problem. In this paper, we give and analyze an algorithm for the efficient construction of deterministic finite automata (DFA) designed to operate directly on tokenizations produced by the popular byte pair encoding (BPE) technique. This makes it possible to apply many existing techniques and algorithms to the tokenized case, such as pattern matching, equivalence checking of tokenization dictionaries, and composing tokenized languages in various ways. The construction preserves some key properties of the automaton, and we use this to establish asymptotic bounds on the state complexity of the automata that result. Finally, we demonstrate how to construct an input-deterministic (subsequential) string-to-string transducer which precisely describes the relationship between strings and…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Reliability and Analysis Research
