A Partition Cover Approach to Tokenization

Jia Peng Lim, Shawn Tan, Davin Choo, Hady W. Lauw
1/8/2025
cs.CLcs.AIcs.DS

No official code found. Best implementation: PreferredAI/pcatt (2 stars, MIT, last commit 2026-04-16).

Abstract

Tokenization is the process of encoding strings into tokens of a fixed vocabulary size, and is widely utilized in Natural Language Processing applications. The leading tokenization algorithm today is Byte-Pair Encoding (BPE), which formulates the tokenization problem as a compression problem and tackles it by performing sequences of merges. In this work, we formulate tokenization as an optimization objective, show that it is NP-hard via a simple reduction from vertex cover, and propose a polynomial-time greedy algorithm GreedTok. Our formulation naturally relaxes to the well-studied weighted maximum coverage problem which has a simple $(1 - 1/e)$-approximation algorithm GreedWMC. Through empirical evaluations on real-world corpora, we show that GreedTok outperforms BPE and Unigram on compression and achieves a covering score comparable to GreedWMC. Finally, our extensive pre-training for two transformer-based language models with 1 billion parameters, comparing the choices of BPE and GreedTok as the tokenizer, shows that GreedTok achieves a lower bit per byte even when we control for either the total dataset proportion or total training tokens.

View on arXivView PDF

Code Implementations(1)

PreferredAI/pcattCommunity100%
MIT

GreedTok - aiming to be your preferred greedy tokenizer

22C++, PythonNov 4, 20246 months agoMIT
algorithmscomputational-linguisticsnatural-language-processingtokenizer

Similar Papers

Cite this paper

@article{lim2025partition,
  title  = {A Partition Cover Approach to Tokenization},
  author = {Jia Peng Lim and Shawn Tan and Davin Choo and Hady W. Lauw},
  year   = {2025},
  eprint = {2501.06246},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2501.06246v3}
}

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

Discussion