Which statement correctly describes the Unigram Language Model tokenizer's training procedure?
Unigram LM starts with a large vocabulary and prunes the tokens whose removal least hurts corpus likelihood, the opposite direction from BPE's additive merges.
Imagine you start with a giant box holding every word and word-fragment you could ever use. Your job is to shrink the box to a fixed size, keeping only the most useful pieces. Instead of guessing, you test each piece: if I throw this one out, how much harder is it to describe my training text? You keep tossing the pieces that you barely miss, and stop when the box is the right size. That is Unigram LM. It prunes a big vocabulary down by usefulness, which is the reverse of the other popular method that starts tiny and glues frequent pieces together.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: subtractive vs additive + EM E-step and M-step + likelihood objective + pruning by smallest drop + probabilistic output enables sampling.
Real products, models, and research that use this idea.
- Google's T5 and mT5 use SentencePiece Unigram LM, where likelihood-based pruning balances vocabulary across many languages.
- The Llama-family SentencePiece tokenizers were built with the Unigram algorithm, giving a probabilistic segmentation model rather than pure BPE merges.
- ALBERT ships a SentencePiece Unigram tokenizer, relying on its sampling to regularize subword segmentation during pretraining.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does the E-step use forward-backward over all segmentations rather than just the Viterbi best path?
QHow does stochastic tokenization from Unigram act as data augmentation, and what robustness does it buy?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Mixing up the directions. Unigram LM prunes a large vocabulary down by likelihood, while BPE merges up from characters by frequency.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.