# Scaled Dot-Product Attention

- **Canonical URL:** https://getaimath.com/dictionary/scaled-dot-product-attention/
- **Topics:** [Transformer Architecture](https://getaimath.com/dictionary/category/transformer-architecture/)
- **Last updated:** 2026-11-25

## What is Scaled Dot-Product Attention?

**In one sentence:** Scaled dot-product attention is the standard math recipe for attention: compare queries and keys, scale the results, softmax them, and mix the values.

The "dot product" measures how well a query matches a key. The scores are divided by a number based on their size so they do not get too large and unstable. Then softmax turns them into weights for mixing values.

![Transformers & Attention: The Smart Highlighter — Simple cartoon diagram showing how a Transformer reads a whole sentence at once and shines a bright highlighter beam from the word "IT" back to "trophy" so it knows what "IT" means.](https://getaimath.com/diagrams/transformer-architecture.png)
*Napkin Diagram (Transformer Architecture): Older AI read word-by-word and often lost track of earlier words; a Transformer highlights which words connect to which.*

## What is an example of Scaled Dot-Product Attention?

Every Transformer layer in GPT-style models uses scaled dot-product attention for each head.

## Why does Scaled Dot-Product Attention matter?

It is the core formula of the Transformer, written in just one line of math.

## Related Concepts

- [Attention Scores](https://getaimath.com/dictionary/attention-scores/): Attention scores are numbers that show how much each word should focus on every other word.
- [Causal Attention](https://getaimath.com/dictionary/causal-attention/): Causal attention only lets each word look at the words before it, never the words after.
- [Value Matrix](https://getaimath.com/dictionary/value-matrix/): The value matrix is a grid of learned weights that turns each word's numbers into the value it shares.
- [Masked Attention](https://getaimath.com/dictionary/masked-attention/): Masked attention is attention where some positions are hidden, so certain words cannot look at certain other words.
- [Key Matrix](https://getaimath.com/dictionary/key-matrix/): The key matrix is a grid of learned weights that turns each word's numbers into its key.
- [Cross-Attention](https://getaimath.com/dictionary/cross-attention/): Cross-attention lets one part of a model pay attention to a different input, like a decoder looking at an encoder's output.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/scaled-dot-product-attention/)
