Intuitive Understanding
Attention mimics human attention — when we look at a painting, we don’t focus equally on every pixel but concentrate on key areas.
Scaled Dot-Product Attention
Why divide by ? When is large, dot products become very large, causing softmax gradients to vanish. See Transformer Architecture Explained for the full implementation.