3.1.5 · D1Neural Network Fundamentals

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

2,116 words10 min readBack to topic

Before you can read the parent note on ReLU and variants, you need to earn every symbol it throws at you. This page builds each one from nothing — plain words first, then a picture, then why the topic needs it. Read top to bottom; each block leans on the one above.


0. What even is a "function"?

The picture is a graph: put the input on the horizontal axis, the output on the vertical axis. Every input gets exactly one dot. Join the dots and you see the machine's "shape".

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

Look at the left panel: a straight line — this is a linear machine, output is just input scaled. The right panel has a kink — that bend is what "non-linear" means, and it is the whole reason ReLU exists.

Why the topic needs this: every activation (, , ) is a function. If you can read a graph, you can read them all.


1. — the pre-activation

Picture a single number sliding along a horizontal line (a number line). To the right of the middle mark it is positive; to the left it is negative; the middle mark is zero.

Why the topic needs it: every activation's behaviour is described case by case — "for do this, for do that". You cannot follow those cases until -the-number-line is second nature.


2. The sign of : positive, negative, zero

The symbol means "less than or equal to" — it includes the boundary . The parent note writes $x \le 0$ precisely to decide which side owns the zero point. This is not fussiness: the whole "dying neuron" story lives right at that boundary.


3. — pick the bigger one

Picture two heights; hands you the taller one. That's the entire operation — one comparison, no arithmetic.

Why the topic needs it: is defined by this. When is positive it beats , so you get ; when is negative wins, so you get . The kink in that right-hand graph of Figure 1 is the switching winners at .


4. Piecewise functions and the "case bracket"

Read aloud: "if , output ; otherwise output ." One machine, two rules glued at .

Why the topic needs it: every function in the parent note is written this way. Master the bracket once and Leaky ReLU / ELU are free.


5. Slope — how steep is the line?

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

The chalk-blue segment climbs at slope (up as much as it goes across). The pink segment is flat, slope . The pale-yellow segment leaks downhill gently, slope (a small number like ).

Why the topic needs it: the "gradient" that trains a network is nothing but the slope of the activation. A flat piece (slope ) means no learning signal passes — that is the dying-neuron catastrophe. Everything the variants do is "stop the slope from being exactly zero."


6. Derivative — the slope, as its own machine

Why this tool and not another? Training a network asks one question over and over: "if I nudge this input a hair, how much does the output move?" That sensitivity is exactly slope-at-a-point, which is exactly the derivative. No other tool answers "how sensitive?" as directly — that is why the parent note reports a derivative for every activation.

For ReLU the derivative is itself piecewise:

Slope on the climbing piece, slope on the flat piece — read straight off Figure 2.

Recall Why is the derivative undefined

exactly at for ReLU? Because the graph has a sharp corner there — the slope jumps from to with no single value in between. In practice we just pick or by convention; a single point rarely matters. Reveal ::: Sharp corner = no unique slope, so we define it by convention.


7. and — the exponential machine

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

Look at the curve: to the right it rockets upward; to the left () it flattens toward but never touches it. That gentle flattening on the left is the whole point of ELU.

Why the topic needs it: ELU uses for negative inputs. As marches to , , so . The output saturates — settles to a floor of instead of falling forever. That bounded, smooth negative side is exactly what the exponential buys you.

Also: , so . This is why ELU joins smoothly to at the boundary (the parent's continuity check).


8. (alpha) — the small tuning knob

Picture the pale-yellow leaky segment in Figure 2: is literally how steeply it tilts below zero. Bigger = steeper leak; recovers plain ReLU; makes the line perfectly straight (and kills the non-linearity — see the parent's mistake box).

Why the topic needs it: is the single dial that turns ReLU into Leaky ReLU or ELU. Knowing it is "just a small slope number" demystifies all the formulas.


9. Probability and — the Gaussian gate

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

The bell is the Gaussian. is the shaded fraction of area to the left of . Far left → almost no area → . At the centre → exactly half the bell → . Far right → nearly all the area → .

Why the topic needs it: multiplies the input by this probability. It's a soft gate: keep the input with probability . Large positive → gate ~fully open (, output , like ReLU). Large negative → gate ~shut (, output ). But it opens gradually instead of snapping — that smoothness is GELU's edge, used in Transformers and Attention.


10. — the S-shaped squasher

Why the topic needs it: the practical GELU formula uses because has no elementary formula (you can't write it with powers). is a cheap S-curve that mimics the shape of closely enough. It also appears in Sigmoid and Tanh Activations, the older activations ReLU replaced.


How these feed the topic

function f of x and its graph

input x on a number line

sign cases positive negative zero

max picks the bigger

piecewise case bracket

ReLU

slope rise over run

derivative slope machine

gradient flow and dying neurons

alpha small slope knob

Leaky ReLU

exponential e to the x saturation

ELU

probability and Gaussian Phi

GELU

tanh S curve

ReLU and variants

Non-linearity is the reason for all this — it links to the Universal Approximation Theorem (many kinks approximate any curve), while the derivative story links to Backpropagation, Vanishing and Exploding Gradients, and Weight Initialization (He vs Xavier).


Equipment checklist

Test yourself — you're ready for the parent note when each of these is obvious:

What does give when ?
, because is the larger of and .
What does the curly-brace notation mean?
A piecewise function — different formula in different regions of ; pick the row whose condition your meets.
In plain words, what is "slope "?
Go one step right, go one step up — a climb; the output rises exactly as fast as the input.
Why does a slope of stop a neuron from learning?
The gradient (= slope) is what carries the learning signal back; zero slope means zero signal passes, so weights never update.
What is in one sentence?
A new function reporting the slope of at every point — i.e. how sensitive the output is to a tiny nudge in .
What does do as ?
It shrinks toward (never negative, never zero), which makes level off at the floor .
What is , and why does it make ELU continuous at ?
, so , matching the positive side's value of — no jump.
What does measure?
The shaded area under the bell curve to the left of — the probability a standard Gaussian lands below ; runs from up to .
What is ?
, exactly half the bell lies left of centre.
Why does GELU use in its practical form?
has no elementary closed form, so (a cheap matching S-curve) approximates it.
What is the single core idea of the whole ReLU topic?
Stacked linear layers collapse to one line; a cheap non-linear bend (that keeps the slope non-zero) restores expressive power without killing gradients.