arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2503.12450cs.CV

LazyMAR:通过特征缓存加速掩码自回归模型

LazyMAR: Accelerating Masked Autoregressive Models via Feature Caching

Beijing Institute of Technology(北京理工大学);Central South University(中南大学);China University of Mining and Technology(中国矿业大学);University of Electronic Science and Technology of China(电子科技大学);Tsinghua University(清华大学);Shanghai Jiaotong University(上海交通大学)

Feihong Yan, Qingyan Wei, Jiayi Tang, Jiajun Li, Yulin Wang, Xuming Hu, Huiqi Li, Linfeng Zhang

AI总结:

针对 MAR 双向自注意力无法使用传统 KV 缓存的问题,本文提出训练免费、即插即用的 LazyMAR,通过令牌与条件两类特征缓存实现 2.83 倍加速且几乎不损失生成质量。

摘要:

掩码自回归(MAR)模型已成为图像生成中一种很有前景的方法,人们期望其借助并行解码能力,在计算效率上超越传统自回归模型。然而,它们对双向自注意力的依赖与传统的 KV 缓存机制存在内在冲突,从而产生了意外的计算瓶颈,削弱了其预期效率。为解决这一问题,本文利用两类冗余研究了 MAR 的缓存机制:Token Redundancy(令牌冗余)表明,很大一部分令牌在相邻解码步骤中具有非常相似的表示,这使我们能够先在先前步骤中缓存它们,再在后续步骤中复用。Condition Redundancy(条件冗余)表明,classifier-free guidance(无分类器引导)中有条件输出与无条件输出之间的差异在相邻步骤中呈现非常相似的值。基于这两类冗余,我们提出 LazyMAR,它引入两种缓存机制分别处理它们。LazyMAR 无需训练,并且对所有 MAR 模型即插即用。实验结果表明,我们的方法实现了 2.83 倍加速,且生成质量几乎没有下降。代码将发布于 https://github.com/feihongyan1/LazyMAR。

英文摘要:

Masked Autoregressive (MAR) models have emerged as a promising approach in image generation, expected to surpass traditional autoregressive models in computational efficiency by leveraging the capability of parallel decoding. However, their dependence on bidirectional self-attention inherently conflicts with conventional KV caching mechanisms, creating unexpected computational bottlenecks that undermine their expected efficiency. To address this problem, this paper studies the caching mechanism for MAR by leveraging two types of redundancy: Token Redundancy indicates that a large portion of tokens have very similar representations in the adjacent decoding steps, which allows us to first cache them in previous steps and then reuse them in the later steps. Condition Redundancy indicates that the difference between conditional and unconditional output in classifier-free guidance exhibits very similar values in adjacent steps. Based on these two redundancies, we propose LazyMAR, which introduces two caching mechanisms to handle them one by one. LazyMAR is training-free and plug-and-play for all MAR models. Experimental results demonstrate that our method achieves 2.83 times acceleration with almost no drop in generation quality. Our codes will be released in https://github.com/feihongyan1/LazyMAR.

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

↑