Where a model's facts actually live.

SRC·35 Source
Attention gets the credit. This layer keeps the memories.

Attention gets the credit. This layer keeps the memories.

Every transformer block has two halves. Attention decides what to look at — and takes all the credit. The other half, the feed-forward layer, sits right after it and quietly holds most of what the model actually knows. When it recalls that a lemon is sour or a river runs through a city, that fact most likely lives here — not in the looking, but in the remembering.
The famous half is the smaller one.

The famous half is the smaller one.

attn: 4d2vsFFN: 2ddff=8d2    (dff=4d)    8d212d2=23\text{attn: } 4d^2 \quad\text{vs}\quad \text{FFN: } 2\,d\,d_{ff} = 8d^2 \;\;(d_{ff}=4d)\;\Rightarrow\; \frac{8d^2}{12d^2}=\frac{2}{3}
Like an iceberg: attention is the bright tip above the water, but the feed-forward layer is the mass below. Count the big weight matrices in one block and roughly two-thirds of them sit in this single layer. The part everyone studies is the smaller part. And unlike attention, it works on each word alone — no mixing, no neighbors, just one token passing through.
First it tests each word against thousands of patterns.

First it tests each word against thousands of patterns.

h=max(0,  xW1+b1)Rdff,dff=4dh = \max(0,\; xW_1 + b_1)\in\mathbb{R}^{d_{ff}}, \qquad d_{ff} = 4d
Like a tray of compass needles: sweep a magnet over them and only the ones aligned to it swing. The feed-forward layer does this with each word — it widens it into a space about four times larger, where thousands of learned patterns wait. Each pattern measures how well the word matches it; a simple threshold keeps the strong hits lit and zeros the rest.
Every pattern is wired to a stored answer.

Every pattern is wired to a stored answer.

FFN(x)=i=1dfff ⁣(kix)vi\text{FFN}(x) = \sum_{i=1}^{d_{ff}} f\!\left(k_i^{\top} x\right)\, v_i
Here's the secret: each lit unit is a key bound to a value. The key is the pattern it hunts for; the value is the slice of meaning it writes back. Like a set of inked stamps: whichever ones get pressed leave their mark, and the page ends up carrying all of them at once. A word's output is simply every fired value, added together.
So this is the model's memory — and it can be edited.

So this is the model's memory — and it can be edited.

x    x+FFN(x)x \;\leftarrow\; x + \text{FFN}(x)
If a fact is a key wired to a value, then it has an address. And the layer never overwrites the word — it adds its recalled values onto the running stream. Like punching a piano roll: each hole triggers one stored note, so re-punching a single hole changes that one alone — the rest of the song plays on. Find the right values and a single fact can often be located and changed, leaving the rest untouched.
Modern models add a smarter gate.

Modern models add a smarter gate.

Swish(z)=zσ(z),σ(z)=11+ezSwiGLU(x)=(Swish(xW1)xW3)W2\begin{aligned} \text{Swish}(z) &= z\,\sigma(z), \quad \sigma(z)=\tfrac{1}{1+e^{-z}} \\ \text{SwiGLU}(x) &= \big(\text{Swish}(xW_1)\otimes xW_3\big)\,W_2 \end{aligned}
Newer layers split the job in two. One branch proposes the content; a second branch becomes a gate that decides, channel by channel, how much of it gets through — then the two are multiplied. Like a stencil over spray paint: the paint is the content, the stencil decides where it lands. This gating, called SwiGLU, adds a third matrix, so models trim the hidden width to two-thirds and pay nothing extra.
Two moves, every block: gather, then remember.

Two moves, every block: gather, then remember.

xx+Attn(x)(gather)xx+FFN(x)(recall)\begin{aligned} x &\leftarrow x + \text{Attn}(x) && \text{(gather)} \\ x &\leftarrow x + \text{FFN}(x) && \text{(recall)} \end{aligned}
Now the whole block clicks together. Attention gathers context — it asks what here is relevant? Then the feed-forward layer answers from memory — here's what I know about it. Like a baton handoff: one runner carries the context in, the next carries the knowledge home. Stack that pair dozens of times — with the stabilizing norms tucked in between — and you have the engine: look, recall, look, recall.
🌱 Is remembering a fact different from looking it up?

🌱 Is remembering a fact different from looking it up?

We found where knowledge sits: keys wired to values, patterns wired to answers — a library that replies the instant the right question brushes past. But a library doesn't understand the books it holds. If everything the model knows is a value waiting for its key, is recalling a fact a kind of thought — or only a very fast lookup? And somewhere in all that wiring, where does knowing become understanding?
tap →swipe ↑ for depthswipe ↓ to exit