tokenize.rs

Preprint ยท arXiv 2606.27019

MinGram

Sander Land

Read the paper on arXiv ↗

Unigram's token-list representation makes vocabularies easy to edit, but training it is heavy and complex. MinGram keeps the representation and strips the training down.

Scatter plot of compression improvement over Unigram versus morphological alignment score, with MinGram sitting in the high-compression, high-alignment region above other compression-focused tokenizers.
MinGram hits the compression and morphology sweet spot, beating other high-compression tokenizers on alignment.

The problem

Unigram represents a vocabulary as a flat list of tokens with scores, which makes editing and repairing it easy. Training is the hard part: suffix-array candidate mining, marginal EM over a segmentation lattice, and an iterative pruning loop. BPE is simpler, but its ordered merge list makes the vocabulary awkward to change.

What we do

MinGram keeps the Unigram representation and replaces all three heavy steps with light ones: a BPE-derived seed vocabulary, hard EM along a single minimum-token path (two iterations are enough), and one flat score-pruning pass. Token count is the objective, and the probability score only breaks ties. Training needs little more than tokenizer inference.

Why it matters

The MinGram family compresses better than both BPE and standard Unigram across six languages, keeps competitive morphological alignment, and leads on downstream bits-per-byte, while leaving far fewer rarely-seen tokens behind: 9, against 172 for BPE.

Read the paper on arXiv ↗ Browse the code ↗