Picture it. In the figure below the arrow has two numbers, so it lives on a flat board. Real Transformers use arrows with 512 numbers — impossible to draw, but the idea is identical: an arrow pointing somewhere in a high-dimensional space.
Why the topic needs it. A word like "cat" cannot be added, scaled, or compared as a raw symbol. Turn it into an arrow of numbers and suddenly all of arithmetic is available. Every box in the parent note is moving arrows around.
Before any formula, here is the full glossary the parent note leans on. Read top to bottom — each builds on the one above. Every symbol here is pictured or drawn in the sections that follow; the map at the end shows exactly which figure defines which.
Every symbol about shape lives in one picture: the grid X. Each row is one token's arrow x (there are n of them, indexed by pos or i); each column is one of the dmodel entries (indexed by j).
We use the row-vector convention throughout, matching the parent note (Q=XWQ, with x written as a row and the matrix on its right).
Why the topic needs it. The projections Q=XWQ, the feed-forward xW1+b1, the output mix WO — all of them are "reshape this arrow through a learned machine, then nudge". Training tunes the numbers inside W and b.
Why this tool and not another? We need a single number saying "how relevant is token A to token B?". Distance would work but grows with vector length and ignores direction. The dot product answers exactly "do these two arrows agree in direction?" — which is precisely what "these two words are related" should mean once meaning lives in direction. That is why the parent's score matrix is QK⊤ (every query dotted with every key).
Why the exponential es and not just "divide by the total"? Two reasons. First, raw scores can be negative; es is always positive, so every weight is a valid share. Second, esexaggerates the winner — a slightly higher score grabs a much larger slice, which lets attention focus sharply on the most relevant token instead of spreading itself thin.
Analogy. A library search: your typed query meets each book's index card (key); the match strength decides how much of each book's contents (value) you carry away.
Why the topic needs it. Splitting one arrow into these three roles lets the same token behave differently as a seeker versus as a target. Without it, attention could only measure raw similarity, never learned, task-specific relevance. This is the core of Scaled Dot-Product Attention and Multi-Head Self-Attention.
Why the topic needs it. Deep stacks make numbers drift huge or tiny, and softmax + dot products misbehave at extremes. Layer Normalization uses exactly this to keep every arrow at a sane scale before the next layer; γ and β give it a way to undo the squashing when helpful.
Read it top-down: tokens become embedding-plus-position arrows in a grid, arrows get reshaped into Q/K/V, transpose lets dot products score them, scaling + softmax turn scores into a vote, heads split the width, the vote blends the values, WO mixes the heads, and normalization (with γ,β) keeps everything stable enough to stack six times.
Cover the right side and answer aloud — if you can, you are ready for the parent note.
What is a vector, in one picture?
An arrow of numbers pointing to a spot in d-dimensional space.
What does the symbol R mean?
The set of all real numbers — any ordinary number on the number line.
In the token grid X, what is a row, and what is a column?
A row is one token x at position pos=i; a column is one feature slot j shared across all tokens.
What does Rn×d describe?
A grid with n rows and d columns — one arrow per row.
Where does a token's starting arrow come from?
Add the meaning arrow E(x) to the position arrow PE(pos).
In the row-vector convention, what shapes must W and b have for xW+b to work?
W∈Rdin×dout and b∈Rdout; b shifts the reshaped arrow.
What do din and dout stand for?
The lengths of the arrows going into and out of a reshape.
What does the transpose K⊤ do and why is it in QK⊤?
Swaps rows and columns so key arrows become columns, letting one multiply compute all query–key dot products.
What single number does a dot product give, and when is it large?
A relevance/alignment score; large and positive when the two arrows point the same direction.
Why is attention built on dot products rather than distances?
We need one number for "how related?"; the dot product measures directional agreement, which is exactly relatedness once meaning lives in direction.
What does softmax output, why the exponential, and what stability trick is used?
Positive weights summing to 1; the exponential keeps them positive and sharpens focus; subtract max before exponentiating to avoid overflow (same result).
What are the shapes of Q, K, V?
Q,K∈Rn×dk and V∈Rn×dv.
What does h do to the width dmodel, and what does WO do afterwards?
Splits it into h blocks of size dk=dmodel/h; WO∈Rdmodel×dmodel mixes the concatenated heads back into one output.
What does ⋅ mean and why divide scores by dk?
a is the number whose square is a; dot products grow like dk, so dividing cancels that and keeps softmax in its high-gradient range.
What do μ, σ, γ, β do in layer norm?
μ,σ recenter and rescale to mean 0 / spread 1; γ,β are learned scale and shift applied afterward.