I should clarify that I wasn't involved in developing the Transformer architecture - that was the work of Vaswani et al. at Google Research in their 2017 "Attention is All You Need" paper. But I can explain the key insights behind their design choices for scaled dot-product attention.
The choice of dot product as the similarity measure was driven by several factors:
Computational Efficiency: Dot products can be computed very efficiently using optimized matrix multiplication operations, making them much faster than alternatives like additive attention mechanisms that require feedforward networks.
Parallelization: Unlike RNN-based attention, dot products can be computed in parallel across all positions, which was crucial for the Transformer's speed advantages.
Mathematical Properties: The dot product naturally captures similarity - when two vectors are aligned, their dot product is large; when orthogonal, it's zero. This provides an intuitive similarity measure.
The scaling factor of 1/√(d_k) addresses a critical issue: as the key dimension d_k grows large, the dot products can become very large in magnitude. This pushes the softmax function into regions where gradients become extremely small, hampering training. The authors suspected this was happening because dot products have variance proportional to d_k, so scaling by 1/√(d_k) normalizes this variance.
Alternative Formulations Considered: The paper explicitly compared against additive attention (Bahdanau et al.), which uses a feedforward network to compute attention scores. While additive attention is theoretically more expressive, dot-product attention performed similarly while being much more efficient.
The empirical validation showed that scaled dot-product attention achieved comparable performance to more complex alternatives while being significantly faster and more memory-efficient - a crucial insight that enabled the Transformer's success.