TransMLA: Migrating GQA Models to MLA with Full DeepSeek Compatibility and Speedup

Fan-Xu Meng, Pingzhi Tang, Zeng-Wei Yao, Xing Sun, Mu-Han Zhang
1/1/2025

No confident code implementation found for this paper.

Abstract

Modern large-language models often face communication bottlenecks on current hardware rather than computational limitations. Multi-head latent attention ( MLA ) addresses this by compressing the key-value cache using low-rank matrices, while the Absorb operation prevents the KV cache from reverting to its original size, significantly boosting both training and inference speed.

Show full abstract

Despite the success of DeepSeek V2/V3/R1, most model vendors have heavily invested in optimizing GQA-based models and therefore lack strong incentives to retrain MLA-based models from scratch. In this paper, we introduce TransMLA, a framework that seamlessly converts any GQA-based pre-trained model (e.g., LLaMA, Qwen, Mixtral) into an MLA-based model. For the first time, our method enables direct conversion of these models into a format compatible with DeepSeek’s codebase , allowing them to fully leverage DeepSeek-specific optimizations such as vLLM and SGlang. By compressing 93% of the KV cache in LLaMA-2-7B, we achieve a 10.6x speedup with an 8K context length while maintaining meaningful output. Moreover, the model requires only 6B tokens for fine-tuning to recover comparable performance across multiple benchmarks. TransMLA provides a practical path for migrating GQA-based models to the MLA structure, and when combined with DeepSeek’s advanced optimizations—such as FP8 quantization and Multi-Token Prediction—further inference acceleration can be achieved.

DOISemantic Scholar

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{meng2025transmla,
  title  = {TransMLA: Migrating GQA Models to MLA with Full DeepSeek Compatibility and Speedup},
  author = {Fan-Xu Meng and Pingzhi Tang and Zeng-Wei Yao and Xing Sun and Mu-Han Zhang},
  year   = {2025},
  doi    = {10.52202/085713-2741},
  url    = {https://doi.org/10.52202/085713-2741},
  journal = {Neural Information Processing Systems}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/7c371ce3406a97b6abccec3bfd5436dd3758709c.svg)](https://codeofpaper.com/paper/7c371ce3406a97b6abccec3bfd5436dd3758709c)

Discussion