Log inStart free
LESSON 5.C1 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Activation functions side by side

Watch one small net train with seven activations, one row each.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 5.C1 · ACTIVATION BAYRELU · 13 WEIGHTS · 8 POINTS
01
Stage 1 of 6 · Seven activations
One MLP with 4 hidden units fits 8 points. Each row trains it with another activation.
Explain it simply

Each row is the same small network: one input, four hidden units and one output. It tries to fit eight teal points on a bowl-shaped curve. Only the activation changes, and the blue line shows how it bends a unit's input. The rows come from sigmoid and tanh, ReLU and Leaky ReLU, GELU and SiLU and SwiGLU.

Seven rows, one per activation: sigmoid, tanh, ReLU, Leaky ReLU, GELU, SiLU and SwiGLU. Each row draws its curve f of z.

points, zf(z), fitweights, biasslope, lossz ≤ 0 on all 8 inputsfollowed row
f(z)sigmoidlesson 5.04tanhlesson 5.04ReLUlesson 5.05Leaky ReLUlesson 5.05GELUlesson 5.06SiLUlesson 5.06SwiGLUlesson 5.07× valueseven activations, one 1-4-1 netReLU, unit 1 at x = 1: h = f(0.02·1 + 0.49) = f(0.51) = 0.51f(z)sigmoidlesson 5.04tanhlesson 5.04ReLUlesson 5.05Leaky ReLUlesson 5.05GELUlesson 5.06SiLUlesson 5.06SwiGLUlesson 5.07× valueseven activations, one 1-4-1 netReLU, unit 1 at x = 1: h = f(0.02·1 + 0.49) = f(0.51) = 0.51
Toy: 5.05's 1-4-1 MLP · y = 1.5x² − 0.5 at 8 points · 500 steps · SwiGLU keeps a gate bias: 13 weights
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
h=f(z),z=w x+b\sy{h}{out}{h} = f(\sy{z}{data}{z}),\quad \sy{z}{data}{z} = \sy{w}{param}{w}\,\sy{x}{data}{x} + \sy{b}{param}{b}
z=0.02⋅1+0.49=0.51, h=max⁡(0, 0.51)=0.51z = 0.02 \cdot 1 + 0.49 = 0.51,\ h = \max(0,\,0.51) = 0.51

Each unit bends its weighted input z with the activation f.

Common mix-ups

MYTHA unit pushed below 0 stops learning in every net.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01At learning rate 0.05, which row ends with the highest loss?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.