TL;DR
Hendrycks and Gimpel proposed the Gaussian Error Linear Unit, or GELU, as an activation function for neural networks. It multiplies each input x by , the probability that a standard normal random variable falls at or below x, so large positive inputs pass almost unchanged and negative inputs are shrunk toward zero. On the tasks they tested, from MNIST and TIMIT to CIFAR-10, CIFAR-100 and tweet tagging, GELU matched or beat ReLU and ELU, with the largest gain on CIFAR-100.
Builds on: GELU, ReLU, Dropout · Leads to: BERT and the Transformer language models that use GELU in their feed-forward blocks
Why it mattered
GELU became one of the standard activations of large language models. Transformer models trained for language, including the BERT family and the GPT family, use GELU in their feed-forward blocks, and many later models kept it. The paper's main contribution was to show that a smooth, input-weighted gate could replace the sign-based gate of ReLU without losing trainability, and to give a probabilistic reading of why that gate works. Practitioners adopted it because it cost almost nothing extra and often gave a small, consistent accuracy gain.
The problem
By 2016 a neuron was usually a weighted sum followed by an Activation Function. The choice was a real design decision, because a stack of layers without a bend is just one linear map. Sigmoid and tanh activations were smooth but saturated, so gradients vanished in deep networks. ReLU fixed saturation for positive inputs but gated hard on the sign of the input: anything below zero became exactly zero, and the function had a corner at zero. ELU allowed negative outputs but still had a separate rule for each sign.
At the same time, regularizers such as Dropout randomly zeroed units, and this was a separate design choice from the activation. The authors observed that dropout and ReLU both multiply the input by a zero-or-one mask, one of them deterministically and the other at random. Their question was whether a single nonlinearity could combine the two ideas: a mask that depends on the input and is still a smooth function of it.
How it works
The paper's method is one function, its approximations, and an experimental protocol. The pipeline for one neuron runs as follows.
- Input. A neuron receives its pre-activation value x, the weighted sum of its inputs. Example: x = 1.
- Probability of being kept. Compute , the chance that a standard normal draw is at most x. For x = 1, . Check: a value near 1 means the input is almost certainly kept.
- Gate. Multiply x by . For x = 1, the output is . Check: the output is close to x, because the gate is nearly 1.
- Negative input. Take x = −1. , so the output is . Check: the output is negative but small, unlike ReLU, which gives exactly 0.
- Extremes. For x = 2, and the output is 1.9545. For x = −2, the output is −0.0455, and for x = 0 it is 0. Check: the curve passes through the origin and is smooth there.
- Use it in a network. The same function is applied to every neuron, and its parameters are fixed at mean 0 and standard deviation 1, so the method adds no new hyperparameters.
- Compute it quickly. The exact form uses the error function, so the paper gives two cheap approximations and uses the tanh one in all its experiments. Check: at x = 1 the tanh form gives about 0.841, close to the exact 0.8413.
flowchart LR X[Pre-activation x] --> P[Probability Phi of x from the normal CDF] X --> M[Multiply] P --> M M --> Y[Output x times Phi of x]
The gate in step 2 is the one idea to keep in mind. ReLU asks whether x is positive. GELU asks how far x sits above the typical input, and weights x by that answer.
The math
Step 2 in symbols: the gate as a probability
The paper starts from a random gate. Let , a 0-or-1 value that equals 1 with probability . The neuron outputs . Because the probability depends on x, the mask is random but tied to the input: a small x is more likely to be dropped.
Step 3 in symbols: the expected output
The deterministic function the network uses is the expectation of that random output. Given x, the output is x with probability and 0 otherwise, so
This is the GELU. It is the average behaviour of the stochastic gate, which is why the paper gives it a probabilistic reading.
Step 4 in symbols: the negative side
For , , so the gate is less than one half and the output is shrunk toward zero but not cut off. For x = −1 the gate is 0.1587 and the output is −0.1587. ReLU at the same input is .
Step 7 in symbols: the approximations
The two cheap forms are
where is the sigmoid. The first is the one used in the paper's experiments. Check at x = 1: , , and , which matches .
- GELU (tanh form)
- ReLU
Results
The paper reports median results over several runs, with learning rates tuned on a validation split. Each comparison is between GELU, ReLU and ELU on the same architecture.
- MNIST classification (fully connected, 8 layers of 128 units). The paper reports that GELU has the lowest median training log loss, both with and without dropout. It also reports better robustness to noisy inputs. No single headline error rate is given in the text.
- MNIST autoencoder. The authors say GELU "significantly outperforms" the other activations and tolerates a wider range of learning rates. ELU diverged at learning rate 0.01, and GELU and ReLU converged poorly there.
- Tweet part-of-speech tagging. Median test error: 12.57% for GELU, 12.67% for ReLU and 12.91% for ELU. The gap is small and the dataset is small.
- TIMIT frame classification. Median test error: 29.3% for GELU, 29.5% for ReLU and 29.6% for ELU.
- CIFAR-10 (9-layer convolutional network with batch normalization). Median error: 7.89% for GELU, 8.16% for ReLU and 8.41% for ELU.
- CIFAR-100 (wide residual network, 40 layers, width factor 4). Median error: 20.74% for GELU, 21.77% for ReLU and 22.98% for ELU.
What these numbers mean. The gains over ReLU are consistent in direction but small, about 0.1 to 1 percentage point. Each number is a median over several runs, so the comparison is about typical behaviour, not a best run.
Limits. The experiments cover five datasets and a few small architectures, and they tune learning rates on each activation. The paper does not show GELU in very large language models, which later work made the main use. The probabilistic story is a motivation and does not by itself prove the activation is optimal.
Reading guide
The paper is short. Read it in this order, and use the lessons listed for each part.
- Section 1, Introduction. Needs Activation Function, sigmoid, ReLU and Dropout. The introduction explains why activations and regularizers were treated as separate choices.
- Section 2, GELU formulation. Needs the GELU definition, the Gaussian distribution, the cumulative distribution function and the Bernoulli distribution. Read the Bernoulli step slowly; it is the whole argument.
- Section 2, approximations. Needs the tanh function and the sigmoid.
- Section 3, experiments. Needs Feedforward Neural Network, Batch Normalization and Adam Optimizer. The experiment descriptions use these without redefining them.
- Section 4, discussion. Compare the GELU with ReLU and the sigmoid; it draws on Activation Function and the curvature of the function.
- Appendix B. A history of how GELU and SiLU came to be; it is optional for understanding the method.