Associative memoryas a fuzzy perspective on
architecture design

Presented at Perplexity · November 2026

Based on You could have invented transformers from memory and Test-time regression (JMLR)

Why are transformer architectures so arbitrary?

Associative memory is an old idea

A picture of Homer Simpson with its lower half masked out, retrieved as the full stored picture
From Hopfield Networks is All You Need, a blog post by Johannes Brandstetter et al. (2020)

The simplest memory store adds outer products

Recall weights each value by its key's similarity

Recall picks up interference

  • Query with a stored unit-length key $k_j$: $$f(k_j) = \underbrace{v_j}_{\text{signal}} + \underbrace{\sum_{i \neq j} v_i \, (k_i^\top k_j)}_{\text{interference}}$$
  • Orthonormal keys give no interference, but $\mathbb{R}^{d_k}$ only has $d_k$ of them
  • Random keys have $k_i^\top k_j \approx \pm 1/\sqrt{d_k}$, so $$\frac{\|\text{interference}\|}{\|\text{signal}\|} \sim \sqrt{\frac{M}{d_k}}$$
  • Heuristic: interference overwhelms the signal and recall fails when $M \sim d_k$
$M = $ 16 memories, $d_k = 64$

How can we do better?

  1. Make the memory larger by increasing $d_k$ (the dimension of your linear map)
  2. Store things more carefully
  3. Suppress interference

Store carefully: the optimal linear memory

  • Choose $W$ to fit every memory at once, a linear regression: $$\min_W \sum_{i=1}^{M} \|W k_i - v_i\|^2$$
  • For $M > d_k$, the solution whitens the keys before comparing them with the query: $$W = V^\top K \, (K^\top K)^{-1}$$
  • No interference up to $M = d_k$, and capacity doubles to $M \approx 2 d_k$

Recall selectively: the MLP

  • Pass each similarity through a nonlinearity $\sigma$: $$f(x) = \sum_{i=1}^{M} v_i \, \sigma(k_i^\top x) = V^\top \sigma(Kx)$$
  • This is a two-layer MLP: the rows of the first weight matrix are keys, the columns of the second are values
  • $\sigma = \mathrm{ReLU}$ chops off keys with negative similarity, so the less relevant memories add no interference
  • For random keys, about half the similarities are negative, so ReLU drops about half the interference terms

Suppress harder: square the ReLU

  • $\sigma(s) = \mathrm{ReLU}(s)^2$ shrinks small similarities far more than large ones: 0.1 becomes 0.01, while 1 stays 1
  • This is a GLU MLP whose gate shares weights with the input projection: $$V^\top \mathrm{ReLU}(Kx)^2 = V^\top \big(\mathrm{ReLU}(Kx) \odot Kx\big)$$
  • SwiGLU gives the gate its own weights $G$ and uses Swish in place of ReLU: $V^\top \big(\mathrm{Swish}(Gx) \odot Kx\big)$

Capacity: linear maps vs MLPs

  • Capacity is where each line crosses interference = signal
  • Linear: $M \approx d_k = 64$
  • ReLU MLP: $M \approx 2 d_k = 128$
  • Squared ReLU (GLU) and SwiGLU MLPs: $M \approx 2 d_k^2 / 3 \approx 2{,}700$, about 40 times the linear store's

Every power at once: the exponential

  • Raise the power: $\mathrm{ReLU}(s)^p$ keeps a match of 1 at 1, but shrinks a typical similarity $1/\sqrt{d_k}$ to $d_k^{-p/2}$
  • Capacity grows to about $d_k^p$: about 35,000 for $p = 3$
  • Push it to the limit and use every power at once: $$e^{\beta s} = \sum_{p=0}^{\infty} \frac{(\beta s)^p}{p!}$$
  • Capacity grows exponentially: $M \approx e^{2\beta(1 - \beta/d_k)}$, about 1.2 million at $\beta = \sqrt{d_k} = 8$

Every layer's capacity

Memory store$f(x)$CapacityAt $d_k = 64$
Outer product$V^\top K x$$d_k$64
Optimal linear$V^\top K (K^\top K)^{-1} x$$2 d_k$128
ReLU MLP$V^\top \mathrm{ReLU}(Kx)$$2 d_k$128
Squared ReLU (GLU MLP)$V^\top \mathrm{ReLU}(Kx)^2$$2 d_k^2 / 3$about 2,700
SwiGLU MLP$V^\top \big(\mathrm{Swish}(Kx) \odot Kx\big)$about $2 d_k^2 / 3$about 2,900
Cubed ReLU$V^\top \mathrm{ReLU}(Kx)^3$$2 d_k^3 / 15$about 35,000
Exponential, $\beta = \sqrt{d_k}$$V^\top \exp(\beta K x)$$e^{2\sqrt{d_k} - 2}$about 1.2 million

Slow weights and fast weights

  • An MLP's keys and values are parameters: training writes them, slowly, and they stay fixed while the model runs
  • Attention's keys and values come from the tokens in context: the forward pass writes them, one memory per token
  • So attention's memory store grows with the context
  • Slow weights change only during training; fast weights change with every token (Schmidhuber 1992)

Memorizing is regression

k1 v1 k2 v2 ⋮⋮ kt vt mt Step 1: memorize the pairs mt qt yt Step 2: retrieve with a query

Test-time regression: three knobs

$$m_t = \underbrace{\arg\min_{m \in \mathcal{M}}}_{\color{#B3202A}{3}} \; \tfrac12 \sum_{i=1}^{t} \underbrace{\gamma_i^{(t)}}_{\color{#B3202A}{1}} \, \big\|v_i - \underbrace{m}_{\color{#B3202A}{2}}(k_i)\big\|^2$$
  1. Regression weights $\gamma_i^{(t)}$: which memories to trust (uniform, decaying, by similarity)
  2. Function class $\mathcal{M}$: linear, MLP, non-parametric
  3. Optimizer: one gradient step, one SGD step per token, exact solve

One objective, many layers

Layer1. Weights2. Function class3. OptimizerMemory update
Linear attentionuniformlinearone gradient step$M_t = M_{t-1} + v_t k_t^\top$
Mamba-2, GLA, RetNetdecayinglinearone gradient step$M_t = \gamma_t M_{t-1} + v_t k_t^\top$
Mesa-layeruniform or decayinglinearexact solve$M_t = V_t^\top K_t (K_t^\top K_t)^{-1}$
DeltaNetuniformlinearSGD, one step per token$M_t = M_{t-1}(I - \beta_t k_t k_t^\top) + \beta_t v_t k_t^\top$
Gated DeltaNetuniformlinearSGD with weight decay$M_t = \alpha_t M_{t-1}(I - \beta_t k_t k_t^\top) + \beta_t v_t k_t^\top$
TTT-MLPuniformMLPmini-batch SGD
Softmax attentionby similarity to $q_t$non-parametricexact solvekeeps every $(k_i, v_i)$

How it all fits together

Slow weights: written by training Fast weights: written in the forward pass Outer product ReLU MLP GLU / SwiGLU MLP Exponential Optimal linear Test-time regression weights · function class · optimizer Linear attention, Mamba-2 DeltaNet, Gated DeltaNet Softmax attention recall more selectively store carefully generalize normalize the weights Every layer is a memory store