arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2611.35314cs.CVcs.LG
收藏

ZenAttention:针对流式视频扩散模型的量化KV缓存直接4位注意力机制

ZenAttention: 4-bit Attention Directly on a Quantized KV Cache for Streaming Video Diffusion

University of Arizona(亚利桑那大学);Tsinghua University(清华大学);First Intuition

Yingwei Song, Tony Zhu, Kelly Peng, Yuan Gao, Huanrui Yang

AI总结:

ZenAttention针对流式视频扩散模型KV缓存4位注意力的质量问题,通过偏差校正与最新帧8位层级设计,实现了更快速度、更低内存占用与更高保真度的长视频生成。

摘要:

在长视频生成任务中,流式视频扩散模型在每一步去噪过程中,高达58%的时间都用于对过往帧的键值(KV)缓存进行注意力计算。若将该缓存与注意力计算均保持在4位精度,可大幅节省内存与时间,但现有方法仅能实现其中一项:FP4注意力会在每次调用时对bf16格式的缓存进行重新量化,且在流式滚动生成中会丢失4%-28%的高频隐层细节;而4位KV缓存则会在注意力计算前反量化回bf16格式。我们将4位注意力在缓存上的质量下降追溯至两个原因:FP4注意力误差存在系统性偏差,且会通过缓存反馈,在自强制(Self-Forcing)场景下将单块损失放大约3倍;最新缓存帧相比更早的历史帧需要更精确的注意力分数。ZenAttention针对每个原因分别设计了一个组件——每个分数仅需一次融合乘加运算的闭式偏差校正,以及针对最新帧的8位层级,且可直接对一次性写入的NVFP4格式KV缓存进行注意力计算。ZenAttention的性能表现为:在RTX 5090上达到628有效TOPS(是SageAttention2++的1.45倍),自注意力速度比bf16快2.6-3.5倍(是SageAttention2++的1.23-1.50倍,比8位和4位SageAttention更快),去噪速度比bf16快最高1.89倍(比LongLive 2.0的4位版本快1.84倍);通用性方面:单个内核无需重新训练即可适配8种流式视频与世界模型(参数规模13亿至50亿);内存占用方面:KV缓存内存减少三分之二(仅为bf16的33%-35%);保真度方面:在8种模型上隐层细节与bf16的差异保持在0.7%以内(而SageAttention3会丢失4%-28%),同时在自强制场景(946个提示词)和LongLive-2.0-5B(VBench-Long)上的VBench指标与bf16相当。代码:this https URL

英文摘要:

In long-video generation, streaming video diffusion models spend up to 58% of denoising time attending to a key-value (KV) cache of past frames at every step. Keeping both the cache and the attention computation in 4-bit precision would save substantial memory and time, yet existing methods achieve only one of the two: FP4 attention requantizes a bf16 cache at every call and loses 4-28% of high-frequency latent detail in streaming rollouts, whereas 4-bit KV caches dequantize back to bf16 before attention. We trace the quality drop of 4-bit attention on a cache to two causes: FP4 attention error is systematically biased and fed back through the cache, amplifying single-chunk loss roughly 3x on Self-Forcing; and the newest cached frame requires more precise attention scores than older history. ZenAttention addresses each cause with one component -- closed-form bias corrections costing one fused multiply-add per score and an 8-bit tier for the newest frame -- and computes attention directly on a write-once NVFP4 KV cache. ZenAttention is fast: 628 effective TOPS on an RTX 5090 (1.45x SageAttention2++), 2.6-3.5x faster self-attention than bf16 (1.23-1.50x SageAttention2++, faster than 8-bit and 4-bit SageAttention), and up to 1.89x faster denoising than bf16 (1.84x over LongLive 2.0's 4-bit release); general: one kernel runs without retraining across eight streaming video and world models (1.3B-5B); small: KV-cache memory drops by two-thirds (33-35% of bf16); and faithful: latent detail stays within 0.7% of bf16 across all eight models (vs. 4-28% lost by SageAttention3), while VBench matches bf16 on Self-Forcing (946 prompts) and LongLive-2.0-5B (VBench-Long). Code: https://github.com/wrencanfly/ZenAttention

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

↑