arXiv(opens in a new tab)cs.LGOct 2026Cited by 3 papers on PaperVantage

Manuscript Offprint

arXiv:2610.02383

The Surprising Effectiveness of Shared Memory in Looped Transformers

Giovanni Monea, Keshav Ramji, Yousef El-Kurdi, Luis A. Lastras, Yoav Artzi, Nathan Godey, Ramón Fernandez Astudillo

ABSTRACT

Looped Transformers apply the same layers several times per token, adding compute to improve quality without more parameters. Each recursion, however, writes its own key-value cache, so memory still grows with compute. Inference-time techniques can shrink this cache at a cost in quality. We pretrain looped language models to share memory: only the first recursion writes a cache, and later recursions read it while keeping a short window of their own. Surprisingly, we find that sharing memory does not cost quality and instead improves it. At 150M–1B parameters, our Looped Prediction Transformer (LPT) and its hybrid variant set a new quality–memory frontier for looped models: with five recursions, the hybrid lowers validation perplexity on FineWeb-Edu by 1.12–1.82 relative to a same-size standard Transformer while using 76–79% less context memory. Through an extensive analysis, we investigate why memory sharing helps. Shared and local memory develop different representations, and later recursions attend mostly to the shared memory, which also acts as a gradient highway to the first recursion.

Looped Prediction Transformer

Figure

Recursions 2 3 5

Full Attention

Figure 1: Shared memory not only saves memory, it also improves quality. Left: in our Looped Prediction Transformer (LPT), later recursions read the KV cache written by the first recursion and keep only a short window of their own. Right: perplexity and context memory of 1B-parameter models with two to five recursions, against a parameter-matched standard Transformer (STD). Each of our models adds shared memory to the looped baseline above it: LPT to the looped Transformer LT, and H-LPT to the gated DeltaNet hybrid LT2.

*Work done during an internship at IBM Research. Correspondence to: giovanni@cs.cornell.edu †Equal advising

1 INTRODUCTION

Looped Transformers (LT) repeatedly apply the same layers several times before predicting the next token, adding computation without adding parameters (Dehghani et al., 2019; Zhu et al., 2025). In principle, they trade time for memory, matching the compute of a larger model with far fewer parameters. In standard formulations, however, context memory still grows with recursion depth, as each iteration keeps a separate key-value (KV) cache (Geiping et al., 2025; Zhu et al., 2025). At long contexts, this context memory can grow larger than the weights memory itself, undoing the very reason to use a looped model.

Sharing caches across recursions during decoding can save substantial memory with little quality loss (Geiping et al., 2025; Zhu et al., 2025). So far, this reuse has been studied mainly as a way to save memory. Yet it also shows that memory written by one recursion can serve the others, even in models never trained to share it. This raises a question: if sharing can work untrained, what can it do when models are trained for it? To answer it, we train looped models with memory sharing from the start, investigating it as an architectural inductive bias.

We study a simple recipe for Memory Sharing in looped Transformers (Figure 1, left). At each full-attention layer, later recursions attend to both their own KV entries and the cache written by that layer in the first recursion, within the same attention operation. To further save memory, we truncate the cache of every recursion after the first to a short sliding window. The resulting Looped Prediction Transformer (LPT) keeps LT's sequential recurrence and uses context memory close to a standard (non-looped) Transformer's. Applied to the full-attention layers of a hybrid looped Transformer (Deng et al., 2026), the same rule yields the Hybrid Looped Prediction Transformer (H-LPT). We pretrain all models from scratch at 150M to 1B parameters. Because later recursions give up most of their own memory, one would expect Memory Sharing to cost some quality, as untrained sharing does.

Surprisingly, Memory Sharing improves quality over full-cache LT even when each later recursion's own cache covers less than 2% of the context. Its advantage grows with depth: LT stops improving in perplexity after three recursions, while LPT improves through five. Across sizes, LPT lowers validation perplexity by up to 1.09 nats and raises downstream accuracy by up to 4.8 percentage points over a matched-depth LT, with up to 4.7×4.7 \times less context memory and nearly the same inference FLOPs. Sharing also improves the hybrid baseline: at five recursions, H-LPT outperforms a same-size standard Transformer in both language modeling and downstream accuracy while using 76–79% less context memory, moving the quality–memory frontier for looped models (Figure 2).

These results raise a further question: why does memory sharing improve quality? We find that later recursions rely heavily on the shared memory. LPT outperforms LT at every window size, even when later recursions keep no cache of their own, and later recursions attend mostly to shared memory even when their own cache covers the full context. Shared and local memory also develop distinct key representations, suggesting that they serve different purposes. Reading shared memory sends gradients directly to the first recursion, helping it learn what to store. This gradient highway bypasses the intermediate recursions: in LT, the magnitude of the gradient reaching the first recursion falls sharply with depth, while LPT recovers much of it through the shared memory. When we block this path, the model still reads shared memory but no longer matches LPT's quality and stability.

References (81)