Term
Multi-Query Attention
Meaning
An attention variant in which all query heads share a single key projection and a single value projection, while each head keeps its own query projection. This reduces the key and value memory and cost during autoregressive decoding.
How papers use it 6 papers
PaLM: Scaling Language Modeling with Pathways
Use Used in PaLM. The authors report that it has a neutral effect on model quality and training speed, citing Shazeer (2019), while giving significant cost savings at autoregressive decoding time. They explain that standard multi-head attention runs inefficiently on accelerators during decoding because keys and values are not shared across examples.
Fast Transformer Decoding: One Write-Head is All You Need
Use Proposed by the paper as its main architectural change. It replaces the attention layers of the Transformer, including encoder self-attention, decoder self-attention and encoder-decoder attention, in the WMT14 English-German experiments. The feed-forward hidden size is widened from 4096 to 5440 so that the total parameter count matches the baseline. Its dev and test BLEU scores are slightly below the multi-head baseline, and its decoder time per token during incremental inference is far lower (3.8 µs against 46 µs for the baseline in the beam-free setting). The paper argues that the gain comes from reduced memory bandwidth. It is also trained in a language-model setting on the Billion-Word benchmark, where perplexity is slightly worse than the baseline.
Meaning A variant of multi-head attention in which all query heads read from one shared set of keys and one shared set of values. Because the keys and values carry no heads dimension, the cached key and value tensors are much smaller, which lowers the memory traffic needed during step-by-step decoding.
Gemini: A Family of Highly Capable Multimodal Models
Use Named as one of the efficient attention mechanisms that Gemini models employ to support their 32k context length.
Meaning An attention variant in which several query heads share a single set of key and value projections. This lowers memory and compute cost, especially during inference.
Competition-Level Code Generation with AlphaCode
Use Used to make sampling from the models cheaper. The authors note that the cache and memory costs of key and value heads were the main bottleneck during sampling, and that the saved memory allows larger batch sizes for sampling. In the 9B and 41B models, which were trained with model parallelism, each shard carries one key and value head.
Meaning An attention variant in which all query heads are kept but the key and value heads are shared across the heads of an attention block. Sharing reduces the memory needed for keys and values and the cost of updating the cache during decoding.
Gemma: Open Models Based on Gemini Research and Technology
Use Used in the Gemma 2B model, which sets the number of key-value heads to 1, while the Gemma 7B model keeps multi-head attention with 16 key-value heads. The authors cite earlier ablations at small scales as the reason for choosing it for the 2B model.
Meaning An attention variant in which many query heads share a single key head and a single value head, which reduces the size of the key-value state compared with standard multi-head attention.
GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints
Use Serves as the most aggressive reduction of key-value heads in the study. Uptrained T5-XXL models with MQA reach an average score of 46.6 with a per-sample inference time of 0.24 s, compared with 47.2 and 1.51 s for MHA-XXL (Table 1). Its quality is lower than MHA and GQA-8, and it is also compared against MHA-Large, which it outperforms in quality and speed in the main results.
Meaning An attention variant in which many query heads share one key head and one value head. Because only a single key-value pair is stored per layer, the key-value cache and the data read at each autoregressive decoding step are much smaller than in standard multi-head attention.