An activation function changes both the values moving forward through a network and the slopes moving backward. GELU makes a useful example: its formula is short, but understanding its slope takes the product rule.
Spotted in the wild
- “f prime at a”Instantaneous slope at .
- “d f by d x”The derivative of a scalar function.
- “little o of h”An error negligible compared with as .
- “sigmoid of x”The logistic activation.
- “phi of x”Standard normal density.
- “capital phi of x”Standard normal cumulative distribution.
| Symbol | Say it | Meaning | LaTeX |
|---|---|---|---|
| “f prime at a” | Instantaneous slope at . | ||
| “d f by d x” | The derivative of a scalar function. | ||
| “little o of h” | An error negligible compared with as . | ||
| “sigmoid of x” | The logistic activation. | ||
| “phi of x” | Standard normal density. | ||
| “capital phi of x” | Standard normal cumulative distribution. |
The best local line
A derivative is the limit
Equivalently, : after subtracting the proposed line, the remaining error divided by tends to zero. This is why the tangent predicts the effect of a small parameter change.
For , the difference quotient at is , so . Near , the prediction for is . The exact value is ; the error is the omitted .
What is the derivative of at ?
Rules that save work
Linearity gives . The product rule is . To prove it, add and subtract in the numerator:
Differentiability implies continuity, so taking the limit gives the rule. A product's derivative is generally not the product of the derivatives. The quotient rule, when , is .
Useful building blocks are , , for , and . Differentiating a composition will be the next chamber's main task.
What is ?
The activation toolbox
Let . Differentiating the quotient gives . Since , its maximum is at .
| Activation | Derivative | What to watch |
|---|---|---|
| Maximum 1 at zero; saturated tails have small slopes | ||
| , softplus | Positive slope tending to 1 | |
| , ReLU | 0 for , 1 for | No ordinary derivative at zero |
| , GELU |
ReLU implementations choose a backward value at the kink, often zero. That convention does not turn the corner into a differentiable point. GELU's derivative can exceed one and can be negative: smoothness does not imply monotonicity.
The lab also includes , a bounded smooth function with derivative . Its maximum slope is 1 at zero.
Check a derivative numerically
The central difference is
For a sufficiently smooth function its truncation error is . Forward differences usually have error. Floating-point subtraction eventually dominates when becomes very small; compare several step sizes. At a kink, central differences can average two incompatible one-sided slopes. For at zero they always give zero, although the derivative does not exist.
A central difference for at zero is zero. What does that prove?
Read beyond
Book · free online · ~20 min
Calculus, Volume 1OpenStax · Sections 3.1–3.3: derivatives and rules
Derive the slope of a polynomial from the difference quotient.
Book · free online · ~20 min
Mathematics for Machine LearningDeisenroth, Faisal & Ong · Section 5.1: univariate differentiation
Compare derivatives, finite differences and local linear approximation.
Book · free online · ~20 min
The Matrix Calculus You Need For Deep LearningParr & Howard · Scalar derivative rules
Check which expressions are sums, products or compositions before differentiating.
Read the equation in context
Gaussian Error Linear Units (GELUs)Dan Hendrycks & Kevin Gimpel · 2016The paper defines GELU by weighting an input by a Gaussian cumulative probability. Differentiate this exact formula before considering its common approximations. The derivative we obtain below follows from the product rule and the fact that the derivative of a CDF is its density.
Decode the paper · Section 2: GELU definition
Gaussian Error Linear Units (GELUs)Dan Hendrycks & Kevin Gimpel · 2016
The paper defines GELU by weighting an input by a Gaussian cumulative probability. Differentiate this exact formula before considering its common approximations. The derivative we obtain below follows from the product rule and the fact that the derivative of a CDF is its density.
Options
Your turn
Move along each activation and compare its output with its derivative. Find a point where the derivative reaches its maximum, then submit the slope.
Interactive lab
Tangent tracer
Value
0.8808
Slope
0.1050
Match · Expression ↔ Meaning
Activation slopes
Options
Match · Expression ↔ Meaning
Numerical checks
Options
Proof puzzle
The product rule
Claim
Prove at a point of differentiability.
Tap lines in the order they should appear. Tap a line in your proof to send it back.
Your proof
- Pick the first line below.
Available lines
Prove it yourself
A derivative forces continuity
Claim
Prove that differentiability at implies continuity at .
Your typeset proof appears here.
Coding problems
Problem 4·Warm-up
Sum the slopes
For , compute .
Problem 5·Standard
Central difference accuracy
Estimate the derivative of at by central differences with . Find the smallest integer for which the exact-arithmetic absolute error is below .
Problem 6·Challenge
Where GELU is steepest
The derivative of GELU is . Find the positive maximising , and give 6 decimal places. Use calculus or numerical search.
Key takeaways
- The derivative is the slope of the best local line.
- The product rule differentiates one factor at a time.
- ReLU needs a convention at its kink; smooth activations have different saturation behaviour.
- Finite differences check a formula, with both truncation and rounding error to consider.
Checkpoint
Prove it to the labyrinth
Answer every question to clear this chamber. First-try answers earn the most XP.
What is the largest sigmoid derivative?
What is ?
What is the derivative of softplus at zero?
What is the derivative of exact GELU at zero?
As a finite-difference step becomes extremely small, what can happen?
Which statement is true?
End of the chamber
Clear this chamber
- Questions in this chamber (0/9 solved)Next unsolved
- Bonus: Slope sleuth (+30 XP)
- Bonus: Problem 4: Sum the slopes (+20 XP)
- Bonus: Problem 5: Central difference accuracy (+35 XP)
- Bonus: Problem 6: Where GELU is steepest (+50 XP)
- Bonus: Proof: The product rule (+25 XP)
- Bonus: Proof: A derivative forces continuity (+35 XP)
- Bonus: Decode the paper (+25 XP)
- Bonus: Match: Activation slopes (+20 XP)
- Bonus: Match: Numerical checks (+20 XP)