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

Yingwei Song, Tony Zhu, Kelly Peng, Yuan Gao, Huanrui YangarXiv 2026

TL;DR

Generating long videos chunk-by-chunk requires constantly reading a massive memory bank of past frames, eating up gigabytes of VRAM and over half your compute time. ZenAttention figures out why compressing both this memory bank and the math on it down to 4 bits usually ruins video quality—discovering sneaky feedback loops and a single ultra-sensitive "copy head"—and fixes both on the fly. The result is a drop-in CUDA kernel that slashes memory by two-thirds and nearly doubles generation speed without losing a shred of visual crispness.

What Problem Does This Paper Address?

Streaming video diffusion models generate long videos autoregressively, producing a few frames (a "chunk") at a time. To keep characters and backgrounds consistent, every new chunk looks back at past frames stored in a Key-Value (KV) cache. Unlike LLM text decoding—which processes one token at a time and is bottlenecked by memory bandwidth—video generation processes thousands of spatial tokens per step, making self-attention heavily compute-bound (consuming up to 58% of total denoising time) while the 16-bit (bf16) cache hogs nearly 10 GiB of VRAM.

Ideally, you would quantize finished frames into 4-bit precision (NVFP4—NVIDIA's block-scaled 4-bit floating-point format) once, store them, and run fast 4-bit Tensor Core math directly on them. Yet existing methods only achieve half the dream:

  • 4-bit compute methods (like SageAttention3) keep a bloated bf16 cache and waste time re-quantizing the entire history at every single call—and still wash out up to 28% of fine visual detail.
  • 4-bit cache methods save memory by writing 4-bit records once, but unpack them back to bf16 before computing attention, yielding zero speedup.

Naively gluing the two together fails too: the generated video progressively blurs out into mush. Why?

Methods

ZenAttention introduces a custom NVIDIA Blackwell CUDA kernel built around three core ideas that directly target the root causes of 4-bit degradation:

  1. Write-Once NVFP4 Records: When a video chunk finishes denoising, its keys and values are quantized to 4 bits once and stored alongside lightweight per-key/per-channel summary statistics (means, norms, and quantization error norms).
  2. Closed-Form Bias Corrections: Low-bit rounding isn't random zero-mean noise—it systematically biases attention. Rounding small numbers to zero shrinks vectors (flattening attention), score noise inflates exponentials via Jensen's inequality ($E[e^{s+\varepsilon}] > e^s$), and rounding small post-softmax probabilities to zero creates a "dead zone" that oversharpens weights. Using the stored cache statistics, ZenAttention debiasing rescales inner products, subtracts half the estimated score variance, and applies deterministic table-based dithering (stochastic rounding) before quantizing attention weights. Remarkably, all score corrections fold into a single fused multiply-add (FMA) instruction per score.
  3. Mixed-Precision Two-Tier Cache: Older history lives in the 4-bit tier, while the current chunk and the single newest cached frame sit in a crisp 8-bit (INT8/FP8) tier. Both tiers seamlessly feed into a single FlashAttention-style online softmax pass.

Datasets

ZenAttention requires zero retraining and is evaluated purely at inference time across eight streaming video and interactive world models (1.3B to 5B parameters, built on Wan 2.1 and Wan 2.2 backbones).

  • Prompts & Benchmarks: Evaluated on VBench (946 prompts for 11-second videos) and MovieGen prompts (up to 128 prompts for 60-second rollouts, including the VBench-Long protocol).
  • New Metric Note: Because autoregressive video rollouts are chaotic—tiny 0.17% numerical noise sends a video onto a completely different trajectory within two chunks—pixel-by-pixel MSE against a bf16 baseline measures trajectory divergence rather than visual quality. To isolate true blur vs. oversharpening, the authors measure latent detail: the high-frequency spatial norm above a $3\times3$ local mean in latent space.

Key Insights and Ideas

  • The Cache Feedback Amplifier: By comparing normal "free" rollouts against "teacher-forced" rollouts (where the 4-bit kernel reads a pristine bf16 cache), the authors prove that single-step 4-bit error doesn't grow over time—the cache amplifies it roughly $3\times$ by feeding biased outputs back into history. Furthermore, injecting synthetic errors shows that systematic sign bias drives almost all single-chunk loss and dominates this compounding drift.
  • The Fragile "Copy Head": Why does the first frame of every new chunk lose contrast at 4 bits? Tracing all 360 attention heads in Wan 2.1, the authors uncovered a single head (Layer 29, Head 9) inherited from the base model that places 99.9% of its attention mass on the exact same spatial pixel in the immediately preceding frame! Coarse 4-bit score errors occasionally knock that single target pixel off its #1 spot, acting like dead pixels in a copy operation. Keeping just the newest cached frame at 8 bits completely protects this temporal bridge across models without needing messy per-head rules.

Key Results

Speed of ZenAttention across single calls, end-to-end denoising, and eight streaming models.

Speed of ZenAttention across single calls, end-to-end denoising, and eight streaming models.

Tested on an NVIDIA RTX 5090 across eight models (including Self-Forcing, CausVid, LongLive-2.0-5B, and LingBot-World v2):

  • Blistering Speed: Reaches 628–637 effective TOPS per call ($1.45\times$ faster than 8-bit SageAttention2++ and $3.4\times$ faster than FlashAttention-2). Across full videos, self-attention runs $2.6\text{–}3.5\times$ faster than bf16 and $1.23\text{–}1.50\times$ faster than SageAttention2++.
  • End-to-End Acceleration: Speeds up full pipeline denoising by up to $1.89\times$ over bf16. Paired with 4-bit linear layers on LongLive-2.0-5B, it generates a 64-second $704\times1280$ HD video in 68.8s instead of 126.4s ($1.84\times$ speedup).
  • Memory & Fidelity: Cuts KV-cache memory by two-thirds (33–35% of bf16, dropping Self-Forcing's cache from 5.62 GiB to 1.94 GiB). Latent detail stays within 0.7% of bf16 on all eight models (whereas uncorrected 4-bit SageAttention3 loses 4–28% and visually dissolves into specks), and VBench scores are statistically indistinguishable from bf16.

Limitations and Future Work

  • Where It Pays Off: Speedups shine when multi-frame KV-cache attention is a major share of runtime; for models with tiny cache windows or massive non-attention bottlenecks, end-to-end gains are naturally smaller.
  • Slight Precision Trade-off: Compared directly against 8-bit attention, ZenAttention trades away a tiny sliver of latent detail (0.2–0.7 percentage points) on three of the eight tested models.
  • Hardware Scope: The compiled PTX/CUDA kernel specifically targets NVIDIA Blackwell GPUs (compute capability 12.0, which supports hardware NVFP4 instructions) with a fixed head dimension of 128, and the deep diagnostic ablations focus primarily on Self-Forcing. Future directions are not explicitly discussed in the paper.

Summary updated

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