Introduction
As AI models push toward "infinite context," the standard Transformer's quadratic complexity ($O(N^2)$) has become a significant bottleneck. While Linear Attention and State Space Models (SSMs) reduce this complexity to $O(N)$, they introduce new challenges in parallelization. Training on massive sequences requires splitting data across multiple GPUs (Sequence Parallelism). Existing methods like Ring Attention rely on sequential point-to-point (P2P) communication, creating dependencies that limit hardware utilization and prevent effective communication-computation overlap.
Methods: The LASP-2 Framework
LASP-2 rethinks the communication-computation workflow for linear attention by leveraging collective communication primitives rather than sequential ring patterns.
AllGather on Memory States
In linear attention, the "memory state" (the accumulated $K^T V$ matrix) has a fixed size of $d \times d$, which is independent of sequence length. LASP-2 has every GPU compute its local memory state and then performs a single AllGather operation. This ensures all GPUs receive global state information simultaneously, removing the sequential bottleneck inherent in ring-based approaches.
Computation Decomposition and Overlap
For autoregressive tasks, LASP-2 splits work into "intra-chunk" (local attention) and "inter-chunk" (influence from previous segments) components. This decomposition allows the AllGather communication to occur in the background while GPUs calculate local attention, maximizing hardware efficiency.
LASP-2H for Hybrid Architectures
The framework extends to hybrid models (e.g., Jamba, Samba) through LASP-2H. It applies a similar AllGather strategy for standard attention layers by gathering $K$ and $V$ tensors, providing greater flexibility for complex attention masks compared to traditional ring methods.
Key Results
The researchers evaluated LASP-2 on a cluster of 64 NVIDIA A100 GPUs using Linear-Llama3 variants.
Throughput and Scalability
LASP-2 demonstrates significant performance gains over existing baselines. At a sequence length of 2048K tokens, LASP-2 achieved a 36.6% speedup over Ring Attention and was 15.2% faster than LASP-1.
The system also showed near-perfect linear scaling; for instance, 128 GPUs could process a 2048K sequence with the same per-GPU memory footprint as 8 GPUs processing a 128K sequence.
Convergence and Accuracy
Training tests on the SlimPajama dataset confirmed that LASP-2's efficiency gains do not compromise model accuracy. The loss curves for Linear-Llama3 models trained with LASP-2 were nearly identical to those of the baseline models, proving the method maintains mathematical integrity.
Conclusion
LASP-2 addresses the parallelization bottleneck of linear attention models by replacing sequential P2P communication with efficient collective operations on compact memory states. By decoupling communication overhead from sequence length and enabling superior computation overlap, LASP-2 provides a scalable path toward training models with multi-million token contexts. Future work may explore further optimizations for Mixture-of-Experts (MoE) and even more complex hybrid architectures.
Summary updated