The Surprising Effectiveness of Shared Memory in Looped Transformers
AuthorsGiovanni Monea, Keshav Ramji, Yousef El-Kurdi, Luis A. Lastras, Yoav Artzi, Nathan Godey, Ramón Fernandez Astudillo
AffiliationsIBM Research
A clever memory-sharing scheme lets repeatedly applied Transformers use far less inference memory while performing even better.
Key results
At five recursions, LPT uses up to 4.7× less KV memory than a matched looped Transformer.
Validation-perplexity reduction at five recursions across model sizes.
Memory reduction versus a same-size standard Transformer at five recursions.
Upper end of the measured attention share assigned to shared memory.
Maximum number of sequences per batch relative to a standard Transformer on an NVIDIA H100.
Percentage-point improvement over a matched looped Transformer.
What the paper found
Looped Transformers reuse the same layers for multiple passes, but normally each pass keeps its own full key-value cache, so memory grows with recursion. This paper introduces the Looped Prediction Transformer, or LPT: the first pass writes a full-context cache, and later passes read it alongside a short local window. Across models from 150M to 1B parameters trained on FineWeb-Edu, this learned memory sharing improves quality: at five recursions, LPT improves accuracy by up to 4.8 percentage points over matched looped Transformers while using up to 4.7× less KV memory. Its hybrid variant, H-LPT, combines sharing with Gated DeltaNet and full-attention layers; at five recursions, it lowers validation perplexity by 1.12–1.82 versus a standard Transformer while using 76–79% less context memory. The authors’ analysis suggests that the first recursion specializes in writing memory, while later recursions mainly use it: as much as 80% of final-recursion attention goes to shared memory. Reading that cache also creates a direct gradient path back to the first recursion, and blocking the path harms quality and can destabilize training. On an NVIDIA H100, H-LPT’s smaller cache lets it fit up to 5.0 times as many sequences per batch as a standard Transformer. Unlike cited cache-reduction work such as DeepSeek-V4.1-Flash, this approach treats memory sharing as a trainable architectural bias—and finds it can improve both quality and memory efficiency.
Original 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.
Read the original paperMore in Efficient AI
Browse all 64 papers →DLoop: Looped Speculative Decoding
Geonmo Gu, Byeongho Heo, HeeJae Jun, Yoohoon Kang, Sangmin Lee, Sangdoo Yun, Dongyoon Han
DLoop speeds up large language model generation by letting draft models propose several batches of tokens before the expensive target-model verification step.
HyperThink: Text-to-Parameter Hypernetworks for Efficient Reasoning
Donggyun Kim, Jack Lu, Chanwoo Kim, Mengye Ren, Seunghoon Hong
HyperThink tries to make LLM reasoning faster by turning each question into a small, temporary parameter update instead of a long chain-of-thought.
FrugalEvo: Towards Cost-Aware LLM-Guided Program Evolution
Hui Chen, Xuan Qi, James Xu Zhao, Zhaopeng Feng, Shilong Liu, Kuang Xu, Pang Wei Koh, Bryan Hooi
FrugalEvo makes LLM-driven program evolution more practical by combining stronger strategic models, cheaper implementers, and cache-aware search to achieve competitive results at far lower cost.