AIInterviewTraining logoAIInterview/Training
🧠 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 leaves 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 sharply, and grouped-query attention sits between them by sharing key-value heads across small groups. AI, ML, and GenAI engineer 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
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
COMPANIES THAT ASSUME THIS
NEXT IN FOUNDATIONS OF LLMS & GENAIPositional Encodings (RoPE and ALiBi)