← All questions
Inference & ServingHard· Attention Mechanisms· KV Cache

Explain how MLA differs from GQA as a strategy for redu...

While GQA reduces the number of KV head pairs from N to K, cutting cache size by a factor of G, Multi-Head Latent Attention (MLA) keeps all N heads but projects them into a C-dimensional latent representation. This can reduce cache size by over 30x in specific configurations. The trade-off is that MLA requires additional up-projection compute at query time to reconstruct the necessary information, which is offset by the massive reduction in HBM traffic.

Code playground (Python)