Memory-Efficient Looped Transformer: Decoupling Compute from Memory in Looped Language Models

Victor Conchello Vendrell, Arnau Padrés Masdemont, Niccolò Grillo, Jordi Ros-Giralt, Arash Behboodi, Fabio Valerio Massoli

TL;DR

Looped Transformers improve reasoning by recycling layers, but they usually suffer from a "memory tax" where the KV cache grows with every iteration. MELT (Memory-Efficient Looped Transformer) eliminates this tax by using a learnable gating mechanism to update a single, constant-size KV cache, achieving deep reasoning with a memory footprint comparable to standard, non-looped models.

What Problem Does This Paper Address?

To get better reasoning out of Large Language Models (LLMs), researchers often turn to "inference-time compute." This usually means either Chain-of-Thought (CoT)—generating more tokens—or Looped Transformers, which pass internal representations through the same layers multiple times (latent reasoning).

While looped models like Ouro are parameter-efficient, they are memory-hungry. Standard implementations append new Key-Value (KV) states to the cache for every loop iteration. If a model loops 4 times, its KV cache grows 4x larger than a standard model's. This linear growth creates a massive memory bottleneck, especially for long sequences, making deep iterative reasoning prohibitively expensive.

Methods

The authors introduce MELT, which decouples reasoning depth from memory consumption through three primary innovations:

  1. Gated KV Updates: Instead of appending new KV entries at each loop, MELT maintains a single latent state $h$ per token. This state is updated across loops using a learnable gating mechanism (similar to a GRU). This allows the model to "decide" what information to keep or overwrite, keeping the KV cache size constant regardless of the number of loops.
  2. Interpolated Transition (Phase 1 Training): To avoid "shocking" a pretrained looped model (like Ouro) with a new architecture, the authors use a linear interpolation ($\alpha$) to slowly fade from the original KV cache behavior to the MELT gated behavior during fine-tuning.
  3. Attention-Aligned Distillation (Phase 2 Training): To prevent the model's representations from drifting, they use a frozen LoopLM as a teacher. They apply a specific loss to ensure MELT’s post-attention states match the teacher’s at every layer and every loop.
  4. Chunk-wise Training: Because gated updates create a sequential dependency (you can't compute token $t+1$ until token $t$ is finished), the authors process sequences in fixed-length chunks to balance training efficiency with the need to simulate autoregressive inference.

Datasets

  • Training: A 50/50 mix of AceReason-1.1-SFT and OpenThoughts3, totaling roughly 256M tokens focused on mathematical reasoning and coding.
  • Evaluation:
    • Math/Reasoning: AIME (2024-26), AMC23, MATH-500, and OlympiadBench.
  • General/Knowledge: GPQA, HLE, MMLU-Red, and HumanEval (coding).

Key Insights and Ideas

  • The "Gradient Superhighway": The authors provide a theoretical proof showing that their gating mechanism acts as a structural stabilizer. By keeping the "spectral radius" of the recurrence near unity, they prevent gradients from vanishing or exploding, allowing the model to optimize much deeper reasoning chains than previous recurrent designs.
  • Gating Over Averaging: Ablation studies revealed that simple strategies—like just averaging KV states across loops or only keeping the last one—fail miserably on complex tasks. The element-wise gate is crucial because it allows the model to selectively preserve specific features across iterations.
  • Memory vs. Logic: MELT proves that the "memory tax" of looped models isn't a fundamental requirement for reasoning. You can compress the "thinking" of multiple passes into a single KV entry if you train the model to manage that memory dynamically.

Key Results

  • Massive Memory Savings: MELT-1.6B reduces KV cache memory usage by 3–4x compared to Ouro-1.4B. For a 32k sequence, Ouro requires ~25GB for its KV cache, while MELT requires only ~6GB.
  • Superior Performance-to-Size Ratio: MELT-1.6B consistently outperformed similarly sized non-looped models like Qwen3-1.7B, Gemma4-E2B, and DeepSeek-R1-1.5B across mathematical benchmarks.
  • Closing the Gap: While MELT is slightly behind the original Ouro (which has the advantage of "infinite" memory via its expanded cache), it retains the vast majority of the performance while operating within the memory constraints of a standard transformer. On HumanEval, MELT actually outperformed the original Ouro (81.7 vs 76.8).

Limitations and Future Work

  • Fixed Loop Depth: Currently, MELT uses a fixed number of loops for every token. The authors note that MELT’s constant-memory design is a perfect candidate for adaptive looping (spending more "thought" on hard tokens and less on easy ones).
  • Sequential Bottleneck: The gated update introduces a sequential dependency during training, which is slower than the highly parallel nature of standard Transformers. Finding ways to further parallelize this is a key next step.
  • Multi-Query Attention (MQA): The current version of MELT does not yet implement MQA or Grouped-Query Attention. Combining MELT with these techniques could lead to even more dramatic memory efficiency.

Summary updated

BibTeX
@inproceedings{vendrell2026memory,
  author = {Victor Conchello Vendrell and Arnau Padrés Masdemont and Niccolò Grillo and Jordi Ros-Giralt and Arash Behboodi and Fabio Valerio Massoli},
  title = {{Memory-Efficient Looped Transformer: Decoupling Compute from Memory in Looped Language Models}},
  booktitle = {FoGen @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=YTnbmK4xku},
}
Figure