paper-with-me

홈 › Papers

Towards Economical Inference: Enabling DeepSeek's Multi-Head Latent Attention in Any Transformer-based LLMs

2025-02-20 · Tao Ji, Bin Guo, Yuanbin Wu, Qipeng Guo, Lixing Shen, Zhan Chen, Xipeng Qiu, Qi Zhang, Tao Gui

Multi-head Latent Attention (MLA) is an innovative architecture proposed by DeepSeek, designed to ensure efficient and economical inference by significantly compressing the Key-Value (KV) cache into a latent vector. Compared to MLA, standard LLMs employing Multi-Head Attention (MHA) and its variants such as Grouped-Query Attention (GQA) exhibit significant cost disadvantages. Enabling well-trained LLMs (e.g., Llama) to rapidly adapt to MLA without pre-training from scratch is both meaningful and challenging. This paper proposes the first data-efficient fine-tuning method for transitioning from MHA to MLA (MHA2MLA), which includes two key components: for partial-RoPE, we remove RoPE from dimensions of queries and keys that contribute less to the attention scores, for low-rank approximation, we introduce joint SVD approximations based on the pre-trained parameters of keys and values. These carefully designed strategies enable MHA2MLA to recover performance using only a small fraction (0.3% to 0.6%) of the data, significantly reducing inference costs while seamlessly integrating with compression techniques such as KV cache quantization. For example, the KV cache size of Llama2-7B is reduced by 92.19%, with only a 0.5% drop in LongBench performance.

📄 PDF Abstract BibTeX arXiv:2502.14837

Code (1)

JT-Ushio/MHA2MLA 공식 구현 pytorch

Tasks

Quantization

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Dense Connections Dense Connections, or Fully Connected Connections, are a type of layer in a deep neural network that use a linear operation where every input is connected to every output…
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Feedforward Network A Feedforward Network, or a Multilayer Perceptron (MLP), is a neural network with solely densely connected layers. This is the classic neural network architecture of the…
Multi-Head Attention 설명 없음
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Grouped-query attention 설명 없음

Similar Papers 제목 키워드 기반

DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model

2024-05-07 · DeepSeek-AI, Aixin Liu, Bei Feng, Bin Wang 외

We present DeepSeek-V2, a strong Mixture-of-Experts (MoE) language model characterized by economical training and efficient inference. It comprises 236B total parameters, of which 21B are activated for each token, and su…

Language ModelingLanguage ModellingMixture-of-ExpertsReinforcement Learning (RL)

MHA2MLA-VLM: Enabling DeepSeek's Economical Multi-Head Latent Attention across Vision-Language Models

2026-01-16 · Xiaoran Fan, Zhichao Sun, Tao Ji, Lixing Shen 외 arxiv

As vision-language models (VLMs) tackle increasingly complex and multimodal tasks, the rapid growth of Key-Value (KV) cache imposes significant memory and computational bottlenecks during inference. While Multi-Head Late…

parameter-efficient fine-tuning

Self-Distillation for Multi-Token Prediction

2026-03-25 · Guoliang Zhao, Ruobing Xie, An Wang, Shuaipeng Li 외 arxiv

As Large Language Models (LLMs) scale up, inference efficiency becomes a critical bottleneck. Multi-Token Prediction (MTP) could accelerate LLM inference by predicting multiple future tokens in parallel. However, existin…

TransMLA: Multi-Head Latent Attention Is All You Need

2025-02-11 · Fanxu Meng, Zengwei Yao, Muhan Zhang

Modern large language models (LLMs) often encounter communication bottlenecks on current hardware, rather than purely computational constraints. Multi-head Latent Attention (MLA) tackles this challenge by using low-rank …

All

Insights into DeepSeek-V3: Scaling Challenges and Reflections on Hardware for AI Architectures

2025-05-14 · Chenggang Zhao, Chengqi Deng, Chong Ruan, Damai Dai 외

The rapid scaling of large language models (LLMs) has unveiled critical limitations in current hardware architectures, including constraints in memory capacity, computational efficiency, and interconnection bandwidth. De…

Computational EfficiencyMixture-of-Experts