Exercises — ReLU and variants (Leaky ReLU, ELU, GELU)
This page is a self-test ladder. Each problem is graded L1 → L5. Read the problem, try it on paper, then open the collapsible solution. Every activation used here comes straight from the parent note — but we will re-earn every symbol as we go.
Before we start, a one-line reminder of the four gates, so no notation surprises you later:

Look at the figure above: all four curves agree for large positive (they ride the line ) but disagree on how they treat negatives. Every exercise probes one of those disagreements.
Level 1 — Recognition
L1.1 For each input, decide without computing whether is or equals : , , .
Recall Solution — L1.1
ReLU zeroes anything and passes anything unchanged.
- : negative .
- : the boundary. By the definition , at we get . So output .
- : positive .
L1.2 Which of the four activations can output a negative number? Answer yes/no for each.
Recall Solution — L1.2
- ReLU: no — its smallest value is .
- Leaky ReLU: yes — for it gives , which is negative (small).
- ELU: yes — for , is negative, bottoming out at .
- GELU: yes — near small negative , dips slightly below (a small negative dip), though it returns to as .
Level 2 — Application
L2.1 Compute with , and .
Recall Solution — L2.1
- : use .
- : pass unchanged, .
L2.2 Compute with . Then compute it with .
Recall Solution — L2.2
For , .
- : .
- : . WHAT this shows: scales how deep the negative saturation goes — the floor is .
L2.3 Compute using .
Recall Solution — L2.3
, so . Sanity check: at the gate is open, so we keep most of the input. Compare ReLU() (fully open). GELU is gentler.
Level 3 — Analysis
L3.1 A neuron's pre-activation is . Compute the derivative of each activation at that point (use for Leaky, for ELU). Which neuron is "dead"?
Recall Solution — L3.1
The derivative is the local slope — how much a tiny change in changes the output, and therefore how much gradient flows back in Backpropagation.
- ReLU' (flat on the negative side) → dead, no learning.
- Leaky' → tiny but alive.
- ELU' → alive, smoothly small.
- GELU': near-zero but nonzero (the curve is smooth everywhere), ; not exactly , so not fully dead. Conclusion: only plain ReLU dies here. This is the dead-neuron failure the variants were built to cure.
L3.2 Prove ELU (with ) is smooth in slope at — that is, the left and right derivatives match — whereas ReLU has a corner.
Recall Solution — L3.2
Right side (): both are , slope . Left side derivative of ELU (): . At : (with ). Left slope right slope → matched, no kink. ReLU left derivative at is , right derivative is : → a corner. The exponential's job was precisely to glue the two slopes together at .
L3.3 At exactly, compute all four outputs. Are they all continuous there?
Recall Solution — L3.3
- ReLU.
- Leaky (boundary, ).
- ELU.
- GELU. All equal , and each piece meets its neighbour there → all four are continuous at . (Continuity of value is separate from continuity of slope, which only ELU/GELU have — see L3.2.)
Level 4 — Synthesis
L4.1 Show algebraically that if you set Leaky ReLU's slope to , the activation becomes the identity , and explain why that destroys the network's power (link to the parent's "stacked linear" argument).
Recall Solution — L4.1
With : for , output ; for , output . Both pieces are , so the function is the identity everywhere. An identity activation means : layers collapse into one matrix . By the parent's [!intuition], you lose all curved decision boundaries — the whole reason activations exist (see Universal Approximation Theorem). Hence must stay small.
L4.2 The GELU tanh-approximation is Evaluate and compare it to the exact from L2.3. How close is the approximation?
Recall Solution — L4.2
Inner term: . Cubic bump: . Product: . . . Exact was . Difference — under , exactly as the parent claimed. The two GELUs are effectively the same function; the tanh form just avoids computing .
L4.3 Design choice: you have a deep network suffering from many dead neurons, and you also want the mean activation pushed toward for faster convergence. Between ReLU, Leaky ReLU, and ELU, which do you pick, and why — argue from the derivative and output range.
Recall Solution — L4.3
Pick ELU.
- Dead-neuron cure: its negative-side derivative is everywhere, so no neuron freezes (ReLU fails this).
- Mean-centering: ELU can output negatives (down to ), pulling the average activation toward ; Leaky ReLU also goes negative but its output grows without bound as , whereas ELU saturates to , giving noise robustness. Leaky ReLU is a fine cheaper alternative if you don't need the smooth saturation; ReLU is ruled out because it dies. This connects to He initialization, which is separately tuned to keep ReLU-family variances stable.
Level 5 — Mastery
L5.1 A single neuron computes where input , weight , bias . Compute the pre-activation , then the ReLU output and the gradient that backprop would send to . Is this neuron dead for this input?
Recall Solution — L5.1
Pre-activation: . . Gradient to the weight (chain rule): . The gradient is , so for this input the neuron cannot update via — it is (locally) dead. If every training input drives , it is permanently dead.
L5.2 Same neuron (), but now with Leaky ReLU () and with ELU (). Compute the weight-gradient in each case. Show numerically that both stay alive.
Recall Solution — L5.2
Chain rule again: with , .
- Leaky: , so gradient . Alive.
- ELU: , so gradient . Alive. Both deliver a nonzero nudge to , so the neuron can climb back out of the dead region — the entire motivation for the variants.
L5.3 Full picture. Rank the four activations at by output value (most negative first) and separately by derivative (largest first), using for Leaky and for ELU/GELU. Explain what the two rankings reveal about the "output vs gradient" trade-off.
Recall Solution — L5.3
Compute at :
| Activation | Output | Derivative |
|---|---|---|
| ReLU | ||
| Leaky () | ||
| ELU () | ||
| GELU |
By output (most negative first): ELU → Leaky → GELU → ReLU . By derivative (largest first): ELU → Leaky → GELU → ReLU . Reveal: ELU wins on both here — largest surviving gradient and strongest mean-centering pull. GELU has nearly closed its gate this far into the negatives (near-zero output and gradient), behaving almost like ReLU far from the origin — its gentleness lives near , not out at . So "which is best" depends on where your pre-activations sit.

Recall One-line takeaways
The negative side is where all four differ ::: ReLU zeroes it, Leaky leaks slope , ELU saturates smoothly to , GELU gates probabilistically. Dead neuron test ::: derivative at the operating means no gradient flows to its weights. tanh-GELU vs exact GELU ::: agree to ; same function, faster to compute.
Connections
- Parent: 3.1.05 ReLU and variants (Leaky ReLU, ELU, GELU) (Hinglish)
- Vanishing and Exploding Gradients — why nonzero derivatives matter across depth.
- Backpropagation — the chain rule that turns activation slopes into weight gradients.
- Weight Initialization (He vs Xavier) — keeps ReLU-family variances sane.