# ZenAttention

> Source: https://aiwiki.ai/wiki/zenattention
> Updated: 2026-12-01
> Categories: AI Inference, Video Generation
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) - attribute to "AI Wiki (aiwiki.ai)"
> Cite as: AI Wiki. "ZenAttention." aiwiki.ai, 1 Dec 2026. https://aiwiki.ai/wiki/zenattention
> From AI Wiki (https://aiwiki.ai), the free encyclopedia of artificial intelligence. Reuse freely with attribution.

**ZenAttention** is an attention algorithm and GPU kernel for streaming video [diffusion models](https://aiwiki.ai/wiki/diffusion_model). A model generating a video a few frames at a time repeatedly consults earlier frames. ZenAttention stores most of that history in a four-bit [key-value cache](https://aiwiki.ai/wiki/kv_cache) and computes attention directly on the compressed records. It reserves eight-bit arithmetic for the current chunk and the newest cached frame. Yingwei Song, Tony Zhu, Kelly Peng, Yuan Gao and Huanrui Yang described the method in a preprint submitted on November 25, 2026.[1][2]

## How the cache works

In a streaming generator such as Self Forcing, earlier outputs become part of the input for later frames. Each denoising step reads the keys and values from those earlier frames. In one configuration studied by the authors, a finished chunk can be read up to 30 times before it leaves the window. Compressing that chunk once avoids repeating the conversion on each read. ZenAttention uses [NVFP4](https://aiwiki.ai/wiki/nvfp4), a floating-point format that encodes each value in four bits and shares a scale across a block of 16 values.[1][3][4]

Rounding to four bits can change which earlier frames receive the most attention. The researchers compared a model that repeatedly read its own compressed history with one given a fresh, high-precision reference history at each step. In their Self Forcing experiment, a four-bit operator without corrections lost about three times as much fine spatial detail in later chunks when its errors fed back through the cache. ZenAttention stores statistics with the compressed records to correct systematic errors in the attention scores. It gives the most recent frame higher precision because some attention heads rely heavily on the same spatial position in that frame.[1]

## Performance and limits

The authors tested the kernel without retraining on eight streaming video and world models ranging from 1.3 billion to 5 billion parameters. Their speed tests used one NVIDIA RTX 5090. Kernel throughput measures the work done by an individual attention call. Timings for the denoising network include other operations, so the speedup can be smaller.[1][2]

| What was measured | Comparison | ZenAttention |
| --- | --- | --- |
| One attention call, about 4,700 queries and 23,400 keys | SageAttention2++ at 433 effective trillion operations per second | 628 effective trillion operations per second [1][2] |
| Full denoising network, 60-second Self Forcing video | 98.8 seconds with [bfloat16](https://aiwiki.ai/wiki/bfloat16) attention | 52.2 seconds [1][2] |
| Full denoising network, 64-second LongLive-2.0-5B video, with four-bit linear layers in both runs | 126.4 seconds with the released LongLive four-bit configuration | 68.8 seconds [1][2] |
| Self Forcing cache memory, 21-frame window | 5.62 GiB with bfloat16 | 1.94 GiB [1][2] |

The authors measured the strength of fine spatial detail in the generated latent frames. ZenAttention stayed within 0.7% of the bfloat16 reference on that measure across the eight models. They assessed perceptual quality separately with VBench on Self Forcing and VBench-Long on LongLive-2.0-5B. The compiled kernel targets Blackwell GPUs with compute capability 12.0 and attention heads of width 128. Shorter caches leave less work for the optimization to accelerate. The authors released the kernel, a reference implementation and integrations for three models under the Apache License 2.0.[1][2]

## References

1. Yingwei Song, Tony Zhu, Kelly Peng, Yuan Gao and Huanrui Yang. [ZenAttention: 4-bit Attention Directly on a Quantized KV Cache for Streaming Video Diffusion](https://arxiv.org/html/2611.35314v1). arXiv:2611.35314, November 25, 2026, sections 3-5 and 7.
2. ZenAttention authors. [ZenAttention source code, hardware requirements and benchmark results](https://github.com/wrencanfly/ZenAttention). GitHub.
3. Xun Huang, Zhengqi Li, Guande He, Mingyuan Zhou and Eli Shechtman. [Self Forcing: Bridging the Train-Test Gap in Autoregressive Video Diffusion](https://arxiv.org/abs/2506.08009). NeurIPS, 2025.
4. Eduardo Alvarez and colleagues. [Introducing NVFP4 for Efficient and Accurate Low-Precision Inference](https://developer.nvidia.com/blog/introducing-nvfp4-for-efficient-and-accurate-low-precision-inference/). NVIDIA, June 24, 2025.

