Gaussian Error Linear Units

GELU replaces hard ReLU gating with a smooth probability-weighted activation, becoming a default nonlinearity in BERT-style and many later Transformer feed-forward blocks.

Metadata

FieldValue
PaperGaussian Error Linear Units (GELUs)
AuthorsDan Hendrycks, Kevin Gimpel
Year2016
VenuearXiv preprint
arXiv1606.08415
Codehendrycks/GELUs
Statusseed note started

One-Line Takeaway

GELU is the activation:

where is the standard Gaussian CDF, giving a smooth input-dependent gate rather than a hard threshold at zero.

Question

ReLU applies a hard gate:

This is cheap and effective, but the gate is discontinuous in derivative at zero and fully suppresses all negative inputs.

GELU asks:

Can an activation weight an input by how likely it is to be positive under a Gaussian uncertainty model?

Formula

The GELU activation is:

where:

So:

A common approximation is:

Architecture Contract

ComponentRole
input pre-activation value from linear layer
smooth probability-like gate
product gates value by input magnitude and sign
approximationfaster implementation option
feed-forward placementactivation inside MLP/FFN block

In a Transformer feed-forward block:

GELU sets:

This is why GELU matters as an architecture component: it changes the nonlinearity in the token-wise channel mixer.

ReLU vs GELU

AxisReLUGELU
Formula
Gatehard sign gatesmooth probability-weighted gate
Negative valuesall zeroedsmall negatives can pass
Derivativekink at zerosmooth
Common useCNNs and many MLPsBERT-style Transformers and modern FFNs

GELU is not a new macro-architecture. It is a small block-level choice that became durable because activation behavior compounds over many layers.

Derivative

Let be the standard Gaussian density:

Then:

This derivative is smooth. For large positive :

For large negative :

Near zero, GELU behaves like a soft gate instead of an abrupt switch.

Why It Matters

GELU became important because many Transformer blocks are built from:

The FFN is often where much of the parameter count lives:

So the activation inside the FFN is not cosmetic. It affects channel mixing, gradient flow, sparsity, saturation, and training stability.

What To Watch

  • GELU is usually an activation choice, not a standalone architecture claim.
  • Exact and approximate GELU can differ slightly; implementations should be recorded.
  • Performance gains are recipe-dependent and can interact with normalization, initialization, optimizer, and depth.
  • In modern LLMs, GELU is often replaced by gated activations such as SwiGLU; compare with GLU Variants Improve Transformer.
  • If a paper claims an architecture improvement, isolate whether the gain came from activation, width, normalization, or training recipe.