MiniMax 稀疏注意力
MiniMax Sparse Attention
AI总结:
提出 MiniMax 稀疏注意力(MSA),一种基于分组查询注意力的块级稀疏注意力机制,通过轻量索引分支选择 Top-k 键值块,实现高效长上下文处理,在 109B 模型上以 1M 上下文减少 28.4 倍注意力计算,并带来 14.2 倍预填充和 7.6 倍解码加速。
摘要:
超长上下文能力对于前沿大语言模型变得不可或缺:智能体工作流、仓库级代码推理和持久记忆都要求模型共同关注数十万到数百万个 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 倍的解码端到端加速。我们的推理内核可在以下网址获取:this https URL。一个由 MSA 驱动的生产级原生多模态模型已在以下网址公开发布:this https URL。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。