Home Knowledge Base ReLU — the rectified linear unit — is the workhorse that made very deep networks trainable.

Activation functions are the reason depth means anything. Stack a hundred linear layers with no nonlinearity between them and the whole thing collapses algebraically into a single linear map — no amount of depth buys you extra expressive power. The activation is the small element-wise nonlinearity inserted after each layer that breaks this collapse, letting the network bend, fold, and carve the input space into the complex decision regions that deep learning is famous for. Every architectural era has a signature activation, and the migration from ReLU to GELU to gated units like SwiGLU tracks the field's growing understanding of what a good nonlinearity actually needs to do.\n\nReLU — the rectified linear unit — is the workhorse that made very deep networks trainable. It simply passes positive values through and clamps negatives to zero. That gives it a constant gradient of 1 on the positive side, which sidesteps the vanishing-gradient problem that crippled the old saturating activations, and it is almost free to compute. Its one weakness is the dying ReLU problem: a unit stuck in the negative region gets zero gradient forever and stops learning. Leaky ReLU and its cousins patch this by giving the negative side a small nonzero slope so no unit ever fully dies.\n\nThe classic saturating activations — sigmoid and tanh — are now mostly historical. They squash inputs into a bounded range, but their gradients flatten to near-zero for large-magnitude inputs, so gradients vanish through deep stacks. They survive today mainly as gates — inside LSTMs and gated units — where their bounded 0-to-1 output is exactly the "how much to let through" signal you want, rather than as the main activation.\n\nGELU and SiLU/Swish are the smooth successors to ReLU. Instead of a hard kink at zero, GELU weights each input by the probability that a standard Gaussian is below it, producing a smooth curve that dips slightly negative before rising. SiLU (also called Swish) is the closely related x·sigmoid(x). The smoothness gives cleaner gradients and a small but consistent quality gain, which is why GELU became the default inside BERT and the GPT family.\n\nSwiGLU and the gated-linear-unit family are the current default inside large-model feed-forward blocks. A GLU splits the projection into two paths — one carries the signal, the other passes through an activation and gates it by element-wise multiplication. SwiGLU uses a Swish gate, GEGLU uses a GELU gate. Empirically these gated variants outperform a plain activation in the FFN, which is why models like LLaMA and PaLM adopt SwiGLU (usually with a widened hidden size to keep the parameter count matched). The cost is a third weight matrix in the FFN, a trade the quality gain has repeatedly justified.\n\n| Activation | Formula (essence) | Smooth? | Saturates? | Where it lives |\n|---|---|---|---|---|\n| ReLU | max(0, x) | No (kink) | No | CNNs, older nets |\n| Leaky ReLU | x if x>0 else 0.01x | No | No | Fixes dying ReLU |\n| Sigmoid / tanh | squash to bounded range | Yes | Yes | Gates (LSTM/GLU) |\n| GELU / SiLU | x·Φ(x) / x·σ(x) | Yes | No | BERT, GPT blocks |\n| SwiGLU / GEGLU | gated: (act(xW)) ⊙ (xV) | Yes | No | LLM feed-forward |\n\n``svg\n\n \n Activation functions: the shape that makes depth matter\n Without a nonlinearity, stacked linear layers collapse to one linear map. The activation is what breaks the collapse.\n\n \n 1 - The shapes, on one axis\n \n \n \n x\n f(x)\n \n \n ReLU\n \n \n Leaky ReLU (nonzero slope for x<0)\n \n \n GELU / SiLU\n smooth curves dip slightly below zero, then rise\n\n \n 2 - Gated units (SwiGLU / GEGLU)\n \n input x\n \n \n \n \n Swish/GELU( x W ) gate\n \n x V signal\n \n x\n \n \n one path gates the other, element-wise\n\n \n \n Why you cannot skip it\n W2 (W1 x) = (W2 W1) x = one linear layer\n Stack linear layers with no activation and depth\n buys nothing. Insert a nonlinearity and the network\n can represent curved, folded decision boundaries.\n ReLU solved vanishing gradients; smooth + gated\n variants then squeezed out extra quality.\n\n \n \n The historical arc\n sigmoid / tanh -> saturate, gradients vanish\n ReLU -> constant positive gradient, trainable depth\n GELU / SiLU -> smooth, small quality gain\n SwiGLU / GEGLU -> gated FFN, current LLM default\n each step keeps gradients healthy and adds expressiveness\n\n``\n\nThe easy way to think about activations is as a menu of curves you pick from by reputation — "use SwiGLU, that's what LLaMA does." The more useful framing is that every activation is answering the same question with a different shape: how should a neuron pass information forward while keeping a usable gradient flowing backward? ReLU's flat-then-linear shape keeps the backward gradient alive; GELU smooths the kink for a cleaner signal; gated units let part of the layer decide how much of the rest to let through. Read an activation through a what-shape-keeps-the-gradient-healthy-and-adds-expressiveness lens rather than a which-curve-is-fashionable lens, and the progression from sigmoid to ReLU to SwiGLU reads as one continuous engineering argument rather than a list of tricks.

glu variantsgluneural architecture

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.