Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

0

上海报道 – 在人工智能领域,大型语言模型(LLM)的推理效率一直是研究人员关注的焦点。近日,复旦大学、华东师范大学、上海AI Lab等机构联合推出了一种名为MHA2MLA的创新方法,旨在优化基于Transformer的LLM的推理效率,并显著降低推理成本。

MHA2MLA的核心在于引入了DeepSeek的多头潜在注意力机制(MLA),并通过两项关键策略实现性能提升:一是partial-RoPE(部分旋转位置编码),二是低秩近似。

技术解析:Partial-RoPE与低秩近似

Partial-RoPE 旨在移除对注意力分数贡献较小的查询和键的旋转位置编码(RoPE)维度。在传统的MHA(多头注意力机制)中,RoPE通过旋转操作将位置信息融入查询向量(Q)和键向量(K),帮助模型捕捉序列中的位置关系。MHA2MLA通过计算每个维度对注意力分数的贡献,移除贡献较小的RoPE维度,从而减少计算量和内存占用。

低秩近似 则基于联合奇异值分解(SVD)对键和值进行压缩,减少KV缓存的内存占用。MHA2MLA借鉴了MLA的思想,对MHA中的键和值参数矩阵进行奇异值分解(SVD),将键和值矩阵分解为低秩矩阵的乘积,用更少的参数近似原始矩阵。为了更好地保留键和值之间的交互信息,MHA2MLA采用了联合SVD(SVDjoint)策略,对键和值矩阵进行联合分解,而不是分别处理。

性能表现:大幅减少KV缓存,性能损失极小

实验结果表明,MHA2MLA仅需使用原始数据的0.3%到0.6%进行微调,就能在大幅减少KV缓存(高达92.19%)的同时,将性能损失控制在极小范围内。例如,在LongBench性能测试中,性能仅下降0.5%。

应用场景:边缘设备、大规模推理、长文本处理

MHA2MLA的应用场景广泛,包括:

  • 边缘设备部署: 降低模型内存占用,使其适配资源受限的智能终端和物联网设备。
  • 大规模模型推理: 减少KV缓存,提升推理效率,降低硬件成本和能耗。
  • 结合量化技术: 与量化技术(如4-bit量化)结合使用,进一步提升推理效率,适用于实时对话和在线翻译等场景。
  • 长文本处理: 降低长文本任务的内存瓶颈,高效处理长文档摘要和长篇生成。
  • 快速模型迁移: 仅需少量数据微调,快速将MHA模型转换为MLA架构,降低迁移成本。

专家观点

“MHA2MLA的出现,为LLM的实际应用带来了新的可能性,”一位不愿透露姓名的AI领域专家表示,“通过有效降低推理成本,它使得更复杂的模型能够在资源有限的环境中运行,同时也为大规模部署提供了更经济的解决方案。”

项目地址

感兴趣的读者可以通过以下链接了解更多信息:

结论

MHA2MLA的推出,无疑为LLM的优化提供了一个新的思路。其在降低推理成本、提升推理效率方面的潜力,将有望推动LLM在更多领域的应用,并加速人工智能技术的普及。未来,我们期待看到更多基于MHA2MLA的创新应用,以及其在实际场景中的表现。

参考文献

注: 由于提供的arXiv链接指向一个未来的日期,请在实际引用时确保链接的有效性。


>>> Read more <<<

Views: 0

0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注