A Partition Cover Approach to Tokenization

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Lim, Jia Peng, Tan, Shawn, Choo, Davin, Lauw, Hady W.
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866909811274153984
author Lim, Jia Peng
Tan, Shawn
Choo, Davin
Lauw, Hady W.
author_facet Lim, Jia Peng
Tan, Shawn
Choo, Davin
Lauw, Hady W.
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2501_06246
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle A Partition Cover Approach to Tokenization
Lim, Jia Peng
Tan, Shawn
Choo, Davin
Lauw, Hady W.
Computation and Language
Artificial Intelligence
Data Structures and Algorithms
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.
title A Partition Cover Approach to Tokenization
topic Computation and Language
Artificial Intelligence
Data Structures and Algorithms
url https://arxiv.org/abs/2501.06246