Visual Autoregressive (VAR) models adopt a next-scale prediction paradigm, offering high-quality content generation with substantially fewer decoding steps. However, existing VAR models suffer from significant attention complexity and severe memory overhead due to the accumulation of key-value (KV) caches across scales. In this paper, we tackle this challenge by introducing KV cache compression into the next-scale generation paradigm. We begin with a crucial observation: attention heads in VAR models can be divided into two functionally distinct categories: Contextual Heads focus on maintaining semantic consistency, while Structural Heads are responsible for preserving spatial coherence. This structural divergence causes existing one-size-fits-all compression methods to perform poorly on VAR models. To address this, we propose HACK, a training-free Head-Aware KV cache Compression frameworK. HACK utilizes an offline classification scheme to separate head types, enabling it to apply pattern-specific compression strategies with asymmetric cache budgets for each category. By doing so, HACK effectively constrains the average KV cache length within a fixed budget $B$, reducing the theoretical attention complexity from $\mathcal{O}(n^4)$ to $\mathcal{O}(Bn^2)$. Extensive experiments on multiple VAR models across text-to-image and class-conditional tasks validate the effectiveness and generalizability of HACK. It achieves up to 70% KV cache compression without degrading output quality, resulting in memory savings and faster inference. For example, HACK provides a $1.75\times$ memory reduction and a $1.57\times$ speedup on Infinity-8B.


翻译:视觉自回归模型采用下一尺度预测范式,以显著更少的解码步骤实现高质量内容生成。然而,现有VAR模型因跨尺度键值缓存累积而面临显著的注意力计算复杂度和严重的内存开销。本文通过将KV缓存压缩引入下一尺度生成范式来解决这一挑战。我们首先提出一个关键观察:VAR模型中的注意力头可分为功能迥异的两类:上下文注意力头专注于维持语义一致性,而结构注意力头负责保持空间连贯性。这种结构差异导致现有的一刀切压缩方法在VAR模型上表现不佳。为此,我们提出HACK——一种无需训练的头部感知KV缓存压缩框架。HACK采用离线分类方案分离头部类型,使其能够为每类注意力头应用特定模式的压缩策略并分配非对称缓存预算。通过这种方式,HACK将平均KV缓存长度有效约束在固定预算$B$内,将理论注意力复杂度从$\mathcal{O}(n^4)$降低至$\mathcal{O}(Bn^2)$。在文本到图像和类别条件任务上对多个VAR模型进行的广泛实验验证了HACK的有效性和泛化能力。该方法在保持输出质量不变的前提下实现高达70%的KV缓存压缩,带来内存节约和推理加速。例如,在Infinity-8B模型上,HACK实现了1.75倍的内存缩减和1.57倍的推理加速。

0
下载
关闭预览

相关内容

【TPAMI2024】增强视频-语言表示的结构时空对齐方法
专知会员服务
24+阅读 · 2024年6月30日
【ICML2023】SEGA:结构熵引导的图对比学习锚视图
专知会员服务
22+阅读 · 2023年5月10日
论文浅尝 | Know-Evolve: Deep Temporal Reasoning for Dynamic KG
开放知识图谱
36+阅读 · 2018年3月30日
国家自然科学基金
2+阅读 · 2017年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
17+阅读 · 2008年12月31日
VIP会员
相关基金
国家自然科学基金
2+阅读 · 2017年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
17+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员