Top 3 Architectures Reducing Quadratic Costs
Key innovations mitigating quadratic cost growth include Sparse Attention (reducing complexity to near-linear via selective token focus), Retrieval-Augmented Generation (RAG) (offloading long-context needs to external knowledge bases for cost-efficiency), and State-Space Models (SSMs) like Mamba (achieving linear scaling and constant inference memory usage, often outperforming Transformers).
The top 3
- Flash Attention's Memory I/O Optimization: Flash Attention significantly reduces quadratic memory costs by re-architecting how attention is computed, using tiling and recomputation to keep intermediate results in fast on-chip memory (SRAM), rather than slow high-bandwidth memory (HBM). This approach makes long-context modeling practical, scaling memory usage to linear in sequence length for fixed head dimensions, and can achieve up to 70% of the theoretical maximum FLOPS on A100 GPUs.
- Sparse and Linear Attention Mechanisms: These mechanisms reduce the quadratic complexity of traditional attention by either limiting interactions (sparse attention) or reformulating the computation (linear attention). Sparse attention, like Sliding Window Attention used in models such as Mistral, focuses on a fixed-size local context, reducing computation from O(n²) to O(n⋅w). Linear attention methods achieve O(n) complexity through kernel approximations or recurrent formulations, enabling scalable inference, sometimes with minor accuracy trade-offs.
- Flash Attention's Memory Bandwidth Breakthrough: Flash Attention reduces GPU memory reads/writes by tiling attention computation and recomputing softmax in fast on-chip SRAM, achieving 2-4x speedups without approximation and linear memory scaling for long sequences.
Sources
Open the full topic