alphaFeedback

WorksComputer Science

InstaGen: Group-Shared Importance Sampling for Fast Video Generation

AI contributions
Not recorded for this paper
View details

Abstract

Diffusion Transformers (DiTs) are the dominant architecture for video generation, but their quadratic attention complexity results in substantial computational cost and latency. Permuted block-sparse attention (PBSA) offers a promising approach to reducing this cost by selectively computing blocks of a semantically permuted attention matrix. However, existing approaches typically select only the top few key blocks for each query block, following a top-pp paradigm. We find that top-pp selection can be highly sample inefficient in high-entropy attention regimes, which are common in video generation. In these regimes, we show that sampling can provide substantially better approximations under the same computational budget. More generally, we cast block selection as importance sampling, where the top-scoring keys form an exact set that is computed in full and the remaining keys are represented by a sample drawn in proportion to their estimated attention and reweighted by inverse sampling probability. Building on this formulation, we present InstaGen, which can be parameterized by any PBSA method: it replaces the method's block selection with an exact set plus a weighted sample. Each query cluster draws one sample shared by all its queries, so the sampled keys form blocks amenable to efficient GPU execution. In this paper, we take the SVG family of PBSA methods and show that, on Wan2.1-T2V-1.3B and Wan2.1-T2V-14B, InstaGen parameterized by SVG2 improves PSNR over SVG2 by 3.4 dB and 2 dB, respectively, at matched attention density, and by 1.6 dB and 2.2 dB at matched wall-clock time. On Wan2.1-T2V-14B, InstaGen also beats SVG-EAR by 1.1 dB PSNR at nearly the same density while running faster (1.65x against 1.48x over dense).

Introduction

Diffusion Transformers (DiTs) have been instrumental in achieving state-of-the-art quality in image and video generation [14, 20, 7]. However, image and video generation with DiTs remains computationally expensive, primarily due to the quadratic cost of attention, which is repeated across layers and diffusion steps. As a result, generating even short videos can be extremely slow. For instance, generating a single 5-second 720p video (81 frames, 50 denoising steps) with Wan2.1-T2V-14B takes about 22.6 minutes on one H100 GPU. Improving generation latency is therefore essential for enabling the efficient generation of high-quality, long-form videos.

Training-free sparse attention is a natural paradigm for reducing the computational workload of attention in existing video generation models and improving generation latency. However, effective attention sparsity must strike a unique balance between three often non-aligned goals: (1) Quality per query: Each query token should, in effect, attend to the tokens that are most important for that specific query. (2) Efficiency: The sparsity pattern should be amenable to block-based execution so that it can naturally integrate with FlashAttention [11] and benefit from hardware acceleration. (3) Alignment with the underlying model: While each query may, in principle, attend to its most important tokens, the approximation error introduced by sparsity can accumulate across layers and diffusion steps, potentially derailing the model and causing substantial downstream quality degradation. Permuted block-sparse attention (PBSA) methods such as SVG2 and SVG-EAR [19, 23] have primarily focused on addressing the first two goals through clustering query and key tokens, permuting the tokens into contiguous blocks, scoring each block from the cluster centroids, and computing only the selected blocks with a block-sparse attention kernel. However, their treatment of the third goal often results in an unfavorable trade-off between sparsity and downstream generation quality.

To maintain alignment, it is critical to ensure that the local approximation error in attention computation under sparsity is well controlled. Existing PBSA methods employ top-pp as the underlying sparsification strategy. However, for high-entropy attention distributions, top-pp ends up retaining a large number of tokens. Thus, the top-pp paradigm inevitably sacrifices either efficiency or approximation quality. In fact, to the best of our knowledge, all existing sparse video generation methods retain 30% dense steps, as any sparsification under the top-pp paradigm leads to large approximation errors. This calls for a paradigm shift in sparsity. InstaGen moves away from the deterministic sparsification underlying existing PBSA methods and instead employs stochastic sampling based on importance scores. We find that stochastic sparsity offers a significantly better quality-efficiency tradeoff. In fact, it enables us to completely eliminate dense steps, achieving fully sparse inference for video generation across all layers and all steps.

In InstaGen, we formalize sparse attention as a sampling problem. For each query cluster, the keys are split into an exact set of top-scoring keys, whose attention is computed exactly, and a residual whose contribution is estimated from a sample of its keys reweighted by inverse sampling probability [5]. Top-kk selection is the special case with no sample. We consider two ways of drawing this sample, importance and uniform sampling. In importance sampling, the attention estimated from the cluster centroids sets the sampling probabilities, and we draw the sample by proportional-to-size sampling without replacement (PPSWOR; § 3.2.1). Uniform sampling includes every residual key with equal probability, thus making it a special case of importance sampling. In this paper, we parameterize InstaGen by SVG2, i.e., it keeps SVG2’s clustering and block scoring and replaces its top-pp selection. This choice is not a requirement, and the same estimator can be applied to other methods that produce block scores, such as SVOO [10].

Sampling addresses the third goal, but if done naively it can conflict with the second, i.e., efficient execution. If each query had its own sample, it would attend to its own random keys. Then no two queries share a block of keys, and FlashAttention cannot run it. Drawing about 75,600 separate samples per head in every attention call (Wan2.1 at 720p, 81 frames) is also costly. We instead draw one sample per query cluster, using the probabilities computed from its centroid. All queries within the cluster share the resulting sampled keys, yielding a group-shared sampling scheme. This amortizes the sampling overhead across queries while producing a block structure: the cluster’s queries and the sampled keys form a dense block, which is compatible with FlashAttention and can be efficiently accelerated on GPUs. Moreover, sharing a sample adds no bias. For every query in the cluster, the estimates of the attention sums stay unbiased, because the weights use the probabilities the keys were actually drawn with.

We evaluate InstaGen against SVG [16], SVG2, and SVG-EAR on Wan2.1-T2V-1.3B and Wan2.1-T2V-14B, measuring fidelity to the dense model’s video (PSNR, SSIM [15], LPIPS [22]) and video quality with VBench [6]. Over SVG2, InstaGen improves PSNR by 3.4 dB and 2 dB on the 1.3B and 14B models, respectively, at matched attention density (Figure 2, § 5), and on the 14B model it beats SVG-EAR by 1.1 dB PSNR at nearly the same density while running faster. On Wan2.1-T2V-1.3B, InstaGen needs no dense warmup: it runs sparse attention at every diffusion step and still outperforms SVG and SVG2 run with their warmup (Figure 1). Removing the warmup matters most for long videos, because a dense step grows almost quadratically with video length: generating 561 frames, InstaGen without warmup takes 57.3 minutes, against 82.8 for SVG2 and 162 for dense attention (Figure 6).

Figure 1. Frames from a single Wan2.1-T2V-1.3B generation (720p, 81 frames, 50 steps). InstaGen achieves higher pixel fidelity, reaching a PSNR of 25.50 dB at a lower attention density of 32% when compared to SVG and SVG2. Prompt: The camera pans left to right, moving through cherry blossoms to reveal a Japanese street scene. A tram appears, and the camera follows it closer, showcasing cute shop light boxes. The sky glows pink and blue, with warm-lit poles and lamps lining the street. Cherry blossom trees in the foreground frame the peaceful, beautiful atmosphere. The background is softly blurred, emphasizing high-definition details.

PSNR against generation time per video and attention density

Figure 2. InstaGen gives higher quality than SVG2 at both matched density and matched latency on Wan2.1-T2V-1.3B. Left: PSNR against generation time per video. Right: PSNR against attention density, the share of attention computed over the whole generation. SVG2 uses the configuration from its paper (CqC_q=100, CkC_k=500, full attention for the first 30% of steps, key floor 0.1) at top-pp 0.5, 0.75, 0.9 and 0.95. InstaGen runs exact + sampled budgets from 4+4% to 32+32% at two clustering configurations for uniform and one for importance, with the same warmup and without it.

Figure 6. InstaGen with importance sampling matches SVG2’s quality at much lower density. (a) PSNR against overall attention density (warm-up steps count as dense), averaged over 22 VBench prompts on Wan2.1-T2V-1.3B (720p, 81 frames, 50 steps). SVG2 in its paper configuration (p=0.9p=0.9) reaches 25.03 dB at 44.1%; InstaGen (importance sampling) reaches the same PSNR at 34.0% with the same 30% warm-up, and at 20.0% with no warm-up. (b) Denoising time against the number of frames on one H100 SXM, on one prompt (svg2_ex1, Appendix § 7.§ 1; VAE decoding excluded), with InstaGen (importance sampling) at 4+4% with the 30% warm-up and at 14+14% with no warm-up, budgets at which it beats SVG2 (p=0.9p=0.9) on PSNR, SSIM and LPIPS on this prompt at 81 frames. At 561 frames dense takes 162 min, SVG2 82.8 min (1.97×), and InstaGen 61.9 min (2.62×) with warm-up and 57.3 min (2.83×) without.

Related Work

Structured sparse attention for video diffusion. Sparse VideoGen (SVG) profiles sampled query rows to assign each head a spatial or temporal sparsity layout [16], and Radial Attention uses a static O(Slog⁡S)O(S \log S) mask whose density decays with temporal distance [9]. Both fix the layout structurally rather than adapting it to content.

Content-adaptive sparse routing. Other methods estimate block importance from content: XAttention scores blocks by antidiagonal sums [18], AdaSpa searches hierarchical block patterns online [17], and SpargeAttention filters blocks with compressed query/key representatives and an in-kernel softmax-aware test [21]. SVG2 clusters queries and keys, permutes clusters into contiguous storage, and selects cluster pairs by a centroid score [19]. AdaCluster adapts the clustering to layerwise token geometry [13], and SVOO combines an offline per-layer sparsity schedule with online query–key co-clustering [10]. These methods route each query cluster by a single centroid-derived score. InstaGen reuses this component to score token importance.

Recovering skipped attention. SVG-EAR approximates skipped blocks with key/value centroids and recomputes those with high predicted error [23]; SparsePR learns an affine residual correction from the computed attention [12]; and Sol-Attn estimates the skipped contribution from the computed subset [8]. Attention, developed for LLM decoding, instead samples the residual, giving an unbiased estimate with a probabilistic error guarantee [3]. We extend this idea by casting sparse attention as importance sampling, under which top-kk selection and residual sampling arise naturally.

Changing the model. Veda distills full-attention tile distributions into a learned selector [4]; SANA-Video trains a block-linear video diffusion transformer [2], and SANA-Video 2.0 a hybrid with periodic softmax anchors and cross-depth attention residuals [1]. We focus on training-free sparse attention.

Background

Scaled Dot-Product Attention

Consider a single self-attention head with queries, keys, and values QQ, KK, V∈Rn×dV \in\mathbb{R}^{n \times d}, where nn is the sequence length and dd is the head dimension. For query ii, the scaled attention logits are

ℓij=qiTkjd,j∈{1,…,n}.(1)\ell_{ij} = \frac{q_i^{\mathsf{T}} k_j}{\sqrt{d}}, \qquad j \in\{1,\ldots,n\}. \tag*{(1)}

Softmax attention then produces the output

oi=∑j=1nαijvj,αij=eℓij∑j′=1neℓij′,(2)o_i = \sum_{j=1}^{n} \alpha_{ij}v_j, \qquad\alpha_{ij} = \frac{e^{\ell_{ij}}}{\sum_{j'=1}^{n}e^{\ell_{ij'}}}, \tag*{(2)}

or, equivalently, as the ratio of two sums

oi=nizi,ni=∑j=1neℓijvj,zi=∑j=1neℓij.(3)o_i = \frac{n_i}{z_i}, \qquad n_i = \sum_{j=1}^{n}e^{\ell_{ij}}v_j, \qquad z_i = \sum_{j=1}^{n}e^{\ell_{ij}}. \tag*{(3)}

Evaluating dense attention for all nn queries costs O(n2d)O(n^2d) per head. Sparse and sampled approximations target the sums in Eq. (3): rather than including every key/value index jj, they retain a small subset of indices and estimate the contribution of the remainder. The sampling estimators described below apply directly to approximating nin_i and ziz_i.

Sampling with Probabilities Proportional to Size

Consider the problem of estimating a sum Y=∑j=1nyjY = \sum_{j=1}^{n} y_j from a subset of m<nm < n of its terms. This problem underlies sparse attention, since the numerator and denominator in Eq. (3) are sums of nn terms: setting yj=eℓijvjy_j = e^{\ell_{ij}}v_j recovers nin_i, and setting yj=eℓijy_j = e^{\ell_{ij}} recovers ziz_i. We assume that each term is associated with a score sj>0s_j > 0 that is much cheaper to compute than yjy_j and serves as an estimate of its magnitude ∣yj∣\lvert y_j\rvert. The goal is an unbiased estimator of YY with low variance under a budget of mm terms.

PPSWOR: Probabilities Proportional to Size Without Replacement

PPSWOR is an importance sampling scheme that draws a sample SS of mm distinct terms such that terms with larger scores, and hence a larger expected contribution to the sum, are more likely to be included. The scheme is characterized by the inclusion probabilities πj=Pr⁡[j∈S]\pi_j = \Pr[j \in S], which satisfy ∑j=1nπj=m\sum_{j=1}^{n}\pi_j = m and are set proportional to the scores, πj∝sj\pi_j \propto s_j. Capping the target msj/∑j′sj′ms_j/\sum_{j'}s_{j'} at 1 and renormalizing gives

πj=min⁡(1,λsj),where ∑j=1nmin⁡(1,λsj)=m.(4)\pi_j = \min(1,\lambda s_j), \qquad\text{where } \sum_{j=1}^{n}\min(1,\lambda s_j) = m. \tag*{(4)}

The left-hand side is nondecreasing in λ\lambda, so λ\lambda is well defined. The terms with πj=1\pi_j = 1 form the heavy set H={j:λsj≥1}\mathcal{H} = \{j : \lambda s_j \ge1\}, which is the top-kk set by score, with k=∣H∣k = \lvert\mathcal{H}\rvert determined by the scores rather than fixed in advance. The sample therefore consists of all of H\mathcal{H} and m−∣H∣m-\lvert\mathcal{H}\rvert residual terms, each included with probability exactly πj<1\pi_j < 1.

The Horvitz–Thompson estimator [5] weights each sampled term by the inverse of its inclusion probability. For the sample above, it separates into a deterministic part and a sampled part:

Y^=∑j∈Hyj⏟deterministic top-k+∑j∈S∖Hyjπj⏟sampled residual.(5)\widehat{Y} = \underbrace{\sum_{j\in\mathcal{H}} y_j}_{\text{deterministic top-}k} + \underbrace{\sum_{j\in S\setminus\mathcal{H}}\frac{y_j}{\pi_j}}_{\text{sampled residual}}. \tag*{(5)}

This estimator is unbiased for any choice of scores, and top-kk selection is recovered by dropping the second term. We use this formulation in InstaGen.

Algorithm 1 InstaGen attention for one head. ℓij=qiTkj/d\ell_{ij} = q_i^\mathsf{T} k_j / \sqrt{d} are the logits of § 3.1, qˉg\bar{q}_g and kˉc\bar{k}_c are the centroids of query group gg and key cluster cc, c(j)c(j) is the cluster of key jj, and ∣c∣|c| is its size. Budgets are fractions of the sequence length: ρE+ρS\rho_E+\rho_S means mE=ρEnm_E = \rho_E n and mS=ρSnm_S = \rho_S n (written E+SE+S, in percent, in Section 5). Warmup calls, when used, compute dense attention instead.

Input: Q,K,V∈Rn×dQ, K, V \in\mathbb{R}^{n \times d}; budgets mE,mSm_E, m_S; sampler UNIFORM or IMPORTANCE

Output: O^∈Rn×d\hat{O} \in\mathbb{R}^{n \times d}

  1. Cluster queries into CqC_q groups and keys into CkC_k clusters ▷ kk-means, warm-started

  2. sgc←exp⁡(qˉgTkˉc/d)s_{gc} \leftarrow\exp(\bar{q}_g^\mathsf{T}\bar{k}_c/\sqrt{d}) for every pair (g,c)(g,c) ▷ centroid scores

  3. for each query group gg do

  4. Eg←\mathcal{E}_g \leftarrow whole clusters by decreasing ∣c∣ sgc|c|\,s_{gc} until ∣Eg∣≈mE|\mathcal{E}_g| \approx m_E ▷ exact keys

  5. Rg←{1,…,n}∖Eg\mathcal{R}_g \leftarrow\{1,\ldots,n\} \setminus\mathcal{E}_g ▷ residual keys

  6. if sampler is UNIFORM then

  7. πj←mS/∣Rg∣\pi_j \leftarrow m_S/|\mathcal{R}_g| for all j∈Rgj \in\mathcal{R}_g

  8. Sg←mS\mathcal{S}_g \leftarrow m_S keys of Rg\mathcal{R}_g, uniformly without replacement

  9. else

  10. πj←min⁡(1,λgsg,c(j))\pi_j \leftarrow\min(1,\lambda_g s_{g,c(j)}), with λg\lambda_g such that ∑j∈Rgπj=mS\sum_{j\in\mathcal{R}_g}\pi_j = m_S ▷ § 3.2.1

  11. Sg←\mathcal{S}_g \leftarrow systematic PPS sample of Rg\mathcal{R}_g with probabilities πj\pi_j

  12. end if

  13. wj←1w_j \leftarrow1 for j∈Egj \in\mathcal{E}_g, wj←1/πjw_j \leftarrow1/\pi_j for j∈Sgj \in\mathcal{S}_g ▷ Horvitz–Thompson

  14. o^i←∑j∈Eg∪Sgsoftmax⁡j(ℓij+log⁡wj)vj\hat{o}_i \leftarrow\sum_{j\in\mathcal{E}_g\cup\mathcal{S}_g}\operatorname{softmax}_j(\ell_{ij}+\log w_j)v_j for all i∈gi \in g ▷ =n^i/z^i= \hat{n}_i/\hat{z}_i

  15. end for

  16. return O^\hat{O}

InstaGen

InstaGen builds on the observation in vAttention [3] that sampling can outperform top-pp selection in high-entropy regimes. InstaGen formulates sparse attention as a sampling problem, which leads naturally to an importance sampling formulation with uniform sampling as a special case.

InstaGen performs PPSWOR sampling using scores that serve as proxies for the exponentiated raw attention scores. We obtain these scores from clusters for two reasons: the centroid of a cluster is a cheap proxy that represents the scores of its tokens, and clustering lets us permute the tokens into contiguous blocks, so that attention follows the block structure of FlashAttention [11] and realizes the theoretical speedup of sparsity. Such scores can come from any method that produces them, such as SVG2 [19] and SVOO [10], among others. For clarity, we adopt the clustering of SVG2, in which the queries and keys are clustered separately with kk-means into CqC_q query groups and CkC_k key clusters with centroids qˉg\bar{q}_g and kˉc\bar{k}_c. The score of query group gg and key cluster cc is

sgc=exp⁡(qˉgTkˉc/d),s_{gc} = \exp(\bar{q}_g^\mathsf{T}\bar{k}_c/\sqrt{d}),

which is the proxy for the exponentiated attention score of every query in gg with every key in cc.

These scores are used to perform PPSWOR as described in § 3.2.1. All queries in a group share the same scores, and so do all keys in a cluster, so the whole procedure is carried out once per query group. For each query group, the total budget is split in advance into an exact budget mEm_E and a sampling budget mSm_S. The exact budget is handled first: the key clusters with the largest total score are selected deterministically until mEm_E is reached, and we set πj=1\pi_j = 1 for their keys.

PPSWOR with budget mSm_S is then applied to the remaining keys, the residual. Each residual key jj receives an inclusion probability πj\pi_j proportional to its score and capped at 1, as in equation 4, such that the sample contains mSm_S keys. Keys whose probability reaches 1 are promoted, that is, they are always retained like the exact keys; since scores are constant within a cluster, whole clusters are promoted. The remaining keys (πj<1\pi_j < 1) are sampled using PPS, and the sample is shared across all queries of the group. In our kernel, it is drawn with systematic PPS sampling, which attains the prescribed inclusion probabilities exactly. The resulting attention map is illustrated in Figure 3.

Figure 3. Overview of InstaGen. (a) Queries and keys are clustered into groups. (b) Centroid scores give each key group a probability π\pi of being used by each query group. (c) The top key group is always kept; the remaining keys are sampled in proportion to π\pi and weighted by 1/π1/\pi. (d) Queries in a group share the same keys, so attention runs over dense blocks in one kernel.

This sharing across queries is what keeps the kernel GPU-friendly: all queries in a group attend to the same keys, so queries and attended keys form dense blocks. Let S\mathcal{S} be the PPS sample over the residual. For a query ii, the estimators of the numerator nin_i and denominator ziz_i in equation (3) can be written as

z^i=∑j=1n(I(πj=1)eℓij+I(πj<1)I(j∈S)1πjeℓij)\hat{z}_i = \sum_{j=1}^{n} \left( \mathbb{I}(\pi_j = 1)e^{\ell_{ij}} + \mathbb{I}(\pi_j < 1)\mathbb{I}(j \in S)\frac{1}{\pi_j}e^{\ell_{ij}} \right)
n^i=∑j=1n(I(πj=1)eℓijvj+I(πj<1)I(j∈S)1πjeℓijvj),\hat{n}_i = \sum_{j=1}^{n} \left( \mathbb{I}(\pi_j = 1)e^{\ell_{ij}}v_j + \mathbb{I}(\pi_j < 1)\mathbb{I}(j \in S)\frac{1}{\pi_j}e^{\ell_{ij}}v_j \right),

where I(⋅)\mathbb{I}(\cdot) is the indicator function, and the output is o^i=n^i/z^i\hat{o}_i = \hat{n}_i / \hat{z}_i. Note that both the numerator and denominator estimators are unbiased:

E(z^i)=ziE(n^i)=ni.\mathbb{E}(\hat{z}_i) = z_i \qquad\mathbb{E}(\hat{n}_i) = n_i.

Hardware Efficiency. InstaGen is designed to be compatible with FlashAttention ([11]). All queries in the same cluster attend to the same set of keys, whether exact or sampled. Thus, attention is computed in blocks rather than per query (each selected 128-key tile is either entirely exact or entirely sampled), with the importance weights applied as a logit bias. The sample is drawn on the GPU, where we implement the attention kernel by modifying FlashAttention-3 for NVIDIA Hopper GPUs. Clustering, scoring, and sampling run as separate GPU steps before the attention kernel. Figure 3(d) illustrates this implementation.

Residual Approximation. Like SVG-EAR ([23]), InstaGen estimates the attention of skipped keys instead of dropping it. SVG-EAR does so deterministically, by replacing each skipped cluster with its centroid key and mean value. InstaGen instead samples actual skipped keys with inverse-probability weights, giving unbiased estimates of the attention sums whose variance decreases as the sample grows.

Discussion on Alternative Sampling Schemes. Several sampling schemes can be used to estimate the residual. While we use PPSWOR in our kernel, other choices are possible, and we discuss them below.

PPSWR. Sampling with replacement can be used to estimate the residual in Algorithm 1. Its downside is that keys may be sampled repeatedly. While this matters little statistically at small budgets, it becomes undesirable at large ones; for instance, it does not recover dense attention even when the budget equals that of dense attention. On the other hand, it is easier to analyze: the independence of the samples allows us to apply strong tail bounds, which can be used to devise a verifiable approximation of attention for sparse video generation ([3]).

PPSWOR. Sampling without replacement has several desirable properties for our algorithm. For instance, at large budgets, PPSWOR is guaranteed to cover a larger number of distinct keys. In the limit, it covers all keys for each query and recovers exact dense attention. However, its downside is that the variance of the estimator is difficult to analyze and, consequently, so are analytical guarantees on the approximation error.

Poisson sampling. Poisson sampling is another technique for residual sampling, in which each key is included independently by a separate Bernoulli trial. Its advantage is that the sample is obtained without replacement; however, the sample size equals the budget only in expectation. Nevertheless, the independence again allows us to apply strong tail bounds to the estimators, and thus to obtain a verifiable sparse attention approximation.

These alternative schemes can be seen as extensions of this work, and we leave their exploration to future work.

Experiments

Models. We evaluate InstaGen on two open-source text-to-video diffusion transformers, Wan2.1-T2V-1.3B and Wan2.1-T2V-14B (Wan Team, [14]), generating 81-frame videos at 720p (720 × 1280). After 3D-VAE tokenization, each video has 21 latent frames of 3,600 tokens, so every self-attention call spans 75,600 tokens. We sparsify only self-attention; cross-attention to the text embeddings remains dense.

Metrics. We measure how closely each sparse method reproduces the dense model’s video with Peak Signal-to-Noise Ratio (PSNR), Structural Similarity Index Measure (SSIM) (Wang et al., [15]) and Learned Perceptual Image Patch Similarity (LPIPS) (Zhang et al., [22]). Each method is compared with the dense video from the same pipeline on the same hardware. We assess perceptual quality with four VBench (Huang et al., [6]) dimensions: Imaging Quality (ImgQual), Aesthetic Quality (AesQual), Subject Consistency (SubCons) and Background Consistency (BackCons). Efficiency is measured by density, the fraction of query-key pairs computed relative to full attention. Table 1 reports overall density, counting dense warm-up calls as full attention. End-to-end efficiency is measured by wall-clock speedup over dense generation.

MethodE+SE+SWarm-upPSNR↑SSIM↑LPIPS↓ImgQual↑AesQual↑SubCons↑BackCons↑Density↓Speedup↑
Wan2.1-T2V-1.3B
Dense–––––0.66890.64160.95690.9612100%1.00×
SVG–✓23.620.7940.2140.68370.63780.94890.951849.85%1.47×
SVG2 (p=0.95p=0.95)–✓26.110.8340.1220.61850.60910.94200.949548.92%1.65×
SVG-EAR–✓28.290.9100.0640.66250.63570.94970.954334.87%1.63×
InstaGen (uniform)8+8✓27.120.8560.0930.63310.57980.94110.946741.20%1.76×
InstaGen (uniform)16+1626.540.8760.0880.67180.64900.95210.959632.00%1.68×
InstaGen (uniform)16+16✓28.980.9060.0570.64340.59760.95280.957252.40%1.49×
InstaGen (importance)8+8✓27.690.8690.0710.68260.62720.96650.959141.20%1.72×
InstaGen (importance)16+1627.720.8910.0610.69090.63120.97020.967332.00%1.63×
InstaGen (importance)16+16✓29.390.9060.0530.68640.63060.97010.965252.40%1.46×
Wan2.1-T2V-14B
Dense–––––0.68760.66760.96770.9715100%1.00×
SVG–✓21.010.7420.2020.68920.67420.96530.972851.11%1.41×
SVG2 (p=0.9p=0.9)–✓22.380.7490.1670.69270.62390.96610.970453.34%1.53×
SVG-EAR–✓23.550.8270.1260.68480.67000.96660.967742.19%1.48×
InstaGen (uniform)8+8✓22.910.7710.1360.69630.63450.97630.969342.67%1.67×
InstaGen (uniform)16+1619.100.6640.2370.67920.63340.97360.974832.00%1.63×
InstaGen (uniform)16+16✓23.550.7960.1220.69900.63610.97630.971153.59%1.45×
InstaGen (importance)8+8✓24.610.8710.0830.68770.67010.97010.970142.67%1.65×
InstaGen (importance)16+1621.840.8110.1380.68580.66230.97300.975332.00%1.58×
InstaGen (importance)16+16✓25.500.8870.0720.68570.66520.96990.971653.59%1.42×

Table 1. Table 1: Main results on Wan2.1-T2V-1.3B and 14B. PSNR, SSIM and LPIPS compare each video with the dense video from the same seed, and all quality metrics are averaged over the 22 VBench prompts. E+SE+S: exact and sampled share of keys per sparse call with dense warmup, as prescribed by each baseline’s paper; InstaGen uses SVG2’s (first 30% of steps and 3% of layers). Density is overall, counting warmup calls as full attention. Speedup is end-to-end wall-clock on one H100 against a dense run. Bold: best sparse method in each column.

Prompts. We use 22 prompts from the VBench prompt suite (Huang et al., [6]), the two prompts with the most motion from each of its eleven per-dimension lists, as judged by an LLM. Each prompt

is generated once with a fixed seed, shared by all methods. Figure 5 and Figure 6(b) use a single prompt, the first example prompt of SVG2’s released Wan2.1 script [19]. Appendix § 7.§ 1 lists all prompts.

Warmup ablations on Wan2.1-T2V-14B

Figure 5. Warmup ablations on Wan2.1-T2V-14B (720p, 81 frames, 50 steps). InstaGen with uniform sampling runs its first 0, 5, 10 or 15 of 50 steps at full attention (warmup), ranging from 4+4% to 32+32% budget. SVG2 runs at its paper configurations at top-pp 0.1, 0.25, 0.5, 0.75, 0.9 and 0.99. A 5–10 step warmup matches or beats the 15 steps SVG2 uses. The hollow diamond is SVG2 without its one-layer warmup; the InstaGen runs have none. The prompt used is svg2_ex1, Appendix § 7.§ 1.

Baselines. We compare InstaGen against dense attention and three training-free sparse attention methods: the static method SVG [16], which assigns each head a spatial or temporal pattern, and the dynamic methods SVG2 [19], which keeps the kk-means clusters that reach a top-pp attention-mass threshold, and SVG-EAR [23], which approximates skipped blocks with centroids and routes by predicted error. Each baseline uses its official configuration and dense warm-up schedule. We evaluate InstaGen with both uniform and importance samplers to compare against these baselines.

Implementation. We implement InstaGen with a fused attention kernel derived from FlashAttention-3 and benchmark on an NVIDIA H100 80GB SXM GPU. All methods use 50 UniPC steps with flow

shift 5.0 and guidance scale 5.0. We set Cq=300C_q = 300 and Ck=1000C_k = 1000, running 50 kk-means iterations at a layer’s first call and two warm-started iterations thereafter [19]. Each query group attends exactly to the top-scoring key blocks within E%E\% of the keys and estimates the remainder from S%S\% of the keys, sampled in proportion to their estimated attention mass (§ 3.2.1); we denote this E+SE+S. Both terms are computed in one pass, with importance weights applied as a logit bias. Because InstaGen estimates the omitted attention rather than discarding it, it does not require the dense warm-up used by prior methods. We report it both with and without warm-up, with the first 30% of steps and 3% of layers dense, as in SVG2.

Quality and efficiency evaluation

Attention approximation. We first experiment on one self-attention call captured from a Wan2.1-T2V-1.3B generation. Figure 4(left) shows the mean relative error across all heads in one layer for different methods. Importance sampling has the lowest error at every density: at about 24% of attention computed, its relative L2L_2 error is 0.013, against 0.066 for SVG2 and 0.022 for SVG-EAR, and at about 48% it is 0.004, against 0.033 and 0.014. SVG is a static method, so the error comes via incorrect assumption of attention maps in different attention heads, while the error in other methods is the residual approximation of unselected keys. SVG2 fully drops them, so the error is larger; SVG-EAR and InstaGen both apply different approximation techniques, which lead to relatively lower errors. Figure 4(right) shows the error map across all the layers and heads for the whole generation. Averaged over all steps, InstaGen (uniform, 16+16, no warmup) keeps every head and layer at low error at 32% density, while SVG2 (p=0.9p=0.9) leaves large errors in individual heads and layers despite computing 46% even with warmup steps.

Relative $L_2$ error and per-block, per-head error heatmaps

Figure 4. InstaGen approximates attention more accurately than prior sparse methods. Left: relative L2L_2 error of one self-attention call from Wan2.1-T2V-1.3B against exact attention. Importance sampling gives the lowest error at every density, several times below SVG2. Right: per-block, per-head error over one full generation averaged across all steps. InstaGen (uniform, 16+16, no warm-up) keeps the error low everywhere at 32% density, while SVG2 (p=0.9p=0.9, warm-up counted as zero error) leaves large errors in individual heads and layers despite computing 46%.

Video quality. Table 1 reports quality and efficiency across the two models. Both InstaGen variants share the exact set and budget and differ only in how the sample is drawn: uniform draws the shared sample uniformly without replacement, while importance draws in proportion to the scores from the cluster centroids following PPSWOR. On both models, InstaGen (importance, 8+8 with warm-up) improves PSNR over SVG2 by 1.6 dB at 1.3B and 2.2 dB at 14B while using lower density and running faster. On the 14B model it is the best sparse method on all three fidelity metrics, ahead of SVG-EAR at nearly the same density. Without any warm-up, InstaGen still outperforms SVG and SVG2 on the 1.3B model, even though both run with warm-up. Importance sampling improves on uniform sampling at every configuration: drawing residual keys in proportion to their attention weight lowers the estimator’s variance at the same budget.

We compare algorithms at similar density to get a fair comparison of attention approximation of every method. We fix the overall density at that of SVG2’s paper configuration (p=0.9p=0.9) and give InstaGen (importance) the same budget and warmup, split equally between exact and sampled keys. On Wan2.1-T2V-1.3B (44.1%), InstaGen raises PSNR from 25.03 to 28.42 dB and SSIM from 0.780 to 0.884, and lowers LPIPS from 0.180 to 0.060; on Wan2.1-T2V-14B (54.0%), from 23.40 to 25.41 dB, 0.805 to 0.886, and 0.152 to 0.073. Figure 2(right) shows the curve for quality, where InstaGen envelops SVG2 with both uniform and importance sampling.

Latency. Figure 2 (left) plots quality against generation time on Wan2.1-T2V-1.3B. With importance sampling and no warmup, InstaGen (16+16) reaches 27.72 dB in 173.1 s, 1.6 dB above SVG2’s best setting (p=0.95p=0.95, 26.11 dB in 177.0 s); with warmup, InstaGen (8+8) reaches 27.69 dB in 164.6 s, 1.6 dB higher than SVG2’s best in 12.4 s less time. Figure 6(a) shows the density required to match the quality of SVG2, and at that matched quality Figure 6(b) shows the advantage of InstaGen on longer frames, where it gets higher speedups than SVG2.

Warmup. Sparse video methods keep their initial steps dense because early errors steer the whole trajectory. SVG2 runs its first 30% of steps at full attention; SVG and SVG-EAR use similar schedules. Without any warmup, Figure 2 shows that InstaGen with importance sampling lies above SVG2’s entire frontier, and on Wan2.1-T2V-14B (Figure 5) it needs a short warmup, but 10 steps put it above SVG2 at every density. Removing the warmup matters more as videos get longer, because a dense step grows almost quadratically with length (4.6 s at 81 frames, 187.6 s at 561). In Figure 6(b), InstaGen without warmup (14+14) is slower than with warmup (4+4) at 81 frames (164.2 vs. 153.2 s), level at 241 (778.0 vs. 779.5 s) and faster beyond, taking 57.3 against 61.9 min at 561 frames.

Conclusion

This paper proposes InstaGen, which replaces the top-pp block selection of permuted block-sparse attention with a sampling-based estimate of the full attention. At its core, InstaGen computes an exact set of top-scoring keys in full and estimates the contribution of the remaining keys from a weighted sample, which keeps the estimates of the attention sums unbiased. Parameterized by SVG2, it reuses SVG2’s clustering and block scores and replaces its top-pp selection. Group-shared sampling makes it fast: each query cluster draws one sample shared by all its queries, so the sampled keys form dense blocks that run with the exact blocks in a single FlashAttention pass.

Across sparse video generation experiments, InstaGen consistently achieves a better quality-efficiency tradeoff than existing methods. On Wan2.1-T2V-1.3B and 14B, InstaGen improves PSNR over SVG2 by 3.4 dB and 2 dB at matched density and by 1.6 dB and 2.2 dB at matched wall-clock time, and on 14B it beats SVG-EAR by 1.1 dB at nearly the same density. On the 1.3B model it needs no dense warmup to outperform SVG2, which matters most for long videos: it denoises a 561-frame video in 57.3 minutes, against 82.8 for SVG2. Because InstaGen treats sparse attention as sampling, other block scorers, such as SVOO’s, can be plugged in. These results demonstrate that importance sampling provides an effective mechanism for allocating a limited attention budget between high-importance tokens and the residual attention mass, and offers a general framework that can be combined with different mechanisms for constructing proxy attention scores.

Supplementary Material

Prompts

Table 2 lists the 22 VBench prompts, two from each of its eleven per-dimension prompt lists, used verbatim for Table 1, Figure 2 and Figure 6(a). The importance-sampling generation times in Figure 2 are measured on the first five (d22-01 to d22-05).

IDVBench dimensionPrompt
d22-01appearance stylea shark is swimming in the ocean by Hokusai, in the style of Ukiyo
d22-02appearance styleA couple in formal evening wear going home get caught in a heavy downpour with umbrellas, in cyberpunk style
d22-03colora red car
d22-04colora blue bird
d22-05human actionA person is riding or walking with horse
d22-06human actionA person is catching or throwing frisbee
d22-07multiple objectsa cat and a dog
d22-08multiple objectsan airplane and a train
d22-09object classa train
d22-10object classa motorcycle
d22-11overall consistencyFew big purple plums rotating on the turntable. water drops appear on the skin during rotation. isolated on the white background. close-up. macro.
d22-12overall consistencyBalloon full of water exploding in extreme slow motion.
d22-13scenewaterfall
d22-14scenehighway
d22-15spatial relationshipa skateboard on the top of a surfboard, front view
d22-16spatial relationshipa traffic light on the left of a fire hydrant, front view
d22-17subject consistencya horse running to join a herd of its kind
d22-18subject consistencya bear catching a salmon in its powerful jaws
d22-19temporal flickeringIn a still frame, a tranquil pond was fringed by weeping cherry trees, their blossoms drifting lazily onto the glassy surface
d22-20temporal flickeringA tranquil tableau of a tranquil lakeside cabin nestled among tall pines, its reflection mirrored perfectly in the calm water
d22-21temporal styleAn astronaut flying in space, racking focus
d22-22temporal styleA panda drinking coffee in a cafe in Paris, zoom out

Table 2. The 22 VBench prompts.

Figure 6(b), the 81-frame check that sets the InstaGen budgets in it, and Figure 5 use a single prompt, svg2_ex1, the first example prompt of SVG2’s released Wan2.1 script [19]:

warm colors dominate the room, with a focus on the tabby cat sitting contently in the center. the scene captures the fluffy orange tabby cat wearing a tiny virtual reality headset. the setting is a cozy living room, adorned with soft, warm lighting and a modern aesthetic. a plush sofa is visible in the background, along with a few lush potted plants, adding a touch of greenery. the cat’s tail flicks curiously, as if engaging with an unseen virtual environment. its paws swipe at the air, indicating a playful and inquisitive nature, as it delves into the digital realm. the atmosphere is both whimsical and futuristic, highlighting the blend of analog and digital experiences.

References

  1. [1]Junsong Chen, Jincheng Yu, Yitong Li, Shuchen Xue, Haozhe Liu, Jingyu Xin, Yuyang Zhao, Tian Ye, Zhangjie Wu, Zian Wang, Daquan Zhou, Ping Luo, Song Han, and Enze Xie. SANA-Video 2.0: Hybrid linear attention with attention residuals for efficient video generation. 2026a. URL https://arxiv.org/abs/2607.21553.
  2. [2]Junsong Chen, Yuyang Zhao, Jincheng Yu, Ruihang Chu, Junyu Chen, Shuai Yang, Xianbang Wang, Yicheng Pan, Daquan Zhou, Huan Ling, Haozhe Liu, Hongwei Yi, Hao Zhang, Muyang Li, Yukang Chen, Han Cai, Sanja Fidler, Ping Luo, Song Han, and Enze Xie. SANA-Video: Efficient video generation with block linear diffusion transformer. In International Conference on Learning Representations, 2026b. URL https://arxiv.org/abs/2509.24695. Oral.
  3. [3]Aditya Desai, Kumar Krishna Agrawal, Shuo Yang, Alejandro Cuadron Lafuente, Luis Gaspar Schroeder, Matei Zaharia, Joseph E. Gonzalez, and Ion Stoica. vAttention: Verified sparse attention via sampling. In International Conference on Learning Representations, pp. 52253–52284, 2026. arXiv:2510.05688.arxiv.org/abs/2510.05688
  4. [4]Shihao Han, Hao Yang, Xiaofeng Mei, Xinting Hu, Yi Jiang, and Xiaojuan Qi. Veda: Scalable video diffusion via distilled sparse attention. In International Conference on Machine Learning, 2026.arxiv.org/abs/2605.30325
  5. [5]D. G. Horvitz and D. J. Thompson. A generalization of sampling without replacement from a finite universe. Journal of the American Statistical Association, 47(260):663–685, 1952.DOI
  6. [6]Ziqi Huang, Yinan He, Jiashuo Yu, Fan Zhang, Chenyang Si, Yuming Jiang, Yuanhan Zhang, Tianxing Wu, Qingyang Jin, Nattapol Chanpaisit, Yaohui Wang, Xinyuan Chen, Limin Wang, Dahua Lin, Yu Qiao, and Ziwei Liu. VBench: Comprehensive benchmark suite for video generative models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 21807–21818, 2024.arxiv.org/abs/2311.17982
  7. [7]Weijie Kong, Qi Tian, Zijian Zhang, Rox Min, Zuozhuo Dai, Jin Zhou, Jiangfeng Xiong, Xin Li, Bo Wu, Jianwei Zhang, et al. HunyuanVideo: A systematic framework for large video generative models. arXiv preprint arXiv:2412.03603, 2024.arxiv.org/abs/2412.03603
  8. [8]Haopeng Li, Yitong Li, Junsong Chen, Tian Ye, Haozhe Liu, Jincheng Yu, Duomin Wang, Ruihua Zhang, Zeke Xie, Enze Xie, and Song Han. Sol-Attn: Accelerating video generation inference via on-the-fly attention sparsification, 2026. URL https://arxiv.org/abs/2607.24027. Technical report.
  9. [9]Xingyang Li, Muyang Li, Tianle Cai, Haocheng Xi, Shuo Yang, Yujun Lin, Lvmin Zhang, Songlin Yang, Jinbo Hu, Kelly Peng, Maneesh Agrawala, Ion Stoica, Kurt Keutzer, and Song Han. Radial attention: O(n log n) sparse attention with energy decay for long video generation. arXiv preprint arXiv:2506.19852, 2025.arxiv.org/abs/2506.19852
  10. [10]Jiayi Luo, Jiayu Chen, Jiankun Wang, Cong Wang, Hanxin Zhu, Qingyun Sun, Chen Gao, Zhibo Chen, and Jianxin Li. Attention sparsity is input-stable: Training-free sparse attention for video generation via offline sparsity profiling and online QK co-clustering, 2026. URL https://arxiv.org/abs/2603.18636. Accepted to ICML 2026.
  11. [11]Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, and Tri Dao. FlashAttention-3: Fast and accurate attention with asynchrony and low-precision. In Advances in Neural Information Processing Systems, volume 37, 2024. doi: 10.52202/079017-2193.
  12. [12]Pardis Taghavi, Reza Langari, and Gaurav Pandey. Partition the support, reconstruct the residual: Training-free sparse attention for video generation and world models, 2026. URL https://arxiv.org/abs/2608.18484.
  13. [13]Haoyue Tan, Shengnan Wang, Yulin Qiao, Juncheng Zhang, Youhui Bai, Ping Gong, Zewen Jin, and Cheng Li. AdaCluster: Adaptive query-key clustering for sparse attention in video generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 43249–43259, 2026.arxiv.org/abs/2604.18348
  14. [14]Wan Team. Wan: Open and advanced large-scale video generative models, 2025. URL https://arxiv.org/abs/2503.20314.
  15. [15]Zhou Wang, Alan C. Bovik, Hamid R. Sheikh, and Eero P. Simoncelli. Image quality assessment: From error visibility to structural similarity. IEEE Transactions on Image Processing, 13(4):600–612, 2004.pubmed.ncbi.nlm.nih.gov/15376593
  16. [16]Haocheng Xi, Shuo Yang, Yilong Zhao, Chenfeng Xu, Muyang Li, Xiuyu Li, Yujun Lin, Han Cai, Jintao Zhang, Dacheng Li, Jianfei Chen, Ion Stoica, Kurt Keutzer, and Song Han. Sparse Video-Gen: Accelerating video diffusion transformers with spatial-temporal sparsity. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 68208–68224, 2025.arxiv.org/abs/2502.01776
  17. [17]Yifei Xia, Suhan Ling, Fangcheng Fu, Yujie Wang, Huixia Li, Xuefeng Xiao, and Bin Cui. Training-free and adaptive sparse attention for efficient long video generation. In 2025 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 15982–15993. IEEE, 2025.arxiv.org/abs/2502.21079
  18. [18]Ruyi Xu, Guangxuan Xiao, Haofeng Huang, Junxian Guo, and Song Han. XAttention: Block sparse attention with antidiagonal scoring. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 69819–69831. PMLR, 2025. URL https://proceedings.mlr.press/v267/xu25ag.html.arxiv.org/abs/2503.16428
  19. [19]Shuo Yang, Haocheng Xi, Yilong Zhao, Muyang Li, Jintao Zhang, Han Cai, Yujun Lin, Xiuyu Li, Chenfeng Xu, Kelly Peng, Jianfei Chen, Song Han, Kurt Keutzer, and Ion Stoica. Sparse VideoGen2: Accelerate video generation with sparse attention via semantic-aware permutation. In Advances in Neural Information Processing Systems, volume 38, pp. 96965–96991, 2025a. doi: 10.52202/085713-3243.DOI
  20. [20]Zhuoyi Yang, Jiayan Teng, Wendi Zheng, Ming Ding, Shiyu Huang, Jiazheng Xu, Yuanming Yang, Wenyi Hong, Xiaohan Zhang, Guanyu Feng, et al. CogVideoX: Text-to-video diffusion models with an expert transformer. In International Conference on Learning Representations, volume 2025, pp. 83048–83077, 2025b.arxiv.org/abs/2408.06072
  21. [21]Jintao Zhang, Chendong Xiang, Haofeng Huang, Jia Wei, Haocheng Xi, Jun Zhu, and Jianfei Chen. SpargeAttention: Accurate and training-free sparse attention accelerating any model inference. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 76397–76413, 2025.arxiv.org/abs/2502.18137
  22. [22]Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 586–595, 2018.arxiv.org/abs/1801.03924
  23. [23]Xuanyi Zhou, Qiuyang Mang, Shuo Yang, Haocheng Xi, Jintao Zhang, Huanzhi Mao, Joseph E. Gonzalez, Kurt Keutzer, Ion Stoica, and Alvin Cheung. SVG-EAR: Parameter-free linear compensation for sparse video generation via error-aware routing. arXiv preprint arXiv:2603.08982, 2026. URL https://arxiv.org/abs/2603.08982. Accepted to ECCV 2026.

Paper details

vlnc:W_ayrpjs63
v1 · latestHistory (1)

published · Fresh — added to the Hub within the last 30 days

added ·

Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

CC BY-SA 4.0

Original source

  • Computer Science

Not recorded for this paper · View statement →

Looking for related papers…
Contents