Part II — Inside the Transformer Chapter 06

The Memory Vault (Feed-Forward Layers)

Where facts, associations, and world knowledge live inside the network.

8 min read · 3 interactive labs · Zero math required

We have spent two chapters celebrating Attention — the glowing web of spotlights that lets words talk to one another. Yet if you pause for a second, you will spot a glaring mystery.

Suppose I type: Michael Jordan plays …

Attention can easily connect Michael to Jordan so the model realizes we are talking about the famous athlete rather than a random person named Michael. But the word “basketball” is nowhere in the sentence! No spotlight shining on any word in the prompt can fetch a fact that isn’t there.

So where does basketball — or Paris, or 0°C — actually come from?

The Big Idea

Every Transformer layer has a two-beat rhythm. First, Attention lets words talk to each other across the sentence. Second, the Feed-Forward Layer (the Memory Vault) lets each word think privately and pull stored facts out of long-term memory.

1. The Two-Step Rhythm: Talk, Then Remember

Think of a group of detectives solving a case. In Step 1 (Attention), the detectives lean across the table and share clues: “Hey, ‘Eiffel’ and ‘Tower’ belong together!” In Step 2 (Memory Vault), every detective goes into a private booth — no talking to neighbors — opens their mental filing cabinet, and retrieves the matching fact: “Ah! Eiffel Tower → located in Paris.”

Switch between the three fact prompts below and step through the rhythm (or let it auto-play) to watch information flow horizontally during Attention, then vertically into the private Memory Vault.

Interactive Lab 1 Attention vs. Memory Vault — The Two-Step Rhythm
STEP 1: ATTENTION
Step 1 (Attention): Glowing cyan beams combine Eiffel + Tower horizontally so the token knows it is the famous landmark, not just any tower.

Surprisingly, about two-thirds of all the learned parameters in a modern LLM live inside these Feed-Forward Memory Vaults — not in Attention! Attention routes the clues; the Memory Vault holds the encyclopedia.

2. Inside the Vault: Pattern-Detector Lockboxes

How does a Memory Vault actually store millions of facts? Researchers discovered a remarkably intuitive picture: inside every feed-forward layer sit thousands of tiny neurons that behave like glowing combination lockboxes.

Click a clue combo below — or type your own keywords (try french landmark, yellow curved fruit, red planet, or basketball) — and watch the matching pattern-detector lockboxes ignite!

Interactive Lab 2 Key-Value Neurons — Pattern-Detector Lockboxes
Clues “French + landmark” unlock the Paris / Eiffel pattern detectors. Notice how the other lockboxes stay dark — only the matching neurons pour their memory into the output!
One Lockbox, One Fact? Not Quite!

Early on, scientists hoped every single neuron would neatly store one clean concept (one neuron for Paris, one for bananas, one for Mars). When they looked closer, they found something even cleverer — and far stranger.

3. Superposition: Packing More Ideas Than Rooms

Here is a puzzle that blew researchers’ minds. A modern language model knows millions of distinct concepts — cities, actors, programming languages, recipes, historical dates. Yet a single layer only has a few thousand independent directions (axes) to represent them in.

How can you store far more ideas than you have rooms?

The secret is that most concepts are sparse — they almost never appear at the exact same word at the exact same time. A word is almost never simultaneously “the Eiffel Tower,” “a yellow banana,” and “the planet Mars.” Because only one or two concepts fire at once, the network can pack many idea directions neatly around a shared space like spokes on a wheel — a phenomenon called Superposition.

Drag the slider below to pack anywhere from 2 to 8 concepts into a tiny 2-axis room. Notice how cleanly they fan out into symmetric spokes — and toggle Active at Once to see why superposition works brilliantly when concepts fire one at a time, but gets crowded if too many fire simultaneously.

Interactive Lab 3 Superposition — Packing More Ideas Than Rooms
Packed Concepts: 5
Space size: just 2 axes (X & Y)
Even inside a tiny 2-axis room, 5 concepts arrange themselves like a crisp 5-pointed star. When only 1 concept fires at a time, the network reads it with near-perfect clarity!

Now zoom out and appreciate what we have built inside a single Transformer layer: first, Multi-Head Attention lets words exchange clues across the sentence; then, the Memory Vault lets each word privately consult millions of packed facts and associations.

One layer is already clever. What happens when we stack 96 of these layers on top of each other like a skyscraper? That is the journey waiting in Chapter 7.

Check Your Intuition

You prompt an LLM with “Water freezes at” and it predicts “0°C.” Which part of the Transformer layer is mainly responsible for retrieving that stored world fact?