Rectified Linear Unit

A simple activation function that keeps positive values and turns negative values into zero.

The rectified linear unit (ReLU) is a simple activation function that leaves positive values alone and turns negative values into zero. It became important because deep networks needed a cheap way to add nonlinearity without the training slowdown that older saturating activations such as sigmoid or tanh often caused.

At a glance

Released

January 2010

Authors

Vinod Nair, Geoffrey E. Hinton

Optimizes

  • Activation Sparsity

What It Is

The rectified linear unit (ReLU) is an activation function used in many neural networks. It applies one simple rule to each value: keep positive numbers and replace negative numbers with zero. In transformer feed-forward layers, that rule decides which hidden features stay active before the layer projects back to the model width.

Why It Exists

ReLU exists because neural networks need nonlinearity to model the curved, conditional patterns that show up in real data. Without an activation rule like this, stacked linear layers still collapse into one linear transform. ReLU also became popular because it gave that nonlinearity in a very cheap form that often trained more easily than older saturating activations such as sigmoid or tanh, helping deeper models reduce training loss more reliably.

How It Works

ReLU works one value at a time. If the value is positive, it stays as it is. If the value is negative, it becomes zero. In a transformer feed-forward layer, the model first expands into a wider hidden state, applies that rule to each hidden value, and then projects the filtered result back down.
Activation Curves
f(x)
x
  • ReLU

Hidden State Activity Through ReLU

Hidden State Before ReLU
-303
Hidden State After ReLU
-303
These heatmaps show the same hidden state before and after ReLU. Negative cells collapse to zero, while positive cells keep their strength.

Math Or Compute Schema

The formula below shows the ReLU rule for one value at a time. The key detail is the hard cutoff at zero.
Rectified linear unit activation
ReLU(x)=max⁡(0,x)\mathrm{ReLU}(x) = \max(0, x)
xx
One input value before the activation rule is applied.

Compared To Nearby Modules

ReLU is the sharpest cutoff in this activation family. Leaky rectified linear unit keeps a faint negative path, while sigmoid linear unit smooths the whole transition instead of using a hard corner.
Comparison dimensionReLULeakyReLUSiLU
Negative branchClamp every negative hidden value to 0Keep a small slope alpha x for x < 0Shrink negative values smoothly with x sigma(x)
Transition shapeHard corner at 0Hard corner with a weak negative pathSmooth curve through 0
Main tradeoffVery simple and sparse, but it throws away all negative signalPreserves gradient on the negative side, but stays less smooth than SiLUSmoother hidden filtering, but less minimal than ReLU

Example Architectures

ReLU became famous in the wave of early deep vision and speech models that needed a simpler activation to train reliably. It still appears across many baseline architectures and educational examples, even though many newer language models now prefer smoother or gated feed-forward activations.

Limitations And Tradeoffs

Because every negative value becomes zero, ReLU can throw away weak negative evidence completely. That simplicity helps efficiency, but it also makes the activation less smooth and less expressive than many newer alternatives.

Why It Still Matters

ReLU still matters because it explains two core lessons in deep learning: models need nonlinearity to represent real-world structure, and the shape of that nonlinearity affects how well deep networks train. Even when newer models choose smoother or gated activations, they are still solving the same problem ReLU helped solve clearly and cheaply.

Tags

References

  1. Nair, Vinod, and Geoffrey E. Hinton. "Rectified Linear Units Improve Restricted Boltzmann Machines." ICML, 2010, https://www.cs.toronto.edu/~fritz/absps/reluICML.pdf.