Sparse Window Attention Extends Context to 128K Tokens

A hierarchical sparse decomposition achieves sub-quadratic long-range attention with minimal quality loss.

Editorial Desk·February 15, 2024·7 min readstrong

Underlying Paper

Efficient Long-Range Attention via Sparse Window Decomposition

We introduce Sparse Window Attention (SWA), a method for extending transformer context lengths to 128K tokens while maintaining sub-quadratic computational complexity. SWA decomposes the attention matrix into hierarchical sparse windows with learned routing, enabling models to selectively attend to relevant distant tokens. Experiments on long-document summarization and retrieval tasks show SWA matches dense attention quality at 4.8× lower cost.

arXiv:2402.08901Submitted: Feb 12, 2024v1

The pursuit of scalable generative models has driven a wave of architectural innovation, yet the quadratic cost of attention in transformer-based diffusion models remains a fundamental bottleneck. This paper introduces a compelling alternative: replacing the attention backbone entirely with structured state space models (SSMs).

Core Contribution

The authors demonstrate that Mamba-style SSMs can serve as drop-in replacements for attention layers in the U-Net architecture commonly used for diffusion. The key insight is that the selective scan mechanism of modern SSMs naturally captures the multi-scale spatial dependencies required for high-quality image generation.

Technical Approach

The architecture, dubbed DiS (Diffusion with State Spaces), modifies the standard DiT (Diffusion Transformer) by replacing each attention block with a bidirectional SSM layer. The authors introduce a novel "cross-scan" strategy that processes image patches along four spatial directions simultaneously, aggregating the results to capture both local texture and global structure.

Results and Analysis

On ImageNet 256×256 unconditional generation, DiS achieves an FID of 2.67, comparable to DiT-XL/2 (FID 2.27) while requiring 3.2× fewer FLOPs per denoising step. The gap narrows further at 512×512 resolution, where DiS achieves FID 3.41 vs. DiT's 3.04 — a marginal quality difference that may be acceptable given the substantial computational savings.

Training convergence is notably faster: DiS reaches its best FID in approximately 400K steps compared to DiT's 700K steps under identical training budgets. The linear-time scaling also enables generation at resolutions the transformer variant cannot practically reach without additional engineering.

Figures

Evidence Box

strong

Key Claims

  • Sub-quadratic attention mechanism for 128K context
  • Learned routing selects relevant distant tokens
  • Maintains dense attention quality at lower cost

Key Results

  • Matches dense attention on long-document QA at 4.8× lower cost
  • ROUGE-L within 0.3 points on summarization tasks

Limitations & Caveats

  • Routing overhead adds latency at short contexts
  • Evaluation on natural text only; code/math tasks untested

Artifacts

Related Articles

Readers are encouraged to consult the original arXiv paper for complete details. SOTA Papers does not make claims beyond what is supported by the authors' reported evidence.