Define tied embeddings and explain why Llama-3 chose to untie them
Weight tying shares one `(vocab, d_model)` matrix between the input embedding lookup and the output logits projection (`W_out = W_in^T`). Saves vocab*d_model params (~525M at Llama-3 8B sizes).
Imagine a dictionary you use both to look up words by id (input) and to score how well a sentence ends with each word (output). Tying says: one dictionary, use it both ways. Untying says: keep two dictionaries, one optimized for lookup and one optimized for scoring. At small scale, one dictionary is fine. At frontier scale, having two specialists each doing their own job consistently scores a fraction of a point higher on benchmarks. Llama-3 and most >7B production models pay the extra storage to get the lift.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Weight tying is one of those design decisions that looks tiny on paper but has been deliberately flipped between every major generation of frontier LLMs. The interview question is whether you can articulate both the mechanics (what is shared and what it saves) and the empirical reason the convention shifted.
The two embedding matrices in a transformer LM
Every transformer LM has two vocab by width weight matrices that bridge tokens and hidden dimensions.
Input embedding. Shape vocab by model width. Indexed by token id; row i is the embedding vector for token i. The input forward pass is a pure lookup that pulls one row out of this table.
Output unembedding (LM head). Shape model width by vocab. Multiplied by the final hidden state to emit logits. Each column is a width-dimensional 'next-token preference vector' for one vocab item. The dot product of the residual stream with that vector is the logit for that token.
Both matrices have the same vocab by width shape (modulo transpose). They sit at opposite ends of the network. Weight tying says: use the SAME matrix for both, so the output head is just the transpose of the input embedding.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
| Aspect | Tied embeddings | Untied embeddings |
|---|---|---|
| Param count at vocab=128k, d=4096 | Shared (saves ~525M) | Two matrices (costs ~525M extra) |
| Input embedding role | Lookup AND scoring (compromise) | Pure lookup |
| Output head role | Scoring AND lookup (compromise) | Pure similarity scorer |
| Quality at >7B scale | Slight regression | Slight lift (~0.5-1 benchmark point) |
| Quality at <3B scale | Roughly equal or better (param efficiency) | Slightly worse per-param |
| 2026 frontier convention | Used in small LMs (<3B) | Default for 7B+ decoder LLMs |
Real products, models, and research that use this idea.
- Llama-3 8B, 70B, and 405B all untie embeddings. The 8B pays ~525M extra params for the dedicated output head.
- DeepSeek V3 (671B MoE) unties its embedding from its output head, consistent with the frontier convention.
What an interviewer would ask next. Try answering before peeking at the approach.
QIf untying gives the output head freedom to specialize, why not also use a bigger d_model JUST at the output head?
Because the output head's input is the final residual stream, which has dimension d_model. You cannot widen one without widening the whole stack. Some designs add a final projection layer (d_model -> d_out -> vocab) but the extra parameters could equivalently be spent on widening or deepening, which usually pays off more.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Assuming tied embeddings are always the right default. They were for GPT-2 and Llama-1, but every major decoder LLM from Llama-3 onward untied them deliberately.
60 second bullets to scan on the way to the call.
What weight tying actually shares (one vocab by width matrix between input and output)
Parameter cost of untying: exactly the vocab by width product
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.