Tokenization as Finite-State Transduction
Abstract Tokenization is the first step in modern neural language model pipelines where an input text is converted to a sequence of subword tokens. We introduce from first principles a finite-state transduction framework that can encode all possible tokenizations of a regular language. We then constructively show that Byte-Pair Encoding (BPE) and MaxMatch (WordPiece), two popular tokenization schemes, are also efficiently representable by simple finite-state transducers. For BPE, this is particularly surprising given that it does not tokenize strings from left to right and requires a notion of priority. We also discuss an application of subword-level pattern promotion to guided generation, where the outputs of a language model are constrained to match a specified pattern, and how tokenization-aware promotion offers a theoretical benefit to modeling.
Authors
- Marco Cognetta
- Naoaki Okazaki (ORCID: https://orcid.org/0000-0001-7635-6175)
Institutions
- Cognizant (United States) (US)
- Okazaki Institute for Integrative Bioscience (JP)
Publication Details
- Journal
- Computational Linguistics
- Published
- 2025-01-01
- DOI
- https://doi.org/10.1162/coli.a.23
- Primary Topic
- Natural Language Processing Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00