3.1.5 · D3Neural Network Fundamentals

Worked examples — ReLU and variants (Leaky ReLU, ELU, GELU)

3,035 words14 min readBack to topic

This is the D3 ("Deep Dive 3 — worked-examples grind") companion to the parent note on ReLU and variants. "D3" is just this vault's label for the third deep-dive child of a topic: the one where we stop deriving theory and instead hit the four functions with every kind of input so you never meet a case you haven't seen solved.

Before we start, one shared reminder of the four functions and their derivatives (with the small leak/scale constant):


The scenario matrix

Every input you can feed an activation falls into one of these cells. The worked examples below are tagged with the cell(s) they cover, and together they fill the whole table.

Cell Input regime What it stress-tests Covered by
A (positive) the "pass-through" branch, all four Ex 1
B small the negative branch: leak vs saturate vs gate Ex 2
C (limit) saturation / blow-up behaviour Ex 3
D (limit) do they all agree with ? Ex 3
E (boundary) continuity and kink, all four Ex 4, Ex 6
F Gradient at a dead point dying-ReLU vs recovery Ex 5
G Degenerate parameter ( or ) when a variant collapses into another function Ex 7
H Word problem a neuron in a real forward pass Ex 8
I Exam twist sign trap and -GELU vs exact Ex 9

Worked examples

Figure — ReLU and variants (Leaky ReLU, ELU, GELU)

Recall Did every cell get filled?

Which examples cover the two limits ()? ::: Example 3 (Cells C and D). Which example shows a variant collapsing back into ReLU or into a pure line? ::: Example 7 (Cell G, and ). Which example proves GELU and why we need the product rule? ::: Example 6. Which example is the exam twist (sign trap plus tanh-vs-exact GELU)? ::: Example 9 (Cell I). In Example 8, why does the ELU neuron still learn while a ReLU one would be dead? ::: Its gradient is non-zero, whereas ReLU's negative-side gradient is . In Example 4, which two of the four are smooth at and which two have a kink? ::: ELU and GELU are smooth; ReLU and Leaky have a corner (undefined slope).

Connections

  • Vanishing and Exploding Gradients — Examples 3 and 5 are the saturation/dead-gradient story made numeric.
  • Backpropagation — Example 8 shows the local gradient that gets chained backward.
  • Weight Initialization (He vs Xavier) — good init keeps pre-activations off the dead-negative region of Example 5.
  • Transformers and Attention — Example 6's smooth slope is why GELU rules Transformer blocks.
  • Sigmoid and Tanh Activations — the of Example 9 reused as a cheap Gaussian mimic.
  • Universal Approximation Theorem — the many kinks of Examples 1–2 are the pieces that approximate any curve.