arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.20600cs.CV
收藏

面向头部的键值压缩用于高效自回归图像生成

Head-Aware Key-Value Compression for Efficient Autoregressive Image Generation

Harbin Institute of Technology, Shenzhen(哈尔滨工业大学(深圳));Peng Cheng Laboratory(鹏城实验室)

Guotao Liang, Baoquan Zhang, Zhiyuan Wen, Yunming Ye

AI总结:

本文提出HeadKV框架,通过根据注意力头的局部性偏置分配不同的缓存预算,提高自回归图像生成的效率和内存利用率,同时设计分层令牌驱逐策略以保留长距离信息。

摘要:

自回归(AR)视觉生成在性能上取得了显著成果,但存在内存使用高和吞吐量低的问题,因为需要缓存之前生成的视觉标记。最近的研究表明,仅保留少量缓存标记即可维持高质量图像,同时显著减少内存使用并提高吞吐量。然而,这些方法为每个注意力头分配固定预算,忽视了注意力头之间的异质性,导致内存分配不优。在本文中,我们观察到不同层的注意力头表现出多样的注意力模式,其中一些头专注于局部邻域,而另一些头捕捉更广泛的上下文依赖。基于这一见解,我们提出了一种新的面向头部的键值(KV)缓存压缩框架,称为HeadKV,用于自回归图像生成,该框架为局部偏置头分配较小的预算,为具有更广泛注意力的头分配更大的预算。一个关键挑战在于确定每个注意力头的类型以指导缓存压缩。我们进一步观察到,在同一层中,每个头在不同位置的令牌上表现出一致的注意力模式,即一个头在早期令牌上的行为与后期令牌上的行为保持一致。这一见解表明,头类型可以在早期阶段确定并在生成过程中重用以进行KV压缩。其优势是它不需要额外的训练或数据集级统计,并且可以无缝泛化到不同的输入。此外,我们设计了一种分层令牌驱逐策略以有效保留长距离信息。广泛的实验展示了其在多种自回归图像生成模型上的有效性。

英文摘要:

Autoregressive (AR) visual generation has achieved remarkable performance but suffers from high memory usage and low throughput, as it requires caching previously generated visual tokens. Recent research has shown that retaining only a few lines of cache tokens can maintain high-quality images while significantly reducing memory usage and improving throughput. However, these methods allocate a fixed budget to each attention head, overlooking the heterogeneity among attention heads, leading to suboptimal memory allocation. In this paper, we observe that attention heads across different layers exhibit diverse attention patterns, where some heads focus on local neighborhoods while others capture broader contextual dependencies. Based on this insight, we propose a novel head-aware key-value (KV) cache compression framework for autoregressive image generation, called HeadKV, which assigns smaller budgets to locality-biased heads and larger budgets to heads with broader attention. A key challenge lies in identifying the type of each attention head to guide cache compression. We further observe that, within the same layer, each head exhibits consistent attention patterns across token positions, \emph{i.e.}, a head's behavior for early tokens remains consistent with that for later tokens. This insight suggests that head types can be identified during the early stage and reused for KV compression throughout generation. Its advantage is that it requires no additional training or dataset-level statistics and generalizes seamlessly across different inputs. Moreover, we design a Stratified Token Eviction strategy to effectively preserve long-range information. Extensive experiments demonstrate its effectiveness across multiple autoregressive image generation models.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑