AI Glossary Term

What does “BPE (Byte Pair Encoding)” mean?

Definition

A subword tokenization algorithm that merges the most frequent character pairs into reusable tokens.

How BPE (Byte Pair Encoding) works

Diagram for BPE (Byte Pair Encoding), steps in order: Start with characters: l o w e r; then Merge the most frequent pair: l+o; then Repeat merges: lo, low, ...; then Vocabulary of common pieces.Start with characters: l o w e rMerge the most frequent pair: l+oRepeat merges: lo, low, ...Vocabulary of common pieces

Example

In a training corpus where 'low' and 'lower' are common, the pair 'l','o' merges first, then 'lo','w', and so on. Common words become single tokens, and rare words are broken into familiar pieces.

Why it matters

BPE balances vocabulary size against sequence length and avoids unknown words. Most large language models use a variant of it.

Common questions

Why subwords?

They handle rare and new words by splitting them into known parts.

Does BPE work on bytes?

Byte-level BPE starts from bytes, so any text can be represented.

Where did it come from?

It began as a data-compression method and was adapted for translation models in 2015.

Learn more in our free guides

Test yourself

See also