This page assumes you know nothing about the notation used in the parent Multi-Head Attention note. We build every symbol from the ground up, in the order they depend on each other. Nothing is used before it is drawn.
A sentence like "the cat sat" is, to a computer, just words. But neural networks only eat numbers. So the very first thing that happens is: each word becomes a list of numbers. Everything else is arithmetic on those lists.
Keep that picture in your head: words in a row, each word its own list of numbers. Every symbol below is a name for some part of this picture.
Picture: in figure s01 above, we had 3 words, so n=3. In the parent's example, n=10.
Why the topic needs it: attention compares every word to every other word. If there are n words, that's an n×n grid of comparisons. So n controls how big that grid is.
Picture: the list of numbers describing one word. To build intuition we stand a single word's list up as an arrow in space: 2 numbers = an arrow on a flat page, 3 numbers = an arrow in a room.
Why the topic needs it: a word's "meaning" is stored as the direction and length of its arrow. Two words with similar meaning point in similar directions — and measuring "similar direction" is exactly what attention will do (see §6).
Picture: how many numbers are in one word's list. Longer list = more room to store meaning.
Why the topic needs it: this is the "budget" of numbers the model spends per word. Multi-head attention will split this budget among heads — that is the whole trick of §7.
Picture: figure s01 is a matrix — lay every word down as one row and stack the n rows, giving a grid of shape [n×dmodel] (one row per word, dmodel numbers across). In the parent, Q,K,V∈R10×512 means "a grid with 10 rows — one per word — and 512 columns".
Why the topic needs it: whole sentences are processed as one grid, not word-by-word. This is what makes transformers fast.
Picture: figure s03 walks one output entry through: slide a row of A across a column of B, multiply the aligned numbers, add them up — that single sum is one cell of the answer. Do this for every row–column pair to fill the whole output grid.
Why the topic needs it: The parent writes QiKiT. Because each word is a row (our §4 convention), Qi is [n×dk] and Ki is also [n×dk] — you cannot multiply them directly (inner numbers dk and n don't match). Transposing Ki to [dk×n] fixes the shapes, and the multiply QiKiT becomes an n×n grid where cell (i,j) is "row i dotted with row j" = how much word i aligns with word j. See §6 for why that number means "similarity".
This reshaping-by-multiply is exactly what Linear Projections in Neural Networks is about, and the projection matrices WiQ,WiK,WiV (defined in §7 below) are what get multiplied in.
Why the topic needs it: without these three roles there is no "asking" and "answering". The subscripts you saw in the parent — q3,1, kj,1 — are now fully named: word 3's query in head 1, word j's key in head 1.
Picture: cut the 512-long word-vector into 8 shorter pieces of 64 each.
Why the topic needs it: this is the reason it's called "multi-head". Each head sees the words through its own smaller projection, so one can track grammar while another tracks meaning.
All cases: one very large score → its weight ≈ 1, others ≈ 0 (near hard-max). All equal scores → equal weights 1/n (pure average). Negative scores are fine — es is still positive.
Why the topic needs it: the weights weight3,j in the parent tell word 3 how much of each other word's value to keep. See Self-Attention and Attention Visualization to see these weights drawn as a heat grid.
Picture: figure s05 — the same dv-long output slot, filled mostly by the value-vector of the word with weight 0.6, a little by the one with 0.3, barely by the one with 0.1.
Why the topic needs it: this final blend is the answer attention produces — a context-aware version of each word, built from the words it decided were relevant.
Why divide by it? A dot product of two 64-long vectors adds up 64 products, so it tends to grow large. Large scores make softmax nearly one-hot and kill the gradient. Dividing by dk keeps scores in a sane range so learning stays stable.