Paper commentary
Gaussian Error Linear Units (GELUs)
Gaussian Error Linear Units weight inputs by value instead of sign
- Problem ReLU gates by sign, and regularizers are chosen separately from the nonlinearity.
- Method The GELU is a nonlinearity named Gaussian Error Linear Unit that multiplies each input by the Gaussian cumulative distribution function. Unlike ReLU, it weights inputs by their value rather than gating them by sign.
- Results GELU's median CIFAR-10 error was 7.89 percent, compared with 8.41 percent for ELU.
Where ReLU-style gating leaves a gap
Early units used hard thresholds, and sigmoid activations smoothed them so that networks could be trained with backpropagation. Deeper networks, though, trained better with ReLU, which gates an input according to its sign. ELU later let the unit output negative values, which sometimes sped up training. So the activation stays a deliberate architecture decision, because without a nonlinearity the network reduces to a deep linear classifier.
Deep networks fit their training data so well that designers often add a stochastic regularizer, such as noise or dropout. Such regularizers can make a network act like an ensemble inside one model, which the authors call a pseudoensemble. Yet the regularizer and the nonlinearity have been chosen separately, and neither subsumes the other, because regularizers ignore the input.
That separation is the gap the GELU is meant to close.
A gate whose probability depends on the input
The key idea is to multiply each input by a 0 or 1 mask, where the mask is random but more likely to keep larger inputs. The authors start from ReLU and dropout, which both zero out inputs, and from zoneout, which stochastically keeps inputs unchanged. They combine these by making the mask random while tying its probability to the input value.
The mask is drawn as \( m \sim \mathrm{Bernoulli}(\Phi(x)) \), where \( \Phi(x) = P(X \le x) \) and \( X \sim N(0,1) \). Lower inputs have a smaller chance of being kept, so the transformation is stochastic yet depends on the input. The normal distribution is chosen because neuron inputs tend to look normally distributed, especially after Batch Normalization.
Adaptive Dropout is the closest relative, but it uses a logistic distribution and is applied alongside nonlinearities.
Taking the expected value of this mask gives \( \Phi(x)\,x + (1-\Phi(x))\cdot 0 = x\Phi(x) \), which is deterministic. Because the Gaussian cumulative distribution function is usually evaluated with the error function, the GELU is written as \( x \cdot \tfrac{1}{2}[1+\operatorname{erf}(x/\sqrt{2})] \). For speed, the authors offer a tanh form and \( x\sigma(1.702x) \), and they used the tanh form in every experiment.
The authors could swap in other cumulative distribution functions, such as the logistic one that gives the SiLU \( x\sigma(x) \). They fix mean 0 and standard deviation 1 throughout, so the GELU adds no new hyperparameters to tune.
MNIST classification and noise robustness
The first test replicates a setup from Clevert et al., using an 8-layer, 128-neuron-wide fully connected network trained for 50 epochs with batch size 128. The authors used Adam, where the original used plain SGD without momentum, and they also tested dropout.
With dropout at keep rate 0.5 and without it, GELU tends to reach the lowest median training log loss. The authors note that GELU is inspired by a different stochastic process, yet it fits well with dropout. The reported comparison concerns training log loss.
For robustness, the authors added uniform noise from Unif[-a, a] to test inputs, with a = 3 as the strongest level, using a classifier trained without dropout. GELU classifiers matched or exceeded the robustness of ELU and ReLU classifiers as the noise grew.
MNIST autoencoder and learning-rate sensitivity
The second test trains a deep autoencoder on MNIST with layer widths 1000, 500, 250, 30, 250, 500 and 1000, optimized with Adam at batch size 64. At a learning rate of 0.01, ELU diverged and GELU and ReLU converged poorly.
GELU performed well at both 1e-3 and 1e-4, and the authors report that it outperforms the other nonlinearities here. The authors interpret this as GELU accommodating a range of learning rates.
Tweet tagging and TIMIT frame classification
The tweet tagger is a two-layer network with 256 neurons per layer and pretrained word vectors, and its input joins the word with its left and right neighbours. It was trained on POS-annotated tweets with 25 tags, using a dropout keep probability of 0.8. The median test set error was 12.57% for GELU, 12.67% for ReLU and 12.91% for ELU. The three scores sit close together, so this task shows GELU matching the others rather than pulling far ahead.
TIMIT frame classification used a five-layer, 2048-neuron classifier with dropout rate 0.5, taking 11 frames as input to predict the center frame's phone. The median test error at the lowest validation error was 29.3% for GELU, 29.5% for ReLU and 29.6% for ELU. GELU is ahead again, in the same order as on the tweet task, though the margins are small.
CIFAR classification with a shallow and a wide network
On CIFAR-10 the authors used a 9-layer network with batch normalization and no data augmentation, trained with Adam for 200 epochs. The median error rate was 7.89% for GELU, 8.16% for ReLU and 8.41% for ELU, each a median of three runs.
For CIFAR-100 the authors used a 40-layer wide residual network with widening factor 4, trained for 50 epochs with Nesterov momentum and dropout keep probability 0.7. They changed the block to Conv-Activation-Conv-Activation-BatchNorm, reasoning that this suits ELUs, which had been reported to have exploding gradients in residual networks.
The median error was 20.74% for GELU, 21.77% for ReLU and 22.98% for ELU. The authors also cite 22.89% for the original 40-4 WideResNet with ReLU from prior work, which was not run under their changed setup.
Why the curve shape matters
For mean 0 and a standard deviation tending to zero, GELU becomes ReLU, and the two are asymptotically equal. The authors view GELU as a smoothed ReLU, where the Gaussian cumulative distribution function replaces the binary step, much as the sigmoid smoothed early threshold units. Unlike ReLU, GELU takes negative values, as ELU does.
GELU is non-convex and non-monotonic, with curvature at every point, while ReLU and ELU are convex, monotonic and linear for positive inputs. The authors suggest this extra curvature may let GELU approximate complicated functions more easily, but this is a hypothesis rather than a tested result. ReLU gates by sign, whereas GELU weights each input by how large it is relative to other inputs.
The SiLU variant \( x\sigma(x) \) performed worse than GELU but usually better than ReLU and ELU. The authors give two practical notes: use momentum, and use a close approximation to the Gaussian cumulative distribution function rather than the sigmoid itself.
Limitations
Only mean 0 and standard deviation 1 were tested, and most results are medians of three or five runs. No learnable mean or standard deviation was tested.
LReLU was left out because it resembles ReLU, so the baselines are ReLU and ELU. The CIFAR-100 ELU and ReLU numbers come from a changed block design, and the 22.89% reference is not a matched run. Tasks beyond the MNIST, tweet, TIMIT and CIFAR experiments were not tested.
The conclusion says GELU exceeded ReLU and ELU consistently on the datasets evaluated. The approximations trade exactness for speed, and the tanh form was used throughout.
Paper info
- Authors
- Dan Hendrycks, Kevin Gimpel
- Venue
- arXiv · Preprint
- First published
- 2016-6-27
- Added
- 2026-11-6
- Updated
- 2023-6-6
- Version
- v5
- arXiv
- 1606.08415
- Category
- cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Dan Hendrycks, Kevin Gimpel (2016). Gaussian Error Linear Units (GELUs). arXiv:1606.08415v5. https://arxiv.org/abs/1606.08415v5
BibTeX
@misc{hendrycks2016gaussian,
title = {{Gaussian Error Linear Units (GELUs)}},
author = {Dan Hendrycks and Kevin Gimpel},
year = {2016},
eprint = {1606.08415},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1606.08415v5}
}