Dynamic-Programming-Guided Hierarchical BPE and Empirical Analysis of Vocabulary Pruning
Abstract
Byte Pair Encoding (BPE) constructs vocabularies through greedy pair merging, but the resulting merge order does not necessarily allocate a fixed model-visible vocabulary optimally for compression. We propose Dynamic-Programming-Guided Hierarchical BPE (DH-BPE), a vocabulary-construction method that combines token exposure under exact minimum-token segmentation with the hierarchical dependencies induced by BPE training. Starting from a modestly overshot BPE candidate vocabulary, DH-BPE uses dynamic programming to measure candidate utility and applies exposure-guided, dependency-aware pruning to select a fixed-size model-visible vocabulary. We compare DH-BPE against Standard BPE and recent vocabulary-optimization baselines, including Pruned BPE, MinGram, and MinGram-PP, in primary evaluations at 12K and 16K target vocabulary sizes, with an additional 18K evaluation against MinGram only. Across the primary 12K and 16K comparisons, DH-BPE consistently improves aggregate compression over Standard BPE, Pruned BPE, and MinGram under a shared exact minimum-token DP encoder. MinGram-PP achieves stronger aggregate compression in the primary comparisons, but DH-BPE outperforms it at overshoot factors f = 2.0 and f = 3.0 in cross-corpus evaluation; at 12K, MinGram-PP reverses this ordering only with the substantially larger candidate pools at f = 4.0 and f = 5.0. Qualitative analysis further shows that DH-BPE balances later, more complete BPE merges with reusable subword components, providing a practical approach to improving vocabulary allocation under a fixed model-visible vocabulary budget.
Figures & tables
| Method | Vocabulary modification | Segmentation / optimization | BPE dependency | Selection or removal signal | Primary objective |
| PathPiece | Top-down pruning from a large seed | Exact minimum-token DP | No explicit use | Estimated token-count increase after omission | Token-count compression |
| SaGe | Top-down pruning from an oversized seed | Iterative re-tokenization with contextual scoring | No explicit use | Contextual Skip-Gram ablation loss | Context-aware vocabulary construction |
| BPE trimming | Post-training vocabulary reduction | BPE encoding with recursive decomposition | Uses BPE decomposition | Final token-frequency threshold | Vocabulary reduction |
| PickyBPE | During BPE training | Modified BPE training | No explicit merge graph | Intersection-over-Self criterion | Remove redundant intermediate tokens |
| LiteToken | Post-training residue removal | BPE-based split and re-merge | Yes | Intermediate/final usage and neighbor-diversity signals | Remove underused merge residues |
| AdaptBPE | Fixed-budget merge replacement | BPE merge adaptation | Yes | Adaptation-corpus frequency and compression | Domain/language adaptation |
| Method | Configuration | Corpus II | Corpus I | Corpus III | Overall | (%) |
| Standard BPE | – | 307,026,651 | 190,730,625 | 276,009,112 | 773,766,388 | 0.000 |
| Pruned BPE | 305,341,252 | 190,006,412 | 274,706,279 | 770,053,943 | 0.480 | |
| MinGram | 304,671,017 | 189,891,430 | 274,850,074 | 769,412,521 | 0.563 | |
| MinGram-PP | 302,442,192 | 188,991,924 | 275,064,145 | 766,498,261 | 0.939 | |
| 302,224,084 | 189,055,077 | 275,376,899 | 766,656,060 | 0.919 | ||
| 302,148,125 | 189,082,771 | 274,071,348 | 765,302,244 | 1.094 |
| Method | Configuration | Corpus II | Corpus I | Corpus III | Overall | (%) |
| Standard BPE | – | 292,257,884 | 182,736,861 | 263,421,152 | 738,415,897 | 0.000 |
| Pruned BPE | 290,775,983 | 181,962,160 | 262,531,829 | 735,269,972 | 0.426 | |
| MinGram | 290,172,998 | 181,990,067 | 263,154,525 | 735,317,590 | 0.420 | |
| MinGram-PP | 288,217,401 | 181,301,272 | 263,708,429 | 733,227,102 | 0.703 | |
| 287,975,182 | 181,301,360 | 262,688,176 | 731,964,718 | 0.874 | ||
| DH-BPE | 290,193,410 | 181,843,497 | 262,355,943 | 734,392,850 | 0.545 |
Subword Tokenization
Subword tokenization divides text into reusable units smaller than words to support efficient and flexible language modeling.
See all 83 papers