Optimizing Native Sparse Attention with Latent Attention and Local Global Alternating Strategies

Yuxuan Hu, Jianchao Tan, Jiaqi Zhang, Wen Zan, Pingwei Sun, Yifan Lu, Yerui Sun, Yuchen Xie, Xunliang Cai, Jing ZhangarXiv 2025 · DOI

Abstract

Standard attention mechanisms in Large Language Models (LLMs) face significant scalability challenges due to quadratic computational complexity and high KV-cache memory overhead. This paper introduces Alternating Sparse Attention (ASA), an architecture that alternates between local and global attention patterns across layers. By integrating latent attention mechanisms like Multi-head Latent Attention (MLA) and Grouped-head Latent Attention (GLA), ASA reduces KV-cache memory usage by 50% while maintaining or exceeding the performance of full-attention models on reasoning and long-context tasks.

Introduction

As the demand for long-context capabilities in LLMs grows—driven by tasks like multi-document analysis and long-form code generation—the efficiency of the attention mechanism has become a critical bottleneck. Standard attention scales quadratically ($O(n^2)$) with sequence length, leading to prohibitive computational costs and massive GPU memory consumption for storing the KV-cache.

Native Sparse Attention (NSA) was developed to mitigate these issues by partitioning attention into three specialized branches: sliding-window (local), compressed (summary), and selective (important tokens). However, NSA often suffers from interference between these branches and still maintains a significant memory footprint.

Methods: Alternating Sparse Attention (ASA)

The core innovation of ASA is the Local-Global Alternating Strategy. Unlike NSA, which executes all three sparse attention branches in every layer, ASA alternates them. This design allows specific layers to specialize in either local context processing or global information retrieval, reducing interference and forcing the model to learn effective long-range dependencies.

Comparison of Full Attention (left), Native Sparse Attention (middle), and the proposed Alternating Sparse Attention (right) architectures.

Latent Attention Integration

To further optimize memory, ASA incorporates latent attention mechanisms. For the sliding-window branch, it employs Multi-head Latent Attention (MLA), which compresses the KV-cache into a low-dimensional latent vector. For the selective and compressed branches, the authors introduce Grouped-head Latent Attention (GLA), ensuring compatibility with sparse retrieval patterns. This integration allows the model to maintain high performance while drastically reducing the footprint of the keys and values stored during inference.

Detailed architecture of the GLA (left) and MLA (right) branches within the ASA framework, highlighting the compression, selection, and sliding window mechanisms.

Key Insights

The research highlights two critical findings regarding model behavior:

  1. Functional Specialization: The sliding-window branch acts as the primary engine for common-sense reasoning, whereas the selective branch serves as a "librarian" for long-distance retrieval.
  2. Overcoming the "Shortcut" Problem: In models where local and global attention coexist in every layer, the model tends to rely "lazily" on local context. Alternating these branches across layers forces the network to utilize global retrieval mechanisms more effectively, improving overall retrieval accuracy.

Results and Performance

Evaluations on models up to 1.3B parameters trained on SlimPajama demonstrate that ASA achieves:

  • 50% Reduction in KV-cache Storage: Significant memory savings compared to standard NSA.
  • Performance Parity: Matches or exceeds "Full Attention" models in common-sense reasoning (e.g., PIQA, HellaSwag) and long-context understanding (LongBench).
  • Superior Retrieval: Outperforms NSA on "Needle-In-A-Haystack" benchmarks, indicating better information pinpointing in massive contexts.
  • Hardware Efficiency: Custom GPU kernels provide a 30% speedup in forward-pass latency and a 13% reduction in backward latency for sequences up to 32k tokens.

Conclusion

Alternating Sparse Attention (ASA) represents a significant step toward efficient long-context LLMs. By combining structural alternation with latent attention, it achieves substantial memory savings without sacrificing reasoning or retrieval capabilities. Future work will explore optimal layer placement recipes and scaling these strategies to 70B+ parameter models.

Summary updated

BibTeX
@misc{hu2025optimizing,
  author = {Yuxuan Hu and Jianchao Tan and Jiaqi Zhang and Wen Zan and Pingwei Sun and Yifan Lu and Yerui Sun and Yuchen Xie and Xunliang Cai and Jing Zhang},
  title = {{Optimizing Native Sparse Attention with Latent Attention and Local Global Alternating Strategies}},
  year = {2025},
  eprint = {2511.00819},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.00819},
}
Figure