# Byte Pair Encoding (BPE)

- **Canonical URL:** https://getaimath.com/dictionary/byte-pair-encoding-bpe/
- **Topics:** [LLM Fundamentals](https://getaimath.com/dictionary/category/llm-fundamentals/)
- **Last updated:** 2026-11-25

## What is Byte Pair Encoding (BPE)?

**In one sentence:** Byte Pair Encoding is a popular way to build a tokenizer by repeatedly merging the most common pairs of characters into new tokens.

It starts with single characters. Then it finds which two pieces appear next to each other most often, like "t" and "h," and merges them into "th." It keeps doing this thousands of times until it has a vocabulary of useful chunks, from letters to whole words.

![How ChatGPT & Claude Talk: Super-Powered Autocomplete — Simple cartoon diagram showing a sentence chopped into Lego word blocks (tokens), an AI brain weighing the odds of the next word ("mat" 75%, "couch" 18%, "roof" 5%), and snapping "mat" onto the end of the sentence.](https://getaimath.com/diagrams/llm-fundamentals.png)
*Napkin Diagram (LLM Fundamentals): Language models don’t plan whole essays at once—they play a super-smart game of "guess the very next word" over and over.*

## What is an example of Byte Pair Encoding (BPE)?

After many merges, BPE might learn tokens like "ing," "tion" and "the."

## Why does Byte Pair Encoding (BPE) matter?

BPE is used by GPT models and many others, so it shapes how much your text costs in tokens.

## Related Concepts

- [Subword Tokenization](https://getaimath.com/dictionary/subword-tokenization/): Subword tokenization splits words into common smaller pieces, so the model can handle any word using a limited vocabulary.
- [SentencePiece](https://getaimath.com/dictionary/sentencepiece/): SentencePiece is a free tokenizer tool from Google that splits text into subword tokens and works with any language, even ones without spaces.
- [Tokenization](https://getaimath.com/dictionary/tokenization/): Tokenization is the process of splitting text into tokens so a language model can work with it.
- [Embedding](https://getaimath.com/dictionary/embedding/): An embedding is a list of numbers that represents the meaning of something, like a word, sentence or image.
- [Vocabulary](https://getaimath.com/dictionary/vocabulary/): A model's vocabulary is the complete list of tokens it knows, each with its own ID number.
- [Semantic Representation](https://getaimath.com/dictionary/semantic-representation/): A semantic representation is a way of storing the meaning of text or data so a computer can work with it.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/byte-pair-encoding-bpe/)
