Visual walkthrough — L1 - L2 weight decay in deep nets
Step 1 — What is a "weight" and what does the loss look like?
WHAT. A neural network multiplies its inputs by numbers called weights. Think of a single weight — just one dial the network can turn. The loss is a score that tells us how badly the network fits the training data: low = good, high = bad. We want to turn the dial to the value that makes smallest.
WHY a picture of vs . Because "training" is rolling a ball downhill on this curve. If you can see the hill, you can see everything the optimizer does.
PICTURE. The cyan curve is , a bowl. The lowest point (amber dot) is the weight the data alone wants — call it . The slope of the curve at any point is written (read: "gradient of "); it just means how steep the hill is and which way is uphill.

Step 2 — Rolling downhill: plain gradient descent
WHAT. Gradient Descent says: to go down, step opposite the slope. The rule is
Term by term: points uphill, the minus sign flips it to point downhill, and (the learning rate, a small positive number like ) sets how big a stride we take.
WHY. This is our baseline. Every later formula is this rule plus one extra force. To see what regularization adds, we must first see what it adds to.
PICTURE. The ball starts high on the bowl and takes arrows down the slope, each arrow length , until it rests at the amber minimum .

Step 3 — Adding a "laziness tax": the L2 penalty
WHAT. We now add a second cost that has nothing to do with the data — it charges us for making big. The L2 penalty is and the total objective becomes
Term by term: is a parabola — cheap near , expensive far away. (lambda, ) is the regularization strength: how heavily we tax weight size.
WHY a parabola and why the . We want a penalty that is smallest at and grows smoothly. does exactly that. The is pure convenience: its derivative is , a clean result with no stray factor. (See Maximum a Posteriori (MAP) Estimation for why a parabola specifically — it is a Gaussian prior in disguise.)
PICTURE. Cyan = the data bowl . Amber = the parabola centred at . White = their sum . Notice the white curve's minimum has slid left of the data minimum, toward zero.

Step 4 — The slope of the tax is a spring pulling to zero
WHAT. To do gradient descent on we need its slope. Slopes add, so because the derivative of is exactly .
WHY this matters. Look at the penalty force : it is proportional to and points back toward (if the force is positive, and we subtract it → pushed left; if , pushed right). That is precisely a spring anchored at the origin — the further out you are, the harder it pulls you in.
PICTURE. At three different weights, amber arrows show the spring force — long when is far out, short near , vanishing at . This "shrinks as you approach" behaviour is the whole reason L2 never quite reaches exactly zero.

Step 5 — Fold the spring into the update: "weight decay" appears
WHAT. Put the new slope into the gradient-descent rule from Step 2: Now group the two terms:
Term by term: multiply the current weight by — a number just below 1 — then take the ordinary data step. Since is small and positive, is like : each round the weight shrinks 5% before the data even speaks.
WHY the name. Before any data force acts, is multiplied down toward . It "decays" — hence weight decay. A weight survives only if the data gradient keeps re-supplying it.
PICTURE. One update split into two arrows: a short amber arrow pulling inward by the factor , then a cyan data arrow. The final white dot lands where both agreed.

Step 6 — Where does the weight finally rest? (equilibrium)
WHAT. The dance stops when an update leaves unchanged, i.e. the bracket in Step 5 is zero:
Term by term: is the resting weight; is the data's pull; dividing by says stronger tax ⇒ smaller resting weight.
WHY. This is the "tug of war" settling point: the data force and the spring force exactly cancel. It quantifies the slogan "the data must earn every unit of weight."
PICTURE. Two opposing arrows of equal length at : cyan data pull outward, amber spring pull inward, balanced. Below, three curves for growing show sliding toward .

Step 7 — The L1 twist: a constant force, not a spring
WHAT. Swap the penalty from to (the L1 penalty, see Lasso and Ridge Regression). Its slope is so the penalty force is — a fixed size, same whether is huge or tiny.
WHY it changes everything. L2's spring faded out near zero (Step 4) — so it could never finish the job. L1's push stays full strength right up to zero, so it drives small weights all the way to exactly . That is sparsity.
PICTURE. Side by side: L2 arrows shrinking as (never arriving), L1 arrows all the same length — the last one overshoots past , so the weight is clamped exactly to by the soft-threshold rule

Step 8 — The degenerate cases (never leave the reader stranded)
WHAT / WHY / PICTURE, all at once:
- . No tax. Shrink factor , spring force — we recover plain gradient descent (Step 2). Weights rest at .
- too large so that . Then : the shrink factor flips the weight's sign every step or blows it up — training oscillates or diverges. Keep .
- exactly (L2). Spring force — nothing pushes; a weight already at stays unless the data revives it.
- exactly (L1). is undefined — but the soft-threshold rule handles it: , so is a stable resting point. This is exactly why L1 parks weights there.
- . From Step 6, : every weight crushed to zero → the network underfits (high bias, see Bias-Variance Tradeoff).
The amber danger-zone panel shows the good regime versus the divergent regime .

The one-picture summary
Everything on one canvas: the data bowl, the penalty (spring for L2 / constant toll for L1), the combined force, the shrink-then-step update, and the resting weight pulled in from the data optimum.

Recall Feynman: retell the whole walkthrough in plain words
Picture a ball on a valley — the valley floor is where the data is happy (Step 1). Normally the ball just rolls down to the floor (Step 2). Now we hang the ball on a rubber band tied to the origin (Step 3). The rubber band pulls harder the further out the ball is (Step 4). So each nudge the ball takes is: *first_ get tugged inward a little, then roll toward the data floor (Step 5). It settles wherever the tug and the roll cancel — and the harder we tune the rubber band (), the closer to zero it parks (Step 6). If instead of a rubber band we tie on a constant weight that pulls the same no matter what (that's L1), it can drag the ball all the way onto zero and pin it there (Step 7). Just don't make the rubber band so strong that it flings the ball out of the valley — keep (Step 8). That "shrink, then step" is the whole idea of weight decay.
Related: adaptive optimizers change this story — see Adam and AdamW Optimizers. A different way to force simplicity is Dropout.