AI Terms Dictionary

A comprehensive multilingual AI terminology dictionary

Definition

Byte Pair Encoding (BPE) is a data compression technique adapted for natural language processing to handle out-of-vocabulary words. It starts with a vocabulary of individual characters and iteratively merges the most frequent adjacent pairs of symbols. This process creates a hierarchy of subword units, allowing models to balance between character-level flexibility and word-level efficiency. It is widely used in transformer-based models like GPT-2 and BERT to manage vocabulary size while preserving semantic meaning across diverse languages.

Summary

Byte Pair Encoding is an algorithm used for subword tokenization that iteratively merges the most frequent character pairs to build a vocabulary.

Key Concepts

Use Cases

Code Example

1
2
3
4
import tiktoken
enc = tiktoken.get_encoding("cl100k_base")
tokens = enc.encode("unhappiness")
print(tokens)