Which part of a transformer model's parameter count scales directly and linearly with vocabulary size?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Only the input embedding [vocab_size × d_model] and the output lm_head [d_model × vocab_size] scale with vocabulary size; attention and feed-forward weights depend on d_model alone.
Think of a transformer as a translation office. At the front door sits a filing cabinet with one drawer per word the office knows, and looking up a word means pulling its drawer. That front cabinet is how the office turns a word into notes it can work with. At the back door sits a second cabinet, also one slot per known word, used to decide which word to write next. Add more words to the office's knowledge and both cabinets grow, one drawer at a time. But the clerks in the middle, who shuffle and combine the files, do the same job no matter how many words exist. They never get bigger when the vocabulary does.
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.
2 min: embedding [V×d] + head [d×V] + 2·V·d formula + backbone is vocab-agnostic + weight tying + output softmax cost at large vocab.
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.
Attributing vocabulary scaling to attention heads or feed-forward layers. Those depend only on d_model and the layer count; vocabulary size never appears in them.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.