Every neural network faces the same fundamental question at every neuron: what signal should I pass forward? The activation function answers that question. It's a small mathematical gate, but it shapes everything—how fast a network trains, how deep it can grow, and what kinds of patterns it can learn.
For years, ReLU dominated. It was simple, fast, and solved the vanishing gradient problem that plagued earlier networks. But as architectures evolved—particularly with the rise of transformers—researchers noticed that smoother, more nuanced activation functions consistently delivered better results. The question is why.
The answer lies in three interconnected properties: how gradients flow during backpropagation, what kinds of functions a network can represent, and how the activation's shape interacts with the optimization landscape. Understanding these properties doesn't just explain history—it gives you a framework for making better architectural decisions today.
Gradient Flow Properties
Training a deep network is an exercise in gradient management. During backpropagation, gradients must travel from the loss function all the way back through potentially hundreds of layers. At every layer, the gradient gets multiplied by the local derivative of the activation function. This means the activation's derivative profile isn't a minor detail—it's a bottleneck that determines whether learning happens at all.
The classic sigmoid function illustrates the problem perfectly. Its derivative peaks at 0.25 and rapidly approaches zero for large or small inputs. Stack fifty layers of sigmoid activations and your gradients shrink exponentially—a phenomenon called the vanishing gradient problem. Information about the loss simply cannot propagate back to early layers. The network's first layers stop learning while its last layers overfit.
ReLU solved this elegantly. For positive inputs, its derivative is exactly 1. Gradients pass through unchanged, no matter how deep the network. But ReLU introduced its own pathology: the dying ReLU problem. Any neuron that receives a negative input produces zero output and zero gradient. Once dead, it stays dead. In practice, a significant fraction of neurons in deep ReLU networks can become permanently inactive, wasting capacity.
This tension—between vanishing gradients and dead neurons—is the core trade-off in activation function design. Leaky ReLU and parametric ReLU addressed dying neurons by allowing small negative gradients. But the real breakthrough came from recognizing that smooth gradient transitions matter more than just non-zero gradients. A hard threshold at zero, like ReLU's, creates discontinuities in the optimization landscape that modern optimizers struggle with, especially in architectures like transformers where attention mechanisms amplify small numerical instabilities.
TakeawayAn activation function's most important property isn't what it does to the signal—it's what it does to the gradient. The derivative profile across the full input range determines whether a deep network can actually learn.
Non-linearity Requirements
Without activation functions, a neural network is just a chain of matrix multiplications—a single linear transformation, no matter how many layers you stack. Activation functions inject non-linearity, which is what gives networks their expressive power. But not all non-linearities are created equal. The shape of your activation function determines the function class your network can efficiently represent.
Consider what ReLU actually does geometrically. It folds the input space along a hyperplane, creating a piecewise linear function. A deep ReLU network constructs increasingly complex piecewise linear approximations—like origami, folding flat paper into elaborate shapes. This is powerful but inherently limited. Approximating smooth, curved functions requires many folds, meaning many neurons. For tasks where the underlying relationship is smooth—which describes most natural phenomena—ReLU networks need significantly more parameters than theoretically necessary.
Smooth activation functions like GELU or SiLU change this calculus. Because each neuron's output is itself a smooth curve rather than a sharp bend, the network can represent smooth target functions with fewer parameters. This isn't just theoretical elegance—it translates directly to better parameter efficiency. A transformer with GELU activations often matches the performance of a larger ReLU-based model. When you're training billion-parameter models, that efficiency gap matters enormously.
There's a subtler point here about information preservation. ReLU discards all information about negative inputs—they all map to exactly zero. A smooth activation like GELU preserves some information even for negative inputs, suppressing them gradually rather than eliminating them. This means the network retains a richer signal to work with at every layer. In attention-heavy architectures where context is built from many interacting signals, that preserved information compounds across layers into meaningfully better representations.
TakeawayThe shape of your activation function defines the geometry of what your network can express. Smooth activations don't just look nicer mathematically—they let networks represent complex functions with fewer parameters by matching the smoothness of real-world data.
Modern Activation Design
GELU—the Gaussian Error Linear Unit—has become the default activation in transformer architectures, from BERT to GPT. Its formula looks deceptively simple: GELU(x) = x · Φ(x), where Φ is the cumulative distribution function of the standard normal distribution. In plain terms, it multiplies each input by the probability that a Gaussian random variable would be less than that input. Large positive values pass through almost unchanged. Large negative values get suppressed toward zero. Values near zero get a smooth, probabilistic gating.
This probabilistic interpretation is what makes GELU architecturally significant. Rather than making a hard binary decision about each activation (pass or block, as ReLU does), GELU makes a soft decision based on how the input relates to the distribution of typical inputs. It's effectively performing a form of stochastic regularization baked into the activation itself. During training, this soft gating interacts favorably with dropout and layer normalization—techniques that are standard in transformers.
SiLU (also called Swish), defined as x · σ(x) where σ is the sigmoid function, follows a similar philosophy. Both GELU and SiLU are non-monotonic—they dip slightly below zero before rising. This small negative region creates a subtle but important effect: it allows the network to produce small negative corrections, which improves gradient flow through residual connections. In deep transformer stacks with hundreds of residual additions, this property helps maintain signal diversity and prevents representation collapse.
The lesson from modern activation design isn't that GELU or SiLU are universally optimal. It's that activation functions should be co-designed with the architecture. GELU works well in transformers because its smoothness complements layer normalization, its soft gating aligns with attention's probabilistic nature, and its non-monotonicity supports deep residual learning. When you change the architecture—say, moving to a state-space model or a mixture-of-experts system—the optimal activation may change too. The function and the architecture form a system, and they must be reasoned about together.
TakeawayThe best modern activations aren't discovered by searching random functions—they're designed to complement specific architectural patterns. GELU succeeds in transformers not because it's universally superior, but because its properties align precisely with how transformers process information.
Activation functions are easy to overlook. They're single lines of code in architectures containing billions of parameters. But they operate at every neuron in every layer, which means their properties compound across the entire network.
The progression from sigmoid to ReLU to GELU traces a deeper insight: activation functions shouldn't be chosen in isolation. They're part of a system that includes the architecture, the optimizer, the normalization strategy, and the data itself. The best choice is the one that creates harmony across all of these.
Next time you're selecting an activation function, don't ask which one is best. Ask which one fits. The architecture will tell you if you listen.