dKV-Cache: The Cache for Diffusion Language Models

Xinyin Ma, Runpeng Yu, Gongfan Fang, Xinchao Wang

arXiv:2505.15781 · 2026-07-27 공개 · arXiv · PDF

code-generation training-free kv-cache diffusion-language-models inference-speedup mathematical-benchmarks denoising-process contextual-information

Abstract

Diffusion Language Models (DLMs) have been seen as a promising competitor for autoregressive language models. However, diffusion language models have long been constrained by slow inference. A core challenge is that their non-autoregressive architecture and bidirectional attention preclude the key-value cache that accelerates decoding. We address this bottleneck by proposing a KV-cache-like mechanism, delayed KV-Cache, for the denoising process of DLMs. Our approach is motivated by the observation that different tokens have distinct representation dynamics throughout the diffusion process. Accordingly, we propose a delayed and conditioned caching strategy for key and value states. We design two complementary variants to cache key and value step-by-step: (1) dKV-Cache-Decode, which provides almost lossless acceleration, and even improves performance on long sequences, suggesting that existing DLMs may under-utilise contextual information during inference. (2) dKV-Cache-Greedy, which has aggressive caching with reduced lifespan, achieving higher speed-ups with quadratic time complexity at the cost of some performance degradation. dKV-Cache, in final, achieves from 2-10x speedup in inference, largely narrowing the gap between ARs and DLMs. We evaluate our dKV-Cache on several benchmarks, delivering acceleration across general language understanding, mathematical, and code-generation benchmarks. Experiments demonstrate that cache can also be used in DLMs, even in a training-free manner from current DLMs.

한국어 요약

한 줄 요약

dKV-Cache는 확산 언어 모델(DLM)의 추론 속도를 2~10배 가속화하는 지연형 키-밸류 캐시 메커니즘을 제안한다.

핵심 기여도

핵심 아이디어

DLM은 비자율적 아키텍처와 양방향 어텐션으로 인해 기존 KV-Cache를 사용할 수 없었다. 그러나 토큰의 표현 동역학을 분석한 결과, 키-밸류 상태는 이미 디코딩된 토큰에 대해서는 재사용 가능하다는 점을 발견했다. 이에 따라, 디코딩된 토큰의 키-밸류를 **지연된 조건부 캐시** 방식으로 저장하는 dKV-Cache를 제안했다. 특히, 토큰이 디코딩되기 전까지는 캐시를 지연시켜 메모리 사용량을 줄이고, 디코딩 단계에서만 선택적으로 재사용함으로써 효율성을 극대화했다.

기술적 접근법

주요 결과

의의 및 한계

실용적 활용