Learn AI Math

Scaled Dot-Product Attention

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.

What does Scaled Dot-Product Attention look like?

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.

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.