Memory Caching gives RNNs a growing memory, offering a middle ground between efficient recurrence and expensive full attention.
By Youssef Hosni
Published: 2026-06-21
URL: https://todatabeyond.substack.com/p/google-published-a-paper-that-might
For almost a decade, the Transformer has been the default architecture behind most major progress in large language models. Its advantage comes from more than scale.
At the core of the Transformer is attention, which gives every token access to a growing memory of previous tokens. This is powerful for long-context understanding and retrieval, but it also creates a serious cost problem: memory and compute grow quickly as the context becomes longer.
Google’s paper, “Memory Caching: RNNs with Growing Memory,” revisits an old architectural question from a new angle. Instead of asking whether recurrent models can replace Transformers directly, the paper asks whether recurrent models can be given a better memory system.
Traditional RNN-style models are efficient because they compress the past into a fixed-size state, but that same fixed memory becomes a bottleneck when the model needs to recall precise information from long contexts.
Memory Caching proposes a middle ground. The model still processes sequences recurrently, but it saves compressed memory checkpoints at segment boundaries.
Later tokens can be retrieved from the current online memory and from older cached memories. This allows the effective memory capacity of recurrent models to grow with sequence length without paying the full cost of Transformer-style token-level attention.
In this article, we walk through the history behind this problem, why memory became the central advantage of Transformers, how Memory Caching works, and why its variants — Residual Memory, Gated Residual Memory, Memory Soup, and Sparse Selective Caching — matter.
We also cover the paper’s experiments across language modeling, Needle-in-a-Haystack retrieval, in-context retrieval, LongBench, and MQAR. The main takeaway is not that Transformers are dead. The more careful conclusion is that full attention is no longer the only credible path to growing memory.

Table of Contents:
- The Memory Problem Behind the Transformer Era
- A Short History of Sequence Model Memory
- The Core Bottleneck: Fixed Memory vs Growing Memory
- What Memory Caching Actually Does
- Four Ways to Use Cached Memories
- Segmentation: The Hidden Design Choice
- Linear Memory vs Deep Memory: What Is Actually Being Cached?
- Applying Memory Caching to Real Architectures
- Experiments: What the Paper Tests and What It Finds
- Ablations and Efficiency: What Actually Matters
- What This Paper Is Really Saying
I’m hosting a live workshop on Hands-On Hermes Agent: Persistent Agents, Memory, Skills, and Real Workflows.
In 120 minutes, you will learn how Hermes Agent works, set up your first persistent agent, and build practical workflows with memory, skills, messaging, and automation.

1. The Memory Problem Behind the Transformer Era
Google researchers have published a new paper that might challenge one of the strongest assumptions in modern AI: that the future of large language models must continue to be built around Transformers.
The paper is titled “Memory Caching: RNNs with Growing Memory.” The title sounds modest, but the idea behind it is important. For the last several years, the Transformer has been the default architecture behind most major progress in language modeling.
This is not only because Transformers scale well, but also because their attention mechanism gives them a powerful form of memory. Each token can look back at previous tokens and retrieve information from the context directly.
That ability is one of the main reasons Transformers became so effective. When the model needs to answer a question, resolve a reference, copy a value, or use information from earlier in the prompt, attention gives it a direct path to the relevant part of the sequence. The model does not need to compress everything into a single hidden state before using it later. Instead, the context itself becomes a growing memory.
But this is also where the cost starts.
In a standard Transformer, attention compares tokens against other tokens. As the sequence becomes longer, the number of token-to-token interactions grows quickly. During inference, the model also keeps a KV cache so it can reuse previous key and value representations. This is useful, but it means that long-context Transformers do not only require more computation; they also require more memory at serving time.
This is the basic trade-off that defines much of modern sequence modeling:
- Transformers remember well because their memory grows with the sequence.
- Recurrent models are efficient because their memory does not.
A recurrent neural network, or any modern architecture that behaves recurrently, processes the sequence step by step and keeps a hidden state. That hidden state acts as a compressed representation of the past. This makes recurrent models attractive for long sequences because the model does not need to store every previous token. The memory remains fixed-size, and the computation can scale more efficiently.
The weakness is that fixed-size memory has a natural bottleneck. As the sequence grows, more and more information must be compressed into the same state. For short contexts or tasks that do not require precise recall, this can work well. But for long-context tasks, especially tasks where the model must retrieve a specific fact from much earlier in the sequence, this compression becomes a serious limitation.
This is why many recurrent alternatives to Transformers look promising in terms of efficiency but struggle on recall-heavy tasks. They can process long sequences cheaply, but they often lose the exact information that attention would have preserved.
Memory Caching starts from this observation.
The paper asks a direct question: what if recurrent models did not have to rely on only one fixed-size memory state?
Instead of forcing the model to compress the entire past into a single hidden state, Memory Caching stores checkpoints of the recurrent memory as the sequence is processed. The sequence is divided into segments. Each segment is compressed into a memory state. These memory states are then cached. Later tokens can retrieve not only from the current online memory, but also from cached memories from previous segments.
This gives recurrent models a form of growing memory. It is not the same as Transformer attention, because the model is not storing every token independently. It is storing compressed memory checkpoints. But it is also not a standard RNN, because the model is no longer limited to one fixed hidden state.
Memory Caching, therefore, creates a middle ground:
- A standard RNN keeps one fixed-size memory.
- A Transformer keeps token-level memory across the context.
- Memory Caching keeps a growing set of compressed memories.
This is why the paper is interesting. It does not claim that Transformers are obsolete. In fact, the results show that Transformers remain very strong on some recall-intensive tasks. But it does show that the usual framing, efficient RNNs versus expensive attention, is incomplete. There is another point in the design space: recurrent models with memory that grows as the sequence grows.
\Figure 1. Transformers grow memory by keeping token-level access to the past. RNNs compress the past into one fixed state. Memory Caching sits between them by storing compressed recurrent memory checkpoints.\
The important idea is that memory capacity is not only a detail of implementation. It is one of the central architectural constraints of sequence models. If a model has too little memory, it forgets. If it stores everything, it becomes expensive. The challenge is to decide what should be stored, how compressed it should be, and how the model should retrieve from it later.
Memory Caching is one attempt to answer that question. It keeps the recurrent update rule, but changes how memory is accessed. Instead of reading only from the latest hidden state, the model can read from a set of memory states. This simple change turns recurrence from a fixed-memory system into a growing-memory system.
That is why this paper matters. It is not just another efficient attention variant. It is part of a broader shift toward treating memory as an explicit design dimension in language models.
The Transformer era may not end because one architecture suddenly replaces attention. A more realistic possibility is that the “pure Transformer” era gradually gives way to hybrid memory systems: models that use attention where precise token-level access is needed, recurrent compression where efficiency matters, and cached memory states when long-range retrieval requires something between the two.
\Figure 2.In Memory Caching, each token can be retrieved from the current recurrent memory and from compressed memory checkpoints saved from earlier segments.\
2. A Short History of Sequence Model Memory
To understand why Memory Caching is interesting, it helps to look at the history of sequence models through one specific lens: how the model stores and retrieves information from the past.
Most architecture debates are usually framed around speed, scaling, parallelism, or benchmark performance. Those are important, but they are downstream of a more basic design question: when a model reads a long sequence, where does the past go?
Different generations of sequence models answered this question differently.
Early recurrent neural networks (RNNs) answered it with a hidden state. The model reads one token, updates its state, reads the next token, updates the state again, and continues until the end of the sequence. The hidden state is the model’s working memory. Everything the model needs from the past must be compressed into that state.
This design is elegant because it is naturally efficient. The model does not need to keep every previous token in memory. It only needs to keep the current hidden state. In principle, this makes recurrence attractive for long sequences and streaming applications.
The problem is that the hidden state has a fixed size.
As the sequence grows longer, the model must keep compressing more information into the same amount of memory. Some information can be preserved, but some will be overwritten, diluted, or made difficult to retrieve. This is the classic long-term dependency problem. The model may process a token early in the sequence, but by the time it needs that information later in the sequence, the signal may no longer be available in a usable form.
Long Short-Term Memory networks, or LSTMs, were one of the most important attempts to address this weakness. Instead of using a simple recurrent state update, LSTMs introduced gates that control what should be remembered, what should be forgotten, and what should be exposed to the next step. This gave recurrent models a much better mechanism for managing information over longer time spans.
However, LSTMs did not fundamentally change the memory capacity problem. They improved how information is written and preserved, but they still relied on a fixed-size memory. The model still had to decide what to keep and what to forget as the sequence grew.
\Figure 3.The history of sequence modeling can be read as a history of memory design: from one fixed hidden state, to token-level attention, and now toward hybrid systems with compressed, growing memory.\
The Transformer changed this trajectory by moving away from recurrence. Instead of passing all information through a single hidden state, the Transformer uses self-attention. Each token can compare itself with other tokens in the context and retrieve information directly from them.
This was a major shift. In recurrent models, the past is compressed before it is reused. In Transformers, the past remains available as token-level representations. This is why attention is so effective for tasks that require recall, copying, reference resolution, and in-context learning. A token near the end of a prompt can still access a relevant token near the beginning, as long as both are inside the context window.
This is also why Transformers became the default architecture for modern language models. Their memory mechanism fits the needs of language modeling very well. Language is full of dependencies that are not strictly local. A name, definition, instruction, or constraint may appear early in a document and become relevant much later. Attention gives the model a direct retrieval mechanism for this kind of dependency.
But the same design also creates the long-context cost problem. If each token can attend to many previous tokens, the computation and memory requirements grow quickly as the context becomes longer. During inference, the model also stores key and value representations in the KV cache, which makes long-context serving expensive.
So the field started looking again at alternatives.
Linear attention was one important step in this direction. It showed that under certain kernel formulations, attention can be rewritten in a recurrent form. Instead of explicitly comparing every query against all previous keys, the model maintains a compact state that can be updated as tokens arrive. This reduced the cost from quadratic to linear in sequence length, at least for that class of attention mechanisms.
This was an important conceptual moment because it blurred the line between attention and recurrence. It suggested that the difference between Transformers and RNNs is not always absolute. Some attention mechanisms can be expressed as recurrent updates, and some recurrent models can be understood as compressed memory systems.
After that, several modern architectures tried to recover some of the efficiency of recurrence while keeping as much Transformer-like performance as possible.
RWKV is one example. It tries to combine Transformer-style parallel training with RNN-style efficient inference. RetNet follows a similar motivation from another direction: it introduces a retention mechanism that can be computed in parallel, recurrent, or chunkwise recurrent forms.
Mamba uses selective state-space dynamics, where the model can decide what information to propagate or forget based on the current input. Titans introduces neural long-term memory, where a memory module learns to memorize historical context during inference.
These models are different in their details, but they are part of the same broader movement. The field is trying to move beyond the simple choice between:
- full attention with strong recall but high cost
- recurrence with low cost but fixed memory
Memory Caching fits directly into this line of work.
It does not start by replacing the recurrent update rule. Instead, it asks whether the fixed-memory bottleneck can be relaxed. If recurrent models struggle because they compress the entire past into one state, then one natural solution is to stop using only one state.
The idea is to save intermediate memory states as the sequence is processed. These saved states act as compressed checkpoints of the past. Later tokens can be retrieved from the current memory and from older cached memories. This gives the model a growing memory, but not in the same expensive way as full attention.
\Figure 4. Memory Caching keeps the efficiency intuition of recurrence, but avoids forcing the entire past through one active hidden state.\
This historical context matters because Memory Caching is not just another variation of attention. It is part of a deeper architectural question: Can we design models where memory grows with the sequence, but in a compressed and controllable way?
Transformers solved the memory problem by keeping token-level access to the context. Recurrent models solved the efficiency problem by compressing the context into a fixed-size state. Memory Caching tries to combine parts of both ideas. It keeps recurring, but gives it a larger and more structured memory surface.
This is why the paper is best understood as a continuation of a long sequence modeling debate, not as an isolated architecture trick. The central issue has remained the same from RNNs to LSTMs to Transformers to modern recurrent models:
How much of the past should the model store, how compressed should that memory be, and how should the model retrieve from it when it matters?
3. The Core Bottleneck: Fixed Memory vs Growing Memory
The simplest way to understand the Memory Caching paper is to focus on one question:
Does the model’s memory grow with the sequence, or does it stay fixed?
This question separates the two major families of sequence models.
A standard recurrent model has fixed memory. It reads tokens one at a time and updates a hidden state. No matter whether the sequence has 100 tokens or 100,000 tokens, the model still carries the past through the same memory object. That memory may be a vector, a matrix, or a more complex learned state, but the key idea is the same: the model compresses the past into a fixed-size representation.
A Transformer has growing memory. As the sequence becomes longer, the number of stored token representations also grows. During attention, a token can compare itself with previous tokens and retrieve information directly from them. This gives the model much stronger access to the past, especially when the task requires exact recall.
The difference is not only about implementation. It changes what kind of information the model can preserve.
In a recurrent model, every new token modifies the memory state. The memory must keep useful information and discard less useful information. This is efficient, but it creates pressure. If the model reads a long document, early information has to survive many update steps before it can be used again. Some information may remain, but it is increasingly compressed into the same fixed memory state.
This is why recurrent models often struggle with recall-intensive long-context tasks. The model may have processed the relevant information earlier, but processing something is not the same as keeping it in a retrievable form. Once information has been compressed too heavily, the model may no longer be able to recover the exact detail needed later.
A Transformer avoids this specific bottleneck by keeping token-level access to the context. If a fact appears near the beginning of the prompt, a later token can still attend to it directly. The fact does not need to survive as a signal inside one hidden state. It remains available as part of the context representation.
But this is also why Transformers become expensive.
Attention gives the model a rich memory surface, but the cost grows with the number of tokens. In standard attention, tokens interact with other tokens, so the number of interactions grows quickly as the context length increases. During generation, the model also stores key and value representations in the KV cache. This makes long-context inference memory-intensive, especially when the model serves many users or processes very long documents.
So we get the central trade-off:
- Recurrent models are efficient because they compress history into fixed memory.
- Transformers are powerful because they keep growing token-level memory.
- Memory Caching tries to create a middle ground by letting recurrent memory grow, but in compressed checkpoints rather than raw token-level states.
This is the main idea behind the paper.
Instead of asking a recurrent model to carry the entire past through one hidden state, Memory Caching saves intermediate memory states while the sequence is being processed. The sequence is divided into segments. Each segment is compressed by the recurrent memory module. At the end of a segment, the final memory state is cached.
Later tokens can be retrieved from two places:
- the current online memory, which is still being updated as new tokens arrive;
- older cached memories, which store compressed information from previous segments.
This changes the role of recurrence.
In a standard recurrent model, the latest memory state must represent everything useful from the past. In Memory Caching, the latest memory state is still important, but it is not alone. It is supported by a growing collection of older memory checkpoints. These checkpoints act like compressed snapshots of previous parts of the sequence.
The model no longer needs to compress the entire history into one active state. It can distribute the past across several cached states.
\Figure 5.Memory Caching turns memory capacity into a dial. It can behave closer to a standard RNN when few memory states are cached, or closer to attention when many cached states are available.\