arXiv:2502.13189cs.LGcs.AI2025-02NeurIPS被引 191

MoBA让大模型更高效处理长文本,自动决定关注位置。

MoBA: Mixture of Block Attention for Long-Context LLMs

论文配图:MoBA: Mixture of Block Attention for Long-Context LLMs
图 1 · 摘自论文原文
  • 用块注意力混合机制替代固定注意力模式
  • 支持全注意力与稀疏注意力自由切换,提升效率
  • 已用于Kimi长文本场景,适合长上下文任务

扩展有效上下文长度是推动大语言模型迈向通用人工智能的关键。然而,传统注意力机制固有的二次计算复杂度带来了难以承受的开销。现有方法要么引入强偏置结构(如锚点或窗口注意力),仅适用于特定任务;要么彻底改造注意力为线性近似,但在复杂推理任务中的表现仍不充分。本文提出一种遵循“少结构”原则的新方案,让模型自主决定关注位置,而非预设偏好。我们提出块注意力混合(Mixture of Block Attention, MoBA),将专家混合(MoE)思想引入注意力机制。该架构在长上下文任务中表现优异,且具备关键优势:可无缝切换全注意力与稀疏注意力,提升效率而不牺牲性能。MoBA已部署于Kimi的长文本请求支持中,显著推进了大模型高效注意力计算的发展。代码开源:https://github.com/MoonshotAI/MoBA。

原文摘要 · Abstract (English)

Scaling the effective context length is essential for advancing large language models (LLMs) toward artificial general intelligence (AGI). However, the quadratic increase in computational complexity inherent in traditional attention mechanisms presents a prohibitive overhead. Existing approaches either impose strongly biased structures, such as sink or window attention which are task-specific, or radically modify the attention mechanism into linear approximations, whose performance in complex reasoning tasks remains inadequately explored. In this work, we propose a solution that adheres to the ``less structure'' principle, allowing the model to determine where to attend autonomously, rather than introducing predefined biases. We introduce Mixture of Block Attention (MoBA), an innovative approach that applies the principles of Mixture of Experts (MoE) to the attention mechanism. This novel architecture demonstrates superior performance on long-context tasks while offering a key advantage: the ability to seamlessly transition between full and sparse attention, enhancing efficiency without the risk of compromising performance. MoBA has already been deployed to support Kimi's long-context requests and demonstrates significant advancements in efficient attention computation for LLMs. Our code is available at https://github.com/MoonshotAI/MoBA.

长文本注意力机制MoE高效计算

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。