Home Knowledge Base Grouped Query Attention (GQA)

Grouped Query Attention (GQA) is the attention mechanism that shares key and value projections across groups of query heads, interpolating between multi-head attention (MHA) and multi-query attention (MQA) — reducing KV cache size by 4-8× while maintaining 95-99% of MHA quality, used in Llama 2, Mistral, and other modern LLMs to enable efficient long-context inference within memory constraints.

GQA Architecture:

Comparison with MHA and MQA:

Implementation and Training:

Memory and Performance Impact:

Adoption in Production Models:

Grouped Query Attention is the practical compromise that makes long-context LLMs deployable — by carefully balancing model quality and memory efficiency, GQA has become the standard attention mechanism for modern LLMs, enabling the multi-turn conversations and long-document processing that define production AI applications.

grouped query attention gqamulti query attention mqakv cache reductionattention head groupingllama 2 attention

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.