cs.DSNov 13, 2024

Theoretical Analysis of Byte-Pair Encoding

Authors: László Kozma, Johannes Voderholzer

Organizations: Institut für Informatik, Freie Universität Berlin, Germany

Abstract

Byte-Pair Encoding (BPE) is a widely used method for subword tokenization, with origins in grammar-based text compression. It is employed in a variety of language processing tasks such as machine translation or large language model (LLM) pretraining, to create a token dictionary of a prescribed size. Most evaluations of BPE to date are empirical, and the reasons for its good practical performance are not well understood. In this paper we focus on the optimization problem underlying BPE: finding a pair encoding that achieves optimal compression utility. We show that this problem is APX-complete, indicating that it is unlikely to admit a polynomial-time approximation scheme. This answers, in a stronger form, a question recently raised by Zouhar et al. On the positive side, we show that BPE approximates the compression utility of the optimal pair encoding to a worst-case factor between 1/31/3 and (1−e−2)/2≈0.4324(1-e^{-2})/2 \approx 0.4324. Our results aim to explain the ongoing success of BPE and are, to our knowledge, the first rigorous guarantees on its compression utility that hold for all inputs.

Figures & tables

Explore similar work

CardsList
  1. Greedy Byte-Pair Encoding Achieves at Least 0.361 of the Optimal Compression

    Nov 5, 2026Kundan Baliga, Aiden Xie, Aditya ByjuByte-Pair EncodingLossless Data Compression

  2. Pruned BPE: Post-training Visibility Pruning and Token Reallocation for Byte Pair Encoding

    Aug 1, 2026Kenny ShaoToken PruningSubword Tokenization

  3. MDL-Calibrated Significance-Gain Pair Encoding: Replication-Aware Automatic Stopping for Subword Tokenization

    Sep 20, 2026Azam NouriSubword TokenizationByte-Pair Encoding