NLP Lineage

22 May 2023 · Language modelling

Grouped-query attention

GQA: Training Generalized Multi-Query Transformer Models

J. Ainslie, J. Lee-Thorp, M. de Jong, Y. Zemlyanskiy, F. Lebrón, S. Sanghai

Date
22 May 2023
What the date marks
arXiv submission
Kind
Architectural idea
Organisation
Google Research
Access
Apache 2.0
Other dates
EMNLP 2023
Threads
In the guided tour
Chapter 9. Making it run anywhere
Learning phases
1. Transformer architecture; 6. Local models and deployment

A turning point: 6 later milestones descend directly from it, and its descendants reach 9 of the 10 threads. How levels are decided

Drafted with Claude from the paper on 15 October 2026; reviewed by Zeeshan Arif. Read from arxiv.org (arXiv version 3 (December 2023) of the EMNLP 2023 conference paper).

What it changed

It made text generation faster at almost no cost in quality, by letting groups of attention heads share one set of keys and values. This method, grouped-query attention (GQA), sits between standard attention and the faster but weaker multi-query attention. Many later open models use it, including Llama 2, Mistral 7B and Llama 3.

The problem before it

When a language model writes text, it produces one token at a time. At each step, it must load the keys and values of all earlier tokens from memory, for every attention head. This memory traffic, not the arithmetic, is often what makes generation slow.

Multi-query attention (MQA) had cut this traffic sharply: all the query heads share a single key head and a single value head. But the authors note three problems:

The idea

The mechanism. The paper has two parts.

Averaging the heads worked better than keeping only the first head or starting the new heads from random values.

The authors argue that GQA suits large models well. Larger models have more heads, so a single shared head cuts their capacity a lot. GQA keeps the same ratio as the model grows.

The notation. GQA-G means grouped-query attention with G groups. GQA-1 is MQA and GQA-H, with H heads, is MHA. Going from MHA to MQA makes the key-value cache, the stored keys and values, H times smaller.

What it showed

Reported in the paper. It was published as a peer-reviewed conference paper at EMNLP 2023. We read version 3 of the arXiv paper. All models are T5 encoder-decoder models, and GQA and MQA were applied only to the decoder.

Limits, and what came later

The limits come from the paper:

GQA spread quickly. Llama 2 used it in its 70-billion-parameter model, and Mistral 7B, Llama 3, Llama 3.1 and Qwen2 also use it. DeepSeek-V2 compared its own latent attention against GQA and reported an improvement.

What to know first

How to read it

The paper is short: 5 pages of main text, with one page of appendix.

  1. Read section 1 for the problem.
  2. Read section 2 with Figures 1 and 2. This is the whole method.
  3. Look at Table 1 and Figure 3 for the main results.
  4. Read the limitations section and appendix A on training stability.

Expect about 30 minutes for the steps above (an estimate).

In brief, from the research data

Before it

You chose between multi-head attention, which was accurate but memory-hungry, and multi-query, which was fast but lossy.

The problem

Multi-query attention degraded quality; multi-head attention throttled inference.

What it introduced

Share keys and values across small groups of heads, and convert existing checkpoints cheaply.

Why it matters

Llama 2, Mistral, Qwen and most models since use it. It is the default attention layout today.

What modern models inherit

The attention variant in almost every model you will run.

What came next

DeepSeek's latent attention pushed the same goal further.

Before and after

The milestones it descends from, and the milestones that descend from it. Work developed alongside it is not counted. Weak links are left out unless you include them.

Before: where it came from

Grouped-query attention has 11 documented ancestors across 4 chapters, reaching back to Recurrent networks in 1990. Showing its direct parents and the 4 turning points among them.

Grouped-query attention has 11 documented ancestors across 4 chapters, reaching back to Recurrent networks in 1990. Showing all of them.

Grouped-query attention has 12 recorded ancestors, including indirect ones, across 4 chapters, reaching back to Recurrent networks in 1990. Showing its direct parents and the 4 turning points among them.

Grouped-query attention has 12 recorded ancestors, including indirect ones, across 4 chapters, reaching back to Recurrent networks in 1990. Showing all of them.

  1. 2023Grouped-query attentionThis milestone.
  2. 2019Multi-query attentionGrouped-query attention built directly on thisChapter 9. Making it run anywhere
  3. 2017Transformer Turning pointMulti-query attention built directly on thisChapter 3. Attention, then only attention
  4. 2016Layer normTransformer built directly on thisChapter 3. Attention, then only attention
  5. 2015Residual connectionsTransformer was influenced by thisChapter 3. Attention, then only attention
  6. 2015Luong attentionTransformer was influenced by thisChapter 3. Attention, then only attention
  7. 2014AdamTransformer was influenced by thisChapter 2. Words become vectors
  8. 2014Seq2seq Turning pointTransformer built directly on thisChapter 2. Words become vectors
  9. 2014Attention Turning pointTransformer built directly on thisChapter 3. Attention, then only attention
  10. 2014GRU / encoder-decoderAttention built directly on thisChapter 2. Words become vectors
  11. 1997LSTM Turning pointSeq2seq built directly on thisChapter 1. Language as probability
  12. 1990Recurrent networksLSTM was influenced by thisChapter 1. Language as probability
  1. 2023Grouped-query attentionThis milestone.
  2. 2019Multi-query attentionGrouped-query attention built directly on thisChapter 9. Making it run anywhere
  3. 2017Transformer Turning pointMulti-query attention built directly on thisChapter 3. Attention, then only attention
  4. 2017ConvS2STransformer was influenced by this (indirect influence)Chapter 3. Attention, then only attention
  5. 2016Layer normTransformer built directly on thisChapter 3. Attention, then only attention
  6. 2015Residual connectionsTransformer was influenced by thisChapter 3. Attention, then only attention
  7. 2015Luong attentionTransformer was influenced by thisChapter 3. Attention, then only attention
  8. 2014AdamTransformer was influenced by thisChapter 2. Words become vectors
  9. 2014Seq2seq Turning pointTransformer built directly on thisChapter 2. Words become vectors
  10. 2014Attention Turning pointTransformer built directly on thisChapter 3. Attention, then only attention
  11. 2014GRU / encoder-decoderAttention built directly on thisChapter 2. Words become vectors
  12. 1997LSTM Turning pointSeq2seq built directly on thisChapter 1. Language as probability
  13. 1990Recurrent networksLSTM was influenced by thisChapter 1. Language as probability

After: what it led to

Grouped-query attention has 22 documented descendants across 4 chapters, reaching forward to Qwen3.8 in 2026. Showing its direct descendants and the 1 turning point among them.

Grouped-query attention has 22 documented descendants across 4 chapters, reaching forward to Qwen3.8 in 2026. Showing all of them.

Grouped-query attention has 25 recorded descendants, including indirect ones, across 4 chapters, reaching forward to Qwen3.8 in 2026. Showing its direct descendants and the 1 turning point among them.

Grouped-query attention has 25 recorded descendants, including indirect ones, across 4 chapters, reaching forward to Qwen3.8 in 2026. Showing all of them.

  1. 2023Grouped-query attentionThis milestone.
  2. 2023Llama 2 Turning pointbuilt directly on Grouped-query attentionChapter 8. The weights get out
  3. 2023Mistral 7Bbuilt directly on Grouped-query attentionChapter 8. The weights get out
  4. 2023Mixtral 8x7Bbuilt directly on Mistral 7BChapter 8. The weights get out
  5. 2024DeepSeek LLMwas influenced by Llama 2Chapter 8. The weights get out
  6. 2024OLMowas influenced by Llama 2Chapter 8. The weights get out
  7. 2024GRPObuilt directly on DeepSeek LLMChapter 12. Thinking longer
  8. 2024Gemmawas influenced by Llama 2
    was influenced by Mistral 7B
    Chapter 8. The weights get out
  9. 2024Llama 3built directly on Grouped-query attentionChapter 8. The weights get out
  10. 2024DeepSeek-V2 / MLAwas influenced by Grouped-query attentionChapter 9. Making it run anywhere
  11. 2024Qwen2built directly on Grouped-query attentionChapter 8. The weights get out
  12. 2024Llama 3.1 405Bbuilt directly on Grouped-query attentionChapter 8. The weights get out
  13. 2024DeepSeek-V3built directly on DeepSeek-V2 / MLA
    was influenced by Llama 3.1 405B
    Chapter 8. The weights get out
  14. 2025DeepSeek-R1built directly on DeepSeek-V3Chapter 12. Thinking longer
  15. 2025Llama 4succeeded Llama 3.1 405BChapter 8. The weights get out
  16. 2025Qwen3built directly on Qwen2Chapter 8. The weights get out
  17. 2025Kimi K2was influenced by GRPOChapter 8. The weights get out
  18. 2025DeepSeek-V3.2was influenced by DeepSeek-V2 / MLAChapter 10. Reading more than you remember
  19. 2026Qwen3.5built directly on Qwen3Chapter 8. The weights get out
  20. 2026Muse Sparksucceeded Llama 4Chapter 8. The weights get out
  21. 2026DeepSeek-V4built directly on DeepSeek-V3.2
    was influenced by DeepSeek-V3
    Chapter 8. The weights get out
  22. 2026Kimi K3built directly on Kimi K2Chapter 8. The weights get out
  23. 2026Qwen3.8built directly on Qwen3.5Chapter 8. The weights get out
  1. 2023Grouped-query attentionThis milestone.
  2. 2023Llama 2 Turning pointbuilt directly on Grouped-query attentionChapter 8. The weights get out
  3. 2023Mistral 7Bbuilt directly on Grouped-query attentionChapter 8. The weights get out
  4. 2023Mixtral 8x7Bbuilt directly on Mistral 7BChapter 8. The weights get out
  5. 2024DeepSeek LLMwas influenced by Llama 2Chapter 8. The weights get out
  6. 2024OLMowas influenced by Llama 2Chapter 8. The weights get out
  7. 2024GRPObuilt directly on DeepSeek LLMChapter 12. Thinking longer
  8. 2024Gemmawas influenced by Llama 2
    was influenced by Mistral 7B
    Chapter 8. The weights get out
  9. 2024Llama 3built directly on Grouped-query attentionChapter 8. The weights get out
  10. 2024DeepSeek-V2 / MLAwas influenced by Grouped-query attentionChapter 9. Making it run anywhere
  11. 2024Qwen2built directly on Grouped-query attentionChapter 8. The weights get out
  12. 2024Llama 3.1 405Bbuilt directly on Grouped-query attentionChapter 8. The weights get out
  13. 2024DeepSeek-V3built directly on DeepSeek-V2 / MLA
    was influenced by Llama 3.1 405B
    Chapter 8. The weights get out
  14. 2025DeepSeek-R1built directly on DeepSeek-V3Chapter 12. Thinking longer
  15. 2025Llama 4succeeded Llama 3.1 405BChapter 8. The weights get out
  16. 2025Qwen3built directly on Qwen2Chapter 8. The weights get out
  17. 2025Kimi K2was influenced by DeepSeek-V3 (indirect influence)Chapter 8. The weights get out
  18. 2025gpt-osswas influenced by DeepSeek-R1 (indirect influence)Chapter 8. The weights get out
  19. 2025GLM-4.5was influenced by DeepSeek-R1 (indirect influence)Chapter 8. The weights get out
  20. 2025DeepSeek-V3.2was influenced by DeepSeek-V2 / MLAChapter 10. Reading more than you remember
  21. 2026Qwen3.5built directly on Qwen3Chapter 8. The weights get out
  22. 2026Muse Sparksucceeded Llama 4Chapter 8. The weights get out
  23. 2026DeepSeek-V4built directly on DeepSeek-V3.2
    was influenced by DeepSeek-V3
    Chapter 8. The weights get out
  24. 2026GLM-5.2built directly on GLM-4.5Chapter 8. The weights get out
  25. 2026Kimi K3built directly on Kimi K2Chapter 8. The weights get out
  26. 2026Qwen3.8built directly on Qwen3.5Chapter 8. The weights get out

Direct links and their sources

Where it came from

Built directly on

What it led to

Built on directly by

Influenced

Terms