← Back to LLMs Mind Map
⚡Flashcard Drill➔
⚡ LLMsID: attention-scaled-dot

Scaled Dot-Product Attention

缩放点积注意力
🎯Core Definition
Scaled Dot-Product Attention is the core attention operator of the Transformer: Attention(Q,K,V)=softmax(QKTdk)VAttention(Q,K,V) = softmax(\frac{Q K^T}{\sqrt{d_k}}) V. Dividing by dk\sqrt{d_k} normalizes the dot-product variance: if Q and K have per-dimension variance 1, the variance of a dkd_k-dim dot product grows linearly with dkd_k; without scaling, softmax inputs saturate as dimensionality grows (e.g. dk=128d_k = 128, 128≈11.3\sqrt{128} \approx 11.3) and gradients vanish.
💡Use Cases
every head softly matches all tokens in the sequence — the foundation for MHA/GQA/MLA, FlashAttention and RoPE; interviews typically start with "why divide by dk\sqrt{d_k}" and then probe complexity, masks and head splitting.
⚡Key Problems Solved
unlike unscaled dot products, scaling keeps softmax entropy and gradients stable at any dimensionality so deep networks train reliably; but time and memory stay O(n2)O(n^2), which becomes the main bottleneck for long sequences and motivates IO-aware implementations like FlashAttention.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Scaled Dot-Product Attention.
Use Cases
In production engineering, what are the primary use cases for Scaled Dot-Product Attention and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Why divide by dk\sqrt{d_k}? What breaks without it (variance analysis, softmax saturation)?
2
Time and space complexity of scaled dot-product attention? Why is O(n2)O(n^2) the long-context bottleneck?
3
Shapes of the Q/K/V projections? How are heads split and concatenated?
4
Difference and implementation of padding mask vs causal mask?
5
Single vs multi-head: why h heads rather than one wide dd-dim head?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Scaled Dot-Product Attention"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔
← Previous CardKV Cache ManagementNext Card →Attention Variants MHA/MQA/GQA

🔗 More LLMs Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/LLM/card/attention-scaled-dot