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

Yingwei Song, Tony Zhu, Kelly Peng, Yuan Gao, Huanrui Yang
11/25/2026
cs.CVcs.LG
diffusion-flowtransformer-attention

Official code: wrencanfly/ZenAttention (0 stars, Cuda, Apache-2.0, PyTorch, last commit 2026-11-30).

Abstract

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.

Show full abstract

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

View on arXivView PDF

Code Implementations(1)

PyTorchApache-2.0

4-bit (NVFP4) attention computed directly on a quantized KV cache for streaming video diffusion on NVIDIA Blackwell GPUs: 1.45× SageAttention2++ and 3.4× FlashAttention-2 on an RTX 5090, one-third the cache memory, bf16/8-bit quality.

00Cuda, PythonNov 19, 20262 days agoApache-2.0
attentioncudakv-cachelonglivenvfp4+7 more

Similar Papers

Cite this paper

@article{song2026zenattention,
  title  = {ZenAttention: 4-bit Attention Directly on a Quantized KV Cache for Streaming Video Diffusion},
  author = {Yingwei Song and Tony Zhu and Kelly Peng and Yuan Gao and Huanrui Yang},
  year   = {2026},
  eprint = {2611.35314},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2611.35314v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2611.35314.svg)](https://codeofpaper.com/paper/2611.35314)

Discussion