Lesson 4.3 · 6 min read · about 45 min to master at a very slow pace
Dying ReLU, Leaky ReLU and ELU
ReLU solves vanishing gradients for active units but creates a new failure: a unit stuck on the negative side gets zero gradient forever. How it happens and the remedies.
Why ReLU is the default
ReLU, , has derivative 1 on its positive side, so active units pass the error signal back undiminished. It is also very cheap to compute and gives sparse activations (many units output exactly 0). It's the recommended default for hidden layers of deep networks.
Dying ReLU
If a unit's pre-activation is negative for every training example, its output is always 0 and so is its gradient. Gradient descent never changes its incoming weights, so it stays dead. A large learning-rate step that pushes the bias far negative is a typical cause.
Remedies
- Leaky ReLU: for and for , with . The small negative slope keeps a gradient flowing.
- ELU: a smooth curve on the negative side, also with a non-zero gradient.
- A smaller learning rate and He initialisation make dying less likely in the first place.
Don't confuse the two problems
Vanishing gradients: many small derivative factors multiplied across layers (typical of sigmoid). Dying ReLU: one unit stuck at zero output and zero gradient. Different mechanisms, different fixes.
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
First passIs a dead ReLU unit harmful or just useless?
Mostly useless: it always outputs 0, so it contributes nothing and wastes capacity. If many units die, the network effectively becomes much smaller than designed and may underfit.
First passWhat's the difference between "dead neurons" and "not zero-centred"?
They are two different problems of two different activations.
| Dead neurons | Not zero-centred | |
|---|---|---|
| Which activation | ReLU | Sigmoid (outputs 0 to 1) |
| What happens | for every input, so the output is 0 and the slope is 0. The neuron never updates again. | Outputs are always positive, so all weight gradients into the next layer share one sign. Updates zig-zag and training is slower. |
| How bad | The neuron is useless for good | Training is slower, but it still works |
| Fix | Leaky ReLU or ELU (a small slope for ) | tanh (outputs −1 to 1) |
Thumb rule: "ReLU can die. Sigmoid is lopsided, and it also saturates, which causes vanishing gradients."
Cheatsheet
Leaky ReLU
Vanishing vs dying
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.