MDL-Calibrated Significance-Gain Pair Encoding: Replication-Aware Automatic Stopping for Subword Tokenization
Organizations: Department of Science, Technology & Mathematics, Lincoln University, MO, USA
Abstract
Byte-Pair Encoding (BPE) constructs subword vocabularies through greedy pair merging, but conventional BPE requires the number of merges or target vocabulary size to be specified externally. Significance-Gain Pair Encoding (SG-BPE) replaces frequency-only selection with a statistical criterion based on how strongly an observed pair exceeds its expected co-occurrence under an independence model. This paper introduces MDL-Calibrated Significance-Gain Pair Encoding (MDL-SG), a three-stage procedure separating discovery, replication, and utility. Candidate pairs are ranked by Significance-Gain on a discovery partition, tested for replication on a separate partition using an exact one-sided hypergeometric test with per-iteration Benjamini-Hochberg correction, and then evaluated on a utility partition using a Minimum Description Length (MDL) criterion. Merging stops automatically when no replicated candidate yields positive held-out MDL gain. On WikiText-103, MDL-SG stops at 209, 433, and 847 merges for 120K, 250K, and 500K-character tokenizer-training samples, respectively. At 500K characters, it selects a stored vocabulary of 1,017 tokens without prescribing the vocabulary size in advance. In a compute-matched TinyGPT experiment with identical 2,024,448-parameter models and 500 optimizer updates per language model, MDL-SG achieves validation/test BPC of 3.2612/3.2436, compared with test BPC of 3.2894 for SG-BPE and 3.3493 for frequency BPE. Frequency BPE achieves stronger raw compression, while MDL-SG achieves lower BPC, showing that compression-oriented merge selection and language-model utility need not coincide.
Figures & tables
| Corpus | Merges | Active vocab. | Stored vocab. | Best rejected gain (bits) |
|---|---|---|---|---|
| 120K | 209 | 327 | 348 | |
| 250K | 433 | 565 | 583 | |
| 500K | 847 | 976 | 1,017 |
| Method | Val. tokens | Val. TPC | Test tokens | Test TPC |
|---|---|---|---|---|
| Frequency BPE | 76,153 | 0.380765 | 75,592 | 0.377960 |
| SG-BPE | 79,153 | 0.395765 | 77,779 | 0.388895 |
| MDL-SG | 80,042 | 0.400210 | 79,002 | 0.395010 |
| Method | Val. BPC | Test BPC | Val. PPL | Test PPL |
|---|---|---|---|---|
| Frequency BPE | 3.340716 | 3.349258 | 437.70 | 465.14 |
| SG-BPE | 3.299369 | 3.289352 | 323.31 | 351.73 |
| MDL-SG | 3.261212 | 3.243573 | 283.82 | 296.41 |
Subword Tokenization
Subword tokenization divides text into reusable units smaller than words to support efficient and flexible language modeling.
See all 83 papers