Agreement
One number that says how much two lists agree — it measures angles, casts shadows, points the gradient, and finally decides what a transformer pays attention to.
Every section of every unit ends with a realization — the formula turned into a sentence you could have written yourself. Here they all are, in order. Read it last to see the whole shape at once, or read it first to see where the road goes.
A handful of ideas keep coming back, each time in bigger clothes. Follow one from its first appearance to the place where it runs a real machine.
One number that says how much two lists agree — it measures angles, casts shadows, points the gradient, and finally decides what a transformer pays attention to.
Eigenvectors keep turning up: they unpack a matrix, judge a landscape, explain why a valley is slow, and name the directions that matter in data.
Some inputs vanish without a trace. The blind spot of a matrix explains missing solutions, redundant features and why a model can memorise.
The chain rule, promoted step by step: a product of slopes, a product of Jacobians, a sweep backwards through a graph — and later, through time.
Curvature decides everything near a flat spot — how good an approximation is, whether you found a minimum, and how big a step you can dare.
One rule — step against the gradient — then every refinement of it: how far, how often, with how much memory.
Positive definite matrices are the “honest bowls” of the course: they define rulers, have a square root, certify a minimum and make a problem safe to solve.
Click any title to open that exact section.
Up close, every smooth curve is a straight line. The error of pretending shrinks like the square of how far you look. So we can study the easy, straight version and trust the answer nearby.
In one sentence: almost everything looks straight when you zoom in, so linear equations are the tool machine learning reaches for first.
A vector is not a mysterious arrow. It is a list of numbers you are allowed to add and scale. Houses, photos, words and shopping slips all follow the same two rules, so one set of tools works on all of them. That is why linear algebra powers machine learning.
In one sentence: a vector is an ordered list of numbers that you can add slot by slot and scale, and almost any data can be written that way.
Everything fancy in this unit (matrices, Gaussian elimination, echelon form) is just these two moves, done by a machine at scale: remove an unknown by subtracting rules, then substitute back.
One more thing: four rules for three unknowns usually have no answer at all. This one does because the rules happen to agree. When real data disagrees, which is the everyday case in machine learning, linear regression finds the best almost-answer instead.
In one sentence: a system of linear equations is a set of rules that must all be true at once, and you solve it by subtracting rules to remove unknowns one at a time.
A linear system never has exactly two answers. Suppose and are both answers. Then the point halfway between them is an answer too, and so is every point on the line through them. Two answers always grow into infinitely many. So the only possible counts are zero, one, or infinity.
In one sentence: each equation is a straight line (or flat plane), and they can meet nowhere, at one point, or along a whole line, so a system has zero, one or infinitely many solutions.
A matrix is a function, and multiplying matrices means doing one function after another. "Blur, then darken" is one combined filter, and that filter is (read right to left: acts first). The strange row-times-column rule is exactly the arithmetic that makes true.
That is also why order matters. Socks then shoes is not shoes then socks. In general .
In one sentence: a matrix is a grid of numbers, and multiplying two matrices means "row times column" for every cell, which is the same as doing one filter after another.
Rows give you rules to obey. Columns give you ingredients to mix. The machine view asks which input made this output. Three pictures, one equation. And the big questions (is there an answer? just one?) belong to the machine itself, not to the particular you happen to be holding.
In one sentence: Ax = b can be read as rules to obey (rows), ingredients to mix (columns), or a machine to run backwards, and switching windows is the key skill of linear algebra.
The columns of a matrix are where î and ĵ land. Once you know those two landing spots, you know where every point goes: . And is the area of the tile those two arrows make: how much the machine grows or shrinks area, with a minus sign if it flips space over.
In one sentence: a matrix moves space by sending î and ĵ to its columns, and its determinant is how much it scales area (or volume), with det = 0 meaning space got squashed flat.
The inverse exists exactly when , because you cannot un-squash something that was squashed flat. And even when it exists, a determinant close to zero makes the inverse huge and the answer shaky. In practice we solve with elimination and never build .
In one sentence: the inverse is the undo button for a matrix; it exists only when det A is not zero, and in real work we solve with elimination instead of computing it.
all solutions = one solution + every "invisible" direction
The invisible directions are the arrows the matrix sends to zero: solutions of . Together they are called the null space of . You will meet "one answer plus the null space" again in regression, in optimization, and inside neural networks.
In one sentence: when a system has infinitely many solutions, they all look like one particular answer plus any mix of the directions the matrix sends to zero.
solutions of = + all of
One anchor, plus the whole blind spot. If the blind spot is only , there are no look-alikes, and a solution (when there is one) is unique. You already know that case by its other names: , invertible.
In one sentence: the null space holds every input the matrix sends to zero, and adding any of them to a solution gives another solution, which is why answers come in families.
Elimination rewrites the same problem until the answer is obvious. Every move can be undone, so the solutions never change. At the end, the staircase tells you everything: pivot columns are pinned-down unknowns, columns without a pivot are free, and a row that says something non-zero means no solution. In the big example the last row became "", so there is a solution only when .
In one sentence: Gaussian elimination uses swap, scale and add-a-multiple to turn the augmented matrix into a staircase, without ever changing the solutions, and the staircase then shows the answer and the system's fate.
In RREF, every pivot column is a clean "1 and zeros" column, so the answer can be read straight off the bar. Every column without a pivot is a free variable, and each one gives exactly one invisible direction. So the size of the null space is
unknowns minus pivots: freedom left over = unknowns minus the rules that really pin something down. (This is the rank–nullity theorem.)
In one sentence: RREF keeps eliminating until every pivot is a lone 1, so solutions, null-space directions and even the inverse can be read straight off the page.
Rank answers "how many solutions?" completely. Compare with and with , the number of unknowns:
① At least one solution . Adding brought no new direction, so is in the column space.
② Exactly one ① holds and : no free variables.
③ Infinitely many ① holds and : free variables exist, and the null space is alive.
In one sentence: rank is the number of pivots, the number of truly independent rows and of columns, and comparing rank(A), rank([A|b]) and n tells you whether a system has zero, one or infinitely many solutions.
One picture: a matrix is a machine that moves space; solving asks which input the machine turned into that output. One method: elimination on until the staircase appears. One number: rank, which counts the dimensions that survive and decides all three fates.
In one sentence: a matrix moves space, elimination reveals what it did, and rank tells you whether Ax = b has zero, one or infinitely many answers.
In one sentence: every object in machine learning is a list of numbers, and this unit maps the world those lists live in and the rules for moving around it.
A group is a set with a trustworthy undo button. You can combine any two members and stay inside, brackets never matter, there is a do-nothing member , and every has a partner that brings you back to .
When a set fails, it is nearly always the last promise. The counting numbers have no . The whole numbers under multiplication have no .
In one sentence: a group is any world where combining keeps you inside and every move can be undone.
Adding and scaling can be done in either order, and you never leave the world. Anything you can add and scale by these rules counts as a vector. Every "linear" idea in this course, from gradients to averages, is this route-swapping trick.
In one sentence: a vector space is any world where you can add and scale freely and never fall off the board.
In , the subspaces are exactly the flat things through the origin: the origin alone, lines through , planes through , and so on up to the whole space. A set that is shifted, curved or fenced in always lets something escape.
This is a theorem, not just a pattern. Sections 10 and 11 show why: every subspace is the span of a few independent arrows, and such a span is always a flat through .
In one sentence: a subspace is a flat world through the origin where adding and scaling never take you outside.
Zero in, zero out. Invisible plus invisible is invisible, and a stretched invisible change is still invisible. So the null space is always a subspace. The same two rules make the column space , all the outputs the machine can produce, a subspace too.
But the solutions of with are never a subspace: two of them add up to , not .
In one sentence: whatever a matrix cannot see forms a subspace, because zero plus zero is zero and a stretched zero is still zero.
The span is every mix . It is always a flat through the origin, so it is always a subspace: a point, a line, a plane, or more.
Its size depends on how many different directions the arrows point in. A new arrow that lies inside the current span adds nothing. An arrow that points out of it adds a whole new direction.
In one sentence: the span is everywhere your arrows can take you, and it only grows when a new arrow points somewhere new.
Vectors are independent when the only way to make is with every . You can only get home by never leaving.
If some other weights bring you home, the set is dependent, and at least one vector is a mix of the rest: extra baggage.
In one sentence: vectors are independent when the only walk that brings you home is the one where you never leave.
Stack the vectors as columns and eliminate. A pivot column brings a new direction. A column without a pivot is a mix of earlier columns, and in the reduced form its numbers are the exact recipe.
The number of pivots, the rank, is the number of truly different directions. If every column has a pivot, the vectors are independent.
In one sentence: eliminate the columns, and every column without a pivot is exposed as a mix of the pivot columns before it.
If the ingredients are independent, then the dishes are independent exactly when their recipe cards are. So you can always do the check on the small, simple cards instead of the big dishes.
And more cards than ingredients () always means dependent.
In one sentence: with independent ingredients, dishes are independent exactly when their recipe cards are, so you can always check the cards instead.
A basis reaches everything with nothing extra. Because of that, every vector has exactly one address:
The are the coordinates. Change the basis and the address changes, but the point itself stays put. A dependent pair cannot be a basis: the graph paper collapses to a line.
In one sentence: a basis is a set of directions that reaches everything with nothing to spare, so every vector gets exactly one address.
Every basis of a space has the same number of vectors. That number is the dimension: the count of independent directions, the number of knobs you really have.
Components count the room you are written in. Dimension counts the room you actually use. And more vectors than the dimension always means redundancy.
In one sentence: dimension is the number of independent directions a space really has, and every basis agrees on it.
To find a basis of a span: stack, reduce, and keep the original vectors in the pivot columns. The number you keep is the dimension.
For the slide example: a basis of is , and . Four vectors walked in, one was a mix, and three genuine directions remain.
In one sentence: to shrink a pile of vectors to a basis, keep each vector only if it points outside the span of the ones you already kept.
In one sentence: know your space, spot the redundancy, find the span, and pick the smartest basis.
In one sentence: machine learning keeps asking "how similar are these two things?", and this unit is about the rulers that answer it.
A norm is just a rule for measuring length. Different rules give different shapes of "all points at distance 1": a circle for the crow, a diamond for the taxi. When a machine-learning model measures error or closeness, it has quietly picked one of these rules, and the pick changes the answer.
In one sentence: a norm is any rule for length that scales properly, allows no shortcuts, and gives zero only to "nowhere".
The dot product is an agreement score. Every "people like you also watched…" system is built on this one line of arithmetic.
In one sentence: multiply matching entries and add them up; the total says how much two lists agree, and a list's agreement with itself is its length squared.
Any score with these three ingredients is called an inner product. The dot product is just the most famous one. Every inner product gives you its own length, its own distance and its own angle, and they all behave sensibly. The natural next question: how do we cook up new ones? (Next section.)
In one sentence: an inner product is any agreement score that is fair with sums, the same both ways, and always positive for a list with itself.
The matrix reshapes the unit ball. The identity gives a round ball. A diagonal squashes it into an egg along the axes. Off-diagonal numbers tilt the egg. A matrix that is not positive-definite tears the ball open, because some arrows would get a negative length squared.
In one sentence: to design a ruler, pick a symmetric matrix that gives every non-zero arrow a positive length squared, and test it with the top-left number and the determinant.
A shadow never beats the stick, and a detour never beats the straight road. The first fact makes angles possible (next section). The second fact makes sure every inner product gives a proper length.
In one sentence: length and distance come free with every inner product, and the score can never beat the product of the lengths, just as a shadow can never beat the stick.
is the shadow of a length-1 arrow. Shrink both arrows to length 1, then drop the shadow of one onto the other: its length is . Full shadow: same direction. No shadow: right angle. Negative shadow: opposite. Length never enters. Only direction does.
In one sentence: cosine similarity is the agreement score with the lengths divided out, so it measures direction only: +1 same, 0 unrelated, −1 opposite.
In 2D, two random arrows can point any which way. In 1000D, two random arrows are almost always at almost exactly 90°. The spread of the cosine shrinks like : about 0.03 when .
Why this matters: a 1000-number embedding space has room for millions of ideas that barely get in each other's way. It also means a cosine of 0.3 between two real embeddings is huge. Random chance would give about 0.
In one sentence: in many dimensions, random arrows are almost always at right angles, so real similarity stands out clearly.
"At a right angle" is not a fact about two arrows alone. It is a fact about two arrows and a ruler. Measuring with is exactly the same as stretching the page sideways by and then measuring normally. Choosing the ruler to fit the problem is what feature weighting and the Mahalanobis distance do in machine learning. (Section 5's lens shows the same thing: press diag(2, 1).)
In one sentence: change the ruler and the same two arrows can stop being at a right angle.
This one line is the test for an honest motion. Pass it, and every length, distance and angle is safe. The shear keeps the area (its determinant is 1), but it fails this test, and you can see its arrows slide off the measuring rings.
In one sentence: a matrix with turns or flips space like a stiff tile, so every length and angle survives.
Any arrow = its shadow along a direction + a leftover at a right angle. The shadow amount is . If the stick leans backwards (angle past 90°), turns negative and the shadow falls behind you. This single split is the heart of least squares, attention scores and PCA.
In one sentence: to find a shadow, ask for the leftover to be at a right angle, and the amount comes out as .
Gram–Schmidt = cut off the shadows, then resize to 1. Each new direction loses the parts that point along the clean ones, so what is left must be at a right angle to them. Any basis at all can be cleaned this way.
In one sentence: Gram–Schmidt turns any crooked basis into a square one by cutting off shadows and resizing to length 1.
In one sentence: a matrix moves everything, but it has simple fingerprints: one number for how much it grows space, and special directions it only stretches.
is the area of the tile that the unit square becomes. Its size says how much every area grows. A minus sign means the tile was flipped over. Zero means it was squashed flat, and then nothing can undo .
In one sentence: the determinant is the signed area of the tile the unit square becomes: its size is the growth, a minus means flipped, and zero means squashed flat for good.
A big determinant is a sum of small ones: entry × sign × minor, along any row or column. Pick the line with the most zeros. For big matrices, eliminate down to a triangle and multiply the diagonal. Every road gives the same number.
In one sentence: break a big determinant into small signed pieces along the laziest line, or eliminate to a triangle and multiply the diagonal.
is the sum of the diagonal. It ignores everything off the diagonal, and always. Soon you will see it is also the sum of the eigenvalues.
In one sentence: the trace adds up the diagonal, ignores the order of a product, and turns out to be the sum of the eigenvalues.
An eigenvector is an arrow that only stretches: . The stretch number is its eigenvalue. To test a guess, multiply once and check if the answer is a multiple of the arrow.
In one sentence: an eigenvector is a direction the matrix only stretches, and its eigenvalue says by how much: .
An eigenvalue is a setting of the dial where squashes space flat. Solve this equation for the eigenvalues, then solve for the directions. Check: sum = trace, product = determinant.
In one sentence: eigenvalues are the values of where ; they always add up to the trace and multiply to the determinant.
A symmetric matrix is: turn into the grain, stretch each grain direction by its , turn back. Its eigenvalues are real, its eigen-directions are at right angles, and undoing is just flipping it.
In one sentence: every symmetric matrix has a hidden right-angle grain, so it is just turn, stretch along the grain, turn back: .
A symmetric 3×3 matrix turns the round ball into an egg. The egg's axes are the eigen-directions, their lengths are the 's, and the volume grows by .
In one sentence: in 3D a symmetric matrix squeezes the ball into an egg along three right-angle axes, and the volume grows by the product of the three eigenvalues.
A pure turn has no real eigen-directions. Its eigenvalues are the twins , which sit on the unit circle. The angle of is the turn, and the size of is the stretch.
In one sentence: a matrix that turns has no real eigen-directions, and its complex eigenvalues are the turn written as a number.
Fill in from the top-left corner, one entry at a time. It only works when is positive-definite, so it doubles as a test. And bends a round random cloud into one with covariance .
In one sentence: a positive-definite matrix has a triangular square root , found corner by corner, and is exactly the lens that turns plain random numbers into realistic data.
Different eigenvalues, or a symmetric matrix, guarantee a full set of eigen-directions. A repeated eigenvalue in a non-symmetric matrix can come up short (). And the data matrix is always in the safe, symmetric, positive-definite club.
In one sentence: only non-symmetric matrices with repeated eigenvalues can run short of eigen-directions, and the data matrix never does.
A matrix looks like a block of numbers. Underneath, it is a short list of simple moves. Writing does not change at all. It only lets you see what does.
In one sentence: a decomposition rewrites a matrix as a few simple moves — turn, resize, turn — without changing what it does.
A diagonal matrix is a resize tool: one handle per axis. Repeating, undoing and measuring area all work one number at a time: . The only danger is a handle set to 0 — that axis is flattened for good.
In one sentence: a diagonal matrix is easy because each axis minds its own business — so this unit is a hunt for the diagonal hiding inside every matrix.
says: in its own favourite directions, is just a resize tool. The columns of are those directions (the eigenvectors). The diagonal of says how much each is stretched (the eigenvalues).
In one sentence: just says: put 's eigenvectors in the columns of and their eigenvalues in .
A symmetric matrix is an equalizer. It splits the input along directions at right angles, turns each part up by its own , and adds them back: . Undoing the split is free, because .
In one sentence: a symmetric matrix is a set of perpendicular directions, each turned up by its own eigenvalue — nothing more.
is a translator: into the matrix's own directions, resize, and back. Its best trick is repetition: . Powers of a matrix become powers of plain numbers.
In one sentence: translates into the matrix's own language, does a simple resize there, and translates back.
An eigenvector is a direction the matrix does not turn. Eigendecomposition needs independent ones for an matrix. The shear has one, the rotation has none, and a rectangular matrix cannot even ask the question.
In one sentence: eigendecomposition fails whenever one set of axes must serve both input and output — the shear, the rotation, and every rectangular matrix.
Every matrix is turn · resize · turn: . There are two frames at right angles — for inputs, for outputs — and a list of stretches . No exceptions: not rotations, not shears, not rectangles.
In one sentence: every matrix is turn · resize · turn — , then , then — no exceptions.
To find the SVD, take the round trip. The eigenvectors of are the input frame , and . The output frame comes free: . always has the same shape as , padded with zeros.
In one sentence: to break down , break down the symmetric round trip instead: and the σ's fall out, and finishes the job.
A rectangular matrix maps one world into another. A matrix can only fill a flat sheet inside 3-D space. The SVD's span that sheet, and is the direction it can never reach.
In one sentence: a rectangular matrix maps one world into another: its image is a flat slice of the bigger world, and is the direction it can never reach.
Sort the layers biggest first and keep the top : . No rank- matrix does better, and the error is . Each layer costs only numbers — so this is compression, for photos and for tables of ratings alike.
In one sentence: sort the layers biggest first and keep the top few — the best possible summary of any matrix, whether it is a photograph or a table of tastes.
is the biggest boost a matrix can give: . The ratio says how uneven the boosts are. When it is huge, undoing the matrix blows up tiny errors.
In one sentence: is the loudest a matrix can ever be, and says how uneven its boosts are.
Every matrix is turn · resize · turn. Sort the stretches biggest first and keep the top few, and you have the best short summary a matrix can have. Photo compression, noise removal, PCA and recommenders are all that one move.
In one sentence: find the two frames and the sorted stretches, and any matrix becomes simple enough to read, repeat, undo and compress.
The slope tells you which way is up. So you step the other way. Slope positive? Step left. Slope negative? Step right.
Here (read it: "L-prime of w") is the slope where you stand. (read it: "eta") is a small number that sets your step size. The minus sign is the "go the other way" part.
In one sentence: training is walking downhill in fog: you cannot see the valley, but you can always feel the slope under your feet, and that is enough.
The derivative is rise ÷ run between two points, as the two points squeeze into one. It never divides by zero. It only asks what the ratio gets close to.
In one sentence: the derivative is the slope of a two-point line as the two points squeeze into one, and it exists exactly where the curve looks straight up close.
Machines in a row: their rates multiply. Work out the outer rate at the inner value, then multiply by the inner rate. A deep network is a long row of machines, so this one rule runs all of machine learning.
In one sentence: rates in a row multiply, and a deep network is a long row, which is why the chain rule runs machine learning.
Each term copies one more derivative at the anchor: first the value, then the slope, then the bend. Near the anchor the copy is excellent. Far away it can fail, so Taylor is a local promise.
In one sentence: a Taylor polynomial copies a function's value, slope, bend and more at one point, and the keeps the copies from disturbing each other.
Freeze every other input, then differentiate as usual. Each partial derivative is the slope of one slice through the landscape.
In one sentence: to take a partial derivative, freeze every other input and differentiate as usual.
The gradient points steepest uphill, and its length says how steep. So minus the gradient is steepest downhill. This one line, repeated, is how almost every model in machine learning is trained.
In one sentence: the gradient puts all the partial derivatives in one arrow: it points steepest uphill, its length is the steepness, and minus it is the direction of training.
Two rows of the table do almost all the work in machine learning. The gradient: the loss is one number and the weights are a list, so the derivative is a list shaped like the weights. That is why you can subtract it from them. The Jacobian: a layer turns a list into a list, so its derivative is a matrix.
In one sentence: count before you compute: one sensitivity per (output, input) pair, with outputs as rows and inputs as columns.
Row , column : how much output moves when input is nudged. Zoom in on any smooth map and it becomes this matrix.
In one sentence: the Jacobian is the matrix a curved map turns into when you zoom in close.
is the local area factor. Not zero means you can undo the map near that point. But being undoable near every point still allows the map to wrap around and repeat.
In one sentence: is the local area factor: non-zero means you can undo the map nearby, but not always everywhere at once.
The chain rule for lists is matrix multiplication, later layer on the left. Backpropagation just multiplies from the loss end, so it only ever carries a thin row.
In one sentence: backpropagation is the chain rule as matrix multiplication, done from the loss end backwards so that nothing bigger than a row is ever built.
The gradient says which way. The learning rate says how far to trust it. Too small and you crawl. Too big and you overshoot, again and again.
In one sentence: gradient descent is : the gradient picks the direction, and decides how far to trust it.
At a corner the two sides disagree, so there is no derivative. Software just picks a value in between. Rows versus columns is only a habit, but the order of matrix factors is a rule.
In one sentence: rows versus columns is a habit, the order of matrix factors is a rule, a corner has no derivative, and the giant four-way table is used but never stored.
If you keep one habit from this unit, make it counting shapes before computing anything. Outputs give rows, inputs give columns. A gradient has the same shape as the thing you differentiate by. In a product, the inner sizes must match. Most matrix-calculus mistakes are shape mistakes, and counting catches them before any algebra.
In one sentence: nudge, measure, divide, shrink: that one move, kept tidy with shapes, is all of differentiation for machine learning.
Training needs one slope per knob, at every step. So the real question is not "what is the slope?" but "how do we get a million slopes cheaply?"
Backpropagation is the answer: tiny steps, and blame sent backwards.
In one sentence: training needs the loss's slope for every knob at every step, and finding them one knob at a time would cost one run of the network per knob.
Any function, however scary, is a chain of easy steps. Forward, each step computes a value. Backward, each step receives a blame , starting from .
The blame that reaches at the far left is the answer .
In one sentence: write the function as a chain of easy steps; values flow forward, and blame flows backward from to every step.
Multiply along each route. Add the routes. Backprop does exactly this, and shares the work so that no route is walked twice.
In one sentence: backpropagation is two rules — multiply the small slopes along each path, add the paths — done so that no path is walked twice.
A derivative is a promise: "near here, the function is a straight line plus a leftover that fades fast". Chain two promises, and the slopes multiply. Let several routes run side by side, and their products add.
And one entry of a matrix product, , is both rules written at once.
In one sentence: a derivative is a "straight line plus fading leftover" promise; chaining promises multiplies slopes, side-by-side routes add, and row-times-column is both rules at once.
Set . Walk from right to left. At each value, add up (child's blame × child's small slope) over all its children.
One sweep, and every value in the graph — every input, every weight — holds its slope.
In one sentence: set , then let every value send each parent its own blame times a small slope — one right-to-left sweep prices every knob.
: the miss, times how steep the squash is. Every knob that feeds then gets times one number: for the weight, for the bias.
Step each knob against its slope, repeat, and the loss really falls. That is training, complete.
In one sentence: compute the blame once, and every knob feeding reads its slope off it — then step downhill and the loss really falls.
Through the squash, scale each neuron's blame by its own slope. Then weights get , biases get , and the layer below gets .
Repeat, layer after layer. That is the inner loop of all of deep learning.
In one sentence: scale the blame by each neuron's slope, then weights get , biases get , and the layer below gets — four lines, the inner loop of deep learning.
Dot product → the other vector. → the outer product . → , because appears twice.
When in doubt, count where the variable appears, and add one term for each appearance.
In one sentence: five recipes — dot product, outer product, the doubling and least squares — give almost every small slope a real model needs.
Every layer's slope is the same shared start, times one new factor. Carry that start — the blame — from the loss backwards, and each factor is used once.
So one backward sweep costs about as much as one forward pass, however many knobs there are.
In one sentence: all the layer slopes share one long start — carry it once, from the loss end, and the whole set costs a single sweep.
is the "flat Earth" version of near .
Its error grows like the square of the distance: twice as far, about four times the error. Every gradient-descent step leans on this promise.
In one sentence: is the best straight-line stand-in near — the promise every gradient-descent step relies on.
The nudge estimate's error is (curve error, shrinking like ) + (rounding noise, growing like ). So there is a best — about here — and even there the answer is off by about .
Autodiff has neither problem. Nudging survives only as a gradient checker: a quick test that a hand-written backward pass is right.
In one sentence: autodiff is exact like the paper method and cheap like one run of the program, which is why nudging survives only as a checker.
Blame flows backwards through the same graph that computed the value. Multiply along paths, add at forks, and reuse every shared piece. Then a million slopes cost one sweep.
In one sentence: loss.backward() is this unit run by a for-loop — one backward sweep through the graph hands every knob its slope.
A Taylor polynomial is a copy built from a few facts at one spot: height, slope, bend, and so on. Each extra fact keeps the copy close for longer. What we still need is a promise about how close.
In one sentence: a Taylor polynomial copies a curve's height, slope and bend at one spot, and this unit proves why that copy works and how far it can be trusted.
If a smooth trail starts and ends at the same height, it has a level spot in between: . All it needs is no gaps and no sharp corners. This one small fact will build the whole unit.
In one sentence: a smooth trail with the same height at both ends must be level somewhere in between, and a sharp corner cancels the promise.
Somewhere, the slope equals the average slope: . Rearranged, . That is the straight-line copy, made exact by one secret point.
In one sentence: somewhere on the way your instant speed equals your average speed, and written as a formula this is already a straight-line copy with no error.
Each Rolle step turns two zeros into one new zero, one derivative lower. If is zero at and flat to order at , the zeros pass all the way down: for some in between.
In one sentence: a function that is very flat at and zero at passes one zero down per derivative, until its -th derivative is zero somewhere in between.
Every smooth function is its copy plus one leftover term: , exactly. The leftover looks like the next term, measured at a secret point. And the whole proof is Rolle, used again and again.
In one sentence: make the gap flat at and zero at , run the Rolle ladder, and the leftover turns out to be the next term measured at a secret point.
You never need the secret point. If on the stretch, then . A worst case turns the exact leftover into a guarantee you can compute.
In one sentence: you never learn , but a worst-case size for the next derivative turns the leftover into a firm promise, .
Each new term is the previous one times . Once is bigger than , every step shrinks the term. So the series for , and can be trusted at every . For there is no factorial, and past it fails.
In one sentence: a MacLaurin series is Taylor at , and the series for , and always settle down because eventually grows faster than any .
Walk in a straight line and a landscape becomes a one-variable curve . Its bend is . Those three second slopes are the landscape's curvature, and they are where the Hessian is born.
In one sentence: along a straight walk the landscape is a one-variable curve, and its bend is where the Hessian comes from.
At a level spot, the height change after a small step is . If is always positive, it's a valley; always negative, a peak; both, a pass. The three second slopes at the spot decide which.
In one sentence: at a level spot the slope part is zero, so the bend alone decides whether you are in a valley, on a peak, or at a pass.
. It is the one-variable formula with each piece moved up a level: number, list, table. The step goes in once for the list and twice, like bread, for the table.
In one sentence: the Hessian packs the bends into a table, and the step sandwiches it, so many-variable Taylor reads exactly like the one-variable formula.
The Hessian is the judge. Work out : positive with is a bowl, positive with is an upside-down bowl, negative is a saddle. The eigenvalues say the same thing: they are the strongest and weakest bends, and .
In one sentence: the Hessian's discriminant, its corner determinants and its eigenvalues are three ways to read one verdict — bowl, upside-down bowl, or saddle.
Find every level spot. Work out the Hessian at each one, because it changes from place to place. Read , then . And when , the bends have run out of evidence, so look further.
In one sentence: find every level spot, judge each one with its own Hessian, and when admit that the bends cannot decide.
Near its bottom, a loss is its own quadratic clone. The Hessian's eigenvalues say how narrow the valley is, and so how hard plain descent will be. Its inverse turns the clone into Newton's one jump, , which is powerful but costly for millions of weights.
In one sentence: near its bottom a loss is its own quadratic clone, so the Hessian decides how hard training is, and its inverse gives Newton's one-jump step.
Every smooth function is, up close, a polynomial, and Taylor's theorem tells you exactly how far "up close" reaches. The leftover came from a ladder of level spots. In two variables, the bend part is a table, the Hessian, whose signs say whether a level spot is the bottom of a bowl. When a training run says it has found a minimum, this unit is how you can check.
In one sentence: Taylor copies a function near a point with a guaranteed error, and the Hessian in that copy judges every valley a learning machine finds.
Read it: new position equals old position, minus the stride times the uphill arrow at the old position. Take the arrow, turn it around, shrink it to your stride, and step. This one line is the picture you just played with, written in symbols.
In one sentence: learning is a walk in fog — feel the slope, step the other way, repeat — which works in any number of dimensions, but finds only the valley below where you started.
Wrongness is the sum of squared misses, . Its slope, , just says "move the line toward the points". If the misses are mostly positive, push the line up.
In one sentence: say what "wrong" means, and a landscape appears by itself — one height for every setting of the knobs — with a slope that says which way the line should move.
The walk stops where the slope is zero, . The bend decides what kind of stop it is: is a valley, is a hilltop. And the valley you reach is the one below your start, not always the deepest.
In one sentence: the walk stops on level ground; the bend tells a valley from a hilltop or a saddle; and you land in the valley below where you started.
The rule is . On a bowl the slope is a spring, , and the bottom is . A trench has one stiff spring and one soft one, so a single stride bounces across it while crawling along it.
In one sentence: on a bowl the slope is a spring, ; a trench has a stiff spring and a soft one, so one stride bounces across it while it crawls along it.
Each step multiplies the distance to the bottom by . Keep that between and , which means . With many directions, the stiffest one () sets the limit for all, and the softest one sets how slowly you crawl.
In one sentence: each step multiplies the distance to the bottom by , so keep — and the gap between the stiffest and softest directions is what makes the walk zig-zag.
Line search fixes the direction , then slides to the bottom of . At the best stride, the new slope is at a right angle to the step. On a bowl, that stride is .
In one sentence: slide along the downhill line until the ground stops dropping — there the new slope is at a right angle to your step — and on a bowl the best stride is .
Trap the bottom in a bracket and squeeze. Halving leaves width after rounds; golden cuts shrink it by per round and reuse a probe. Or skip the hunt: Armijo accepts any stride with .
In one sentence: when there is no formula for the best stride, trap it in a bracket and squeeze — or, like real training, take Armijo's "good enough" stride.
Start bold, finish careful. On a clock: , , or divide by a constant every few epochs. By feel: the bold driver multiplies the rate by after a good step, and undoes and halves after a bad one.
In one sentence: the learning rate is a speed that should drop as you near the bottom — on a timer (exponential, inverse, step) or by feel (the bold driver).
To audit a slope, nudge and divide. Forward, , is off by about . Central, , is off by about . So use central, with a small but not tiny .
In one sentence: check a coded slope by nudging a few knobs; the two-way nudge is far more accurate, until the nudge is so tiny that rounding takes over.
The loss is a sum over examples, so its slope is too. A random handful gives ; scaled by , it is right on average, and its noise shrinks like . Step on it: . That is minibatch gradient descent; is stochastic, and is batch.
In one sentence: batch, minibatch and stochastic differ only in how much data they read per step; a random spoonful is right on average, so per data read the noisy walkers win — which is why deep learning uses minibatches.
With a noisy slope and a fixed stride, the walker ends in a cloud around the bottom whose size grows with the stride: its variance is about , where is the size of the noise. A shrinking stride with and closes the cloud. The same shake can lift a walker out of a shallow dip.
In one sentence: a noisy slope is a shaking hand — a fixed stride leaves a jitter cloud, a shrinking stride closes it, and the same shake can hop a walker out of a shallow dip.
In one sentence: gradient descent is one reflex — step against the slope — and this whole unit is about how big, how exact and how cheap that step should be.
The bill is the total area of the patches: . Its slope is every row's push, added up: .
A row that guessed too high pushes the knobs down along itself. A row that guessed too low pushes them up. A bigger miss pushes harder.
In one sentence: the bill is the total area of one square patch per data row, and its slope is each row's miss times that row, added up — the same recipe for one knob or a billion.
Start small, centred and random: small so the first step stays on the map, random so no two knobs are clones.
And when the numbers explode anyway, look at the factor . It is the size of the data, not your start, that needs fixing.
In one sentence: start small and random — and when the numbers explode anyway, blame the feature's size squared in the factor , not the place you started.
More knobs than facts means a zero training bill is free, so a zero training bill means nothing. Judge a model on rows it has never seen.
Later units add a small charge for big knobs (a regulariser). Then "fits the data with small knobs" beats "fits the data with any knobs", and the learner wins.
In one sentence: with more knobs than facts a zero bill is free and so means nothing — the memoriser hits every training row and still cannot see the one feature that matters.
A knob's sensitivity is its feature's size, squared: . One stride moves knob by .
So features of different sizes make one knob overshoot while another crawls. No stride can serve both. Rescaling the features is the fix.
In one sentence: a knob's sensitivity is its feature's size squared, so features of different sizes turn one stride into a fire hose on one knob and a drip on the other — and only rescaling the features can fix it.
Rescaling changes the units, not the meaning. After standardising, every column has average and , so every column is the same size and one stride can serve every knob.
What rescaling does not fix: two columns that rise and fall together. That leftover comes back in Section 10.
In one sentence: centring slides, standardising squeezes, min–max boxes — all three put every column on the same scale, and all three treat new data with the training numbers.
Descent finds the valley downhill from where it starts, and the watershed decides which one. Restarts give chances: all fail with probability .
With knobs of dips each, the dips multiply to , and the chance of being right on every knob shrinks to .
In one sentence: the side of the watershed you start on decides the valley you reach, and with many knobs the valleys multiply like the settings of a combination lock — so restarts alone cannot save you.
Step length is stride × tilt: . Small tilt means small steps, whether or not you are near a valley. A flat of width and tilt costs about steps.
The cure comes next unit: momentum, which keeps rolling across the flat instead of deciding every footstep afresh.
In one sentence: each step is stride times tilt, so a plateau — small tilt, but no valley — can swallow hundreds of thousands of steps.
Each direction shrinks by its own factor, . The steepest direction sets the speed limit, . At that limit the gentlest direction crawls, and measures how badly.
Steepest descent is the best direction for this one step, never the best direction for the whole trip.
In one sentence: in a canyon each direction shrinks by its own factor , the steepest wall sets the speed limit, and , steepest over gentlest, tells you how much of the walk is wasted bouncing.
Along a contour the height does not change, so : the gradient is at right angles to every contour.
It points at the bottom only when the contours are circles. On ovals, the angle between "steepest" and "towards the bottom" is the zig-zag.
In one sentence: a step along a contour changes nothing, so the gradient crosses every contour at a right angle — which points at the bottom only when the contours are circles.
The bill's steepness in knob is : the column's size, squared. The full table of steepnesses is . Standardising makes every diagonal entry , so the walls level out: here falls from to .
The part that survives is the off-diagonal, from columns moving together. Removing it takes a rotation, not a rescaling.
In one sentence: the bill feels each column squared, so dividing every column by its own spread levels every wall — the canyon becomes a bowl, the safe stride grows a hundredfold, and the model and the data's meaning stay untouched.
Every failure has a signature on the loss curve: blow-up, the train–test scissors, a growing zig-zag, fast-then-crawl, flat from the start, a different answer every run.
Every fix either reshapes the landscape or teaches the walker.
In one sentence: every failure in this unit leaves its own shape on the loss curve, and every fix either reshapes the landscape or gives the walker better instincts.
In one sentence: most training troubles are a badly shaped landscape, and the cheapest way to reshape it is to put every feature on the same scale.
Each step multiplies every direction by its own number, and all those numbers share one . Pick for the steep direction and the gentle one crawls. Pick it for the gentle one and the steep one blows up. No single stride serves both.
In one sentence: The slope tells you which way is down but not how long it lasts, so one shared stride must suit every direction at once — and when directions differ tenfold, no stride can.
Each move is a faded copy of the last move plus a fresh push. Pushes that agree pile up to times one push — ten times at . Pushes that flip cancel. You pay for the speed with overshoot.
In one sentence: Momentum adds a faded copy of the last move, so pushes that agree pile up to times a plain step and pushes that flip cancel — at the cost of overshoot, where the loss may rise for a while.
( means "multiply entry by entry".) Each knob divides its step by the root of its own total. On step one this leaves exactly for every knob, whatever its slope. But the total never shrinks, so the steps only ever get smaller.
In one sentence: Divide each knob's step by the root of everything it has ever felt, and the first step is exactly for every knob — but the record never clears, so the brake never lifts.
Swap the running total for a fading average, and the stride settles at a healthy size instead of dying. On a steady slope it settles at exactly . The price is a first step that is times too big.
In one sentence: Swap the permanent record for a fading one and the stride survives all the way down — at the price of a first step that is times too big, because an average that starts at zero is a wild guess after one reading.
Step = average direction ÷ root of average loudness, times a warm-up rate . Pushes that disagree cancel, loudness divides out, and the very first step is exactly .
In one sentence: Adam keeps a signed average and a squared average for every knob, steps by their ratio so disagreement cancels and loudness divides out, and uses a warm-up rate that makes the first step exactly and then switches itself off.
The steepest direction sets the safe stride. The gentlest direction sets how many steps you need. Their ratio (read "kappa", the condition number) is the tax plain descent pays. The adaptive methods divide each slope by its own size, so they never see at all.
In one sentence: Plain descent's safe stride is set by the steepest direction and its speed by the gentlest, so it pays the condition number in steps — while every adaptive method divides each slope by its own size and never notices.
Three roles, three pictures. is the score: you want it small. is the path: you must stay exactly on it. Each is a fence: you must stay behind it. So becomes , whose slope is . Watch that minus sign — it is where most marks are lost.
In one sentence: Put a wall in a problem and the answer moves onto the wall, where the slope is not zero — so "stop where it is flat" must be replaced, starting by writing every problem as with and .
At the answer, nothing is left to slide along the fence. So the score's arrow and the fence's arrow lie on one line. They are parallel, not equal, and is the stretch between them. Soon will turn out to be a price.
In one sentence: You stop when nothing is left to slide along the fence, so and lie on one line with a stretch between them — and that stretch is about to become a price.
Obey the fence and the guard's best fine is : you pay nothing. Break it and the guard raises without limit. So the Lagrangian — score, plus a fine for leaving the path, plus a fine for each fence — is not a rough copy of the problem. It is the problem, with rules turned into prices.
In one sentence: You cannot differentiate an infinite wall but you can differentiate a straight line, and letting the guard raise the line's slope rebuilds the wall exactly — so with is the fenced problem itself.
Write the room left as a square and differentiate. Out comes : either you have room and the fine is zero, or you are touching and the fine may be positive. Never room and a fine at once.
In one sentence: Write the room left as a square, differentiate, and out comes — either there is room and the fine is zero, or you are touching and the fine may be positive.
KKT is "set every derivative to zero" on the Lagrangian, plus the sign rule. To use it by hand, guess for each fence whether it is touching, solve, and throw out any guess that gives a negative fine or breaks a rule.
In one sentence: KKT is "set every derivative to zero" on the Lagrangian plus the sign rule, and room-or-fine turns it into cases to check, most of which die on a negative fine.
The curve stays under every string, or, the same thing, above every tangent. The tangent form means one slope reading is a promise about the whole function. On a convex problem, a point that passes the five conditions is the answer.
In one sentence: A bowl never rises above its strings and never dips below its tangents — and on a bowl with bowl fences, a point that passes the five conditions is the answer; anywhere else it is only a candidate.
Left, you move first: the primal. Right, the guard moves first: the dual. Moving second is an advantage, so the dual is always a lower bound. And the dual is the lowest of many straight lines, so it is always a hill.
In one sentence: Letting the guard move first gives the dual, which is the lowest of many straight lines — so it is always a hill and always a lower bound — and the fine it hands back is the price of the wall.
The boundary is built from the fines: in general , with . Points far from the boundary get and could be deleted. Only the touching points — the support vectors — matter.
In one sentence: The widest road is the smallest that clears every point, its dual has one fine per training point, and room-or-fine makes almost all of them zero — so the machine rests on a few support vectors.
In one sentence: Optimisers divide each step by what that knob has felt, and fenced problems turn every wall into a price — and the price tells you which walls matter.
Look at the cloud from every direction. For each one, drop the points onto the line and measure how spread out they land. Keep the direction with the biggest spread.
That is principal component analysis (PCA). Everything else in this unit is the machinery that does this search quickly, and the reason it works. On the 90 points, line A has spread and line B only . You have just done PCA by eye.
In one sentence: PCA looks at a cloud of data from every direction and keeps the direction along which the points land most spread out.
A model can only explain change in using change in . So a direction along which the data barely changes carries almost no information, whatever the target is.
That is why PCA ranks directions by their spread — and why it can do so without ever looking at .
In one sentence: a column that barely changes cannot explain anything, so PCA ranks directions by their spread, and it does this without ever looking at the thing you want to predict.
After centring, one small table says how much each column moves (the diagonal) and which columns move together (the rest). From here on, is the only thing about the data that PCA will ever use.
In one sentence: subtract the average from every column, then one small symmetric table records how much each column moves and which columns move together.
For any arrow of length 1: one number for every direction, and no data needed. PCA is now a clean question: which unit arrow makes as big as possible?
In one sentence: the spread along any unit direction is , so once you have every direction gets a score without looking at the data again.
On the leash, the best direction is the place where the uphill arrow points straight along . That is exactly what an eigenvector is. The directions PCA is looking for are the eigenvectors of .
In one sentence: fix the arrow's length to 1, turn that rule into a fine, and setting the slope to zero leaves — the best directions are eigenvectors of .
The spread along an eigenvector is its eigenvalue. So the largest spread is the largest eigenvalue, and it lives along that eigenvector. The same number is the stretch, the spread and the fine. That is why we always list eigenvalues from biggest to smallest, : it is a ranking of directions by how much of the data they show.
In one sentence: put back into the score and it becomes , so the fine, the stretch and the spread are one number, and the top eigenvector wins.
Each new component is the best direction of what is left. Whether you add a leash or peel off the old components, you land on the next eigenvector of the same — and they all meet at right angles for free.
In one sentence: every later component is the top eigenvector of what the earlier ones left behind, and because is symmetric they all come out at right angles.
Turning the axes never changes the total spread. PCA just pushes as much of it as possible into the first few directions — which is exactly why keeping only those few loses so little.
In one sentence: the eigenvalues add up to the trace, so they split one fixed spread budget, and you keep the biggest slices until you have the share you need.
Because the total is fixed, "keep the most spread" and "lose the least" are one instruction. The slides call these the maximum-variance view and the projection view of PCA. They are two sides of one seesaw.
In one sentence: by Pythagoras, what a direction keeps plus what it loses always adds up to the same total, so the line with the most spread is also the line with the smallest rebuild error.
The new columns are uncorrelated by construction, and each one's spread is its eigenvalue. The loadings are the recipe for each new column: read the pattern, not the sign.
In one sentence: the scores have covariance , so the new columns never repeat each other, and the loadings are the recipe that says what each one is made of.
The principal directions are the right singular vectors of the centred data. Cutting the SVD after layers is the best possible rank- copy of the data — PCA again, seen as compression.
In one sentence: substituting into gives and , and cutting the SVD after layers is the best rank- copy of the data, with an error made of the dropped singular values.
No formula can find the eigenvalues of a big matrix, so software multiplies instead. Each multiplication by favours the direction stretches most: the wrong part shrinks by every pass, until only the top direction is left.
In one sentence: no formula finds the eigenvalues of a big matrix, so software multiplies by and rescales, and each pass shrinks everything except the top direction by the factor .
When columns outnumber rows, solve the small problem instead. The non-zero eigenvalues are identical, and one multiplication by — then a rescale — turns each small eigenvector into a principal direction.
In one sentence: when , eigen-split the small Gram matrix instead — same non-zero eigenvalues — and turn each into a direction with .
Fit , and once, on training data, and reuse them for everything new. And remember what PCA cannot see: units nobody told it about, the target , and curves.
In one sentence: centre, standardise, eigen-split and project with numbers fitted once on training data — and never forget that PCA is blind to units you did not fix, to the target, and to curves.
Mean → centre → → → eigenvectors of length 1 → scores. And three free checks at the end: , , and "spread of the scores ".
In one sentence: centre, build , solve the quadratic, make the eigenvectors length 1, project — and let the trace, the determinant and the spread of the scores check your work for free.
In one sentence: PCA turns "which way does the data spread most?" into "which eigenvector of has the biggest eigenvalue?", and every other view of it — budget, rebuild error, uncorrelated scores, SVD — lands on the same answer.
The margin is the width of the widest empty street: twice the distance from the line to the nearest point. Training error cannot choose between the many perfect lines. The margin can. Among all lines that make no mistake, take the one whose street is widest. Everything else in this unit is turning that sentence into mathematics and solving it.
In one sentence: Many lines make no mistakes, so choose the one with the widest empty street around it — it forgives wobble, it is unique, and it rests on only a few points.
is the compass: it points straight across the boundary and sets its tilt. only slides the boundary. And a score becomes a distance only after you divide by .
In one sentence: In , points straight across the line and sets its tilt, slides it, and the score divided by is the true distance.
Subtracting the two edge equations kills and leaves . Cauchy–Schwarz turns that single number into a distance, and tells us it is the shortest distance across — which is exactly what the width of a street means.
In one sentence: The street's edges are ; subtracting leaves , and Cauchy–Schwarz turns that into the width , reached only straight across.
Scaling by changes every number but not the street. Only the ratio is real. Set and "widest street" becomes "smallest ".
In one sentence: Multiplying by any leaves the street untouched, so we pin the nearest scores to 1; then the width is and every point obeys .
A bowl with straight walls. Same winner as "maximise ", but smooth, with exactly one bottom. The points pressing against the walls at that bottom are the support vectors.
In one sentence: The widest street is the lowest point of the bowl inside straight walls — a convex quadratic program with exactly one answer, and none at all if the groups overlap.
Every point gets a price : how hard it pushes on the street. Points with room to spare pay nothing. Only points pressed against an edge carry a price.
In one sentence: Turn each wall into a price ; the prices punish any trespass without limit, and at the answer only the points pressed against the street carry a price.
The direction of the street is a weighted sum of the training points, and the two classes' prices balance like a tug-of-war that has come to rest.
In one sentence: Setting the slopes of to zero gives — the street's direction is built from the points themselves — and , the balance of the two classes' pushes.
A hill in the prices alone. Its peak equals the primal minimum (a free check), and the data appears only through dot products.
In one sentence: Substituting and back into leaves a hill in the prices alone, whose peak equals the primal minimum and which sees the data only through dot products.
Find the widest street → it collides with a few points → those are the support vectors → the whole model can be rebuilt from them alone. Every arrow runs forward. You never choose them; the solution hands them to you.
In one sentence: Complementary slackness splits the points into those with room (price 0, deletable) and those pressed on an edge; the few with a positive price — the support vectors — hold the street up on their own.
Let points trespass, but fine them per unit. In the dual the fine becomes a ceiling on how hard any one point can push. Small : wide and forgiving. Large : narrow and strict. : the hard margin.
In one sentence: Give each point a slack , fine it per unit, and the dual stays the same except for a ceiling — the knob that trades a wide street against trespassers.
The hinge loss is not a design choice. It is the cheapest slack that obeys both floors: zero when a point is safely outside the street, growing one-for-one as it walks in and across.
In one sentence: The cheapest slack that obeys both floors is — the hinge loss, flat beyond the edge and a straight slope inside, which turns the SVM into "regulariser plus loss".
Classifying is a vote: each support vector says how similar the new point is to it, weighted by its importance, pulling towards its own side. Keep this picture — the kernel trick changes only the similarity.
In one sentence: The data enters both the training and the prediction only through dot products, and is a vote: importance × side × similarity, plus an offset.
Take the data to a higher-dimensional space by adding new features. Up there, fit an ordinary linear SVM — a flat boundary. Its shadow back home is curved. The SVM never stopped being linear; it is linear in the higher space.
In one sentence: Add features so the data rises into a higher space, cut it there with a flat plane, and the cut comes back down as a curve — the machine stays linear, just not in the space you started in.
A kernel is a dot product in a bigger space, computed without going there. Swap every dot product in the dual and in the vote for , and the linear machine draws curves — at the cost of the small space, whatever the size of the big one.
In one sentence: Because , a kernel gives the similarity of the lifted points from the small space alone — so we swap every dot product for and never build the huge (even infinite) lift.
The kernel table is always — four points give a table whatever the degree. The degree only changes the size of the lifted space, which we never build. still exists, , but it lives up there; we keep the prices and the support vectors instead.
In one sentence: Build the kernel table (dots first, kernel second), shrink the dual with symmetry and balance, find the prices, get from a support vector, and classify by the vote — the boundary is flat upstairs and curved down here.
In one sentence: An SVM is the widest street between two groups, held up by a few support vectors, softened by a fine, and bent by a kernel — and it only ever meets the data through dot products.
A random variable turns an uncertain outcome into a number. You cannot know the next value of . You can know its distribution: how the chances are spread over the possible values. The shape of the pile is the knowledge.
In one sentence: A random variable turns an uncertain outcome into a number, and although one outcome cannot be predicted, the distribution of many outcomes can — the shape of the pile is the knowledge.
Probability lives in a mass for countable outcomes and in an area for smooth ones. The mean is the balance point of that mass. The variance is the average squared distance from it.
In one sentence: A distribution says where the probability lives — as masses that add to 1 or as an area of 1 under a density — and its mean is the balance point while its variance is the average squared distance from it.
Bayes' rule turns "how likely is the evidence, if the idea is true?" into "how likely is the idea, now that I have seen the evidence?". The prior is where you stood before. The posterior is where you stand after, and it becomes the prior for the next piece of evidence.
In one sentence: Bayes' rule turns the evidence around — posterior ∝ likelihood × prior — and because the prior is where you stood before the evidence, a rare disease stays fairly unlikely even after a good test says yes.
The bell only asks one question: how many 's from the middle are you? That is why 68–95–99.7 holds for every bell. And it appears whenever many small independent nudges add up — the average of rolls has spread and a bell's shape.
In one sentence: The bell measures everything in 's from the middle, so 68–95–99.7 holds for every bell, and it shows up whenever many small independent nudges add up.
The many-dimensional bell is the 1-D bell with the distance measured in the data's own ruler. Its contours are ellipses — Unit 12's covariance ellipse was a Gaussian's contour — with axes along the eigenvectors of and lengths .
In one sentence: A many-dimensional Gaussian is a bell whose distance is measured with , so its contours are ellipses along the eigenvectors of — the covariance ellipse of Unit 12 is a contour of this mountain.
Every Gaussian is a round cloud, stretched. To sample from , find a square root of (Cholesky), stretch round samples by it, and shift them by .
In one sentence: To draw from , stretch a round cloud by a square root of and shift it — has covariance .
Probability goes from the model to the data. Likelihood goes back from the data to the model. Learning by maximum likelihood means choosing the model under which what you saw is least surprising. For a coin, that is simply the share of heads.
In one sentence: Likelihood reads as a function of the model, maximum likelihood picks the model that makes the data least surprising, and taking logs turns tiny products into sums without moving the peak.
The bell that makes your data least surprising sits at the average and is as wide as the average squared spread. Fitting a model is climbing a likelihood landscape to its peak.
In one sentence: Maximum likelihood fits a bell by placing it at the average and making it as wide as the average squared spread — a climb to the top of the likelihood landscape, with a small downward bias that dividing by corrects.
A loss function is a belief about noise in disguise. Squared error is maximum likelihood with bell-shaped noise — that is why least squares works so well, and why it is thrown off by outliers that a bell says should never happen.
In one sentence: If the noise is a bell, the most likely line is the least-squares line — Unit 3's projection was maximum likelihood all along — and a pointier, heavier-tailed noise turns the loss into absolute error, which shrugs off outliers.
Exponentiate, then share out. Softmax turns any scores into a point on the probability triangle; only the differences between scores matter; and the temperature slides the answer between "winner takes all" and "no opinion".
In one sentence: Softmax exponentiates the scores and shares them out so they become probabilities — only score differences matter, temperature slides from winner-takes-all to uniform, and with two classes it is the sigmoid of the score difference.
Surprise is minus the log of the chance. Entropy is the average surprise — the true uncertainty of a distribution: zero when you are certain, largest when every outcome is equally likely.
In one sentence: The surprise of an outcome is , and entropy — the average surprise — measures how uncertain a distribution is, from 0 for a sure thing up to its maximum when all outcomes are equally likely.
Cross-entropy is your average surprise when the truth is and you believe . It splits into the surprise nobody can avoid, , plus the extra you pay for being wrong, . KL is never negative, zero only for a perfect belief, and not symmetric.
In one sentence: Cross-entropy is the average surprise of believing when the truth is , it equals the truth's own entropy plus , and because KL is lopsided, fitting in one direction covers every hump while the other direction locks onto one.
With a one-hot truth, cross-entropy is the surprise of the right answer — the negative log-likelihood. Its gradient with respect to the scores is prediction minus truth, the simplest signal a learner could ask for.
In one sentence: For a classifier, cross-entropy with the one-hot truth is , the negative log-likelihood, and its gradient with respect to the scores is simply prediction minus truth, .
In one sentence: Uncertainty has a shape, the Gaussian's shape is the covariance ellipse, fitting a model means maximising the likelihood of the data, and softmax plus cross-entropy turn that idea into a classifier whose gradient is prediction minus truth.
A network is not a mystery box. It is a chain of simple steps: multiply, shift, bend — again and again. The graph, the matrices and the chain are three drawings of the same thing. The rows of each matrix belong to where the wires go; the columns to where they come from.
In one sentence: A network is a line of simple layers, and each layer only multiplies by a matrix, adds a shift, and bends — the matrix having one row per neuron here and one column per neuron before.
One neuron draws one straight line across its inputs — the place where — and then bends the flat sheet along it. ReLU folds it like paper. Sigmoid and tanh make a smooth step. "None" does not bend at all. The weights turn the line; the bias slides it.
In one sentence: A neuron draws one straight line and bends the plane along it — a hinge with slope 0 or 1 for ReLU, a smooth step with slope at most 0.25 for sigmoid.
A straight step after a straight step is one straight step. Without bends, a network of any depth is just one matrix and one shift, and can only ever draw straight boundaries. The bend between layers is what lets depth fold space — and folding is what untangles data.
In one sentence: Two straight layers are one straight layer — and — so without a bend depth is wasted, and the bend is what lets a network fold space.
One ReLU is one crease. Three make a hat. Enough hats trace any shape — that is universal approximation, and it promises closeness, not a recipe. Width adds creases one at a time; depth folds the folds, so layers can make pieces.
In one sentence: Each ReLU adds one crease, three make a hat, enough hats trace any curve — and stacking layers folds the folds, doubling the pieces with every layer.
The forward pass is just row times column, add the shift, bend — layer after layer, left to right. Each row is one neuron's dot product. A neuron that gets a negative total is switched off by ReLU. And every value along the way goes into the cache, because the backward pass will read it.
In one sentence: The forward pass walks the chain left to right — row times column, add the shift, bend — and keeps every z and a in a cache for the way back.
At the output, the whole blame is simply prediction minus truth — for a number with squared error, and for a choice with softmax and cross-entropy. The head changes; the shape of the answer does not. Everything before the head is the same backward walk.
In one sentence: Whether the head predicts a number (squared error) or a class (softmax + cross-entropy), the blame it sends back is prediction minus truth — or .
Crossing a ReLU arrow: pass the blame where the neuron was awake, block it where it slept. Crossing a linear arrow: a weight's blame is its output's blame × its input, and the layer below gets the blame sent back through — the same wires, walked the other way. Two rules, any depth.
In one sentence: Walking back through a network needs only two rules — a ReLU arrow is a switch that passes or blocks the blame, and a linear arrow gives the weights (blame)(input)ᵀ, the shifts the blame itself, and the layer below Wᵀ·blame.
One backward sweep gives every gradient. It starts from prediction minus truth, crosses each arrow with Rule A or Rule B, and reads the stored z's and a's in reverse order. The red numbers are just the blue ones' story told backwards — except where a sleeping ReLU blocks the blame.
In one sentence: Starting from and crossing the seven arrows backwards with Rule A or Rule B gives all 20 gradients — big where a weight carried a lot, zero where a neuron slept.
One forward pass, one backward pass, one small step: the loss fell from 50 to 18.89. The step had to be tiny because a first-layer gradient is multiplied by the raw input, and age = 30 is big. Scale the inputs and a much bigger step becomes safe. And check your gradients against finite differences — they must agree.
In one sentence: Step every number against its gradient — loss 50 → 18.89 — but a first-layer gradient carries the raw input inside it, so scale the inputs, and check the gradients against .
The blame reaching the first layer is a product of one factor per layer. Factors below 1 make it fade (sigmoid: at most 0.25 each). Factors above 1 make it explode. A factor of exactly 0 — a neuron asleep for every input — kills it. Good bends, good starting weights and scaled inputs keep the factors near 1.
In one sentence: The blame reaching an early layer is a product of one factor per layer, so it fades with sigmoid (≤ 0.25 each), explodes with big weights, and dies at neurons that are always asleep — good bends, starting weights and scaled inputs keep it alive.
A network of any shape runs on the same three moves you did by hand. The playground is not a new idea — it is the salary network's forward pass, backward pass and update, done for whatever network you build, as many times as you like.
In one sentence: The playground runs the same forward pass, two backward rules and update on any network you build, so you can test every claim of this unit — straight collapse, folds, dead and fading blame — with your own hands.
At the output, the whole gradient is prediction minus truth. Everything before it is Unit 7's "local slope times incoming blame", done with matrices — Rule A at every bend, Rule B at every matrix. That is backpropagation, whole.
In one sentence: A network is multiply–shift–bend repeated; training is a forward pass that stores everything, a backward pass that starts from prediction minus truth and uses two rules, and a small step downhill.
One-hot lists put every word at right angles to every other word, all the same distance apart. They tell words apart, but they cannot say "these two are alike". We want short lists where close means similar. The rest of this unit is about finding them.
In one sentence: A one-hot list is a phone directory — every word on its own line, every pair at right angles and apart — so it names words but carries no meaning; we want a city map, where close means similar.
A sentence is a chain of guesses. The chain rule is exact; the Markov assumption shortens each guess's memory so that we can count; counting is the maximum-likelihood guess; and the markers , let the chain start and stop.
In one sentence: A sentence is a chain of guesses — the chain rule multiplies them exactly, the Markov assumption gives the guesser a short memory so we can count, and count ÷ total (with <s> and </s>) gives <s> I drink chai </s> the chance 1 · ¾ · ⅔ · 1 = ½.
Smoothing moves a little probability from what was seen to what was not, so that "never seen" stops meaning "impossible". Add-one is the simplest move and drowns real counts in a big vocabulary; interpolation and backoff move the probability sensibly, by asking a more general adviser.
In one sentence: Smoothing moves a little probability from pairs we saw to pairs we didn't — add-one does it evenly and drowns real counts in a big vocabulary (3/50 003), while interpolation and backoff ask a more general adviser (0.8 · ⅔ + 0.2 · 2/16 = 0.558).
Perplexity is the average surprise turned back into a number of equally likely choices — the number of faces on the model's die. It is 1 for a perfect model and for a model that guesses evenly over words. One word the model thought nearly impossible can ruin it, so a good model never says "impossible".
In one sentence: Perplexity is 2 raised to the average surprise in bits — the number of faces on the model's die — so 1 is perfect, is knowing nothing, 0.5 · 0.25 · 0.5 · 0.125 gives about 3.364, and it only compares models tested on the same text.
A word's row in a company table is a first, honest word vector. Words used in the same places get rows that point the same way. We did not tell the computer that chai and coffee are drinks — the counts told it. Small windows find stand-ins, big windows find topic-mates.
In one sentence: Count the company a word keeps — by document or by neighbours within a window — and each row becomes a word vector whose angle to another row says how alike their company is: 0.964 for chai and coffee, 0.096 for chai and cricket, stand-ins with small windows, topic-mates with big ones.
Not all company counts. Weigh each meeting by how much more often it happens than chance would allow: PMI for pairs of words, TF-IDF for words in documents. A neighbour that is everywhere, like "the", gets weight 0.
In one sentence: Weigh company by surprise, not by size — PMI gives chai–hot 0.678 and chai–the exactly 0, and TF-IDF gives any word found in every document the weight 0 — but beware rare pairs, which PMI over-rewards.
The SVD finds the few strong directions hiding in a big table of counts. Keep those, drop the rest, and each word gets a short list of numbers; the energy kept, , tells you how much of the table survived. Because each direction is shared by whole groups of words, the squeeze also finds friends of friends.
In one sentence: The SVD squeezes a company table to its top directions (98.5% of our 4 × 4 table at ), and because each direction is shared by groups of words it finds friends of friends — chai and tea, who never meet, get cosine 1 at through coffee, and 0 again when keeps their difference.
word2vec replaces counting with guessing. A window slides along the text. At each stop a tiny two-table network either fills in the centre word from its context (CBOW) or guesses the context from the centre word (skip-gram). The guessing is only a test. What we keep is the input table, whose rows were forced to put words with the same company close together.
In one sentence: word2vec slides a window along the text and trains a tiny two-table network to guess each centre word from its neighbours (CBOW) or the neighbours from the centre word (skip-gram), then keeps the input table as the word vectors — don't write down the gossip, train a guesser and read its mind.
CBOW averages the context vectors, scores every word against that average, and nudges the vectors until the true centre word wins. With words on each side the committee has members, and each member receives a share of the blame.
In one sentence: CBOW averages the neighbours' vectors, scores every word against that average, and nudges the vectors until the true middle word wins — a committee of neighbours filling in the blank.
Skip-gram uses the centre word's own vector as the opinion, makes one softmax over the vocabulary, and checks it against every neighbour. The errors of all the slots add up, and the centre word receives the whole sum. (The lab in §11 plays a cheaper version of this game, with negative sampling in place of the full softmax — see §12.)
In one sentence: Skip-gram looks up the centre word's vector, makes one softmax over the whole vocabulary and checks it against every neighbour — so it learns a word's company as a list of chances, and the centre word gets the full sum of its neighbours' blame.
CBOW buys speed by averaging the committee into one guess. Skip-gram pays about times more to give every word — and especially every rare word — its own full update.
In one sentence: CBOW is the coaching class — one averaged guess per window, fast and smooth — while skip-gram is home tuition — up to guesses per window, slower, but every word, especially every rare one, gets its full share of attention.
Three tricks made word2vec cheap: ask yes/no questions instead of scoring all words (negative sampling), walk forks of a tree (hierarchical softmax), and skip most copies of very common words (subsampling). The cost of a guess stops growing with the vocabulary.
In one sentence: A full softmax scores all words for every guess; negative sampling asks yes/no questions (50 000 against 6), a tree asks left/right questions (16), and subsampling keeps each "the" with chance only — together they made training on billions of words possible.
Words that keep the same company receive the same pulls, so their vectors converge. At its best, word2vec's dot products equal the PMI of §6 shifted by — it is squeezing the counting table without ever writing it down — and GloVe fits the log counts directly, so that differences of vectors reproduce ratios of probabilities.
In one sentence: Words that keep the same company get the same pulls and converge — strangers who shop at the same stores — and at its best word2vec makes (chai–hot: 0.470 − ln 5 ≈ −1.139), while GloVe fits the log counts so that meaning shows up in ratios like hot's 20 for chai against lassi.
A neural language model is a Unit 15 network with a lookup table in front and a softmax at the end. The table is just the first layer's weights, learned by the same backprop — the same kind of table word2vec learns. Because similar words get similar rows, what the model learns about one word helps it with the others.
In one sentence: A neural language model looks up each previous word's row in an embedding table (one-hot × matrix = picking a row — the same table word2vec learns), glues the rows, mixes them in a hidden layer and ends with a softmax over the vocabulary, so similar words share what they learn and even unseen sentences get sensible chances.
In a good word space, closeness (by cosine) is similarity and a difference of meanings is a direction. The same arrow turns man into woman, king into queen and boy into girl; another turns a country into its capital. "B is to C as A is to ?" becomes arithmetic: , then the nearest word by cosine, leaving out , and .
In one sentence: Measure "similar" by the cosine (after normalising, all three rulers agree), and a difference of meanings becomes a direction — king − man + woman = (3, −2) = queen in our toy plane, and with real vectors we take the nearest word by cosine, leaving out the three words we started from.
One vector per word must blend all its meanings (weighted by use), copies the patterns of its text, and has nothing to say about unseen words. Pieces fix the unseen words — fastText adds up character n-grams, BPE learns a vocabulary of frequent pieces — but only a vector that changes with its sentence can fix "bat".
In one sentence: One vector per word blends every meaning of that word (80% cricket gives cosines 0.970 and 0.243), copies the patterns of its text and knows nothing of unseen words — pieces fix the unseen words (chaiwala shares 3 pieces with chai; BPE cuts bug as b · ug), and Unit 18's vectors that change with the sentence fix the rest.
A word becomes a point in space, placed by the company it keeps — counted, weighed and squeezed, or learned by a guessing game, which turns out to be the same thing. In that space, closeness is similarity and a difference of meaning is a direction. Every language model you will meet from here on starts by turning its words, or pieces of words, into such vectors.
In one sentence: Give each word a short list of numbers learned from the company it keeps — by counting, weighing and the SVD, or by word2vec's two guessing games, which secretly do the same — and meaning becomes geometry: similar words point the same way and differences of meaning are directions.
A bag of words forgets order. A window forgets the past. A running note keeps both, if it changes the old note before adding the new word. Every word leaves its mark, and older marks have been changed more times.
In one sentence: A sentence is an ordered list, so a reader must keep a running note and change the old note before adding each new word — a bag or a plain total would give "dog bites man" and "man bites dog" the same note.
A recurrent cell is one layer of Unit 15 with a second input: its own note from one word ago. The same weights are used at every word. The note is the memory — and with , what an old word wrote there fades a little at every step.
In one sentence: A recurrent cell rewrites one fixed-size card at every word, , with the same weights each time — and with a small the first word fades: 0.7616, 0.3634, 0.1797.
A recurrent network is a loop. Unroll it and it is a chain as long as the sentence, one copy of the cell per word. So everything we learned about deep networks — forward pass, backward pass, blame that fades — carries over. The only new twist is that the copies are twins.
In one sentence: Unrolled, a recurrent cell is a deep network as long as the sentence whose layers are twins, so it learns only numbers — 32 for , — whether it reads 3 words or 3000.
One cell, many jobs. Feed inputs at one step or at every step; read out at the end or at every step. When we read out at every step, each step adds its own surprise to the loss, and the total is what training makes small.
In one sentence: Put inputs in and read outputs out at one step or at every step, and the same cell can caption, judge, tag, translate or guess the next word — with the total loss the sum of each step's surprise.
A language model learns with the true text fed in (teacher forcing) and talks by feeding back its own picks. Greedy picking is dull and loops; sampling with a temperature trades safety for variety.
In one sentence: A recurrent language model learns by guessing each next word with the true text fed in (teacher forcing) and talks by feeding back its own picks — greedy loops, and a temperature in turns the same scores 2, 1, 0.5, −1 into 0.842 of the time "Delhi" at or only 0.434 at .
Backprop through time is Unit 15's backward pass on the unrolled chain. The shared weight collects blame from every step, added up. The blame reaching an early word is a product of one factor per step, each containing the same — so if each factor shrinks things, the product shrinks fast.
In one sentence: Backprop through time runs Rule A and Rule B back along the unrolled chain, adds up the shared weight's votes from every step, and multiplies one factor per step on the way back — 0.4838 × 0.4340 ≈ 0.21 here — while truncated BPTT cuts that walk into chunks of words (50 chunks for 1 000 words and ).
The gradient through time carries powers of one matrix. So its eigenvalues decide: along each eigen-direction, memory is multiplied by at every step. Below 1 it fades away, above 1 it blows up, and only exactly 1 holds on. This is the central fact of recurrent networks.
In one sentence: Memory and blame pass down a whisper line that multiplies by the same matrix at every step, so after steps they carry — and the biggest eigenvalue size decides whether they fade (0.5¹⁰ ≈ 0.000977) or explode (1.5¹⁰ ≈ 57.67).
Clipping keeps the direction of the gradient and caps its length. One exploding step can no longer throw training off a cliff. It is cheap first aid for explosions — and no cure for fading.
In one sentence: When the gradient is longer than a limit , shrink it to length without turning it — becomes — and start with every near 1; this tames explosions but cannot rescue memory that has faded.
The LSTM keeps a second memory on an express lane. Nothing multiplies it by or squeezes it — only the forget gate scales it and the input gate adds to it. So blame travels back along the lane multiplied only by , which the network can hold near 1 for as long as it needs to remember.
In one sentence: The LSTM carries a cell state on an express lane, — 0.8808 · 1 + 0.5 · 0.7616 = 1.2616 in the full step — so blame flows back multiplied only by the forget gate, instead of , and a forget shift of 1–2 starts that lane open.
A GRU is one blend dial: keep the old note, or pour in the new. With near 0 the old note rides straight through — an express lane without a separate tank. It learns three blocks of weights where an LSTM learns four and a plain cell one.
In one sentence: A GRU blends old and new with one dial, — 0.5 · 0.5 + 0.5 · 0.8938 ≈ 0.6969 in the full step — uses a reset gate to decide how much old note to consult, and costs three blocks of numbers against the LSTM's four.
A two-way reader gives every word both its past and its future. Floors give the reader depth. Both are built from the same cell, run in a different direction or on a different input.
In one sentence: A two-way reader puts a forward note and a backward note side by side — word 1 of gets — so every word sees the whole sentence (but it cannot write text), and floors stack readers on readers: 24 704, 49 408 and 57 600 numbers for one-way, two-way and two floors.
An encoder–decoder translates through one summary vector. It works, and it was a breakthrough. But everything the decoder knows about the source sentence must pass through that one fixed-size vector — a bottleneck that hurts more with every extra word. What if the decoder could look back at every English word, whenever it needs to? That question is Unit 18.
In one sentence: An encoder squeezes the whole source sentence into one fixed-size summary and a decoder writes the translation from it, trained with teacher forcing — and that single card is the bottleneck: 40 numbers into 8 for five words, 400 into the same 8 for fifty, with word 1 at 0.9⁴⁹ ≈ 0.0057.
Greedy picks the best word now; beam search keeps the best sentences-so-far and can recover when a slightly weaker first word leads somewhere much better. BLEU grades the result by the pieces it shares with a reference, with a penalty for being too short.
In one sentence: Greedy takes the best word each time and can land on 0.20, a beam of width 2 keeps two candidates and finds 0.36, and BLEU grades the result by matching pieces with a reference — "the train is late" scores 0.7788 · √(1 · ⅔) ≈ 0.636.
A machine with memory multiplies by the same matrix at every word, so its memory and its blame live or die by that matrix's eigenvalues. Gates build an express lane where the multiplier is a number the network controls, close to 1 when it wants to remember.
In one sentence: A recurrent cell reads one word at a time with shared weights, learns to talk by guessing the next word, trains by backprop through time where powers of one matrix make memory fade or explode, is rescued by gates that open an express lane, reads both ways or in floors, and translates through a single summary — the bottleneck that attention removes next.
Before writing word , score every note against the decoder's state , turn the scores into shares , and blend the notes into the context . Keep every note and look back, instead of carrying one summary and hoping it holds everything.
In one sentence: Instead of squeezing the sentence into one summary, the decoder keeps every note and, before each word it writes, scores the notes, turns the scores into shares and blends them — an interpreter glancing back at the speaker's notes, looking hardest where it matters now.
Attention is a lookup that never says "no match". Every key gets a score by a dot product with the query. Softmax turns the scores into shares that add up to 1. The answer is the blend of all the values with those shares. Make the scores bigger and bigger, and the biggest share swallows the rest: the soft lookup becomes a strict one.
In one sentence: Attention answers a query with a blend of every value, weighted by softmax of how well the query matches each key — a librarian who staples a few pages from every book, more from the books whose labels match your wish, and so can learn where to look.
Every word turns itself into a question, a label and a gift. Each question is scored against every label by a dot product; softmax makes each row of scores into shares; each word collects the gifts in those shares. One matrix line does it for all the words at once. This is Unit 13's kernel vote: similarity by a dot product, then a weighted sum.
In one sentence: Self-attention drops the relay: every word makes a query, a key and a value with three shared matrices, and lets every word collect a blend of every value in one hop — students who all ask each other at once instead of passing a whisper down the line.
Long vectors make big dot products, and big scores make softmax pick one winner and freeze. Dividing every score by keeps the scores at a spread of about 1, so the shares stay soft and blame keeps flowing.
In one sentence: A dot product of two random length- vectors has spread , which makes softmax spiky and frozen, so attention divides every score by — like a judge who marks out of 1000 being brought back to marks out of 10 before the prize money is shared.
The sum runs over the words of this sentence. After attention a word's vector is a blend over the words of its own sentence, so the same word gets a different vector in a different sentence. The one fixed vector per word of Unit 16 becomes a vector that knows its company.
In one sentence: Because a word's output is a blend over its own sentence, the same word gets a different vector in each sentence — a chameleon that takes the colour of its neighbours, so "bank" by a river and "bank" with money end up about 53° apart.
The attention map is a table of who listens to whom. Each row adds up to 1. After attention each word's vector is its old self plus a blend of what the words it listened to were carrying (keeping the old self is the residual path of §9). So "it" in "the ball … it was loose" ends up close to "ball".
In one sentence: The attention map shows, row by row, how much each word listens to every other word — "it" grabbing "ball" — and adding the blended values to each word turns fixed word vectors into vectors that carry their sentence.
Many heads are many small attentions, each looking at the words through its own projection. Cut into pieces of size , let each head build its own map, glue the answers back and mix them with . You get different questions for the price of one.
In one sentence: Multi-head attention cuts into heads of size , each looking at the words through its own glasses, then glues the answers and mixes them with — a commentary box of experts, questions for the same weights.
Attention alone treats a sentence as a bag of words. Positions put the order back in: learned rows, clock-hand tags, or turns of the query and key. With clock tags and turns, what matters is how far apart two words are — "two words back" means the same thing everywhere in the sentence.
In one sentence: Attention is order-blind, so we put position into the vectors — a learned row per position, clock hands turning at different speeds, or turns of the query and key — and with clocks and turns the score sees only how far apart two words are.
A block is: talk (attention), think alone (a small network), and after each, add the result to the page and steady it with layer norm. The adds are an express lane for the blame; layer norm keeps the numbers at a calm size, block after block.
In one sentence: A transformer block is talk (attention) then think (a small per-word network), each wrapped as "add to the page, then steady it", so the residual stream is a shared notebook that only ever gets notes added — and the blame rides its express lane straight down.
Adding above the diagonal gives the future words a share of exactly zero, so each word's answer is built only from the words before it. Because of that, one pass over a sentence trains every next-word guess at once — word 1 predicting word 2, words 1–2 predicting word 3, and so on — like a class answering together, each student covering the answers to the right.
In one sentence: Setting the scores above the diagonal to before softmax gives future words exactly zero share, so every position's output is an honest guess of the next word and one pass trains them all at once — the whole class answering together, each student covering the answers to the right.
BERT — no mask; grade the ≈ 15% hidden words.
GPT — causal mask; grade every next word.
Encoder–decoder — both, joined by cross-attention.
One kind of block, three wirings. Who may look at whom (the mask) and which positions are graded (the game) decide whether a transformer becomes a proofreader, a storyteller or an interpreter.
In one sentence: The same blocks become three families — BERT reads both ways and fills in hidden words (the proofreader), GPT reads left to right and guesses every next word (the storyteller), and the encoder–decoder joins the two with cross-attention (the interpreter of §1).
Attention pays for joining every pair of words directly. A relay pays only , but in a queue. Attention's work can all happen at once, which is why transformers train so fast on graphics cards — and why very long inputs are costly.
In one sentence: Attention computes scores per head per layer — a million for a thousand words, the handshakes of a big wedding counted from both sides — but all at once and with no extra weights, while a relay needs only steps that must wait for each other.
A transformer is a lookup table at the bottom, a stack of blocks in the middle and a softmax over the vocabulary at the top. With the mask, one sentence gives a next-word guess at every position, and the loss scores all of them at once. Training is the backprop of Unit 15 running through all these matrices.
In one sentence: A whole transformer is embeddings plus positions, a stack of talk-and-think blocks, and a softmax over the vocabulary — often read out through the embedding table itself — trained on every next-word guess of a sentence at once by cross-entropy and backprop.
Every word asks every other word a question, scores the answers by a dot product, and adds a softmax-weighted blend of what they carry to itself. Repeat in many heads, with positions, shortcuts and layer norm, block after block, trained on every next word at once — that is a transformer.
In one sentence: Attention is a similarity-weighted vote — dot products, softmax, a weighted sum of values — and a transformer stacks it with positions, residual paths, layer norm and small networks into a machine that reads a whole text at once, looking back wherever it matters.
A language model is one function: "given the text so far, a probability for every possible next token". Run it, pick a token, append it, run it again. Multiply the guesses along the way and you get the probability of the whole text.
In one sentence: An LLM is your phone's autocomplete grown huge — read everything so far, give every token a probability, pick one, append it, repeat — and the chain rule multiplies those guesses into the probability of the whole text.
The loss is the average surprise of the true tokens: the log turns the gambler's product into a sum, and the average makes texts of any length comparable. Perplexity turns that average back into "how many equally likely choices".
In one sentence: A model is scored like a gambler who keeps only what it bet on each true word — multiply the probabilities for the sentence, take logs to turn the product into a sum, average for the loss, and exponentiate for the perplexity, the number of faces on its die.
The floors plus the dictionary. Each block holds in attention and in the feed-forward room. The width enters squared, so as models grow the floors swallow almost everything.
In one sentence: An LLM is a tower of identical floors, each holding 4d² numbers in the meeting room and 8d² at the desks, over a V × d dictionary — so parameters ≈ 12Ld² + Vd, and a mixture of experts stores many desk rooms but sends each token to only two.
Temperature divides the scores before the softmax. Every ratio between two tokens is raised to the power : cold makes the favourite a dictator, heat makes every token equal, and the order never changes.
In one sentence: Greedy always takes the top token and ends up in loops, so chat models sample — and temperature, a thermostat on boldness, divides the scores before the softmax: cold stretches every gap until the favourite always wins, heat shrinks every gap until any token can win.
Choose a set of good tokens — the top , or the fewest top tokens whose probabilities reach — and share the whole probability out among them in their old proportions. Then draw.
In one sentence: Thousands of tiny probabilities add up to a real chance of nonsense, so before drawing we cut the tail — top-k keeps a fixed number, top-p keeps the fewest tokens that hold p of the probability — and renormalise, like a buffet where you only throw darts at the good dishes.
The mask freezes the past, so every earlier key and value can be written once and read back forever: the work falls from a triangle to a line, and the notebook grows by the same few hundred kilobytes with every token.
In one sentence: Because the mask freezes the past, the model writes every token's keys and values into a notebook once and reads them back forever — n rows of work instead of n(n+1)/2 — and pays in memory, 2·L·d·b bytes per token, which grouped-query attention shrinks by sharing the notebook between heads.
Each pair of numbers is a clock hand turning at its own speed. The score of a query and a key depends only on the gap between them, fast hands give precision, slow hands give reach — and squeezing positions keeps every hand inside the angles the model has learned.
In one sentence: Rotary positions give every pair of numbers its own clock hand, turning at 10 000^(−2i/d) radians per step, so a score sees only the gap between two words — fast hands for precision, slow hands for reach — and squeezing positions keeps the slow hands inside the angles the model learned.
Training cost is six operations per parameter per token, and loss falls as a sum of power laws in size and data — straight lines on log–log axes. With a fixed budget, balance the two: roughly twenty tokens for every parameter.
In one sentence: Training costs about 6ND operations, and loss falls as a floor plus two power laws — one in parameters, one in tokens — so for a fixed budget, like a school choosing between teachers and books, the best split grows both together, about twenty tokens for every parameter.
is the set of answer positions. The whole conversation is read, but only the assistant's tokens are graded — the apprentice copies the master's plates, not the customers' orders.
In one sentence: Supervised fine-tuning is an apprentice copying the master's plates — the same next-token loss on written examples of good answers, with a mask so that only the assistant's tokens are graded.
Freeze the giant, and learn its change as a thin product of two matrices. It is Eckart–Young as a training method: bet that the change lives in a few directions, and learn only those.
In one sentence: LoRA freezes the giant and learns its change as a thin product BA of rank r — a clip-on lens of 2dr numbers instead of d² — and it works because the change a new job needs lives in a few directions, exactly the ones Eckart–Young says a rank-r copy keeps.
Give every answer a hidden score, predict each choice with the logistic of the score gap, and nudge the winner up and the loser down by how surprised you were — a selector who rates players only by comparing two at a time.
In one sentence: Like a selector comparing two batters at a time, a reward model learns from people's choices — the chance one answer beats another is the logistic of their reward gap, and each choice nudges the winner up and the loser down by how surprised the model was.
Chase the reward, pay for every step away from the old habits, and the best policy is the old habits reweighted by exponentiated reward — a kite as high as the wind can lift it on a string of length set by .
In one sentence: Chasing an imperfect reward on its own ends in reward hacking, so RLHF subtracts β times the KL from the reference — and the best policy is then the old habits reweighted by e^(r/β), a kite that rises with the wind but stays on its string.
The best leashed policy's log-ratios are a reward. Put them into Bradley–Terry and the unknown constant cancels: learn from people's choices with one loss, the model acting as its own judge.
In one sentence: DPO turns the leash's closed form around — a policy's log-ratio against the reference is its hidden reward — so plugging it into Bradley–Terry cancels the unknown constant and trains on people's choices with one plain loss, the model acting as its own judge.
An LLM is a next-token guesser trained on the average surprise of trillions of tokens, written out one token at a time with a sampler, made fast with a cache and long with clocks, and turned into an assistant by copying good answers and then chasing people's preferences on a KL leash.
In one sentence: Inside every chatbot is one loop — a probability for every next token, a sampler that picks one, a notebook of the past — trained to be unsurprised by human text and then taught, with a thin low-rank patch, a reward from people's choices and a leash, to be helpful.
A generator is a fixed function applied to fresh noise. In one dimension we can write the function down: stretch-and-shift for a bell curve, the inverse CDF for anything else. For pictures the function must be learned — and learning it is the whole art.
In one sentence: A generator is a sculptor's fixed skill applied to a random lump of clay — with fresh noise — and since nobody can write down for pictures, the machine has to learn it.
For independent noise, variances add and a scale factor comes out squared. So "shrink by , add noise of variance " keeps a standard cloud standard, and slowly washes any starting point into the same .
In one sentence: For independent noise variances add and scale factors come out squared, so "shrink by , add noise of variance " keeps the glass exactly full while slowly turning any chai into the same milk, .
An autoencoder squeezes each picture into a short code and learns to rebuild it. The squeeze forces the code to keep only what varies most — with straight lines, it is PCA. But it makes no promise about the empty parts of the map, so it is a compressor, not yet a creator.
In one sentence: An autoencoder squeezes a picture into a few numbers and learns to rebuild it — describing a friend's face in two numbers over a bad phone line — but its map of codes has empty regions, so a random code usually draws rubbish.
A VAE encodes each picture as a cloud, rebuilds from a random point in it, and pays a KL price — for each number of the code — for every cloud that is far from the centre or too narrow. The clouds of similar pictures overlap, the map fills up, and every point decodes to something sensible.
In one sentence: A VAE gives every picture a neighbourhood, not a house number — a small cloud on the map — and a KL price pulls every cloud towards the town centre, so the clouds overlap and every point of the map has been trained to draw a sensible picture.
Roll the dice before the network, not inside it. The draw is the same, but now it is a formula in and , and the chain rule carries the blame straight back to the encoder.
In one sentence: Write the random draw as with the wobble rolled in advance — a dartboard where the wobble is written on a card — and the chain rule can carry blame through the sampling step straight back to the encoder.
We cannot compute how likely the model makes a picture, but we can compute a floor under it: rebuild well, stay near the prior. Raising the floor either raises the ceiling or closes the gap — and at the true posterior the floor touches the ceiling.
In one sentence: The ELBO — rebuild well, stay near the prior — is a platform that always sits under the ceiling ; pushing it up either raises the ceiling or closes the gap, and at the true posterior the two touch.
A trained VAE is a map where every point is a picture: draw a point from the prior to create, walk a straight line to morph. Its weakness is blur — the squared-error rebuild paints the average wherever the code leaves a detail open.
In one sentence: A trained VAE is a map of faces you can walk — draw a point from the prior to create, walk a straight line to morph — but where the code leaves a detail open, its squared-error decoder paints the average, so its pictures are soft.
A thousand small "shrink and add noise" steps are one big one. The picture survives with weight , the noise has weight , and at the end every picture is the same pure static.
In one sentence: The forward process spreads the ink — shrink a little, add a little noise, a thousand times — and because the noises add up into one, any step can be reached in a single jump, , ending in the same static for every picture.
A diffusion model is a restorer trained by squared error to spot the dust: noise a real picture by a known amount, and ask for the noise back. Knowing the noise is the same as knowing the clean picture — as well as it can be known from what is left.
In one sentence: A diffusion model is a restorer who, shown a noisy picture and how noisy it is, guesses the dust by plain squared-error regression — and from the dust guess, is the best clean picture that can be known.
The score is a compass at every point, pointing towards more likely data. For a mixture it is each village's pull, weighted by how strongly that village claims the point. A noise predictor is a compass: divide its guess by .
In one sentence: The score is a compass pointing towards more likely data — fuzzy and central in thick fog, sharp and local near a village — and a noise predictor is that compass in disguise: .
Generation is the ink film played backwards: start from static, and at every step move a little along the compass and add a little fresh noise. It is gradient descent on with a jiggle, walked down through the noise levels from very blurry to sharp.
In one sentence: To create, play the ink film backwards — start from static, and a thousand times move a little along the compass and add a little fresh noise — which is Unit 9's downhill walker on , with the jiggle that keeps every walker from ending in the same place.
DDIM looks at the landing and jumps: estimate the clean picture, then re-noise it with the same noise guess to a much lower level. No fresh randomness, so the path is smooth, the same start gives the same picture, and a few dozen strides can do the work of a thousand small steps.
In one sentence: DDIM switches on the light on the staircase — at each visit it estimates the clean picture and jumps far down with the same noise guess — so the path is smooth, the same start always gives the same picture, and a few dozen strides replace a thousand steps.
Steer by taking the difference the request makes to the noise guess and making it louder; walk in a VAE's small latent space to keep it cheap. Words guide the picture through the same compass that made it.
In one sentence: Guidance is a sat-nav voice saying "more to the left than you think" — — and latent diffusion runs the whole walk in a VAE's code, 48 times smaller, before decoding once at the end.
In one sentence: A machine creates by learning to walk from noise to data — through a small map (the VAE) or down a thousand steps of fading static along a learned compass (diffusion) — and every step of that walk is built from the vectors, derivatives, descents and probabilities of this course.