Grouped Query Attention (GQA)

A memory-saving tweak where several attention query heads share one set of key-value data, cutting the memory the model needs during text generation.

Technically: Grouped Query Attention partitions the query heads into G groups, each group sharing one set of key and value heads instead of having its own. This shrinks the KV cache roughly in proportion to G/h, where G << h, directly cutting inference memory and bandwidth. GQA sits between Multi-Head Attention (G=h) and Multi-Query Attention (G=1); Llama 3 and Mistral adopted it to enable longer context and larger batches without sacrificing benchmark scores.

Category: Attention Mechanisms

Related ideas