A Numeric Chain-Rule Example
Multiply local sensitivities
Consider z = w×x, prediction y_hat = z², and loss L = y_hat for a tiny illustration. Let x=3 and w=2, so z=6 and L=36. The local sensitivity of loss to z is 2z=12; the sensitivity of z to w is x=3. The chain rule gives dL/dw = 12×3 = 36.
forward: w=2 -> z=2×3=6 -> L=6²=36
backward: dL/dz=12; dz/dw=3; dL/dw=12×3=36
update with lr .01: w <- 2 - .01×36 = 1.64
The calculation says increasing w locally increases loss sharply, so gradient descent reduces it. Automatic differentiation in deep-learning frameworks performs this bookkeeping across enormous computation graphs; it does not remove the underlying chain rule.
Tip: Track shapes as well as values in a backward pass. Gradients for a weight matrix must have the same shape as that matrix.
Note: This micro-example is intentionally framework-free and runnable by hand; the platform does not include a deep-learning training runtime.