INTRA: Interleaved Non-contiguous Token spaRse Attention
Organizations: New York University
Abstract
Transformers achieve strong performance across modalities but are bottlenecked by the quadratic cost of attention. Sparse attention can reduce this cost, but effective sparsity must preserve useful long-range communication and map well to GPU hardware. We introduce INTRA--Interleaved Non-contiguous Token spaRse Attention--a hardware-aware static sparse attention design based on a relay-communication view under Computational Query Set (CQS) constraints. Rather than directly covering all token-to-token interactions within each sparse layer, INTRA uses complementary sparse groups to provide short mediated communication paths across layers. Scatter forms relay groups that sample broadly across local neighborhoods, while Gather reconnects these groups in subsequent layers. Under a partition model, this structure guides CQS-compatible sparse patterns with global reachability. Our CQS-aware FlashAttention-style kernel computes structured indices at runtime, loads selected non-contiguous tokens, and packs them densely for computation. On an A100, INTRA achieves a speedup in FLUX.1-dev generation, with better measured image quality than evaluated CLEAR configurations after LoRA self-distillation. On LLaMA-3.1-8B, it improves long-context prefill efficiency with strong teacher-forced retrieval performance under matched LoRA adaptation. Attention-only benchmarks further show up to and speedups over MoBA and density-constrained NSA, respectively. Code is available at https://github.com/NovTi/INTRA.
Figures & tables
| Methods | Seq Len | Config | GFLOPS | Latency(ms) | Speedup | FID |
|---|---|---|---|---|---|---|
| FlashAttention 2 | 4K | - | 260.9 | 1.181 | - | - |
| CLEAR | r=8 | 63.5 | 0.893 | 11.70 | ||
| INTRA | Interleave Scatter/Gather | 50.75 | 0.324 | 11.74 | ||
| FlashAttention 2 | 16K | - | 3507.9 | 15.764 | - | - |
| CLEAR | r=8 | 246.2 | 4.625 | 32.46 | ||
| INTRA | Interleave Scatter/Gather | 345.5 | 2.056 | 15.67 |
| 1024 1024 Image Generation | 2048 2048 Image Generation | |||||||
|---|---|---|---|---|---|---|---|---|
| Method | FID ( ) | LPIPS ( ) | CLIPI ( ) | Gen Time(s) | FID ( ) | LPIPS ( ) | CLIPI ( ) | Gen Time(s) |
| Original Model | - | - | - | 13.42 | - | - | - | 66.78 |
| CLEAR (r=8) | 11.70 | 49.96 | 0.8995 | 12.85 | 32.46 | 61.62 | 0.8046 | 47.81 |
| CLEAR (r=4-8) | - | - | - | 13.73 | 19.27 | 54.60 | 0.8467 | 52.07 |
| INTRA | 11.74 | 49.46 | 0.9045 | 11.97 | 15.67 | 51.99 | 0.8559 | 43.72 |
| Pattern in selected layers | Overall retained density | Mean NIAH |
|---|---|---|
| Sliding window | 0.069 | 0.028 |
| INTRA block-level sparse attention | 0.123 | 0.923 |
| Dense attention | 0.185 | 1.000 |
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | 4K | 8K | 16K | 32K |
|---|---|---|---|---|
| FlashAttention 2 | 0.82 | 2.86 | 10.57 | 40.96 |
| INTRA | 0.16 | See Table 3 (a) | ||
| Method | 4K | 8K | 16K | 32K |
|---|---|---|---|---|
| FlashAttention 2 | 137.4 | 549.8 | 2199.1 | 8796.3 |
| MInference | – | 329.8 | 1275.4 | 4398.1 |
| XAttn S=16 | – | 153.6 | 614.2 | 2615.1 |
| INTRA | 17.2 | 68.7 | 274.9 | 1099.5 |
| Pattern | Seq. Len. | Ideal | Actual |
|---|---|---|---|
| Scatter | 4K | ||
| Gather 1 | 4K | ||
| Scatter | 8K | ||
| Gather 1 | 8K | ||
| Scatter | 16K | ||
| Gather 1 | 16K |
| Method | Memory Throughput | Compute Throughput | Time (ms) |
|---|---|---|---|
| FlashAttention | 49.95 | 70.69 | 15.80 |
| INTRA Scatter | 86.31 | 56.64 | 3.04 |
| INTRA Gather 0 | 79.48 | 51.19 | 1.07 |
| Pattern | Seq. Len. | INTRA (ms) | Equally Sparse (ms) |
|---|---|---|---|
| Scatter | 4K | 0.17 | 0.19 |
| Scatter | 8K | 0.53 | 0.52 |
| Scatter | 16K | 1.79 | 1.65 |
| Scatter | 32K | 6.58 | 5.73 |
| Gather 1 | 4K | 0.29 | 0.22 |
| Gather 1 | 16K | 1.07 | 0.79 |
| GovReport | Qasper | QMSum | QuALITY | SummScreen-FD | |
|---|---|---|---|---|---|
| Original model (no fine-tune) | 24.13 | 34.91 | 21.17 | 0.0 | 16.77 |
| Original model | 31.05 | 40.09 | 25.37 | 26.0 | 20.51 |
| INTRA | 27.77 | 39.64 | 24.45 | 29.0 | 19.71 |
| Window width | NIAH at 4K | NIAH at 32K |
|---|---|---|
| 575 | 0.111 | 0.000 |
| 2048 | 0.556 | 0.000 |
| 4096 | 1.000 | 0.111 |
| Configuration | Retained density | Mean NIAH |
|---|---|---|
| Sparse attention in 16 layers (per-layer density 0.125) | 0.098 | 0.130 |
| Wider windows | 0.234 | 0.222 |
| Four global sparse layers (per-layer density 0.5) | 0.123 | 0.923 |
| Dense + LoRA | 1.000 | 1.000 |
| VBench dimension | Dense | INTRA | Absolute difference |
|---|---|---|---|
| Subject consistency | 0.9427 | 0.9405 | 0.0022 |
| Background consistency | 0.9587 | 0.9551 | 0.0036 |
| Aesthetic quality | 0.5362 | 0.5168 | 0.0194 |
| Imaging quality | 0.6036 | 0.5472 | 0.0564 |
| Temporal flickering | 0.9886 | 0.9874 | 0.0012 |
| Motion smoothness | 0.9664 | 0.9689 | 0.0025 |
| Resolution | |||
|---|---|---|---|
| Frames / video tokens | 49 / 5,070 | 121 / 27,280 | 241 / 53,680 |
| End-to-end generation and pipeline components (s) | |||
| Total generation | — | ||
| End-to-end speedup | — | ||
| DiT total (100 forwards) | — | ||
| VAE decoding | 2.6 | 13.4 | — |
Sparse Attention
Sparse attention reduces the token interactions computed by Transformers to lower the cost of long-context modeling and inference.
See all 245 papers