AppliedAIPrep logoAppliedAI/Prep
🧠 Foundations of LLMs & GenAI
Core

Attention Variants: MHA, MQA, and GQA

Multi-head attention gives every query head its own key and value heads, which is expressive but makes the KV cache large and memory-bandwidth hungry at decode time. Multi-query attention shares one key-value head across all query heads to shrink the cache hard, and grouped-query attention sits in between by sharing key-value heads across small groups. Applied-AI interviews probe this because it is the cleanest example of trading model quality against serving memory and throughput, and it explains why frontier models standardized on GQA.

a free account unlocks the core curriculum tier · no card
COURSES COVERING THIS TOPIC

No lesson covers this one directly yet. These teach the surrounding topic from the beginning.

RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
COMPANIES THAT ASSUME THIS
NEXT IN FOUNDATIONS OF LLMS & GENAIPositional Encodings (RoPE and ALiBi)