Multi-Query Attention › Multi-Query Attention

Michael BrenndoerferUpdated August 4, 20251 min read
Language AI HandbookAll chapters
Part 29 of 67Modern Decoder Models
Chapter 210Multi-Query Attention › Multi-Query Attention
Reading section 1 of 11 · Multi-Query Attention · 1 minSection 1 of 11 · 1 min

Book contents

Section 1 of 11 · 1 min read

Multi-Query Attention › Multi-Query AttentionOne section · Sections in this chapter1 / 11 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

In standard multi-head attention, each head maintains its own QKV projections. This design creates a bottleneck during inference: the KV cache grows linearly with the number of heads, consuming large amounts of GPU memory for long sequences. Multi-Query Attention (MQA) solves this problem by sharing a single key-value pair across all query heads, reducing memory requirements while maintaining most of the model's representational power.

This chapter explores the mechanics of MQA, quantifies its memory benefits, examines the quality trade-offs involved, and compares it with its more moderate cousin, Grouped Query Attention (GQA).