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.

Not startedJump to quiz

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

-10123-3-2-10123z
ReLULeaky ReLU (α = 0.1 shown; 0.01 is typical)ELU
Leaky ReLU and ELU keep a non-zero slope for negative inputs, so a unit can recover.
  • 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 neuronsNot zero-centred
Which activationReLUSigmoid (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 badThe neuron is useless for goodTraining is slower, but it still works
FixLeaky 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

for , for (). Keeps a gradient on the negative side; fixes dying ReLU.

Vanishing vs dying

Vanishing: small factors multiply across layers (sigmoid). Dying ReLU: a unit stuck at , output and gradient 0.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1conceptWhat is a "dead" ReLU unit?
Q2applyMany hidden units in your ReLU network output 0 for every input after a few epochs. Which fix targets this?
Q3calculateA Leaky ReLU with receives . What does it output?
Q4conceptHow do vanishing gradients and dying ReLU differ?
Q5interpretWhy is ReLU still the default hidden activation despite dying units?