窗口扩散:通过窗口化令牌修剪和缓存加速扩散语言模型推理
Window-Diffusion: Accelerating Diffusion Language Model Inference with Windowed Token Pruning and Caching
AI总结:
Window-Diffusion通过窗口化令牌修剪和缓存技术,显著提升扩散语言模型推理速度,同时保持生成性能。
摘要:
扩散语言模型(DLMs)通过迭代去噪生成文本,但推理需要在每次迭代中对完整序列进行注意力计算,导致在被掩码的令牌上产生大量冗余计算。块状扩散可以减少这种成本,但通常依赖于重新训练和受限制的更新顺序,限制了其直接应用于预训练DLMs的适用性。我们对令牌级别的分析揭示了DLM推理中显著的结构局部性。解码由一小部分局部化前缀的活跃令牌驱动;远处未解码上下文的影响迅速减弱,解码令牌在阶段内表现出时间稳定性,使中间表示可以重用,除了短暂的后解码瞬态。受这些观察的启发,我们提出了\textbf{\placeholder}\footnote{源代码可在https://github.com/vhicrgit/Window-Diffusion获取。},一种基于窗口的令牌修剪和缓存方法用于推理。我们维护一个局部计算窗口,随着去噪进程向右滑动,并将未解码令牌划分为:(i)\textit{活跃令牌},其在线计算;(ii)\textit{缓冲令牌},其KV状态被缓存并定期刷新;(iii)\textit{远场令牌},其被修剪出窗口之外。计算仅限于窗口内的活跃和缓冲令牌,而远场令牌在每个阶段都被省略。在LLaDA和Dream上的实验表明,在匹配的计算预算下,我们的方法在保持生成性能的同时,实现了高达99倍的推理加速。
英文摘要:
Diffusion language models (DLMs) generate text through iterative denoising, but inference requires full-sequence attention at every iteration, resulting in substantial redundant computation on masked tokens. Block-wise diffusion can reduce this cost, yet it typically relies on retraining and constrained update orders, limiting its direct applicability to pretrained DLMs. Our token-level analysis reveals pronounced structural locality in DLM inference. Decoding is driven by a small set of prefix-localized active tokens; the influence of distant undecoded context diminishes rapidly, and decoded tokens exhibit stage-wise temporal stability, enabling reuse of intermediate representations except for a brief post-decode transient. Motivated by these observations, we propose \textbf{\placeholder}\footnote{The source code is available at https://github.com/vhicrgit/Window-Diffusion.}, a window-based token pruning and caching method for inference. We maintain a local computation window that slides rightward as denoising progresses, and partition undecoded tokens into: (i) \textit{active tokens} that are computed online, (ii) \textit{buffer tokens} whose KV states are cached and periodically refreshed, and (iii) \textit{far-field tokens} that are pruned outside the window. Computation is restricted to active and buffer tokens within the window, while far-field tokens are omitted at each stage. Experiments on LLaDA and Dream show that, under matched compute budgets, our method achieves up to $99\times$ inference speedup while largely preserving generation performance.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。