A corpus has the words low (), lower (), newest () and widest (), each split into characters. BPE merges the most frequent adjacent pair. WordPiece merges the pair with the highest score . Which pair does each choose first, and why do they differ?
Sequence models and transformers, Tokenisation
Level L3 Intermediate. Length Long. Nature Mat Mathematical.
What's being asked
Whether you can count symbol and pair frequencies and see that WordPiece scores a pair by how much more often it occurs than chance.
Key idea
BPE picks . WordPiece picks , a pointwise-mutual-information-like score that favours pairs whose parts rarely occur apart.
Steps
- Symbol counts (weighted by word frequency): , , , , , , , , , .
- Pair counts: , , , , , , , , , , .
- BPE: the largest count is , a tie between and . It merges one of them.
- WordPiece scores: , , , , .
- WordPiece merges first, with the highest score . Both symbols occur only together, so this pair is the most "tied" even though it is not frequent.
- So BPE favours raw frequency (it will build common pieces like "es" or "st"), while WordPiece favours pairs that are informative and does not let very frequent letters like and dominate.
Common mistakes
- Using only for WordPiece, which makes it identical to BPE.
- Counting symbols without multiplying by the word frequency.
- Forgetting that a word split must be re-counted after each merge.
How long your answer should be
Half a page; 5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Sequence models and transformers: Assume GPT-2 small has layers, , feed-forward width , vocabulary and context length with learned positional embeddings, and output weights tied to the token embedding, where each projection has a bias and each layer has two layer norms. How many parameters does it have?
Next in Sequence models and transformers: LoRA computes , where is initialised to zero and is random. How do you show that at initialisation the model equals the pre-trained one, what are the gradients and at the start, and what is the factor for?