Several query heads share one key/value head, shrinking the KV cache several-fold with little quality loss.
Introduced inMay 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints
In classic multi-head attention every head has its own keys and values, and all of them must be cached for every generated token. GQA keeps many query heads but lets groups of them share a single key/value head. With one shared KV head this becomes multi-query attention. Since KV-cache size is what limits batch size and context length at inference time, nearly every recent LLM uses it.
Share of new models that have included GQA over time.
Open any of these on hfviewer to find this block in the interactive architecture graph.
Browse all 1860 models with this in the catalog →
hfviewer renders the full architecture of 3,500+ Hugging Face models as interactive graphs. Hover any block to see what it does, with this model’s real numbers.
Browse all model graphs →