What fraction of a 7B transformer lives in its embedding table at vocab 128k?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
128k vocab times d_model 4096 is ~524M parameters in the input embedding alone, about 7.5% of a 7B model. Untying the output head doubles the cost to ~15%.
Imagine a giant phone book where every word the model knows has its own page, and each page is filled with a long list of numbers that describe what the word means. The phone book is huge: 128,000 pages times 4,096 numbers per page comes out to about 524 million numbers. On a 7 billion number model, that phone book alone is 7.5% of the whole thing. Not a rounding error, but not a black hole either: most of the model is still the stack of thinking layers above it. If you also keep a second phone book at the back of the model for turning answers into word scores, the pair takes about 15% of the total. Sharing one phone book for both ends (called tying) saves that 7.5% at a tiny cost in quality.
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.
5 min: do the multiplication, contrast tied vs untied embeddings, explain why Llama 3 moved to 128k vocab, and discuss how the fraction scales with model size.
| Model | Vocab | d_model | Embedding params | % of total |
|---|---|---|---|---|
| Mistral 7B (tied) | 32k | 4096 | 131M | 1.9% |
| Llama 2 7B (tied) | 32k | 4096 | 131M | 1.9% |
| Llama 3.1 8B (untied) | 128k | 4096 | 1.05B | 13% |
| Llama 3.1 70B (untied) | 128k | 8192 | 2.1B | 3% |
| Gemma 4 (untied) | 256k | 2048 | 1.05B | varies |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating embeddings as negligible because they are a lookup. They're not: at 128k vocab they're 7-8% of a 7B model, and at 256k plus vocab the cost climbs further.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.