“The core equation that makes transformers work, from the original 2017 paper: Attention(Q,K,V) = softmax(QK^T / sqrt(d_k)) * V. Q (queries), K (keys), and V (values) are matrices; QK^T is the dot product of queries against keys, divided by the square root of the key dimension d_k to keep the numbers from getting too large before the softmax step, which turns the result into attention weights applied to V.”
Vaswani et al, 'Attention Is All You Need' (2017), arXiv 1706.03762.