NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

dKV-Cache: The Cache for Diffusion Language Models

Xinyin Ma, Runpeng Yu, Gongfan Fang, Xinchao Wang

TL;DR

Diffusion Language Models (DLMs) offer a promising, highly parallel alternative to standard autoregressive models but have long been plagued by $O(L^3)$ inference complexity. This paper introduces dKV-Cache, a training-free, "delayed" key-value caching mechanism that achieves 2–10$\times$ speedups by exploiting the fact that token representations stabilize once they are decoded.

The Challenge: Why DLMs Can't Use Standard KV-Cache

In the world of Large Language Models, Autoregressive (AR) models like GPT are the gold standard. They generate text one token at a time from left to right, using a "KV-Cache" to store previous computations. This caching mechanism keeps their per-token complexity at a manageable $O(L^2)$.

Diffusion Language Models (DLMs) are a newer contender. Instead of generating text sequentially, they start with a sequence of noise (or masks) and refine the entire block simultaneously. While theoretically parallelizable, they are painfully slow in practice. Two main roadblocks prevent them from using standard KV-caching:

  1. Bidirectional Attention: In DLMs, every token attends to every other token. Because every token is changing during the denoising process, you cannot simply "freeze" and cache previous states as you would in an AR model.
  2. Non-Sequential Decoding: DLMs do not fill in blanks from left to right; they might decode a word at the end of a sentence before one at the beginning.

Consequently, DLMs usually recompute the entire sequence at every denoising step, leading to a cubic $O(L^3)$ time complexity that makes them uncompetitive for real-world deployment.

Methods: Introducing dKV-Cache

To overcome these hurdles, the authors propose dKV-Cache (delayed KV-Cache), a caching strategy specifically tailored for the denoising dynamics of DLMs.

Comparison of standard Autoregressive KV-Cache and the proposed dKV-Cache.

The Core Insight: Stability After Decoding

By analyzing the representation dynamics of DLMs, the authors found that while masked tokens fluctuate wildly, a token’s representation becomes remarkably stable once it is "decoded" (unmasked).

Analysis of token representation dynamics during the diffusion process.

Key Techniques

Building on this insight, the authors developed several techniques to make caching viable for diffusion models:

  • One-Step Delay: The most significant change in a token's representation happens exactly when it transitions from a [MASK] to a real token. To avoid caching "stale" data, dKV-Cache waits exactly one step after a token is decoded before storing its Key and Value states.
  • dKV-Cache-Decode: This variant reuses cached states for all previously decoded tokens while recomputing only the currently masked ones. It provides nearly lossless acceleration and, surprisingly, sometimes improves performance on long sequences.
  • dKV-Cache-Greedy: A more aggressive version that restricts attention to the current token, the previous token, and a small local window. This successfully drops the complexity from $O(L^3)$ to $O(L^2)$, matching the scaling of AR models, though with a slight hit to accuracy.
  • Cache Refreshing: To prevent minor representation shifts from compounding into larger errors, the system periodically discards and recomputes the cache (e.g., every 8 steps).
  • concat_reorder Operator: Since DLMs decode tokens in arbitrary positions, the authors developed a custom operator to efficiently gather and scatter cached tensors without the overhead of standard non-contiguous memory indexing.

Key Insights and Results

The researchers evaluated dKV-Cache across several high-profile benchmarks using 7B and 8B parameter models (LLaDA and Dream), covering General Understanding (MMLU), Reasoning & Math (GSM8K, Math500, GPQA), and Code Generation (HumanEval, MBPP).

  • Massive Speedups: The method achieved 2–10$\times$ speedups in wall-clock inference time, largely narrowing the gap between ARs and DLMs.
  • Maintained (or Improved) Performance: The dKV-Cache-Decode variant maintained nearly identical accuracy to the original models. For example, on GSM8K with the LLaDA model, it achieved a 1.92$\times$ speedup with a slight increase in accuracy (78.85% vs 77.56%).
  • The Benefits of "Forgetting": The fact that the Decode variant sometimes outperformed the full-computation baseline on long sequences suggests that the standard DLM approach might suffer from "noise" by over-attending to fluctuating masked tokens. Caching stable tokens acts as a form of beneficial attention filtering.
  • Training-Free Wins: One of the biggest strengths of dKV-Cache is that it is a "plug-and-play" algorithmic improvement. It requires no fine-tuning or retraining of existing diffusion models.

Limitations and Future Work

While dKV-Cache represents a major leap forward for Diffusion Language Models, some challenges remain. The authors note that while their algorithmic design is efficient, there is still significant room for improvement at the system level (e.g., writing specialized CUDA kernels for the concat_reorder operation). Additionally, caching requires extra VRAM, which can become a bottleneck for very long sequences. Finally, while the $O(L^2)$ Greedy variant is fast, it shows noticeable performance degradation on complex reasoning tasks compared to the $O(L^3)$ version. Future work could focus on making this aggressive caching more "intelligent" to preserve accuracy while maintaining AR-like scaling.

Summary updated

BibTeX
@inproceedings{ma2025dkv,
  author = {Xinyin Ma and Runpeng Yu and Gongfan Fang and Xinchao Wang},
  title = {{dKV-Cache: The Cache for Diffusion Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=Gppo2JImHs},
}
Figure