LoopCache: Accelerating Long-Context Self-Speculative Decoding for Looped Transformers

Zizhuo Fu, Haochen Huang, Shengxuan Qiu, Linye Wei, Ziyu Tang, Runsheng Wang, Meng LiarXiv 2026 · arXiv

Looped Transformers are a clever architectural trick for scaling "test-time compute." By repeatedly passing hidden states through a weight-shared block for $R$ recurrent steps, these models achieve the effective depth of a massive network with a fraction of the parameters. However, this recurrence creates a massive inference bottleneck: generating a single token requires $R$ sequential passes, and in long-context scenarios, the memory traffic from attending to a massive Key-Value (KV) cache becomes a dealbreaker.

LoopCache, a new framework from researchers at Peking University, tackles this bottleneck head-on. It introduces a self-speculative decoding strategy that achieves over 10× speedup compared to existing state-of-the-art methods by rethinking how we handle intermediate predictions and memory access.

TL;DR

LoopCache accelerates Looped Transformers by dynamically updating draft tokens based on intermediate loop confidence and implementing a cyclic KV cache scheduling strategy. This reduces memory traffic from $R\times$ to nearly $1\times$ while maintaining lossless verification, resulting in massive speedups (up to 14.56×) for long-context decoding.

What Problem Does This Paper Address?

The primary challenge with Looped Transformers is their sequential nature. To speed this up, previous "wave-style" methods like WaveFront Decoding (WFD) and LoopSpec pipeline the process, drafting and verifying tokens at different depths simultaneously.

However, these methods suffer from two "critical limitations":

  1. Stale Trajectories: They draft only at fixed loops. If a prediction changes at an intermediate loop, the model continues down an outdated path until the final verification, wasting compute.
  2. Memory Traffic Amplification: Because tokens in a single batch are at different recurrent depths, the system must load up to $R$ different loop-specific KV caches per step. In long-context settings (tens of thousands of tokens), this $R\times$ memory overhead completely offsets the benefits of pipelining.
Figure 1: Architecture of looped Transformers.

Methods

LoopCache introduces three key innovations to solve these issues:

  1. Confidence-Guided Dynamic Draft Updating: Instead of drafting at fixed depths, LoopCache monitors predictions across all intermediate loops. If a prediction switches and the "logit gap" (confidence) exceeds a threshold $\tau$, the draft is updated in flight. This prunes stale trajectories early without the exponential branch growth of naive approaches.
  2. Cyclic Loop KV Cache Scheduling: To fix the memory bottleneck, LoopCache rotates through loop-specific KV caches in a fixed cycle ($KV_{R1} \to KV_{R2} \dots$). This ensures that every token in a batch attends to the same long-prefix KV cache at any given step, reducing traffic to $1\times$ (the same as standard autoregressive decoding).
  3. Selective Shallow-Layer KV Decoupling: The authors observed that shallow layers are highly sensitive to loop differences, while deeper layers are more stable. LoopCache selectively retains independent KV caches for just a few shallow layers, improving draft acceptance rates with negligible memory overhead.
Figure 2: Token generation dataflows and per-step KV cache read overheads for a Looped Transformer (R = 4) under (a) AutoRegressive, (b) Draft-then-Verify, and (c) WaveFront Decoding / LoopSpec.

Datasets

The authors evaluated LoopCache across six different Looped Transformer models (including Ouro, Huginn, and Raven variants) using three major long-context benchmarks:

  • LongBench v1/v2: For bilingual, multi-task long-context understanding.
  • RULER: To test retrieval and reasoning at varying context lengths.
  • LongReason: A synthetic benchmark for long-context reasoning. Evaluation spanned context lengths from 4K to 128K tokens.

Key Insights and Ideas

  • The "Aha" Moment on KV Similarity: The researchers found that KV states across different loops exhibit high cosine similarity, especially in deeper layers. This justifies using a "mismatched" KV cache for drafting, as long as the final verification uses the correct loop-specific cache.
  • Confidence as a Pruning Signal: There is a strong correlation between prediction switches and output confidence. By using the logit gap to guide updates, LoopCache maintains a single active draft trajectory, avoiding the "branching explosion" that plagues other speculative methods.
  • Memory vs. Compute: In the long-context regime, inference is memory-bound, not compute-bound. Reducing the number of KV cache loads is far more impactful for wall-clock speed than reducing FLOPs.
Figure 3: Intermediate-loop prediction behavior. (a) Fixed-depth drafting versus draft updating with intermediate-loop predictions. (b) Token switch probability across recurrent loops. (c) Agreement between intermediate-loop and final-loop predictions.

Key Results

LoopCache demonstrates significant performance gains across the board:

  • Massive Speedups: It achieves an average 10.25× speedup over WFD and 14.56× over LoopSpec. Compared to standard autoregressive (AR) decoding, it is 5.12× faster.
  • Long-Context Robustness: Unlike previous wave-style methods that slow down as context grows (sometimes becoming slower than AR), LoopCache maintains its speedup even at 128K tokens.
  • Efficiency: It reduces total KV cache reads significantly while maintaining high "Tokens Per Forward" (TPF), proving that it effectively manages the memory-compute trade-off.

Limitations and Future Work

  • Model Specificity: The current framework is tailored for Looped Transformers. While the principles of confidence-guided drafting could apply to standard Transformers (e.g., using early-exit layers), the cyclic KV scheduling is specific to the weight-shared recurrent structure.
  • Memory Overhead: While "negligible," the selective decoupling of shallow layers does require storing a few extra KV caches, which might be a constraint for extremely memory-limited edge devices.
  • Future Directions: The authors suggest exploring more adaptive scheduling strategies and integrating LoopCache with KV cache compression techniques (like quantization or eviction) to push the context limits even further.

Summary updated

Abstract

Looped Transformers achieve large effective depth with compact models by repeatedly applying a weight-shared block across R recurrent steps, each maintaining a loop-specific key-value (KV) cache. To accelerate sequential loop execution, recent wave-style self-speculative methods like WaveFront Decoding (WFD) and LoopSpec pipeline draft and target tokens across loops in a single step. However, they face two critical limitations. First, they draft only at fixed loops and ignore intermediate prediction changes, wasting computation on stale trajectories. Second, batching tokens from different loops loads up to Rx the KV cache per step, severely amplifying memory traffic in long-context scenarios. To address these challenges, we propose LoopCache, an efficient self-speculative decoding framework for long-context Looped Transformers. Based on the correlation between prediction switches and output confidence, LoopCache introduces confidence-guided dynamic draft updating to refine drafts in flight across all intermediate loops. Furthermore, LoopCache employs a cyclic loop KV cache strategy that rotates through loop-specific KV caches, restricting per-step KV traffic to a single loop while batching tokens at the nearest matching cycle for lossless verification. By also selectively retaining independent KV caches for a few loop-sensitive shallow layers, LoopCache improves acceptance rates with negligible overhead. Experiments show that LoopCache achieves average 10.25x and 14.56x speedup over WFD and LoopSpec.
BibTeX
@misc{fu2026loopcache,
  author = {Zizhuo Fu and Haochen Huang and Shengxuan Qiu and Linye Wei and Ziyu Tang and Runsheng Wang and Meng Li},
  title = {{LoopCache: Accelerating Long-Context Self-Speculative Decoding for Looped Transformers}},
  year = {2026},
  eprint = {2611.24301},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.24301},
}
Figure