Tokenisation over Bounded Alphabets is Hard

Violeta Kastreva, Philip Whittington, Dennis Komm, Tiago Pimentel
11/19/2025
cs.CLcs.DScs.LG

No confident code implementation found for this paper.

Abstract

Recent works have shown that tokenisation is NP-complete. However, these works assume tokenisation is applied to inputs with unboundedly large alphabets -- an unrealistic assumption, given that in practice tokenisers operate over fixed-size alphabets, such as bytes or Unicode characters. We close this gap by analysing tokenisation over bounded $n$-ary alphabets, considering two natural variants: bottom-up tokenisation and direct tokenisation, where we must, respectively, select a sequence of merge operations or a vocabulary whose application optimally compresses a dataset. First, we note that proving hardness results for an $n$-ary alphabet proves the same results for alphabets of any larger size. We then prove that even with binary alphabets, both variants are not only NP-complete, but admit no polynomial-time approximation scheme (unless P=NP). We further show that direct tokenisation remains NP-complete even when applied to unary alphabets. While unary alphabets may not be practically useful, this result establishes that the computational intractability of tokenisation is not an artifact of large alphabets or complex constructions, but a fundamental barrier. Overall, our results explain why practical algorithms such as BPE and UnigramLM are heuristic, and points toward approximation algorithms being an important path going forward for tokenisation research.

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!

Cite this paper

@article{kastreva2025tokenisation,
  title  = {Tokenisation over Bounded Alphabets is Hard},
  author = {Violeta Kastreva and Philip Whittington and Dennis Komm and Tiago Pimentel},
  year   = {2025},
  eprint = {2511.15709},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2511.15709v1}
}

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/2511.15709.svg)](https://codeofpaper.com/paper/2511.15709)

Discussion