arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.07864cs.LGcs.AI
收藏

TransMLA:多头潜在注意力就是你所需的全部

TransMLA: Multi-Head Latent Attention Is All You Need

Institute for Artificial Intelligence, Peking University(人工智能研究院,北京大学);State Key Laboratory of General Artificial Intelligence, BIGAI(通用人工智能国家重点实验室,BIGAI);Tencent Youtu Lab, Shanghai, China(腾讯优图实验室,上海,中国);Xiaomi Corp., Beijing, China(小米公司,北京,中国)

Fanxu Meng, Pingzhi Tang, Xiaojuan Tang, Zengwei Yao, Xing Sun, Muhan Zhang

AI总结:

本研究提出TransMLA框架,可将基于GQA的预训练模型无缝转换为MLA结构,兼容DeepSeek优化,大幅压缩KV缓存实现推理加速,仅需少量微调即可恢复原模型性能,为模型架构迁移提供实用方案。

摘要:

本文提出TransMLA,这是一个可将任意基于GQA(分组查询注意力)的预训练模型无缝转换为基于MLA(多头潜在注意力)模型的框架。该方法可直接兼容DeepSeek代码库,使这些模型能充分利用DeepSeek专属优化,如vLLM和SGlang。通过将LLaMA-2-7B中93%的KV缓存进行压缩,TransMLA在8K上下文长度下实现了10.6倍的推理加速,同时保留了有意义的输出质量。此外,该模型仅需60亿个token进行微调,就能在多个基准测试上恢复到与原模型相当的性能。TransMLA为将基于GQA的模型迁移到MLA结构提供了实用方案。当与DeepSeek的FP8量化、多token预测等高级特性结合时,还可实现更高的推理加速效果。

英文摘要:

In this paper, we present TransMLA, a framework that seamlessly converts any GQA-based pre-trained model into an MLA-based model. Our approach enables direct compatibility with DeepSeek's codebase, allowing these models to fully leverage DeepSeek-specific optimizations such as vLLM and SGlang. By compressing 93% of the KV cache in LLaMA-2-7B, TransMLA achieves a 10.6x inference speedup at an 8K context length while preserving meaningful output quality. Additionally, the model requires only 6 billion tokens for fine-tuning to regain performance on par with the original across multiple benchmarks. TransMLA offers a practical solution for migrating GQA-based models to the MLA structure. When combined with DeepSeek's advanced features, such as FP8 quantization and Multi-Token Prediction, even greater inference acceleration can be realized.

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

↑