the.ai

Attention / Efficiency

verified

Multi-Query Attention

Attention heads each keep their own keys and values, and at generation time all of them sit in memory. Multi-query attention keeps the separate queries but shares one set of keys and values across every head, shrinking the cache by the number of heads at a small cost in quality.

Viz primitive · budget-splitheads-shared-away = 31

heads-shared-away holds 97% of the budget; rest holds the remaining 3%.

Key-value cache that sharing removes against the single copy multi-query keeps, both as one head's cache. Drag the head count down to watch the saving collapse — almost all of it is already won by the first few heads shared away.

31

Reviewed by opendroid · 2026-08-04