Memory Attention
Jiale Kang
cs.LG
2026-09-24
Memory Attention builds values as contextual keys plus a per-layer vocabulary lookup, reaching matched loss with 13.8-29.6% fewer tokens and less GPU-resident memory.
Standard attention derives Q, K and V from the same hidden states through three dense projections. V is the content being aggregated, yet a large share of what it carries is token identity, which the paper describes as reusable across contexts. Paying a dense matmul plus GPU-resident weights for it at every layer is a fixed cost. Prior work added token-specific components on top of the value projection: value embeddings mix word vectors into V, PLE injects per-layer embeddings, Engram retrieves n-gram-indexed memory. This paper asks the more radical question: can WV be removed outright, with a token-indexed lookup supplying identity and the existing keys supplying context?
The construction fits in one line: V = K + Norm(E[s]).
The division of labor matters: memory says what the token is; K says what it means here. K comes from hidden states that have already absorbed preceding context and layers, so context dependence survives. The same word in different sentences fetches the same row but adds a different K. WK and the tables are trained jointly to support value construction.
At inference, the normalization folds into the tables, so online value construction is one lookup plus one addition, no matmul. Because lookup addresses depend only on token IDs and layer index, the tables can live in CPU memory behind a prefetch pipeline that overlaps transfer with compute. An analyzed extension, MA-Recall, would cache K and token IDs and rebuild historical values as V = K + normalized lookup, halving the KV cache in theory; it is never measured. Relative to MLA: both aggregate a shared representation; MLA applies a learned value mapping after aggregation, while MA aggregates keys plus additive memory.
Matched training token budgets, same seeds, FineWeb-10BT pretraining, average over seven zero-shot tasks:
| Backbone (24 layers, 10B tokens) | Standard | MA | Params |
| MHA | 40.68 | 41.39 | 373M to 1,135M |
| GQA | 40.90 | 41.51 | 349M to 729M |
| MQA | 41.11 | 41.34 | 336M to 526M |
| Gated variant | 41.40 | 42.88 | 398M to 1,160M |
WikiText perplexity drops from 31.55 to 28.64 for MHA. The larger model (24 layers, d=2,048, 20B tokens) moves from 49.06 to 50.22 on average, with +3.00 on OpenBookQA and +2.65 on ARC-Challenge, and slight drops on ARC-Easy and PIQA. Single-needle retrieval shows the widest gap: within the 2K training window MA averages 96.8% versus 82.1% for standard attention; at 4K extrapolation it is 41.9% versus 25.9%; the largest single gain is 62.4% to 98.2%.
Matched-loss token efficiency is 1.42x for the small model and 1.16x for the large one, meaning 29.6% and 13.8% fewer training tokens.
Inference (single H800, batch 8, 2,048-token prefill plus one decode step with 2,048 tokens of history):
| Config | Prefill / decode (ms) | GPU params | Total params |
| Standard | 90.97 / 17.64 | 2,602.38 MiB | 1,364M |
| MA (tables on GPU) | 88.20 / 17.79 | 5,410.38 MiB | 2,836M |
| MA-Offload (tables on CPU) | 90.69 / 17.19 | 2,410.38 MiB | 2,836M, of which 3,000 MiB on CPU |
MA-Offload holds 2.08x the total parameters in 7.38% less GPU parameter storage than the baseline, at comparable latency.
If the substitution holds at scale, attention loses one dense matmul and gains a new home for parameters: vocab-indexed tables that can sit in CPU RAM behind prefetching, decoupling model capacity from GPU memory. That axis is orthogonal to quantization and KV-cache compression. The retrieval gains suggest a second effect worth studying: token identity flowing directly into V may keep rare tokens from being washed out across layers. Honestly, this reads as a feasibility study rather than a production recipe: experiments stop at 2.8B parameters and 20B tokens, it is a single-author preprint, and it has not been peer reviewed.