AIToday
Large Language ModelsLobsters AIPublished: Nov 14, 2026, 16:00 JST

From 64 to over a million: memory capacity of linear layers, MLPs, self-attention derived

Send on LINE
From 64 to over a million: memory capacity of linear layers, MLPs, self-attention derived

3 Key Points

  1. What happened

    The post shows that with 64-dimensional keys, a linear memory store holds about 64 memories, an MLP about 2,700, and self-attention over a million.

  2. Why it matters

    This explains why attention can recall far more facts than simpler layers, suggesting that architecture choices directly set recall capacity.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

The post builds its argument step by step, starting with the simplest memory store: a linear layer that accumulates key-value pairs via outer products. This store's capacity is limited to about d_k memories because interference from other memories grows as more are added. The author then shows that an optimal linear store, which whitens the keys, doubles capacity to 2d_k.

Next, the post introduces nonlinearities: applying a ReLU or squared ReLU to the similarity scores suppresses low-similarity interference, boosting capacity to roughly d_k^p for a power p. For a squared ReLU, that's about 2,700 memories with 64-dimensional keys, far beyond the linear store's 64. This connects to MLPs in transformers, where feedforward layers act as key-value memories.

Finally, self-attention uses an exponential of the similarity, effectively summing over all powers, which leads to very good recall and a capacity that can exceed a million. The author notes that the original transformer paper briefly described the feedforward layer as a kind of attention, a passage removed from later versions.

FAQ
What is the interference-to-signal ratio?
It measures how much other stored memories interfere when recalling a target memory. The number of memories a store can hold before interference equals the signal is its capacity.
How does self-attention achieve such high capacity?
Self-attention uses an exponential of the similarity score, which is a weighted sum of infinitely many powers. This suppresses low-similarity interference, giving very good recall and potentially unbounded capacity.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleJudge Alsup calls ClaimsHero opt-out push 'a fraud of immense proportions'