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.
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.
Where it appears
- Transcribe a short English recordingWav2Vec2 Base 960h2094M params
- Find beats and downbeatsBeat This! Small163.2M params
- Forecast a time seriesGranite TinyTimeMixer R216805K params
- Segment an object by clickingSlimSAM149.7M params
- Change how a voice speakstiny-voca134.5M params
- Fill a gap in ChineseBERT Base Chinese13102M params
- Find a caption that fits a photoTinyCLIP ViT-8M/161323M params
- Estimate depth from a photoDepth Anything V2 Small1225M params
- Classify text with your labelsXtremeDistil zero-shot613M params
- Find an answer in a passageDistilBERT SQuAD665M params
- Find the most relevant answerall-MiniLM-L6-v2623M params
- Track a subject between framesOpenCV VitTrack3174K params
- Ask a question about a tableGoogle TAPAS Tiny24.5M params
- Rerank search resultsMS MARCO TinyBERT-L224.4M params