SLA2: Sparse-Linear Attention with Learnable Routing
- SLA2 is a transformer attention mechanism combining sparse and linear branches through dynamic learnable routing and quantization-aware tuning.
- It employs a novel sparse–linear decomposition with direct α-mixing to ensure row normalization and maintain quality with 97% sparsity.
- Empirical results in video diffusion show significant speedups and metric improvements over dense attention, validating its efficiency.
SLA2 refers to “Sparse-Linear Attention with Learnable Routing and QAT”—a transformer attention mechanism that unifies sparse and linear attention branches through dynamic, learned routing and quantization-aware fine-tuning, achieving high compute sparsity and substantial acceleration in diffusion-based video generation without degrading output quality (Zhang et al., 13 Feb 2026).
1. Sparse–Linear Decomposition and Direct α-Mixing
SLA2 is grounded on a direct, mathematically principled decomposition of the attention map. For a query-key-value configuration with , full softmax attention weights are approximated as a convex mixture:
- Sparse branch: , where and is a learnable mask.
- Linear branch: with an activation (e.g., softmax), row-normalization.
A learnable, per-query mixing ratio dictates the combination:
The attended output is then:
0
Unlike prior SLA approaches that apply a magnitude heuristic to select sparse versus linear computation, SLA2's 1 is optimized end-to-end, eliminating bias and scale mismatches between the two branches and maintaining row normalization without further projection.
2. Learnable Blockwise Router
SLA2’s routing mask 2 is generated by a blockwise compression over 3, followed by differentiable top-4 selection:
- Pooling: 5 and 6 are pooled along rows and columns using block sizes 7 to yield 8 and 9.
- Projected scores: 0 and 1 (2 learnable), producing 3.
- Masking: At inference, hard Top-4 per row: 5 if 6 is among top 7, else 8. Training uses SoftTop-9 with a temperature 0 and Lagrange multiplier 1 to enforce sparsity constraints, allowing gradient flow.
The mask 2 is expanded back to 3 for sparse computation. This mechanism spatially pools attention allocation, scales formally to large 4, and exposes mask sparsity as a tunable, learnable hyperparameter.
3. Quantization-Aware Sparse Attention (QAT)
To reduce arithmetic intensity and memory overhead, SLA2 incorporates quantization-aware fine-tuning (QAT):
- Forward pass: 5 quantized to INT8/FP8 for all sparse-branch steps; s, the scale, accompanies each tensor.
- Attention computation: 6, 7 and 8 quantized using scale parameters, then dequantized for accumulation.
- Backward pass: Gradients are computed using FP16 (or higher precision), treating quantization as identity for backward propagation.
This design allows model parameters—including the router and mixing ratio 9—to adapt to quantization artifacts, leading to negligible performance degradation even at low bit-width. Empirical ablations show removing QAT substantially degrades generation metrics.
4. Error Analysis and Computational Complexity
A direct consequence of SLA2’s design is an exact, row-normalized mixture, avoiding the scale-mismatch incurred by prior SLA methods:
- Given the masked “true” sparse map 0 with row sums 1, 2 (3 is effectively the marginal importance of the sparse branch). SLA2 reconstructs the attention as 4.
- This guarantees the combined output 5 matches the formal mixture of masked softmax and linear attention.
Complexity: For 6 sparsity, sparse branch cost is 7, linear branch is 8, yielding total FLOPs 9. At 0, this corresponds to ≈97% reduction in operations compared to dense attention.
5. Empirical Evaluation in Video Diffusion Models
SLA2 has been extensively tested on video diffusion with Wan2.1-T2V-1.3B (480p) and 14B (720p) models. Metrics include VBench (IQ, OC, AQ, MS, SC) and VisionReward, reporting both quality and efficiency.
- At 97% sparsity:
- IQ: 66.64 (1.3B), 66.93 (14B)
- VisionReward: 0.1039–0.1149 (matches full attention)
- Attention FLOPs: 1.82T (1.3B, 97%), 9.26T (14B, 97%) vs 52.75T for dense
- Kernel speedup: 1–2 over FlashAttn2 @ full attention, 3 VMoBA, 4 VSA at 95%.
- End-to-end video latency: 1.3B: 97s57s (13.9×); 14B: 4.35× speedup, making previously infeasible generations tractable.
Ablations show the necessity of QAT and the learned router; disabling either yields significantly reduced IQ and VR.
| Model | Sparsity | IQ | VR | FLOPs (T) | Speedup (FlashAttn2) |
|---|---|---|---|---|---|
| Full Attention | 0% | 63.67 | — | 52.75 | 1× |
| SLA2 (1.3B) | 90% | 67.70 | — | 5.51 | — |
| SLA2 (1.3B) | 95% | 67.04 | — | 2.87 | — |
| SLA2 (1.3B) | 97% | 66.64 | 0.1039 | 1.82 | 18.6× |
| SLA2 (14B) | 97% | 66.93 | 0.1149 | 9.26 | 18.7× |
6. Implementation Notes, Limitations, and Extensions
Implementation uses FlashAttention-style fused kernels for both masked (“sparse”) and blockwise linear branches, avoiding 6 operations in practice. Routing masks are computed on compressed blocks, balancing mask granularity and efficiency.
Limitations:
- Performance verified on video diffusion; transferability to other domains (e.g., NLP, general vision) is not demonstrated.
- The blockwise router may be less effective when attention locality is highly irregular.
- Mask granularity is determined by block size, trading off routing flexibility versus computational savings.
Future directions include adapting SLA2’s direct α-mixing and quantized routing infrastructure to multi-modal transformers, NLP, or large-scale foundation models, and exploring alternative sparse-linear fusion strategies to further minimize error and improve generalization.
7. Comparative Positioning and Impact
SLA2 provides a direct, optimization-driven alternative to heuristic sparse/linear splits, achieving extremely high compute sparsity without sacrificing output quality or imposing additional normalization corrections. Empirical results show consistent outperformance over baseline dense and prior sparse attention schemes at a fraction of computational cost. This suggests a general pathway for integrating learnable routing and quantization into mixed-attention architectures for efficient, scalable, and high-fidelity generative modeling (Zhang et al., 13 Feb 2026).