Scaled dot-product attention

Turns query-key similarity scores into normalized weights and uses them to combine value vectors.

Attention of Q, K, and V equals softmax of Q times K transpose divided by the square root of d sub k, then multiplied by V.

Each query decides how much attention to place on every key, then blends the associated values using those weights.

The outer data flow is a normalized weighted sum: score, scale, normalize, then mix values.

This is the Transformer paper's core attention primitive; masking and batching add structure around it without changing this central operation.