TL;DR
Generating AI video takes forever because self-attention scales quadratically over tens of thousands of tokens, and simply compressing the math down to ultra-fast 4-bit precision (FP4) ruins the video quality. The authors introduce DeCo-Attention, a clever algorithm-and-system co-design that tucks error-correcting "compensation" channels right inside the 4-bit matrix multiplication, allowing the GPU to fix its own rounding mistakes on the fly. Paired with custom softmax optimizations, it delivers nearly 8-bit video quality at scorching 4-bit speeds—no model retraining required.
What Problem Does This Paper Address?
If you want to generate a crisp 5-second video clip using modern Video Diffusion Transformers (DiTs), the model has to process tens of thousands of spatiotemporal tokens simultaneously across dozens of denoising steps. Because self-attention compares every token to every other token, its computational cost explodes quadratically, eating up nearly 70% of total generation time.
Modern NVIDIA GPUs (like Blackwell and Rubin) feature 4-bit floating-point (FP4) tensor cores that run matrix multiplications up to nine times faster than standard 16-bit (BF16) precision. Naturally, researchers want to run attention in FP4. The catch? Rounding Queries ($Q$) and Keys ($K$) down to 4 bits introduces massive relative errors (up to 25% regardless of scaling). Worse, the attention mechanism feeds their product ($QK$) directly into an exponential function via softmax. That exponential acts like a magnifying glass for large errors, wildly shifting attention weights to the wrong tokens and noticeably degrading the final video.
Methods
DeCo-Attention ("Decompose to Compensate") tackles both the numerical accuracy drop and the resulting hardware bottlenecks without requiring any training or offline calibration data.
- Principal Residual Compensation (Novel): When you quantize $Q$ and $K$ (after a standard Hadamard rotation to spread out outliers), you are left with known rounding errors ($\delta Q$ and $\delta K$). Recomputing the exact error terms would cost more than just running 8-bit math. Instead, the authors find the top 32 principal directions (via eigendecomposition) where most of the keys' and queries' energy lives. They project the residuals onto this shared 32-dimensional subspace and append them as extra FP4 channels to $Q$ and $K$ (expanding head dimension from 128 to 192). Now, a single FP4 matrix multiplication computes both the attention scores and their first-order error corrections simultaneously! To keep runtime overhead tiny (~3%), the basis is estimated from a random 1/256th sample of tokens and shared between $Q$ and $K$.
- I-ExpCast & Softmax Tuning (Novel + Adapted): Once $QK$ runs at blistering FP4 speeds, the GPU's Special Function Unit (SFU) chokes trying to compute softmax exponentials fast enough. The authors introduce I-ExpCast, a neat bit-level trick: because the integer bit-pattern of an FP16 number grows linearly with its base-2 logarithm, a single Fused Multiply-Add (FMA) instruction in FP32's subnormal range can approximate the exponential directly into FP16, letting hardware handle clean rounding to FP8 or FP4. They combine this with adapted techniques—lazy rescaling and computing probability row-sums by appending ones to the Value ($V$) matrix—alongside standard $V$-smoothing.
Datasets
Because DeCo-Attention is completely training-free and calibration-free, no training datasets are used. For evaluation, the authors generate videos using 100 prompts from MovieGen Bench (measuring speedups on a 7-prompt subset) across four state-of-the-art video models: Wan2.2, LongCat-Video, HunyuanVideo-1.5, and MiniMax-H3. No new benchmarks are introduced.
Key Insights and Ideas
- Why $QK$ hurts way more than $PV$: Quantizing the second attention product ($PV$) to FP4 barely dents accuracy, whereas quantizing $QK$ destroys it. Small score errors pass through softmax linearly, but once centered FP4 errors exceed ~1.0, the exponential blows up non-linearly, hijacking the attention distribution.
- Floating-point scales can't save you: Unlike integer formats (INT8), fine-grained block scaling in floating-point formats (FP8/NVFP4) cannot reduce intrinsic mantissa rounding error. You have to fix it algebraically.
- $Q$ and $K$ share a brain: Because $Q$ and $K$ are linear projections of the exact same input activations, their top eigenvectors overlap heavily (0.75 overlap vs. 0.25 for random subspaces). Sharing one basis cuts eigendecomposition work in half while still capturing 69% of $K$'s energy in just 32 directions.
- Fast math exposes hidden bottlenecks: Speeding up matrix multiplication alone barely moved the needle (79.0 ms vs. 83.8 ms baseline) until the softmax bottleneck was dismantled via I-ExpCast, dropping execution time to 58.0 ms.
Key Results
Tested across three GPU architectures—NVIDIA GB300, VR200 (using FP4 $QK$ + FP8 $PV$), and RTX PRO 6000 (fully FP4)—DeCo-Attention pushes the Pareto frontier of speed and accuracy:
- Speedups: On Wan2.2, the attention kernel runs 2.13×, 2.49×, and 2.82× faster than BF16 across GB300, VR200, and RTX PRO 6000, respectively. End-to-end video generation speeds up by 1.55×, 1.68×, and 1.80×, outperforming all prior low-precision kernels (like SageAttention and VC-Attention).
- Kernel Accuracy: On Wan2.2's hardest layers, DeCo-Attention slashes relative L2 output error from 30.56% (uncompensated NVFP4) down to 2.80%, beating even the best FP8-$QK$ baselines (3.67%).
- Visual Quality: With FP8 $PV$, generation quality matches 8-bit FP8-$QK$ methods (e.g., 19.42 dB PSNR / 0.216 LPIPS on Wan2.2 vs. 15.34 dB / 0.417 LPIPS uncompensated). In fully 4-bit mode, it handily beats prior 4-bit methods like SageAttention3 across all four video models.
Limitations and Future Work
- Not ready for LLM KV-caching: The kernels are tailored for full-sequence self-attention in video diffusion models and cannot yet be dropped directly into autoregressive LLM decoding with KV caches.
- Low-latency overhead: Estimating principal directions at runtime adds 2.7%–3.6% overhead—negligible for massive video sequences, but potentially noticeable in short, low-latency workloads.
- Room to grow on easy layers: While DeCo-Attention beats FP8-$QK$ kernels on the "hardest" layers, its average error across all layers still sits slightly above the single most accurate FP8-$QK$ baseline (VC-Attention) and INT8-$QK$ methods. The authors plan to address these gaps and publicly release their CuTe DSL kernel code.
Summary updated