掩码令牌即先知:面向高效dLLM推理的细粒度缓存驱逐
Mask Tokens as Prophet: Fine-Grained Cache Eviction for Efficient dLLM Inference
AI总结:
针对扩散大语言模型缓存开销大的问题,提出免训练的MaskKV框架,通过掩码查询引导评分和自适应预算策略,在LLaDA上压缩KV缓存至5%以下仍保持94%性能,并实现31倍加速。
摘要:
扩散大语言模型(dLLMs)通过并行解码能力,为占主导地位的自回归模型(ARMs)提供了一种有前景的替代方案,但代价是巨大的计算和内存开销。具体而言,dLLMs中双向注意力的缓存机制需要大量内存占用,限制了其在资源受限环境下处理长上下文的能力。现有的缓存驱逐策略是为ARMs设计的,忽略了dLLMs的独特特性,导致性能不佳。为解决这些挑战,我们引入了MaskKV,一个针对dLLMs量身定制的免训练缓存驱逐框架,聚焦于dLLMs中掩码令牌的作用。MaskKV基于两项关键创新:(1)一种掩码查询引导的评分机制,利用注意力权重来识别并驱逐每个头中较不关键的提示令牌;(2)一种自适应缓存预算策略,通过减少中间层的分配并将资源集中于偏好提示的头,来提高效率。在LLaDA上使用MaskKV,将KV缓存压缩至仅256对(少于5%的令牌),在LongBench上保留了全缓存性能的94%,并在32k提示长度下实现了高达31倍的加速。代码公开于:https://github.com/jianuo-huang/MaskKV
英文摘要:
Diffusion large language models (dLLMs) present a promising alternative to dominant autoregressive models (ARMs) by the ability of parallel decoding at the expense of substantial computation and memory costs. Specifically, the cache mechanism for bidirectional attention in dLLMs demands large memory footprint, restricting their ability to handle long contexts under resource-limited settings. Existing cache eviction strategies are designed for ARMs and ignore the unique characteristics of dLLMs, thus leading to unsatisfactory performance. To address these challenges, we introduce MaskKV, a training-free cache eviction framework tailored to dLLMs, focusing on the effect of mask tokens in dLLMs. MaskKV is built on two key innovations: (1) a mask-query guided scoring mechanism that leverages attention weights to identify and evict less critical prompt tokens for each head; (2) an adaptive cache budgeting strategy that improves efficiency by reducing allocation in intermediate layers and concentrating resources on prompt-preferring heads. On LLaDA with MaskKV, compressing the KV cache to only 256 pairs (less than 5% of tokens) retains 94% of the full-cache performance on LongBench and achieves up to 31x acceleration at 32k prompt length. The code is publicly available at: https://github.com/jianuo-huang/MaskKV
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。