Direct access attention: associative recall at a fraction of the compute of softmax, linear attention and state-space models

Simon Dennis, Rivaan Patil, Hao Guo, Kevin Shabahang
11/28/2026
cs.LG

No confident code implementation found for this paper.

Abstract

Direct access attention replaces context search with a learned integer lookup. Each token is projected to a $d_k$-dimensional code whose signs select one of $2^{d_k}$ memory cells.

Show full abstract

Its value is written to that cell; a query with matching signs retrieves it in $O(d_k+d_v)$ operations per head, independent of context length $T$. Softmax attention compares each query with every context key, costing $O(T(d_k+d_v))$ operations per head and separating $2^{O(d_k)}$ pairs. Linear attention superposes pairs in a fixed-width matrix, costing $O(d_k d_v)$ operations, independent of $T$, but separating only $O(d_k)$ pairs per head. Direct access replaces the product of key and value widths with their sum and provides $2^{d_k}$ cells, at the cost of storing $2^{d_k} d_v$ values per head. An efficient differentiable training algorithm factorises address learning into $d_k$ independent bit probabilities. This lets gradients adjust addresses; at inference, each bit becomes a definite binary choice, enabling integer lookup. Training and inference agree when these probabilities approach zero or one. Because cross-entropy alone does not reliably produce such certainty, we add an address-entropy penalty after the model has learned to match queries to the correct keys. On in-context associative recall, one-layer models with matched parameter counts achieve perfect accuracy at every tested task size, from 8 to 512 stored pairs, using either direct access or softmax attention. At 512 pairs, linear attention achieves 0.340 accuracy; a selective state-space model with the same state size performs at chance beyond 32 pairs. Direct access preserves softmax's accuracy while reducing attention-route decoding cost by three orders of magnitude.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{dennis2026direct,
  title  = {Direct access attention: associative recall at a fraction of the compute of softmax, linear attention and state-space models},
  author = {Simon Dennis and Rivaan Patil and Hao Guo and Kevin Shabahang},
  year   = {2026},
  eprint = {2611.38402},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2611.38402v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2611.38402.svg)](https://codeofpaper.com/paper/2611.38402)

Discussion