Scaled Dot-Product Attention
Category: Neural Networks & Architectures
The specific attention computation used in transformers that scales dot-product similarity by the square root of the key dimension.
Full Explanation
Scaled dot-product attention is the core attention operation in transformers, computing attention weights by taking the dot product of queries and keys, dividing by the square root of the key dimension, applying softmax, and multiplying by values. The scaling factor 1/sqrt(d_k) prevents the dot products from growing too large with high-dimensional keys, which would push the softmax into regions with extremely small gradients. The formula is Attention(Q, K, V) = softmax(QK^T / sqrt(d_k))V. This operation can be efficiently computed using matrix multiplication on GPUs. For autoregressive models, a causal mask is applied to prevent attending to future positions. Scaled dot-product attention is the building block used within each head of multi-head attention and is one of the most fundamental operations in modern deep learning.
Related Terms
More in Neural Networks & Architectures
Explore More
- AI Tools Library — Discover AI tools related to Scaled Dot-Product Attention
- AI Education — Courses to learn about Neural Networks & Architectures
- AI News — Latest news and updates