MiniMax 稀疏注意力

MiniMax Sparse Attention

闫俊杰 Junjie Yan · MiniMax · 2026-06-11 · arXiv:2606.13392 ↗ · 被引 2

打开互动全文版(逐段中英对照 + 图/公式 + 论文问答)→

摘要 · Abstract

超长上下文能力对于前沿大语言模型变得不可或缺:智能体工作流、仓库级代码推理和持久记忆都需要模型共同关注数十万到数百万个 token,但 softmax 注意力的二次成本使得这在部署规模上难以实现。我们提出了 MiniMax 稀疏注意力(MSA),一种基于分组查询注意力(GQA)的块级稀疏注意力。轻量级索引分支对键值块进行评分,并为每个 GQA 组独立选择 Top-k 子集,实现组特定的稀疏检索,同时保持高效的块级执行;主分支则仅对所选块执行精确的块稀疏注意力。MSA 的设计遵循简单和可扩展的原则,经过精心简化,使其能够在广泛的 GPU 上高效部署。为了将稀疏性转化为实际加速,我们与 MSA 共同设计了 GPU 执行路径,使用无指数 Top-k 选择和 KV 外部稀疏注意力来改善块粒度访问下的张量核心利用率。在具有原生多模态训练的 109B 参数模型上,MSA 的性能与 GQA 相当,同时在 1M 上下文下将每个 token 的注意力计算减少了 28.4 倍。结合我们共同设计的内核,MSA 在 H800 上实现了 14.2 倍的预填充和 7.6 倍的解码墙钟加速。我们的推理内核可在 https://github.com/MiniMax-AI/MSA 获取。由 MSA 驱动的生产级原生多模态模型已在 https://huggingface.co/MiniMaxAI/MiniMax-M3 公开发布。

Ultra-long-context capability is becoming indispensable for frontier LLMs: agentic workflows, repository-scale code reasoning, and persistent memory all require the model to jointly attend over hundreds of thousands to millions of tokens, yet the quadratic cost of softmax attention makes this untenable at deployment scale. We introduce MiniMax Sparse Attention (MSA), a blockwise sparse attention built upon Grouped Query Attention (GQA). A lightweight Index Branch scores key-value blocks and independently selects a Top-k subset for each GQA group, enabling group-specific sparse retrieval while maintaining efficient block-level execution; the Main Branch then performs exact block-sparse attention over only the selected blocks. Designed around a principle of simplicity and scalability, MSA is deliberately streamlined, making it straightforward to deploy efficiently across a broad range of GPUs. To translate sparsity into practical speedups, we co-design MSA with a GPU execution path that uses exp-free Top-k selection and KV-outer sparse attention to improve tensor-core utilization under block-granular access. On a 109B-parameter model with native multimodal training, MSA performs on par with GQA while reducing per-token attention compute by 28.4x at 1M context. Paired with our co-designed kernel, MSA achieves 14.2x prefill and 7.6x decoding wall-clock speedups on H800. Our inference kernel is available at: https://github.com/MiniMax-AI/MSA. A production-grade natively multimodal model powered by MSA has been publicly released at: https://huggingface.co/MiniMaxAI/MiniMax-M3.

核心贡献 · Key contributions

局限 · Limitations

论文章节 · Sections(共 19)

阅读逐段中英对照全文 →