Memory Attention Paper ↗
Preprint arXiv:2609.28399 cs.LG September 2026

Memory Attention.

Replacing the value projection with token-indexed memory and contextual keys.

Fig. 1 Token-indexed memoryM̄ℓ · one per layer
Rows are gathered by token ID, not by position, so the lookups jump around the table. IDs are illustrative.
§ 01Abstract

What if values could be retrieved?

Memory Attention (MA) investigates replacing a dedicated attention value projection with learned token-indexed memory, complemented by context-dependent keys.

Each attention layer learns a token memory table; its retrieved representation contributes reusable token-specific information, while the key representation retains contextual information. At inference, row normalization can be folded into the memory table, leaving lookup and addition to construct values. CPU placement and prefetching provide a parameter-storage trade-off. Experiments report improvements in language modeling and average downstream scores under matched training-token budgets, with additional memory parameters.

§ 02Method

Memory instead of a value projection.

Standard attention produces values with a learned dense projection. MA combines a pre-normalization content key with memory retrieved using the original token ID. Normalized rows may be precomputed for inference.

Standard V = xWV becomes
VValueBuilt from a lookup and an addition. KcontentContextual keyPre-normalization content key, not the RoPE key. M[ids]Token memoryLayer-specific table, rows normalized, gathered by token ID.
01 · ValueCore

Memory-based construction

Eliminates the independent V projection, using a layer-specific table and contextual keys instead.

02 · OffloadEvaluated

CPU memory, GPU compute

The token-indexed table may reside on CPU. Prefetching overlaps required lookups and transfers with computation while a conventional KV cache remains in use.

03 · RecallProposed

Reconstruct historical values

Retain sufficient K information and token IDs, then rebuild V on demand. This extension was not included in the paper's inference benchmarks.

§ 03Interactive

Attention, token by token.

Follow the input stream and compare standard causal attention with the proposed memory-lookup interpretation.

Fig. 2 Input sequenceSelect any token

TOKEN 01 / 08Space ← →

Standard attention

Keys and values are retained in the GPU cache

2a

Memory attention

Cached keys · CPU memory lookup · reconstructed values

2b
Current query Active attention Previous positions Cached keys & values CPU lookup Causal mask

Conceptual animation only. In actual MA, attention values use pre-RoPE content keys. MA-Recall requires preserving or recovering the correct key representation, with additional retrieval and positional-transform costs.

§ 04Results

Quality and efficiency, in the reported settings.

The following values are from the paper's experimental tables.

Quality · MHA + MA 41.39

Average downstream score

vs 40.68 Standard, 1024 hidden, 10B tokens.

Storage · MA-Offload 7.38%

Less GPU parameter storage

vs Standard in the reference inference setup; excludes KV cache and buffers.

Latency · MA-Offload Nooverhead

Decode forward-pass latency

17.189 ms vs 17.636 ms Standard at batch 8, 2K context — offloading adds no extra overhead.

Table 1 · Average downstream score, 10B training tokens
ConfigurationStandard avg. ↑MA avg. ↑Difference
MHA · 1024 hidden40.6841.39+0.71
GQA · 1024 hidden40.9041.51+0.61
MQA · 1024 hidden41.1141.34+0.23
Gated · 1024 hidden41.4042.88+1.48

Source: paper language-modeling results table and Table 4 (inference). Average is the unweighted mean of seven accuracy-based evaluations. MA-Recall is not part of the reported inference measurements.

Ablations: where and how memory helps.

Key findings from the paper's ablation studies. Unless noted, all models use 24 layers, hidden size 1,024, 10B training tokens, and roughly 0.5M tokens per batch.

Memory Attention configuration 41.38 Best in column

AIntegration

Reusing keys as values works best.

ConfigurationParams.LAMBADA PPL ↓WikiText PPL ↓Avg. ↑
V = xW std.336M50.3831.8441.11
V = M526M58.3632.9440.34
V = (1−λ)·xW + λ·E[i]532M47.8731.1240.99
V = xW + M532M45.6829.8941.28
V = K + M526M45.9329.8241.38

Memory alone (V = M) degrades the average to 40.34 — memory complements input-dependent values rather than replacing them; key–value reuse with additive memory is the best integration.

BPlacement

Enrich values, not matching.

Memory added toParams.LAMBADA PPL ↓WikiText PPL ↓Avg. ↑
Hidden states · H + M526M50.2230.6841.14
Queries · Q + M526M59.6933.1740.55
Keys · K + M526M58.2332.6340.35
Values · V + M526M45.9329.8241.38
Outputs · O + M526M71.8334.4739.83

Shared key–value representations (K = V). Memory helps most when enriching what attention aggregates; output-side injection is the worst, with LAMBADA perplexity rising to 71.83.

CNormalization

Normalize the memory rows.

ConfigurationParams.LAMBADA PPL ↓WikiText PPL ↓Avg. ↑
V = K + E[i]526M54.4632.6040.85
V = KRoPE + Norm(E[i])526M51.3830.7940.61
V = K + Norm(E[i])526M45.9329.8241.38

Controlling the scale of memory embeddings balances the key and memory contributions, improving both language modeling and downstream accuracy. Sharing the RoPE-transformed key (V = KRoPE + Norm(E[i])) lowers the average to 40.61 — positional encoding must stay out of the shared value path.

DAttnRes

Complementary to attention residuals.

ConfigurationParams.LAMBADA PPL ↓WikiText PPL ↓Avg. ↑
Standard336M50.3831.8441.11
Standard + AttnRes336M39.5929.7741.00
MA526M45.9329.8241.38
MA + AttnRes526M38.3728.8841.46

AttnRes improves both Standard and MA; MA + AttnRes reaches the best overall numbers, showing explicit memory and residual propagation are complementary.

Source: paper ablation studies (integration, placement, normalization, and AttnRes tables).

Explore all experiments ↗

§ 05Implementation

Built on Flash Linear Attention.

The public implementation exposes an MA layer and a Hugging Face-style causal language model. CPU-offload comparisons are currently in standalone profiling scripts; the repository README does not describe them as integrated into the primary causal LM implementation.

Joluck/memory-attention Repository map
├─fla/layers/memory_attn.pyCore layerKey projections, layer-specific token-indexed memory and value construction.
├─fla/models/memory/ModelBackbone configuration and causal language model interface.
└─profile/ProfilingReference inference experiments and CPU-offloading traces.

View repository ↗

§ 06Citation

Cite this work.

BibTeX
@misc{kang2026memoryattention,
  title={Memory Attention},
  author={Jiale Kang},
  year={2026},
  eprint={2609.28399},
  archivePrefix={arXiv},
  primaryClass={cs.LG},
  url={https://arxiv.org/abs/2609.28399}
}