A Unified Sparse Attention via Multi-Granularity Compression
Abstract
Lay Summary
Long-context inference in large language and multimodal models is bottlenecked by self-attention, whose cost grows quadratically with sequence length and dominates latency at scales beyond tens of thousands of tokens. Existing remedies introduce a structural tension: training-coupled sparse architectures embed efficiency into the model weights but cannot accelerate pre-trained models, while inference-time heuristics buy speed at the cost of fidelity and cross-modal generality. The deeper question is whether a single, modality-agnostic abstraction can reconcile both. We propose UniSparse, which reframes sparse-attention selection through a multi-granularity compression lens. Queries and keys are aggregated into composite tokens — compact summaries that compress along the sequence dimension and, optionally, the head dimension. Proxy attention is computed entirely in this reduced space, yielding block-level importance scores that drive a dynamic Top-P selection at orders-of-magnitude lower cost than full attention, while remaining a drop-in replacement for any pre-trained Transformer. Across long-context language and video benchmarks (RULER, HELMET, Video-MME), UniSparse retains ≥99% of full-attention accuracy and delivers up to 2.6× attention speedup over FlashAttention, establishing multi-granularity compression as a unified principle for training-free sparse attention.