[Paper Review] GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints
The paper introduces uptraining to convert multi-head attention to multi-query and generalized grouped-query attention (GQA), enabling fast inference with competitive quality while using a small fraction of original pre-training compute.
Multi-query attention (MQA), which only uses a single key-value head, drastically speeds up decoder inference. However, MQA can lead to quality degradation, and moreover it may not be desirable to train a separate model just for faster inference. We (1) propose a recipe for uptraining existing multi-head language model checkpoints into models with MQA using 5% of original pre-training compute, and (2) introduce grouped-query attention (GQA), a generalization of multi-query attention which uses an intermediate (more than one, less than number of query heads) number of key-value heads. We show that uptrained GQA achieves quality close to multi-head attention with comparable speed to MQA.
Motivation & Objective
- Motivate decoder bottlenecks due to memory bandwidth in autoregressive transformers and seek faster inference without sacrificing quality.
- Propose a cost-effective uptraining recipe to transform existing multi-head checkpoints into multi-query configurations.
- Introduce grouped-query attention (GQA) as an interpolation between multi-head and multi-query attention.
- Demonstrate that uptrained GQA achieves quality close to multi-head attention with speeds near multi-query attention across tasks.
Proposed method
- Convert a multi-head attention checkpoint by mean-pooling key and value projection matrices to form a single head for MQA or for each GQA group.
- Uptrain the converted model using a small fraction (α) of the original pre-training steps with the same data and recipe.
- Define grouped-query attention (GQA) with G groups of query heads, sharing a single KV head per group, interpolating between MQA (G=1) and MHA (G=H).
- Experiment with T5-Large and T5-XXL, applying MQA and GQA to decoder self-attention and cross-attention (not encoder self-attention).
- Evaluate on summarization, translation, and QA benchmarks, reporting inference time per sample and dev-set performance.
Experimental results
Research questions
- RQ1Can multi-head checkpoint be effectively uptrained into a fast multi-query form with limited additional computation?
- RQ2Does grouped-query attention provide a tunable trade-off between speed and quality that surpasses MQA and approaches MHA?
- RQ3How does uptraining affect stability and performance across different tasks and model scales?
Key findings
- Uptrained MQA offers faster inference with higher quality than MHA-Large but still lags behind XXL-MHA in some cases.
- Uptrained GQA achieves quality close to MHA-XXL with speed close to MQA, providing a favorable trade-off.
- Mean-pooling for checkpoint conversion preserves information better than selecting a head or random initialization.
- Performance improves with 5% uptraining, with diminishing returns beyond 5–10% for both MQA and GQA.
- GQA performance benefits are more pronounced on larger models due to bandwidth dynamics and cache considerations.
- Increasing the number of GQA groups from 1 (MQA) toward more groups yields modest speedups with increasing cost, with 8 groups identified as a favorable middle ground.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.