Glossary

What is Byte-pair encoding?

In Turkish: Bayt çifti kodlaması (BPE) · Topic: Models and training

A tokenization method that builds a subword vocabulary by repeatedly merging the most frequent pairs of characters or pieces in a text collection. It originated as a data compression technique.

How does it work?

The vocabulary starts with single characters or bytes. The algorithm scans a large body of text, finds the pair that appears side by side most often, and adds it to the vocabulary as a new piece. This merging repeats until the vocabulary reaches the desired size. In the end, frequent words are single pieces and rare words are built from smaller ones. Byte-level versions ensure that no character is ever left out as “unknown”.

Why does it matter?

Many large language models use BPE-based tokenizers, so it is the logic behind much of the “token” counting seen in AI products. It solves the unknown-word problem while keeping the vocabulary a manageable size. Debates about some languages being split into more pieces than others also trace back to which text the vocabulary was built from.

Example

If the pieces “car” and “pets” often appear next to each other in the training text, the algorithm may merge them into one piece, “carpets”.

FAQ

Is BPE the same as tokenization?

No. Tokenization is the general process, and BPE is one method of doing it. Other approaches exist.

Does BPE work equally well in every language?

No. Languages that were well represented when the vocabulary was built are split more efficiently. Less represented languages may have words broken into many small pieces.

All terms