Glossary

What is Grouped-query attention?

In Turkish: Gruplanmış sorgu dikkati (GQA) · Topic: Models and training

A variant of multi-head attention in which query heads are split into groups and each group shares a single key-value head. It largely preserves quality while cutting memory use and the time it takes to generate responses.

How does it work?

In standard multi-head attention, every query head has its own key and value head. In grouped-query attention, query heads are divided into groups and the heads in a group use the same key-value pair. The extreme case where all heads share one key-value pair is known as multi-query attention, and GQA offers a middle path between the two. During text generation, the stored key-value cache gets smaller, which eases memory pressure and speeds up generation.

Why does it matter?

When large language models generate responses, much of the memory burden comes from the key-value cache, and long contexts and many simultaneous users make it heavier. GQA allows longer context and higher throughput on the same hardware at a small cost in quality. That is why it is often cited among the architectural choices of current large language models.

Example

In a chat service answering thousands of users at once, a model that uses GQA can hold each conversation's cache in less memory.

FAQ

What is the difference between GQA and multi-head attention?

In multi-head attention, each query head has its own key and value head. In GQA, a group of query heads shares one key-value head, which reduces the memory load.

Does GQA reduce a model's accuracy?

There can be a small loss in quality, and the method is designed to keep that loss to a minimum. The effect varies with the model's architecture and training.

All terms