Tokenization
Splitting text into model units: BPE, WordPiece, SentencePiece, and more.
BPE-dropoutBPE-dropout randomly skips merge rules when splitting words with BPE, showing the same word segmented in various ways during training only. It works with the existing BPE vocabulary and improves both machine translation accuracy and robustness to misspellings.
Byte Pair Encoding (BPE)BPE (Byte Pair Encoding) is a tokenization method that builds a vocabulary by repeatedly merging frequently adjacent character pairs into single symbols and splits words into subwords, so that even words absent from the training data can be represented as combinations of known parts.
Byte-Level Tokenization (Token-Free)Byte-level tokenization treats text as a sequence of UTF-8 bytes (256 possible values). It includes byte-level BPE, which learns BPE on bytes (as in GPT-2), and token-free models that take bytes directly as input (ByT5); text in any language or with any symbols can be represented without unknown tokens.
SentencePieceSentencePiece is a tokenizer that trains BPE or a Unigram language model directly on text without splitting it into words, treating whitespace as a symbol (▁). It needs no language-specific preprocessing and can restore the original text exactly from the segmented result.
Unigram Language ModelThe Unigram language model is a tokenization method that computes the probability of text by assuming each subword occurs independently, and builds its vocabulary by pruning symbols with little effect on the likelihood from a large initial vocabulary. It can choose the most probable segmentation, and by varying segmentations stochastically during training (subword regularization) it improves translation accuracy and robustness.
WordPieceWordPiece is a tokenization method that builds a vocabulary by merging, one at a time, the symbol pair that most increases the likelihood of a language model on the training data, and splits text into subwords by longest match against that vocabulary. It is used by BERT and can represent unknown words as combinations of known parts.
