Inside a region the gradient is one matrix product
gradient▲▲△For the network of I.5.B01 at , compute in closed form from (I.5.3), confirm it against a central difference, and then compute the gradient reaching each column of . Explain the third column’s value.
Hint
On a region the network is , so the gradient in is itself (The derivative of a linear map 0.MC.04). For the weight gradients, differentiate the same expression with held fixed.
Solution
Closed form. The pattern at is , so and
Central difference. With , the snippet returns . The two agree, which is the point of computing both.
Gradients into . Differentiating with respect to , at fixed pattern:
At : unit 1 gives , unit 2 gives , unit 3 gives . The snippet’s finite differences return the same three numbers.
Why the third is zero. : unit 3 is off at this input, so does not depend on its incoming weights at this input, and the derivative is exactly zero rather than small. Perturbing by changes nothing, because the ReLU absorbs it.
Two consequences worth separating.
Locally, this is how backpropagation will look. Chapter I.6 derives it properly, and the shape of the answer — a product of the layer matrices with a diagonal mask between them — is already visible here.
This is not a dead unit. Unit 3 receives no gradient from this example. It receives plenty from , where . A unit is dead only when the pattern is zero for every example in the dataset (I.3), and a single zero gradient is evidence of nothing.
Where the closed form stops being exact. is the gradient inside the region. On the boundary, where some , ReLU has no derivative and frameworks pick a subgradient by convention — the same kink discussed in I.2.X09. The set where this matters has measure zero, but a finite-difference check that straddles a boundary will disagree with the closed form, and that disagreement is real rather than numerical.