Key-Value Means: Transformers with Expandable Block-Recurrent Compressed Memory

Daniel Goldstein, Navneel Singhal, Eugene Cheah
5/11/2026
2 citations
cs.LGcs.AIcs.CL
transformer-attention

Official code: featherless-ai/KVM-paper (1 star, Python, Apache-2.0, last commit 2026-08-03).

Abstract

Recall presents a difficult choice: transformers have a linearly growing memory that slows each successive token, while linear RNNs typically have fixed costs but limited recall. We present Key-Value Means ("KVM"), a novel block-recurrence for attention that can accommodate either fixed-size or growing state.

Show full abstract

Equipping a strong transformer baseline with fixed-size KVM attention layers yields a strong $O(N)$ chunked RNN, while adding only an insignificant number of new parameters. We train a transformer with a growable KVM cache and show it performs competitively on long-context tests with only subquadratic prefill time and sublinear state growth. KVM is implementable with standard operations and without custom kernels, and supports chunk-wise parallelizable training and prefill. It provides many of the benefits of both traditional transformers (expandable context memory, chunk-wise parallelizable training and prefill) and RNNs in a single unified package. It can be used on every layer, saving KV-cache memory, and allowing a continuous range of choices of prefill time complexity between $O(N)$ and $O(N^2)$. We release our code at https://github.com/featherless-ai/KVM-paper and trained models at https://huggingface.co/collections/featherless-ai/kvm-paper under the Apache 2.0 license.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Key Value Means paper code repository

11Python, ShellMay 14, 20264 months agoApache-2.0

Similar Papers

Cite this paper

@article{goldstein2026keyvalue,
  title  = {Key-Value Means: Transformers with Expandable Block-Recurrent Compressed Memory},
  author = {Daniel Goldstein and Navneel Singhal and Eugene Cheah},
  year   = {2026},
  eprint = {2605.09877},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2605.09877v5}
}

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/2605.09877.svg)](https://codeofpaper.com/paper/2605.09877)

Discussion