Transformer Attention Mechanisms: Scaled Dot-Product vs Multi-Query Attention (MQA)
How Grouped-Query Attention (GQA) and Multi-Query Attention (MQA) reduce KV-cache memory bandwidth consumption in LLM inference.
The Memory Bandwidth Bottleneck
Standard Multi-Head Attention (MHA) maintains $H$ distinct Key and Value heads. Grouped-Query Attention (GQA) shares KV heads across query head groups, yielding 8x memory bandwidth reduction during generation.
References & Further Reading: