Every ML paper is written in a compressed language. The parent note assumes you already read that language fluently. Here we slow all the way down and earn each symbol one at a time, in the order they depend on each other — nothing appears in a formula before it has its own section below. (We will only name the two big target equations at the very end, once every piece inside them exists.)
Where the parent topic note lives is the destination; this page is the runway.
A scalar is a single number, like 3 or −0.5. We write scalars in plain italics: x, dk.
A vector is an ordered list of numbers — think of it as an arrow, or as a column of stacked values. We write vectors in bold: x.
Why the topic needs it. In the parent note, a bold input like x is what flows into a neural network layer — an image flattened into numbers, a word turned into a list. You cannot read a layer equation without knowing a bold letter is a list of numbers.
We often need many vectors at once. Stack them and you get a matrix.
The picture: rule out a table with r rows and c columns and drop a number in every cell. A single vector of length n is just a matrix of shape (1, n) or (n, 1).
Why the topic needs it. In the parent note Q, K, V are matrices — each row is one query, key, or value vector. To combine them we need operations that respect their shapes, which is exactly what the next two sections build.
The picture: a box with an arrow in and an arrow out. Same input always gives the same output.
H(x) = "the whole transformation a layer is supposed to perform" (H for the desired mapping).
F(x) = "the residual — the small correction the layer actually learns."
Why the topic needs it. Papers bury their key machine in prose. Recognising "this script letter is a function from input to output" is the single move that lets you extract the core equation in Pass 2.
Now that we have matrices (§2), some sit as rows and some as columns, and to line them up we flip one.
The picture: take a rectangular table of numbers and tip it 90°.
Why the topic needs it. In attention, QKT appears. Q and K are stacks of vectors (matrices). Transposing K makes the shapes line up so that multiplying them measures how similar each query is to each key — see §5. Without transpose the shapes clash and the multiplication is undefined.
To turn two vectors into a single similarity number, we use the dot product. (Multiplying Q by KT is really a table full of these dot products, one per row-pair.)
Why the topic needs it. Multiplying Q by KT produces a whole matrix of these dot products — one similarity number for every query–key pair. That matrix is exactly what softmax (§6) will turn into attention weights.
We now have raw similarity scores. But scores can be any size, positive or negative. To use them as weights ("how much attention to pay"), we need them to be positive and to sum to 1 — a probability distribution.
Why the topic needs it. In the parent's attention formula, softmax (applied over the key axis) converts the similarity matrix into attention weights that then blend the value vectors V. It is the step that decides what the model looks at.
Training a model = adjusting numbers to make a loss (an error score) as small as possible. To know which way to nudge each number, we need the derivative.
The last symbols in the parent note come from probability.
The picture: a symmetric bell centred at 0; variance is how wide the bell is.
Why the topic needs it. This single scaling factor is the whole "from first principles" argument in the parent's Transformer example. Note that Var here is always the variance of one score entry, never of a whole matrix.
With every piece earned, the parent note's headline formulas decode cleanly:
ResNet:H(x)=F(x)+x — "the desired transformation H (a function, §3) of the input vector x (§1) equals the learned residual F plus the input added straight back."
Attention:softmax(dkQKT)V — "matrix-multiply queries Q by keys transposed KT (§2, §4) to get a table of dot-product similarities (§5); divide each entry by dk to keep its variance at 1 (§8); softmax along the key axis (§6) into attention weights; use them to blend the value rows V."
Once these symbols are solid, the parent note connects outward to: Attention Mechanisms (where softmax and dk live for real), Transfer Learning, Hyperparameter Tuning and Experiment Tracking and Versioning (the Pass-3 reproduction machinery), Statistical Significance Testing (checking those "within 0.5 BLEU" claims honestly), Model Debugging (the overfit-10-samples sanity check), and finally writing your own results up in Paper Writing and Publication.
Test yourself — reveal only after you have answered.
A bold letter like x means what, and looks like what?
An ordered list of numbers (a vector), pictured as an arrow from the origin to a point.
What is a matrix, and what is its shape?
A rectangular grid of scalars — a stack of vectors — with shape (number of rows, number of columns).
What does the script F(x) represent, and how does it relate to H?
A learned function (the residual); F=H−x, so H(x)=F(x)+x.
What does the transpose KT do to a matrix of shape (r, c)?
Flips rows and columns to give shape (c, r), so shapes line up for multiplication.
What does ∑i=1nqiki compute, and what single number does it give?
The dot product of q and k — one similarity score, large when the arrows align.
Softmax takes what and returns what, and along which axis in attention?
Takes a whole list of scores, returns a same-length list of positive weights summing to 1; applied along the key axis (last dim) so each query's weights sum to 1.
Why does softmax use es instead of plain division?
es is always positive (valid probabilities even for negative scores) and exaggerates the leader while staying differentiable.
What is the difference between a gradient and a Jacobian?
A gradient is the derivative of a scalar output w.r.t. a vector (a vector); a Jacobian is the derivative of a vector output w.r.t. a vector (a matrix of all component-wise partials).
Why does the +I term in ResNet's gradient prevent vanishing gradients?
Differentiating the +x shortcut gives the identity I, guaranteeing a full, undiluted gradient always flows straight back.
(QKT)ij sums dk unit-variance terms; what is its variance and why divide by dk?
Variance is dk; dividing the entry by dk divides its variance by dk, restoring it to 1 and preventing softmax saturation.
Recall Quick self-quiz
Cover the answers above. If any reveal surprised you, reread that numbered section before opening a real paper.