Definition
Byte Pair Encoding
Byte pair encoding is an algorithm for encoding strings or text into smaller strings by creating and using a translation table.
Algorithm
Counting Pairs: For a given text corpus, count all adjacent pairs of symbol in every word. If we denote a word as a sequence of symbols
then each pair
Merging: Identify the most frequent pair, say
Replace every occurrence of
Repeat: Repeat the counting and merging steps until a predefined vocabulary size is reached or no pair occurs more than once.