﻿# Linear attention summarizes feature interactions in a recurrent state

Linear attention can summarize keys and values through a feature map and associative products. Understand the recurrent state and why this is not universally exact softmax attention.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/linear-attention-feature-map-summary/
Language: en

Linear attention refers to approaches that reorganize or alter attention to avoid forming every query-key pair in the usual way. In a feature-map formulation, associative multiplication allows past keys and values to be accumulated into a summary. The exact kernel and normalization define what that summary can compute.

## Replace pairwise similarity with a compatible feature form

A kernel similarity can be expressed through transformed queries and keys using a feature map. This makes it possible to regroup sums and products under the formulation’s assumptions. The feature map is part of the model definition. Arbitrarily moving multiplication around an ordinary softmax expression is not justified because its normalization and exponential pair interactions must still be represented. Some approaches approximate a kernel while others define a different one. State which case is being discussed before claiming equality to a baseline attention computation.

## Accumulate a key-value summary and a normalizer

For a causal prefix, one summary can accumulate outer products of transformed keys with values, while another accumulates transformed keys for normalization. A transformed query reads these states to form its output. The states are updated as new positions arrive. This describes the algebraic role of the carried information, not a guarantee that its size is negligible for all head dimensions. Unlike a full position list, the summary does not expose every previous token as a separate addressable item through ordinary query-key scoring.

## A toy stream reveals what the summary retains

Imagine several past values attached to transformed keys. A new query weights their combined contribution through the summary and divides by its compatible normalizer. Adding a new key-value pair updates those accumulated statistics. The example is a way to inspect the formula, not an assertion that all useful sequence questions can be answered from the same state. Distinct histories can share a summary under a chosen representation. The learned feature map and state capacity therefore matter to what distinctions survive for later predictions.

## Validate the intended kernel before timing

On a short sequence, compare the summary-based calculation with an explicit pairwise calculation of the same defined kernel, including causal masks and normalization. This tests the reassociation. Comparing it with softmax attention instead measures a different question unless equivalence is actually established. Then evaluate task quality, state storage and runtime under the intended implementation. Keeping algebraic correctness separate from architectural quality prevents the word linear from becoming a universal claim about exactness, speed or memory on every workload.

## Primary research and implementation references

- [Mamba: Linear-Time Sequence Modeling with Selective State Spaces](https://arxiv.org/abs/2312.00752).

- [Transformers Are RNNs: Fast Autoregressive Transformers with Linear Attention](https://arxiv.org/abs/2006.16236).

- [Retentive Network: A Successor to Transformer](https://arxiv.org/abs/2307.08621).

## Related engineering context

[Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/); [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/).
