Multi-head Latent Attention (MLA) is an attention mechanism that compresses the keys and values together into a single low-dimensional "latent vector" and, at inference time, stores only that latent vector in the KV cache. DeepSeek-AI proposed it in 2024 in the paper on the DeepSeek-V2 language model, "DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model."
A model that generates text one token at a time keeps the keys and values of past tokens in a KV cache. Standard multi-head attention (MHA) stores values per token in every layer (number of heads × head dimension × two for keys and values), so the cache limits both the number of requests that can be served at once and the context length.
Multi-query attention (MQA) and grouped-query attention (GQA) reduce the cache by sharing key and value heads, but in the paper's comparison they fell short of MHA. Instead of sharing heads, MLA compresses the keys and values into a low-rank form, and with a cache about the size of GQA with 2.25 groups it outperformed MHA.
As an analogy with storing goods: MHA lines up every item as is in the warehouse, GQA and MQA merge similar items into one to reduce their number, and MLA vacuum-packs each item into a small bundle for storage and restores it to full size when it is needed.
In the figure at the top of the article, the left side shows the computation in MLA (only the two items inside the yellow dashed box are cached), and the right side compares the size of the KV cache per token.

