← 🧠 Foundations of LLMs & GenAINEXT IN FOUNDATIONS OF LLMS & GENAIAttention Variants: MHA, MQA, and GQA→
Core
Attention and Self-Attention
Attention turns each token into a query, key, and value, scores every query against every key, softmaxes those scores into weights, and returns the weighted sum of values, so each token pulls in information from the others. Self-attention does this within one sequence. The all-pairs scoring is why cost grows with the square of sequence length, which in turn explains context limits, long-prompt expense, and the KV cache. Applied-AI interviews probe it because it links architecture to cost and latency in one mental model.
a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
LLM & GenAI FundamentalsWhy do transformers scale attention scores by 1/√d_k, and what breaks if you skip it?→LLM & GenAI FundamentalsEncoder-only vs decoder-only vs encoder-decoder: when do you use each, and why are decoder-only models dominant?→Coding & DSAImplement multi-head self-attention from scratch in NumPy, with a causal mask.→Coding & DSAImplement attention with a KV cache for autoregressive generation.→LLM & GenAI FundamentalsWhat is cross-attention, and how does it differ from self-attention?→LLM & GenAI FundamentalsWhat are Multi-Query (MQA) and Grouped-Query Attention (GQA), and why do they exist?→
COMPANIES THAT ASSUME THIS
