Dynamic-Programming-Guided Hierarchical BPE and Empirical Analysis of Vocabulary Pruning

TL;DR

Proposes DH-BPE combining minimum-token segmentation exposure with hierarchical BPE for fixed vocab optimization.

cs.CL 🔴 Advanced 2026-09-07 48 views
Kenny Shao
subword tokenization vocabulary pruning dynamic programming BPE optimization model compression

Key Findings

Methodology

DH-BPE integrates dynamic programming-based minimum-token segmentation exposure metrics with the hierarchical structure of BPE merges. Starting from an overshoot candidate vocabulary, it computes token utility via DP on training corpora, measuring how often tokens appear in minimal segmentation. This exposure guides dependency-aware pruning, preserving tokens critical for maintaining BPE dependencies. The process results in a fixed-size, optimized vocabulary that outperforms standard BPE, Pruned BPE, and MinGram in compression and generalization, especially in cross-corpus evaluations.

Key Results

  • DH-BPE achieves 5-8% better compression rates than baseline methods at 12K and 16K vocab sizes, with significant improvements in cross-corpus tests at overshoot factors f=2.0 and f=3.0. It effectively balances long-tail tokens and reusable subword components, leading to more efficient vocabulary allocation.
  • In experiments, DH-BPE consistently surpasses standard BPE and recent baselines in compression metrics, with notable robustness across datasets. Larger candidate pools benefit MinGram-PP at very high overshoot factors, but DH-BPE maintains superior performance at moderate overshoot factors.
  • Qualitative analysis shows DH-BPE’s ability to allocate vocabulary capacity effectively, balancing complete BPE merges with reusable subword units, which enhances model generalization and practical deployment efficiency.

Significance

This work advances vocabulary optimization by integrating precise minimum-token segmentation metrics with hierarchical dependency structures, addressing the longstanding challenge of fixed vocabulary allocation in large language models. It offers a theoretically grounded, practically effective framework that improves compression, reduces redundancy, and enhances cross-corpus robustness, crucial for deploying efficient, scalable NLP systems in resource-constrained environments.

Technical Contribution

The core innovation lies in combining DP-based token exposure measurement with BPE’s merge hierarchy, enabling dependency-aware pruning. This approach diverges from traditional frequency-based methods by directly quantifying token utility under minimal segmentation, ensuring the selected vocabulary is both compact and highly effective. The framework supports adjustable overshoot factors and pruning ratios, providing flexible, scalable solutions for diverse scenarios. The method’s theoretical guarantees stem from the explicit use of DP for exact minimal segmentation, ensuring optimal token retention based on actual utility.

Novelty

This is the first work to incorporate exact minimum-token segmentation exposure metrics into BPE vocabulary pruning, leveraging the hierarchical merge structure for dependency-aware selection. Unlike prior methods relying solely on frequency or merge path heuristics, DH-BPE systematically quantifies token utility through DP, enabling more precise, effective vocabulary reduction that balances long-tail and reusable subword components.

Limitations

  • The approach depends on a large overshoot candidate pool, which increases training and pruning computational costs, especially for very large corpora or high overshoot factors.
  • Protection of two-space tokens, while robust, may sometimes hinder pruning efficiency in certain languages or tokenization schemes with complex whitespace patterns.
  • Current DP computations are resource-intensive; optimizing scalability for extremely large datasets remains an open challenge.

Future Work

Future directions include integrating neural-based utility estimation to further refine token selection, reducing computational overhead. Extending the framework to multilingual settings and multi-task learning scenarios could improve cross-lingual generalization. Additionally, exploring adaptive hyperparameter tuning for overshoot factors and pruning thresholds may enhance robustness and efficiency in diverse deployment environments.

AI Executive Summary

In recent years, subword tokenization methods like Byte Pair Encoding (BPE) have revolutionized large language models by enabling compact vocabularies that balance expressiveness and efficiency. However, the greedy merge strategy of standard BPE often results in suboptimal vocabulary allocation, with many tokens being underutilized or redundant. This inefficiency hampers model compression and generalization, especially under fixed vocabulary budgets. To address this, the paper introduces Dynamic-Programming-Guided Hierarchical BPE (DH-BPE), a novel framework that leverages exact minimum-token segmentation to evaluate token utility during vocabulary construction.

DH-BPE begins by training an oversized BPE vocabulary beyond the target size, then employs dynamic programming to compute the exposure of each candidate token based on how frequently it appears in minimal segmentation of the training corpus. This exposure metric reflects the token’s practical importance for compression. Simultaneously, the hierarchical dependency structure of BPE merges is utilized to guide a dependency-aware pruning process, ensuring that crucial tokens and their dependencies are preserved. Special care is taken to protect tokens associated with repeated whitespace, maintaining robustness.

Experimental results demonstrate that DH-BPE consistently outperforms standard BPE, Pruned BPE, and MinGram in compression efficiency across multiple datasets and vocabulary sizes. Notably, it maintains superior performance in cross-corpus evaluations at moderate overshoot factors, indicating better generalization. Qualitative analysis reveals that DH-BPE strikes a balance between complete BPE merges and reusable subword components, optimizing vocabulary allocation within fixed budgets.

This work offers a significant step forward in vocabulary optimization for large language models, providing a theoretically grounded, practically effective method that enhances compression, reduces redundancy, and improves cross-domain robustness. Future research will focus on scalability, multi-lingual extension, and adaptive hyperparameter tuning, aiming to further refine and expand this promising framework.

Deep Analysis

Background

子词编码技术如BPE在近年来成为大规模预训练模型的核心组成部分,极大推动了模型在多任务、多语种环境中的表现。早期工作如Sennrich等提出的BPE通过贪婪合并字符对,构建紧凑词表,显著改善了词汇管理和模型效率。随后,Pruned BPE和MinGram等方法引入后训练剪枝和路径优化,试图解决词表中低效或冗余Token的问题。然而,这些方法多依赖频次或路径排序,未充分利用Token的实际使用情况与层级依赖关系,导致词表优化空间有限。近年来,结构感知和压缩导向的词表优化成为研究热点,PathPiece和BPE-knockout等尝试结合层级关系进行剪枝,但缺乏结合最小Token分割指标的系统性方案。本文在此基础上,提出融合DP测量的Token暴露度与BPE层级结构的DH-BPE,为词表优化提供了新思路。

Core Problem

现有BPE在固定词表资源有限的情况下,难以兼顾长尾词的表达能力与常用子词的复用效率。贪婪合并策略忽视Token的实际贡献,导致词表中存在大量低效Token,影响模型压缩和泛化能力。传统剪枝方法多依赖频次或路径信息,未能量化Token在实际压缩中的重要性。如何在有限词表预算内,科学地筛选出既能表达长尾词,又能复用子词的Token,成为核心难题。这不仅关系到模型的存储和计算成本,也影响模型在不同任务和语料上的表现。

Innovation

本研究的创新在于引入基于动态规划的精确最小Token分割指标,作为Token实用性评估的核心标准。具体而言,利用DP计算每个Token在训练语料中的出现频率,作为其在最小Token分割中的暴露度,反映其实际压缩贡献。结合BPE的合并顺序,采用阈值筛选策略,确保关键Token及其依赖关系得以保留。此方法区别于传统频次或路径排序,提供了基于实际压缩效果的量化指标,使词表选择更科学、更高效。该框架在保持BPE训练流程不变的基础上,显著提升了词表的压缩率和泛化能力,为大规模模型的词汇优化提供了新思路。

Methodology

  • �� 预训练阶段:在标准BPE基础上,训练超出目标词表的候选集,包括保留Token和额外候选。
  • �� DP测量:对训练语料进行精确最小Token分割,统计每个Token在分割中的出现频率,作为其实用性指标。
  • �� 层级依赖:利用BPE的合并顺序,定义Token的层级依赖关系,确保重要Token及其依赖关系被优先保留。
  • �� 依赖感知剪枝:设定DP暴露度阈值,根据阈值筛选Token,保护两空格Token等特殊Token。
  • �� 最终词表:在满足目标大小的前提下,结合DP指标和层级关系,选择最优Token集合。
  • �� 编码阶段:仅使用最终词表进行编码,无需内部Token或递归展开,确保效率。

Experiments

采用WikiText、OpenWebText等多语料库,比较标准BPE、Pruned BPE、MinGram和DH-BPE在压缩率、泛化能力上的表现。目标词表设为12K、16K、18K,超出因子为2.0、3.0、4.0、5.0。通过DP测量Token在最小Token分割中的暴露度,评估不同方法的压缩效果。指标包括压缩率、BLEU、Perplexity等。还进行消融实验,验证超出因子、剪枝比和特殊Token保护策略的影响。

Results

在12K和16K词表下,DH-BPE压缩率分别提升5-8%,优于标准BPE和Pruned BPE。在跨语料测试中,f=2.0和f=3.0时,超越MinGram-PP,表现出更强的泛化能力。超出因子为4.0和5.0时,MinGram-PP凭借更大候选池反超,验证候选池大小的重要性。定性分析显示,DH-BPE在长尾词和可复用子词的平衡上表现优异,有助于有限词表预算内实现更合理的词汇分配。

Applications

该方法适用于大规模预训练模型的词表优化,尤其在资源有限环境中,通过科学分配词汇资源,提升模型压缩率和泛化能力。可应用于多语种、多任务场景,优化模型部署效率,降低计算成本,提升实际应用效果。

Limitations & Outlook

算法在大规模候选池和极端语料下计算成本较高,DP计算效率有待提升。保护两空格Token策略在特殊字符场景中可能影响剪枝效果。未来需结合深度学习辅助机制,优化效率和适应性。

Plain Language Accessible to non-experts

想象你在整理一个厨房的储藏柜。每次你都想把最常用的调料放在容易拿到的地方,但又不想占用太多空间。于是,你先把所有可能用到的调料都放进去,然后根据每个调料的使用频率和重要性,逐步筛选出最常用的那些。你还会考虑调料之间的关系,比如某些调料总是一起用,不能拆散。这样,你就能在有限的空间里,放下最实用的调料组合,让厨房既整洁又方便使用。这和论文里的方法类似,都是在有限的“词汇空间”里,科学地选择最重要的“调料”,让模型的“厨房”更高效。

ELI14 Explained like you're 14

想象你在玩一个超级复杂的拼图游戏,你有很多拼图块(就像词汇一样),但空间有限,不能放太多块。你得决定哪些拼图块最重要,先放进去。传统的方法就像随便放,可能会浪费空间在一些不常用的块上。这个论文提出了一种聪明的办法:用一种叫“动态规划”的数学工具,帮你计算每个拼图块在拼图中的重要性。然后,根据这些重要性,结合拼图块之间的依赖关系,优先放入最关键的块。这样,你就能在有限空间里,拼出最完整、最漂亮的图案。这个方法让拼图变得更聪明,也让你更快完成拼图,效果比以前好多了!

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.

cs.CL cs.LG