Zenaique

Define tied embeddings and explain why Llama-3 chose to untie them

Flashcard·Medium·4.0 · 0·~30s·Asked atAccentureBasetenLambda Labs·Relevant atAnthropicMistral AI
Attempt it
TL;DR

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).

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

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.

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.

What tying saves and what it gives up
Why the two operations want different representations
What 2026 frontier models do
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
AspectTied embeddingsUntied embeddings
Param count at vocab=128k, d=4096Shared (saves ~525M)Two matrices (costs ~525M extra)
Input embedding roleLookup AND scoring (compromise)Pure lookup
Output head roleScoring AND lookup (compromise)Pure similarity scorer
Quality at >7B scaleSlight regressionSlight lift (~0.5-1 benchmark point)
Quality at <3B scaleRoughly equal or better (param efficiency)Slightly worse per-param
2026 frontier conventionUsed 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.
Sign in to see more production examples.

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?
A

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.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

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.

Sign in to see all red flags and common mistakes.

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

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Explain scaled dot product attention.
Short answer·Medium