Saved in:
Bibliographic Details
Main Authors: Kozma, László, Voderholzer, Johannes
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2411.08671
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866929589671952384
author Kozma, László
Voderholzer, Johannes
author_facet Kozma, László
Voderholzer, Johannes
contents 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 $0.333$ and $0.625$. 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.
format Preprint
id arxiv_https___arxiv_org_abs_2411_08671
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Theoretical Analysis of Byte-Pair Encoding
Kozma, László
Voderholzer, Johannes
Data Structures and Algorithms
Computation and Language
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 $0.333$ and $0.625$. 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.
title Theoretical Analysis of Byte-Pair Encoding
topic Data Structures and Algorithms
Computation and Language
url https://arxiv.org/abs/2411.08671