GQA: New King of LLM Memory Efficiency

Grouped-Query Attention (GQA) balances Multi-Head Attention's quality with Multi-Query Attention's speed, reducing KV cache size by up to 90% and boosting inference by 30-40% compared to MHA, adopted by Llama 2/3 and Mistral 7B.

The top 3

  1. GQA's Performance Edge: Up to 8x KV Cache Reduction: Grouped-Query Attention (GQA) significantly reduces KV cache memory footprint by a factor equal to the number of query heads divided by KV groups (e.g., 8x for Llama 3), leading to 30-40% faster inference compared to Multi-Head Attention (MHA) while maintaining accuracy.
  2. Top LLMs Embracing GQA: Llama 2, Mistral, Gemma: Pioneered by Llama 2 70B in July 2023, GQA is now a standard in flagship open-weight LLMs like Llama 3, Mistral 7B, Qwen, DeepSeek, and Gemma, enabling efficient inference and longer context windows for production deployments.
  3. GQA's Core Innovation: Grouping Keys & Values: GQA achieves its memory efficiency by grouping multiple query heads to share a single set of key and value projections. This drastically reduces memory bandwidth demands for the KV cache, as key and value diversity is less critical than query diversity, preserving high model quality.

Sources

Open the full topic