arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.13189cs.LGcs.AIcs.CL
收藏

MoBA:用于长上下文大语言模型的块注意力混合机制

MoBA: Mixture of Block Attention for Long-Context LLMs

Moonshot AI(月之暗面);Tsinghua University(清华大学);Zhejiang Lab(之江实验室);Zhejiang University(浙江大学)
Enzhe Lu, Zhejun Jiang, Jingyuan Liu, Yulun Du, Tao Jiang, Chao Hong, Shaowei Liu, Weiran He, Enming Yuan, Yuzhi Wang, Zhiqi Huang, Huan Yuan, Suting Xu, Xinran… 展开作者

Enzhe Lu, Zhejun Jiang, Jingyuan Liu, Yulun Du, Tao Jiang, Chao Hong, Shaowei Liu, Weiran He, Enming Yuan, Yuzhi Wang, Zhiqi Huang, Huan Yuan, Suting Xu, Xinran Xu, Guokun Lai, Yanru Chen, Huabin Zheng, Junjie Yan, Jianlin Su, Yuxin Wu, Neo Y. Zhang, Zhilin Yang, Xinyu Zhou, Mingxing Zhang, Jiezhong Qiu

AI总结:

针对长上下文LLMs传统注意力机制的二次复杂度问题,提出块注意力混合机制(MoBA),通过将MoE原理应用于注意力机制,实现全注意力与稀疏注意力的无缝切换,提升长上下文任务性能与效率,已支持Kimi的长上下文请求。

摘要:

扩展有效上下文长度对于推动大语言模型(LLMs)向人工通用智能(AGI)发展至关重要。然而,传统注意力机制固有的计算复杂度二次增长带来了难以承受的开销。现有方法要么采用强偏向性结构(如任务特定的sink或窗口注意力),要么将注意力机制彻底修改为线性近似,而后者在复杂推理任务中的性能仍未得到充分探索。在这项工作中,我们提出了一种遵循“更少结构”原则的解决方案,允许模型自主决定注意力分配位置,而非引入预定义偏差。我们引入块注意力混合机制(MoBA),这是一种将专家混合(MoE)原理应用于注意力机制的创新方法。该新型架构在长上下文任务上表现出优越性能,同时具备关键优势:能够在全注意力和稀疏注意力之间无缝切换,在不影响性能的前提下提升效率。MoBA已部署用于支持Kimi的长上下文请求,并在LLMs的高效注意力计算方面展现出显著进步。我们的代码可在https://github.com/MoonshotAI/MoBA获取。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑