Robots Atlas>ROBOTS ATLAS
Architecture

MLA

2024ActivePublished: 2 September 2026Updated: 2 September 2026Published
Key innovation
Compresses the key-value (KV) cache into a low-dimensional latent vector, drastically cutting inference memory while preserving quality close to standard Multi-Head Attention.
Category
Architecture
Abstraction level
Building block
Operation level
Architecture blockInference
Use cases
Long-context LLM inferenceKV cache memory reductionHigher generation throughputMixture-of-Experts models (DeepSeek-V2/V3, Kimi K2)

How it works

MLA projects the input representation into a low-dimensional latent vector via a down-projection matrix (joint key-value compression). Only this compressed latent vector is stored in the KV cache (optionally alongside a small decoupled part carrying RoPE positional information). During attention, per-head keys and values are reconstructed from the latent vector through up-projection matrices, after which attention is computed normally. Queries can be compressed analogously to reduce activation memory during training. RoPE positional embeddings are handled in a decoupled path because rotary encodings do not compose directly with the latent compression. The result is a KV cache whose size scales with the latent dimension d_c, far smaller than the head-count times head-dimension product of standard MHA.

Problem solved

Standard Multi-Head Attention must store a full key-value cache for every token and head, growing linearly with context length and becoming the dominant memory and throughput constraint in long-context inference. MLA addresses this by compressing the KV cache into a small latent vector.

Components

KV latent down-projectionCompresses keys and values into a shared latent vector

Matrix projecting the input representation into a low-dimensional latent vector c_KV, the only quantity kept in the KV cache.

Latent KV cacheStores the compressed representation instead of full K/V

Buffer storing the latent vector c_KV per token; its size scales with the latent dimension d_c rather than the number of heads.

Key/value up-projectionsReconstructs per-head keys and values from the latent vector

Up-projection matrices that reconstruct per-head keys and values from the latent vector at attention time.

Decoupled RoPE pathCarries positional information independently of latent compression

A small, separated key/query component carrying rotary positional embeddings (RoPE), which cannot be folded directly into the latent compression.

Official

Implementation

Implementation pitfalls
RoPE requires a decoupled pathHigh

Rotary positional embeddings cannot be folded directly into the latent compression; omitting the decoupled RoPE path breaks position encoding.

Fix:Use the decoupled RoPE path as designed in DeepSeek-V2 MLA.
Choosing the latent dimension d_cMedium

Too small a d_c degrades quality; too large limits the KV cache memory savings.

Fix:Tune d_c empirically, balancing KV cache size against quality.

Evolution

Original paper · 2024 · arXiv 2024 · DeepSeek-AI
DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model
DeepSeek-AI
2024
MLA introduced in DeepSeek-V2
Inflection point

DeepSeek-V2 (236B/21B active) introduces MLA, cutting KV cache by 93.3% and raising max generation throughput to 5.76x.

2024
MLA adopted in DeepSeek-V3

DeepSeek-V3 continues to use MLA as its attention mechanism.

2025
MLA in the Kimi K2 family (Moonshot AI)

Kimi K2 model cards (1T/32B active) explicitly list "Attention Mechanism: MLA", confirming adoption beyond DeepSeek.

Hyperparameters (configurable axes)

KV compression dimension (d_c)Critical

Dimension of the KV latent vector; the key trade-off between KV cache size and quality.

Query compression dimensionMedium

Latent dimension for query compression, reducing activation memory during training.

Decoupled RoPE dimensionHigh

Size of the decoupled component carrying rotary positional embeddings.

Computational complexity

Time complexity: O(n² · d). Space complexity: O(n · d_c).

Compute bottleneck

KV cache size at inference

In standard MHA the KV cache grows linearly with context length and head count, limiting memory and throughput; MLA moves this bottleneck onto a small latent vector.

Execution paradigm

Primary mode
Dense

MLA is a dense attention mechanism; all heads are active. It often co-occurs with a sparse (MoE) feed-forward, but MLA itself is dense.

Activation pattern
All paths active

Parallelism

Parallelism level
Fully parallel

Attention is computed in parallel across tokens; MLA adds no sequential dependency beyond standard attention.

Scope
TrainingInferenceAcross tokens

Hardware requirements

Primary

MLA targets efficient LLM inference on GPUs; the KV cache reduction frees HBM and increases throughput.