Byte Pair Encoding is Suboptimal for Language Model Pretraining

Kaj Bostrom, Greg Durrett

Abstract

While Byte Pair Encoding (BPE) is the standard tokenization method for models like GPT and RoBERTa, research by Bostrom and Durrett (2020) suggests it may be suboptimal. By comparing BPE with the Unigram Language Model (LM) tokenization method, the authors demonstrate that Unigram LM aligns more closely with linguistic morphology and utilizes vocabulary more efficiently, leading to superior performance across downstream tasks in both English and Japanese.

Introduction

Subword tokenization is a critical component of modern natural language processing, allowing models to handle open vocabularies by breaking text into smaller, manageable units. Byte Pair Encoding (BPE) has become the dominant method due to its simplicity and effectiveness in data compression. However, BPE's "greedy" merge strategy was not originally designed for linguistic modeling. This paper investigates whether this greedy approach hinders a model's ability to learn meaningful representations compared to the probabilistic, top-down approach of Unigram LM.

Methodology

The researchers conducted a controlled comparison by pretraining identical RoBERTa-base models from scratch, varying only the tokenization method.

  • BPE (Bottom-Up): A greedy algorithm that starts with characters and merges the most frequent adjacent pairs until a target vocabulary size is reached.
  • Unigram LM (Top-Down): A probabilistic method that starts with a large set of substrings and iteratively prunes those that contribute least to the corpus likelihood, using Viterbi inference for segmentation.

The models were trained on English and Japanese Wikipedia and evaluated on standard benchmarks including SQuAD 1.1, MNLI, and TyDi QA.

Key Insights: Vocabulary Efficiency and Morphology

A central finding is that Unigram LM provides a better inductive bias by aligning more closely with actual linguistic morphology. While BPE often creates "junk" tokens—intermediate merges that are rarely used but occupy vocabulary space—Unigram LM identifies meaningful sub-components like prefixes and suffixes more accurately.

Token length and frequency distributions for English. Unigram LM shows a more balanced distribution, avoiding the "bulge" of intermediate-length tokens seen in BPE.

In English, Unigram LM achieved a morphological F1 score of 30.3%, significantly higher than BPE's 19.3%. This alignment allows the model to learn compositional meanings (e.g., understanding that "-ly" denotes an adverb) rather than memorizing arbitrary character sequences.

Results

Unigram LM consistently outperformed BPE across diverse tasks:

  • Japanese QA (TyDi QA): The most significant gain was observed here, with Unigram LM reaching 53.7 EM compared to BPE's 41.4 EM—a 12.3-point improvement.
  • English SQuAD: F1 scores improved from 88.2 to 89.3.
  • English MNLI: Accuracy increased by approximately 1.4%.

These results suggest that the "starting hint" provided by better tokenization significantly impacts the final model's reasoning capabilities.

Conclusion

The study concludes that BPE's greedy construction is indeed suboptimal for language model pretraining. Unigram LM offers a more linguistically sound and computationally efficient alternative. The authors recommend that future large-scale language models adopt Unigram LM to maximize performance and morphological awareness.

Summary updated

BibTeX
@inproceedings{bostrom2020byte,
  author = {Kaj Bostrom and Greg Durrett},
  title = {{Byte Pair Encoding is Suboptimal for Language Model Pretraining}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  url = {https://openreview.net/forum?id=9bDedjKvIvs},
}
Figure