﻿# Recurrent state and attention history preserve different information

Recurrent state and attention history retain different representations of a sequence. Understand compressed state updates, KV access and why fixed state is not unlimited exact memory.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/recurrent-state-attention-history/
Language: en

Sequence models must carry information from earlier inputs to later predictions. Recurrent state and attention history provide different ways to do that. Comparing what is retained and how a later input retrieves it is more useful than calling one model memoryless or assuming a compact state remembers every earlier token exactly.

## A recurrence updates a carried representation

A recurrent model applies an update using the previous state and current input to create a new state. The carried object can have a fixed shape for a chosen architecture. Earlier information influences future outputs through the resulting representation rather than through an explicit list of every old token state. A cumulative sum is a simple mathematical illustration of summarization, though actual learned recurrences are richer. The retained statistic can answer some questions perfectly while discarding distinctions needed by others, demonstrating that compactness and exact recoverability are different properties.

## Attention keeps addressable history under its policy

A causal attention implementation can retain past key and value representations and compare a new query against them. Under a full-history policy, the number of retained positions grows with the processed sequence. A sliding window or other restriction changes that history. The new query can select among stored positions through similarity rather than only consuming one fixed-size summary. This does not guarantee perfect retrieval or factual memory; it describes an access mechanism whose behavior still depends on learned representations, masking and numerical execution.

## A pair of questions reveals the tradeoff

Imagine processing a stream of measurements. A state designed to retain their sum can answer a later total query, yet cannot generally recover every individual measurement from that sum. Retaining separate entries supports different queries at additional storage cost. The analogy illustrates an information interface, not a theorem that all neural states behave like sums or that every attention model retains raw inputs. Compare the actual state definition, representation precision and readout function before claiming one architecture has superior memory for every sequence task.

## Architecture and execution mode both matter

State-space, linear-attention and hybrid models have different update and retrieval rules. Some architectures also offer recurrent, parallel or chunked execution views of related mathematics. Do not infer training complexity solely from a step-by-step inference diagram. A useful fixture traces the carried state and outputs on a short sequence, then tests the specific long-range dependency required by the application. Report state size and retained history policy separately from task quality. This connects memory cost to an explicit information path without promising unlimited exact context from a fixed-size representation.

## 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/).
