Constructing a BPE Tokenization DFA

Martin Berglund, Willeke Martens, Brink van der Merwe
5/13/2024
cs.FLcs.CLcs.LG

No confident code implementation found for this paper.

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 their correct tokenizations.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{berglund2024constructing,
  title  = {Constructing a BPE Tokenization DFA},
  author = {Martin Berglund and Willeke Martens and Brink van der Merwe},
  year   = {2024},
  eprint = {2405.07671},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.07671v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.07671.svg)](https://codeofpaper.com/paper/2405.07671)

Discussion