esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

What Is Weight Tying?

What weight tying is, why a language model can reuse one table for reading and writing words, and its trade-off, explained simply for your AI interview.

In short

Weight tying means a language model uses one table of numbers both to read its input words and to score its output words. The model then learns one big table instead of two, so it has fewer numbers to store and train.

10 min readAdvancedOccasional · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Weight tying means a language model uses one table of numbers twice. It reads each input word from the table, and at the end it scores every word against the same table. That removes a whole table of numbers to learn. Press and Wolf recommended it for language models in 2016. The trade-off is that one table has to serve both jobs, so I would test it on my own data before I trust it.

What is weight tying, in plain words?

A language model works with numbers. Every word piece it knows, called its vocabulary, has one row in a big table. Each row is a list of numbers, called a vector, that stands for that piece.

Two steps touch that table. Going in, the model looks up the row for each piece it reads. Coming out, it has to choose the next piece, so it scores every row against what it has worked out so far. Weight tying means one table does both jobs.

Think of a bilingual clerk at an insurance claims desk who keeps one glossary. They look up an English term to find its French, and a French term to find its English. One glossary serves both directions, so there is only one list to keep up to date. A real model works the same way: the same rows of numbers are used to read words in and to score words out.

Key words

Vocabulary
The list of word pieces a model knows. GPT-2's default is 50,257.
Embedding table
The table with one row of numbers per word piece. Reading a word means looking up its row.
Output layer
The last step, which scores every word piece to pick the next one.
Parameter
One learned number inside the model. More parameters mean more to store and train.

How does one table do both jobs?

Follow one word piece through a model that ties its weights. The arrows show the order of the steps.

One table, used at both ends

Token ID 4071

one word piece, as a number

Shared table

one row of numbers per word piece

Model layers

mix the vector with the context

Score every row

same table, read the other way

Next word piece

the chosen piece comes next

  1. 1The word piece's ID finds its row in the shared table.
  2. 2The row's numbers go into the model's layers.
  3. 3The model's final vector goes to the scoring step.
  4. 4The chosen word piece is the next one the model writes.
A word piece comes in as an ID, and its row is read from the shared table. After the model's layers, the last step scores every row of that same table, and the best choice becomes the next piece. Only one table is stored and learned.
  1. 1

    Going in

    Look up the row for the word piece. Its numbers become the vector the model works with.

  2. 2

    Going out

    Compare the model's final vector with every row of the same table. A higher score means a closer match. The model turns the scores into probabilities and usually picks a likely one.

Worked example. Take a made-up support-bot model with 50,000 word pieces and 768 numbers per row. One table holds 50,000 times 768, which is 38,400,000 numbers. An untied model keeps two of these tables, so tying saves about 38.4 million numbers. The code below uses that same arithmetic, then runs both steps on a small table with three word pieces.

Python
# Weight tying: one shared table, read going in and used again going out.
VOCAB = 50000   # made-up support-bot vocabulary: 50,000 word pieces
WIDTH = 768     # numbers per row

def table_numbers(tied):
    tables = 1 if tied else 2   # untied: an input table and an output table
    return tables * VOCAB * WIDTH

print("untied:", table_numbers(False))
print("tied:", table_numbers(True))
print("saved:", table_numbers(False) - table_numbers(True))

# A made-up mini table: 3 word pieces, 2 numbers each, to show the two steps.
shared = [[0.9, 0.1], [0.2, 0.8], [-0.5, 0.4]]

def embed(word_id):          # going in: read the row
    return shared[word_id]

def score_all(vector):       # going out: dot product with every row
    return [round(sum(a * b for a, b in zip(row, vector)), 2) for row in shared]

vec = embed(1)
print("vector for word 1:", vec)
print("scores:", score_all(vec))

Output

untied: 76800000
tied: 38400000
saved: 38400000
vector for word 1: [0.2, 0.8]
scores: [0.26, 0.68, 0.22]

The output shows the same rows doing both jobs. The row for word 1 goes in, and the scores come out of those same rows.

What does it save, and what does it cost?

  • Saves

    Fewer numbers

    One table to store and train instead of two. Press and Wolf found that tying can shrink a translation model to less than half its size without harming its performance.

  • Costs

    One table, two jobs

    The shared table has to serve both jobs. Press and Wolf found it learns more like the output side than the input side. Test it on your own data.

Two tables or one

Without tying

Input table

rows learned for reading words

Output table

rows learned for scoring words

With tying

One shared table

rows learned once, used both ways

Two sets to learn

twice the numbers to store and train

One set to learn

one table's worth saved

  1. 1The input table is learned on its own.
  2. 2The output table is learned on its own too.
  3. 3The one shared table is learned once and serves both jobs.
Without tying, the model keeps and trains two tables. With tying, one table is learned once and used at both ends, so the saving is roughly one whole table. The trade-off is that this one table has to serve both jobs.

The idea goes back to 2016. Press and Wolf showed it for language models, and the 2017 Transformer paper used it too.

  • “When training language models, we recommend tying the input embedding and this output embedding.”

    Press and Wolf, 2016

  • “In our model, we share the same weight matrix between the two embedding layers and the pre-softmax linear transformation”

    Vaswani and others, 2017

How would you decide whether to tie in a new model?

  1. 1

    Count the saving

    Multiply vocabulary size by row width. That is the size of one table, and tying saves about one of them. Tying also needs each row to be as wide as the model's final vector, so the two ends fit.

  2. 2

    Read the setting

    Check the model's config for a tie setting. Hugging Face's GPT-2 docs list one that defaults to True, and say it ties weight embeddings according to a mapping in the model.

  3. 3

    Test on your data

    Train a tied and an untied model on the same data, then compare quality and memory. Decide on the numbers, not on the theory.

Tip

Asked whether tying is always better? Say no. It saves space, but Press and Wolf found the shared table learns more like the output side. Say you would measure it before you ship.

What does the interviewer want to hear?

A strong answer covers

  • One table, read going in and scored again going out.
  • Why it saves: the table is stored and trained once, not twice.
  • The origin: Press and Wolf in 2016, and the Transformer in 2017.
  • The trade-off: one table has to serve both jobs.
  • How to check a model: the tie setting in its config.
  • A design choice to test, not a guaranteed win.

Common traps

  • Trap"Weight tying always makes the model smarter."

    BetterTying mainly saves numbers. Press and Wolf found no harm to performance in their translation models, but results depend on the model and data, so test it.

  • Trap"It copies the input table into the output layer, then trains both."

    BetterThat keeps two tables to learn, so nothing is saved. Tying means one table, used both ways.

  • Trap"The two layers are the same layer."

    BetterThey are two different steps that read the same table. The steps differ, and the numbers are shared.

Can you spot weight tying?

Spot weight tying

A claims team writes this in its design notes. Which line describes weight tying?

Quick check

The made-up support-bot model has 50,000 word pieces and 768 numbers per row. Roughly how many numbers does tying save?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q064Roughly how many parameters are in one transformer layer?9 min
  2. Q068How does the final hidden state become the next token?9 min
  3. Q073Walk through one decoder block's forward pass.12 min
  4. Q062How does BERT differ from GPT?11 min

Last updated on 27 November 2026

Fine-tuning or designing a model for your own team?

I design and build AI products and agents, the screens and the system behind them. Book a short call and tell me what you need.