Home Tools Glossary Byte-Pair Encoding
Technique

Byte-Pair Encoding

Byte-Pair Encoding Tokenization

/byt pair en-koh-ding/

A subword tokenization algorithm that iteratively merges the most frequent pairs of bytes or characters in a text corpus.

In plain English
Byte-Pair Encoding is like building a vocabulary dictionary by starting with individual letters and repeatedly combining the most common letter pairs into syllables and words until a target vocabulary size is reached.
Real-world example
Tokenizing raw string inputs into subword token IDs prior to embedding matrix lookup in transformer models.
Technical definition
Byte-Pair Encoding (BPE) is a data compression and subword tokenization algorithm widely used in modern language models. It initializes a vocabulary with base characters or bytes and iteratively merges the most frequent adjacent pairs across a training corpus, balancing vocabulary size with compression efficiency for open-vocabulary text processing.