Create and explore imaginative 3D worlds with our new product Dreamfield (opens in a new tab)
Papers
Topics
Authors
Recent
Search
2000 character limit reached

Spark-Attn: Adaptive Block-Sparse Attention

Updated 22 November 2026
  • Spark-Attn is an adaptive block-sparse attention method designed for long-video diffusion transformers, replacing dense self-attention during inference with a combination of token reorganization and calibrated compression of unselected key–value blocks; it includes
  • Spark-Reblock,

Spark-Attn is a training-free adaptive block-sparse attention method for long-video diffusion transformers. Introduced in “Spark-H3: Adaptive Block Sparse Attention for Video Diffusion Models” (Tang et al., 18 Nov 2026), it replaces dense self-attention only during inference by combining attention-preference-aware token reorganization with calibrated compression of unselected key–value blocks. Its two principal components are Spark-Reblock, which recursively forms regular tiles whose tokens have similar attention preferences, and Spark-Reweight, which represents unselected tiles with attention-weighted key–value summaries and a logit bias that calibrates their contribution to the global softmax normalization. The method is instantiated in MiniMax-H3 as Spark-H3 and is evaluated on long-video diffusion models without modifying model parameters, LoRAs, or denoising schedules.

1. Computational setting and design objectives

For a video containing NN tokens, one attention head forms query, key, and value matrices

Q,K,V∈RN×d,Q,K,V\in\mathbb{R}^{N\times d},

where dd is the head dimension. The dense score matrix is

S=QK⊤d∈RN×N,S=\frac{QK^\top}{\sqrt d}\in\mathbb{R}^{N\times N},

and dense attention has token complexity O(N2d)O(N^2d). FlashAttention reduces memory traffic and improves on-chip execution, but it still evaluates the dense all-pairs query–key interaction. Consequently, increasing frame count, spatial resolution, or both substantially increases video diffusion latency.

For query qiq_i, key kjk_j, and value vjv_j, Spark-Attn expresses attention through numerator and denominator accumulation:

(n(qi),z(qi))=∑j=1Nes(qi,kj)(vj,1),\bigl(n(q_i),z(q_i)\bigr) = \sum_{j=1}^{N} e^{s(q_i,k_j)}(v_j,1),

where

s(qi,kj)=qi⊤kjd.s(q_i,k_j)=\frac{q_i^\top k_j}{\sqrt d}.

The normalized output is

o(qi)=n(qi)z(qi).o(q_i)=\frac{n(q_i)}{z(q_i)}.

This formulation permits exact and approximate block contributions to be accumulated under one shared normalization. It is central to Spark-Attn because unselected blocks are not simply discarded: their estimated numerators and masses continue to affect the output and the normalization of selected exact tokens.

Conventional block-sparse attention partitions tokens according to fixed spatial, temporal, or raster-order layouts. For a query tile II and key–value tile JJ, it computes a routing score from mean queries and mean keys,

rIJ=qˉI⊤kˉJd,r_{IJ} = \frac{\bar q_I^\top\bar k_J}{\sqrt d},

and evaluates the highest-scoring fraction of tiles exactly. If ρ\rho denotes exact-block density, the exact branch evaluates approximately ρN2\rho N^2 token interactions, while the overall dominant interaction term is approximately O(ρN2d)O(\rho N^2d), in addition to routing, reblocking, compression, and compressed-query costs.

Spark-Attn addresses two limitations of this baseline:

  • Preference mismatch: fixed tiles can contain tokens with dissimilar attention preferences, causing mean queries or keys to be poor routing representatives.
  • Compression bias: replacing a key–value tile with uniformly averaged representations generally underestimates its attention mass because exponentiation is nonlinear.

The method therefore separates the problem into token organization and unselected-block approximation. Spark-Reblock addresses preference mismatch, whereas Spark-Reweight addresses compression bias.

2. Spark-Reblock: preference-aware regular tiling

Spark-Reblock recursively partitions tokens according to their induced attention preferences rather than their raw feature-space proximity or original spatial order. For a query qq, the normalized interaction vector is

uQ(q)=Kq∥Kq∥2.u_Q(q)=\frac{Kq}{\lVert Kq\rVert_2}.

Two queries are considered similar when they induce similar score patterns over the current key set. The corresponding preference distance is

dQ(q,q′)=1−uQ(q)⊤uQ(q′)=1−cos⁡(MK1/2q,MK1/2q′),d_Q(q,q') = 1-u_Q(q)^\top u_Q(q') = 1-\cos\bigl(M_K^{1/2}q,M_K^{1/2}q'\bigr),

where

MK=K⊤KN.M_K=\frac{K^\top K}{N}.

A symmetric key distance is defined using

MQ=Q⊤QN.M_Q=\frac{Q^\top Q}{N}.

In practice, Spark-Reblock estimates the relevant second-moment matrix M^\widehat M from sampled tokens and reuses it during partition construction, avoiding formation of the dense attention matrix.

For each current token group GG, tokens are transformed as

zx=M^1/2x.z_x=\widehat M^{1/2}x.

The algorithm chooses two local landmark-derived representatives, μG,−\mu_{G,-} and μG,+\mu_{G,+}, and assigns each token a split margin

ΔG(x)=cos⁡(zx,μG,+)−cos⁡(zx,μG,−).\Delta_G(x) = \cos(z_x,\mu_{G,+}) - \cos(z_x,\mu_{G,-}).

Tokens are sorted by (ΔG(x),x)(\Delta_G(x),x) and divided into prescribed child groups. Recursion terminates when a group reaches the target tile size b⋆b_\star. Thus, the leaves are uniformly sized tiles, subject to boundary handling when the sequence is not exactly divisible by the tile size.

The recursive construction preserves regular block shapes while adapting token grouping to attention preference. This distinction is important for GPU execution: arbitrary clustering can improve semantic coherence but produce irregular memory layouts, whereas Spark-Reblock maintains fixed-capacity leaves suitable for block-oriented kernels.

Spark-H3 uses 32 landmarks, two refinement updates per split, and 64 tokens per tile. To reduce construction cost, it batches four binary partitioning levels at once. A landmark tree creates 15 split directions for 16 child groups, after which a batched matrix product evaluates split scores and rank cutoffs form the child partitions and token permutation. With fixed feature dimension and landmark budget, the construction complexity is O(Nlog⁡N)O(N\log N).

The standard Spark-H3 configuration partitions using keys and applies the resulting permutation to QQ, KK, and VV. The output is restored to the original query order after attention. A variant, Spark-H3†^\dagger, separately partitions queries and key–value tokens using the query and key preference distances. This can improve alignment slightly but incurs additional construction complexity and modestly higher latency.

After reblocking, query and key–value tiles are routed using

rIJ=qˉI⊤kˉJd.r_{IJ} = \frac{\bar q_I^\top\bar k_J}{\sqrt d}.

For each query tile II, the router selects approximately ρM\rho M of the MM key–value tiles. Selected tiles are computed with token-level precision; unselected tiles are processed by Spark-Reweight.

3. Spark-Reweight: calibrated representation of unselected blocks

Uniform averaging of an unselected key–value tile introduces a systematic mass error. For a key tile JJ, the standard mean-key approximation estimates its mass as

m^J(q)≈bkves(q,kˉJ),\widehat m_J(q) \approx b_{kv}e^{s(q,\bar k_J)},

with estimated log-mass

ℓ^J(q)=s(q,kˉJ)+log⁡bkv.\widehat\ell_J(q) = s(q,\bar k_J)+\log b_{kv}.

The exact log-mass is

ℓJ(q)=log⁡∑j∈Jes(q,kj).\ell_J(q) = \log\sum_{j\in J}e^{s(q,k_j)}.

Jensen’s inequality gives

ℓJ(q)−(log⁡bkv+s(q,kˉJ))≥0.\ell_J(q) - \bigl(\log b_{kv}+s(q,\bar k_J)\bigr) \ge 0.

Therefore, mean pooling generally underestimates the contribution of a compressed tile.

Spark-Reweight uses the global mean query

qˉ=1N∑i=1Nqi\bar q=\frac{1}{N}\sum_{i=1}^{N}q_i

as an anchor. For tile JJ, define

eJ(qˉ)=exp⁡(TJKqˉd),\mathbf e_J(\bar q) = \exp\left(\frac{\mathcal T_J^K\bar q}{\sqrt d}\right),

and its exact anchor mass

mJ(qˉ)=1⊤eJ(qˉ).m_J(\bar q) = \mathbf 1^\top\mathbf e_J(\bar q).

The normalized anchor weights are

wJ(qˉ)=eJ(qˉ)mJ(qˉ).\mathbf w_J(\bar q) = \frac{\mathbf e_J(\bar q)}{m_J(\bar q)}.

Using these weights, Spark-Reweight constructs attention-weighted representatives:

k~J=(TJK)⊤wJ(qˉ),\widetilde k_J = (\mathcal T_J^K)^\top\mathbf w_J(\bar q),

and

v~J=(TJV)⊤wJ(qˉ).\widetilde v_J = (\mathcal T_J^V)^\top\mathbf w_J(\bar q).

These differ from ordinary means because keys and values that receive greater attention under the anchor query contribute more strongly to the representatives.

A scalar logit bias calibrates the total mass:

βJ=log⁡mJ(qˉ)−s(qˉ,k~J).\beta_J = \log m_J(\bar q) - s(\bar q,\widetilde k_J).

For an unselected tile, Spark-Reweight approximates its mass and numerator as

m^J(q)=es(q,k~J)+βJ,\widehat m_J(q) = e^{s(q,\widetilde k_J)+\beta_J},

and

n^J(q)=m^J(q)v~J.\widehat n_J(q) = \widehat m_J(q)\widetilde v_J.

The compressed tile is therefore represented by

(k~J,v~J,βJ).(\widetilde k_J,\widetilde v_J,\beta_J).

The method has a first-order Taylor interpretation. Let

ℓJ(q)=log⁡mJ(q).\ell_J(q)=\log m_J(q).

Its gradient at the anchor is

∇ℓJ(qˉ)=k~Jd.\nabla\ell_J(\bar q) = \frac{\widetilde k_J}{\sqrt d}.

The first-order expansion is

TqˉℓJ(q)=ℓJ(qˉ)+(q−qˉ)⊤∇ℓJ(qˉ)=s(q,k~J)+βJ.T_{\bar q}\ell_J(q) = \ell_J(\bar q) + (q-\bar q)^\top\nabla\ell_J(\bar q) = s(q,\widetilde k_J)+\beta_J.

Consequently, the approximation is exact at the anchor in the sense that

m^J(qˉ)=mJ(qˉ),\widehat m_J(\bar q)=m_J(\bar q),

and, because v~J\widetilde v_J is the anchor-normalized value aggregate,

n^J(qˉ)=nJ(qˉ).\widehat n_J(\bar q)=n_J(\bar q).

Away from qˉ\bar q, Spark-Reweight is a first-order approximation. Its accuracy depends on how representative the global mean query is for the queries being processed and on the nonlinearity of the tile’s log-sum-exp function.

4. Integrated inference procedure

Spark-Attn is applied independently for each attention head and denoising step. The procedure begins with current projections QQ, KK, and VV. A preference metric is estimated from sampled tokens, and Spark-Reblock produces fixed-size preference-aware tiles.

The tile means qˉI\bar q_I and kˉJ\bar k_J are then computed, and routing scores

rIJ=qˉI⊤kˉJdr_{IJ} = \frac{\bar q_I^\top\bar k_J}{\sqrt d}

are used to select an exact tile set SI\mathcal S_I for each query tile. Exact blocks satisfy J∈SIJ\in\mathcal S_I and are evaluated using the full token-level score matrix. For query qiq_i, the exact contribution from tile JJ is

(nJ(qi),mJ(qi))=∑j∈Jes(qi,kj)(vj,1).(n_J(q_i),m_J(q_i)) = \sum_{j\in J} e^{s(q_i,k_j)}(v_j,1).

For unselected tiles, Spark-Reweight supplies n^J(qi)\widehat n_J(q_i) and m^J(qi)\widehat m_J(q_i). The complete output is

o^(qi)=∑J∈SInJ(qi)+∑J∉SIn^J(qi)∑J∈SImJ(qi)+∑J∉SIm^J(qi).\widehat o(q_i) = \frac{ \sum_{J\in\mathcal S_I}n_J(q_i) + \sum_{J\notin\mathcal S_I}\widehat n_J(q_i) }{ \sum_{J\in\mathcal S_I}m_J(q_i) + \sum_{J\notin\mathcal S_I}\widehat m_J(q_i) }.

Selected tiles are masked out of the compressed branch so that no tile is double-counted. Exact and compressed branches contribute to the same denominator. Consequently, an unselected tile can alter the normalized weights assigned to exact keys, even though its internal token-level interactions are not evaluated.

The principal control parameter is exact density ρ\rho. A smaller ρ\rho increases speedup but places greater reliance on compressed tile representations. A larger ρ\rho improves fidelity while reducing acceleration. The overall speed is not exactly 1/ρ1/\rho because reblocking, routing, compression, permutations, kernel launches, and compressed-query evaluation remain part of the computation.

Spark-Attn is inference-only. It does not modify model parameters, LoRAs, or denoising schedules, and does not require model retraining. The reported experiments use dense warm-up steps before sparse attention, allowing early denoising structure to form before applying aggressive sparsification.

5. Experimental results

MiniMax-H3

The primary evaluation uses MiniMax-H3 to generate 14.4-second videos at 1344×7681344\times768 resolution with 345 frames and 20 denoising steps. The first four denoising steps are dense, and quality is measured relative to dense outputs.

Method Density DiT latency Speedup PSNR
Dense 100% 4061.8 s 1.00×1.00\times ∞\infty
PISA 10% 1643.4 s 2.47×2.47\times 20.20 dB
Sol-H3 approximately 20.8% 1781.9 s 2.28×2.28\times 21.26 dB
Spark-H3 10% 1629.6 s 2.49×2.49\times 24.81 dB
Spark-H3 20% 1796.1 s 2.26×2.26\times 26.76 dB
Spark-H3†^\dagger 20% 1818.0 s 2.23×2.23\times 26.89 dB

At 10% density, Spark-H3 achieves the highest reported speedup and a PSNR of 24.81 dB. At 20% density, PSNR increases to 26.76 dB while the DiT speedup remains 2.26×2.26\times. Spark-H3†^\dagger reaches 26.89 dB but is slightly slower.

The dense baseline has SSIM $1.00$, LPIPS $0$, and VBench $84.38$. Spark-H3 at 20% density reaches SSIM $0.86$, LPIPS $0.09$, and VBench $84.50$. Spark-H3†^\dagger reaches SSIM $0.87$, LPIPS $0.08$, and VBench $84.56$.

LTX-2.5

The second evaluation uses LTX-2.5 for 10-second videos at 3840×21763840\times2176. The reported sparse-attention latency covers the second stage of the generation process.

Method Density Latency Speedup PSNR
Dense 100% 1223.6 s 1.00×1.00\times ∞\infty
PISA 10% 313.4 s 3.90×3.90\times 29.20 dB
Sol-Attn approximately 18.5% 385.7 s 3.17×3.17\times 24.72 dB
Spark-Attn 10% 312.0 s 3.92×3.92\times 30.84 dB
Spark-Attn 20% 415.1 s 2.95×2.95\times 32.68 dB
Spark-Attn 50% 736.9 s 1.66×1.66\times 36.79 dB
Spark-Attn†^\dagger 50% 737.8 s 1.66×1.66\times 35.16 dB

At 10% density, Spark-Attn matches PISA’s latency while improving PSNR by 1.64 dB. Increasing density produces the expected quality–efficiency trade-off: 20% density yields 32.68 dB PSNR at 2.95×2.95\times speedup, while 50% density yields 36.79 dB at 1.66×1.66\times speedup.

MiniMax-H3-Turbo

Spark-H3 is also evaluated on MiniMax-H3-Turbo, an eight-step distilled LoRA, using 14.4-second videos at 1344×7681344\times768. The first two steps are dense.

Method Density Speedup PSNR
Spark-H3 10% 2.27×2.27\times 24.80 dB
Spark-H3 20% 2.08×2.08\times 26.48 dB
Spark-H3†^\dagger 20% 2.07×2.07\times 26.65 dB

These results indicate that Spark-Attn can be applied to a few-step distilled model without retraining the adapted model.

6. Ablations, limitations, and significance

Spark-Reblock ablation

At 10% exact-block density, removing Spark-Reblock reduces attention-mass recall from 79.69±0.91%79.69\pm0.91\% to 61.36±2.71%61.36\pm2.71\% and PSNR from 24.81 dB to 20.30 dB. At 20% density, recall falls from 88.63±0.61%88.63\pm0.61\% to 74.05±2.12%74.05\pm2.12\%, while PSNR falls from 26.76 dB to 21.65 dB.

Thus, Spark-Reblock increases recall by 18.33 percentage points at 10% density and 14.58 points at 20% density. It improves PSNR by 4.51 dB and 5.11 dB at the respective densities. The method at 10% density with reblocking outperforms fixed grouping at 20% density in the reported comparison.

Spark-Reweight ablation

At 20% density, the effect of Spark-Reweight is:

Reblock Reweight Log-mass MAE PSNR
No No 3.38 21.24 dB
No Yes 2.52 21.65 dB
Yes No 1.39 26.24 dB
Yes Yes 1.16 26.76 dB

Spark-Reweight reduces log-mass error both with and without reblocking. Its benefit is larger after Spark-Reblock has produced more coherent tiles.

Principal limitations

Spark-Attn remains an approximation to dense attention. Its accuracy is limited by several factors:

  • Anchor dependence: Spark-Reweight is first-order accurate at the global mean query. Queries far from that anchor can incur larger mass errors.
  • Residual tile heterogeneity: Spark-Reblock reduces preference variation but cannot eliminate it.
  • Routing error: tile-mean routing can still misrank blocks when tiles remain multimodal.
  • Construction overhead: recursive partitioning, landmark processing, rank selection, and permutations reduce the benefit at shorter sequence lengths.
  • Warm-up dependence: the reported results use dense initial denoising steps; a fully sparse procedure could have different fidelity and speed characteristics.
  • Hyperparameter sensitivity: tile size, landmark count, refinement updates, exact density, and partitioning strategy affect quality and latency.
  • Hardware dependence: nominal block sparsity does not guarantee proportional wall-clock acceleration; performance depends on block-sparse kernels and scheduling.
  • Quality metric scope: the principal measurements compare sparse outputs with dense outputs using PSNR, SSIM, LPIPS, and VBench. These establish approximation fidelity but do not constitute a guarantee of identical generated distributions or semantic quality across all prompts.

Spark-Attn’s central contribution is the joint treatment of where attention blocks are formed and how unselected blocks are represented. Spark-Reblock aligns regular GPU tiles with attention preferences, while Spark-Reweight preserves compressed-block mass through an attention-weighted representative and a calibrated logit bias. The resulting method retains exact computation for a small fraction of blocks and approximates the remainder under a common softmax normalization. In the reported long-video settings, this yields 2.49×2.49\times DiT speedup at 10% exact-block density with 24.81 dB PSNR on MiniMax-H3, and 26.76 dB PSNR at 20% density with 2.26×2.26\times speedup.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Spark-Attn.