SQuad: Sub-Quadratic Attention Distillation for Efficient Video Generation

Qualcomm AI Research

SQuad v/s Wan 2.2 5B [5s @ 704p]

Click any sample to enlarge it, compare it to the corresponding tuned Wan 2.2 5B samples and view its text prompt.

Abstract

Video Diffusion Transformers (DiTs) spend most of their compute inside the Self-Attention operation, whose cost grows quadratically, $\mathcal{O}(n^2)$, with the number of latent tokens $n$. For the task of video generation, the token count is large, so this term dominates runtime and memory, and thereby caps the resolution and duration we can generate. Linear $\mathcal{O}(n)$ and low-rank $\mathcal{O}(nk)$ surrogates of Self-Attention trade the full softmax $QK^T$ for cheaper kernels, but rarely recover the original's expressivity, leaving a stubborn quality gap. Motivated by this, we propose SQuad, a Sub-Quadratic Attention Distillation framework that achieves a complexity of $\mathcal{O}(n\sqrt{n})$ in the resulting distilled Attention, naturally balancing the efficiency v/s expressivity trade-off. Instead of training our own Video DiT from scratch, which is prohibitively expensive, we fit a pretrained full softmax Self-Attention DiT into our proposed SQuad-Attention one by distilling the former in two stages: Flow-Matching Supervised Fine-Tuning (SFT), followed by improved Distribution Matching Distillation (DMD2) which additionally makes the sampling more efficient. On the Wan 2.2 5B text-to-video model, SQuad matches the quadratic teacher on VBench ($83.20$ v/s $83.08$) while cutting the per-step per-block attention FLOPs by $\sim$$67\times$ and attention latency by $\sim$$11\times$, and end-to-end DiT latency by $\sim$$2\times$, all while also generating a video in only $6$ Neural Functional Evaluations (NFEs) instead of the default $100$.

This project page is intended to complement the paper by presenting video results that static figures cannot adequately convey. It offers a concise, visual overview of the project rather than an exhaustive account; for the complete methodology, derivations, and quantitative results, we refer the reader to the paper PDF.

Method

Attention pattern diagram. Left: original self-attention — the query token
                   attends to every other token on the grid (dense, quadratic). Right: SQuad
                   attention in two passes — a local pass where the query attends within its
                   window, then a global pass across windows at the shared slot, recovering a
                   full receptive field at sub-quadratic cost.
Side-by-side pseudocode: full self-attention is one call to the attention
                   function over Q, K, V with O(n squared) cost; SQuad calls the same function
                   twice, reshaping Q, K, V for a local pass then a global pass whose values are
                   the local output, for O(n root n) cost.
Generation quality panel for Wan 2.2 5B at 704p: VBench Total 83.08 for the
                   original versus 83.20 for SQuad — the two match. Below, a human preference
                   study of 1,179 paired comparisons: 41% preferred SQuad, 33% saw no
                   preference, and 26% preferred the original — 74% chose SQuad or saw no
                   difference.
Wan 2.2 5B
SQuad (ours)
Efficiency panels for Wan 2.2 5B at 704p (n = 18,480 tokens). FLOPs per block
                   per step: attention drops from 4.205 to 0.063 TFLOPs (66.7x fewer) and the
                   whole block from 9.680 to 5.548 TFLOPs (1.7x fewer). Latency: attention 47.1
                   to 4.27 ms (11x faster), block 61.8 to 19.55 ms (3.2x faster), full DiT eager
                   870 to 520 ms (1.7x faster) and compiled 667 to 314 ms (2.1x faster).

How to distill?

Both training stages are necessary. For now. When all 30 blocks of the model are replaced with SQuad-Attention: SFT alone collapses (VBench Tot. 73.03), and DMD2 alone reaches only 80.91, but the two stages together recover the full 82.99 VBench Tot.

SFT-only
VBench Tot. 73.03 · 100 NFEs
DMD-only
VBench Tot. 80.91 · 6 NFEs
SFT + DMD (Ours)
VBench Tot. 82.99 · 6 NFEs

Local ↔ Global Ablation

Composing both passes matches original's expressivity whereas either one alone is not able to recover the quality. Alternate order swaps local and global block-by-block instead of keeping one order throughout.

Original
VBench Tot. 83.08
Local-only
VBench Tot. 62.62
Global-only
VBench Tot. 62.63
Local → Global (Ours)
VBench Tot. 83.20
Global → Local
VBench Tot. 82.99
Alternate order
VBench Tot. 82.87

Window Characterization Ablation

SQuad-Attention factorizes Self-Attention into a global and a local branch, where the local branch attends within a window of $T \times H \times W$ tokens. For our $21 \times 22 \times 40$ token grid ($n = 18{,}480$, so $\sqrt{n} \approx 136$), we sweep the window shape while holding its volume close to $\sqrt{n}$, which keeps the $O(n\sqrt{n})$ complexity fixed and isolates the effect of how those tokens are distributed across time v/s space. Drag the slider to sweep from purely spatial windows, through the isotropic ones, to windows spanning the full temporal extent, ending on the $21 \times 2 \times 4$ shape we propose.

Local window (T × H × W)

BibTeX


@article{karnewar2026squad,
title        = {SQuad: Sub-Quadratic Attention Distillation for Efficient Video Generation},
author       = {Animesh Karnewar and Denis Korzhenkov and Amirhossein Habibian and Mohsen Ghafoorian},
journal      = {arXiv preprint arXiv:2608.16585},
year         = {2026}
}
            

Explore more efficient video generation/editing projects from our team at Qualcomm AI Research