A network has input , two hidden units, and one linear output . All weights and biases start at . The loss is and the learning rate is . What happens over two gradient-descent steps (a) with sigmoid hidden units and (b) with ReLU hidden units, and what happens to the two hidden units?
Deep learning, Weight initialisation
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can run backpropagation by hand on a tiny network and see exactly how zero initialisation behaves under different activations.
Key idea
Backpropagation multiplies by the output weights and by the activation derivative. With all weights , the hidden activations are the same for every unit, so every hidden unit receives the same update. With ReLU the activations and the hidden-layer error are both , so nothing in the hidden layer moves at all.
Steps
- This is the harder follow-up to `zero-initialisation-symmetry-problem`, which comes first. Set up: pre-activation for both units. The error at the output is . Gradients: , , and for hidden unit , with .
- (a) Sigmoid, step 1: , , . Output weights: gradient each, so ; . Hidden error because , so the hidden weights do not move yet.
- (a) Sigmoid, step 2: , so . Hidden error for both units. Gradient for both rows, so both rows of hidden weights become , and both hidden biases become (their gradient is itself). The units are still identical.
- (b) ReLU, step 1: so . Then (taking ; the result is the same with because ) , . Output weight gradients are , and the hidden error is since . Only moves, to .
- (b) ReLU, step 2: , so and every gradient is . Training stops with the loss at on this one example, but all hidden weights are still and both hidden units are dead: the network is just the constant .
- Lesson: in both cases the two hidden units receive identical updates at every step, so they can never become different features. Random initialisation (small, zero-mean) gives each unit a different starting direction and breaks the tie. Starting every weight at the same constant has the same problem, because the two units still compute the same thing.
Common mistakes
- Saying zero initialisation gives zero gradients in every case. With sigmoid the output-layer gradient is non-zero from step 1; the trouble is the symmetry, not zero gradients.
- Forgetting that the hidden-layer gradient is multiplied by the output weights, which are at step 1. That is why the hidden weights do not move at first.
- Concluding that zero biases are a problem. Only identical weights are.
How long your answer should be
Half a page; about 5 minutes.
Read this
Previous in Deep learning: You have implemented backpropagation by hand and want to test it with gradient checking. Why is the central difference preferred to the forward difference, how do you compare it with your analytic gradient, and what goes wrong if is too large or too small? Illustrate with at and ?
Next in Deep learning: How do you derive the recurrence for the receptive field of a stack of convolution and pooling layers with kernel sizes and strides , and what receptive field does it give for a unit in (a) a conv with stride 2 followed by two convs with stride 1, and (b) a conv with stride 1, a max-pool with stride 2, then two convs with stride 1?