GELU

Activation · node type · Gelu, Erf

A smooth ReLU that weighs each input by how likely it is to be positive; the transformer default.

Also called Gaussian error linear unit, Erf

Move the input and compare activation functions. The gradient is what training sees: where it is flat, learning stalls.
-4-224-22

f(1.00) = 0.841

Figure 1. Try it: every number is computed in your browser from the formula below.

What it does

GELU multiplies the input by the probability that a standard normal variable is below it. Large positive inputs pass almost unchanged, large negative inputs go to zero, and around zero the curve is smooth and dips slightly below zero. That smoothness tends to train better in deep transformers than ReLU’s sharp corner. Older exporters do not have a Gelu operator, so in many ONNX graphs it appears as a small chain: Div by √2, Erf, Add 1, Mul by x, Mul by 0.5.

Formula

GELU(x) = x · Φ(x) = 0.5 · x · (1 + erf(x / √2))tanh form: 0.5 · x · (1 + tanh(√(2/π) · (x + 0.044715 · x3)))

Shapes and parameters

Shapes
Any shape in, the same shape out.
Parameters
None. An activation is a fixed function applied to every element, so it adds no parameters.
Used for
Feed-forward blocks of BERT, ALBERT, DistilBERT, ViT, CLIP and most other transformers; the mixers of TinyTimeMixer.

Figure 2. GELU inside Ask a question about a table, a real model in WeightSpace. The 2 outlined nodes are GELU; select any node for its shapes and parameters.

Figure 3. The typed ports of GELU, in the same format as every model drawing. Letters such as N or C stand for any size.

In WeightSpace

Read-only in WeightSpace today: there is nothing learned inside it. When an edit moves a bias in the layer before it, this function decides how much of that shift reaches the next layer, so its shape explains why some edits flip an answer and others barely move it.