Activation Functions › Activation Function Comparison
Language AI HandbookAll chapters Activation Functions › Activation Function ComparisonOne section · Sections in this chapter9 / 16 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
To compare these functions, it helps to look at four properties: the output range, whether the function is zero-centered, the gradient at zero, and the computational cost.
| Function | Output Range | Zero-Centered | Gradient at | Saturates |
|---|---|---|---|---|
| Sigmoid | No | Both sides | ||
| Tanh | Yes | Both sides | ||
| ReLU | No | (undefined) | Negative | |
| Leaky ReLU | Approx. | No | ||
| ELU | Approx. | Negative only | ||
| SELU | Yes | Negative only | ||
| GELU | Approx. | No | ||
| Swish/SiLU | Approx. | No | ||
| Mish | Approx. | No |
Gradient Flow Analysis
To understand how these functions affect gradient flow in deep networks, consider what happens when you backpropagate a gradient through a layer with activation . The gradient signal that reaches the layer below is . If consistently, the gradient shrinks at each layer. If , it grows (which can cause exploding gradients).
For sigmoid, everywhere. Backpropagating through sigmoid layers multiplies the gradient by at most . With just 10 layers, this is : a million-fold reduction. The early layers receive essentially no gradient and their weights barely move.
For ReLU, on the active side. Backpropagating through active ReLU neurons multiplies the gradient by : no shrinkage at all. This is the core reason ReLU enabled training of deep networks. The caveat is that dead neurons (the side) block gradient flow entirely, which is why the dying ReLU problem matters for deep or poorly initialized networks.
For GELU and Swish, the derivative near zero is approximately 0.5, and the gradient grows to approximately 1 for large positive inputs. These smooth functions have slightly smaller average gradients than ReLU on the positive side but handle the transition at zero more gracefully, avoiding the hard zero that causes dying neurons. The gradient for GELU varies between approximately 0.5 and 1.0 for typical pre-activation values, which means GELU networks do experience some gradient attenuation but far less than sigmoid networks.
The following plot illustrates gradient magnitude decay across layers for sigmoid versus ReLU, showing the dramatic difference that activation choice makes in deep networks:

Convergence Speed
In controlled experiments on standard benchmarks, the relative convergence speed of activation functions is roughly:
GELU Swish Mish ELU Leaky ReLU ReLU tanh sigmoid
This ordering is approximate and architecture-dependent. The modern smooth functions (GELU, Swish, Mish) often converge faster and to slightly better optima, particularly in deeper networks. The advantage over ReLU is often small (a few percent in final accuracy) but consistent enough across benchmarks that transformers standardized on GELU.
The reason the smooth activations tend to converge faster is subtle. ReLU creates a piecewise-linear loss landscape: the loss surface is flat in all the directions where neurons are dead. This means gradient descent must take many small steps around the flat regions. GELU and Swish produce a smoother landscape with fewer flat regions, so gradient descent can move more directly toward the optimum. The difference is not dramatic for shallow networks, but compounds over many layers.