A network has input x=(1,2)⊤, two hidden units, and one linear output y^=a1w21+a2w22+b2. All weights and biases start at 0. The loss is 12(y^−1)2 and the learning rate is 1. 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 0, 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 0, so nothing in the hidden layer moves at all.

Steps

  1. This is the harder follow-up to `zero-initialisation-symmetry-problem`, which comes first. Set up: pre-activation zi=wi1⋅1+wi2⋅2+bi=0 for both units. The error at the output is δ=y^−1. Gradients: ∂L/∂w2i=δ ai, ∂L/∂b2=δ, and for hidden unit i, δi=δ w2i ϕ′(zi) with ∂L/∂wi⋅=δi x.
  2. (a) Sigmoid, step 1: a1=a2=σ(0)=0.5, y^=0, δ=−1. Output weights: gradient −0.5 each, so w21=w22=0.5; b2=1. Hidden error δi=δ w2i σ′(0)=0 because w2i=0, so the hidden weights do not move yet.
  3. (a) Sigmoid, step 2: y^=0.5(0.5)+0.5(0.5)+1=1.5, so δ=0.5. Hidden error δi=0.5×0.5×σ′(0)=0.25×0.25=0.0625 for both units. Gradient 0.0625 (1,2)=(0.0625,0.125) for both rows, so both rows of hidden weights become (−0.0625,−0.125), and both hidden biases become −0.0625 (their gradient is δi itself). The units are still identical.
  4. (b) ReLU, step 1: zi=0 so ai=max⁡(0,0)=0. Then (taking ReLU⁡′(0)=0; the result is the same with 1 because w2i=0) y^=0, δ=−1. Output weight gradients are δ ai=0, and the hidden error is δ w2i ϕ′(zi)=0 since w2i=0. Only b2 moves, to 1.
  5. (b) ReLU, step 2: y^=0+0+1=1, so δ=0 and every gradient is 0. Training stops with the loss at 0 on this one example, but all hidden weights are still 0 and both hidden units are dead: the network is just the constant b2.
  6. 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 c≠0 has the same problem, because the two units still compute the same thing.

Common mistakes

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 J(w+h)−J(w−h)2h preferred to the forward difference, how do you compare it with your analytic gradient, and what goes wrong if h is too large or too small? Illustrate with J(w)=w3 at w=2 and h=0.1?
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 kl and strides sl, and what receptive field does it give for a unit in (a) a 3×3 conv with stride 2 followed by two 3×3 convs with stride 1, and (b) a 3×3 conv with stride 1, a 2×2 max-pool with stride 2, then two 3×3 convs with stride 1?