What is rectified linear unit (ReLU)?

ReLU is an activation function that turns negative inputs into zero and passes positive inputs unchanged, written f(x) = max(0, x).

It is also called the rectifier. It is the simplest and most common activation function. Unlike sigmoid and tanh it does not saturate for positive values, so vanishing gradients are much reduced in deep networks.

Topic
Machine learning, models and training
Also known as
Rectifier
Origin
popularised in 2010

How rectified linear unit (ReLU) works

  1. max(0, x) is applied to each input: −3 becomes zero and 2 stays 2.
  2. The derivative is 1 for positive values and 0 for negative ones (libraries usually use 0 at the undefined point zero), so gradients pass through active neurons without loss.
  3. Zeroing negatives switches off part of the neurons at once, making the representation sparse.
  4. A neuron that outputs zero for every input stops updating; variants such as leaky ReLU ease this dying neuron problem.

In more detail

He initialisation and preserving variance

Training deep ReLU networks relies on variance-preserving initialisation, most notably He (Kaiming) initialisation. Because ReLU zeroes roughly half of the activations, Xavier initialisation halves signal variance at each layer; drawing weights with a variance of two divided by the number of inputs keeps activations and gradients stable across deep stacks.

Quantisation and ReLU6

Because ReLU has no upper bound on positive outputs, activations can grow large enough to cause overflow or lost dynamic range in fixed-point or INT8 inference on edge hardware. Mobile and embedded models therefore often use ReLU6, which clamps outputs at 6.

Squared ReLU and activation sparsity

Beyond leaky ReLU and GELU, squared ReLU (the square of the ReLU output) has attracted renewed interest in sparse language model architectures. It keeps exact zeros for negative inputs, a sparsity that can save memory bandwidth, while offering a smoother curve for positive inputs.

Commonly confused terms

TermHow it differs
GELUGELU weights inputs smoothly by their Gaussian cumulative distribution instead of zeroing negatives sharply, which gives better gradient flow in Transformers and modern vision backbones like ConvNeXt.
SwiGLUSwiGLU is a gated activation block combining Swish (SiLU) with an element-wise gating projection, whereas ReLU is a parameter-free element-wise function. Most modern open-weight LLMs use SwiGLU in their FFN layers.
Leaky ReLU and PReLULeaky ReLU and PReLU apply a small non-zero slope (a fixed or learned coefficient times the input) for negative inputs so neurons keep receiving gradients instead of dying permanently at zero.

Why rectified linear unit (ReLU) matters for on-premises AI

ReLU played a key part in making deep networks practical to train in the early 2010s and remains common in classic convolutional networks, though recent vision models such as ConvNeXt use GELU or SiLU. Being just a comparison, it is the cheapest activation function, a clear advantage for small in-house models on CPUs and edge devices. Large language models mostly use smooth variants such as GELU or Swish-Gated Linear Unit, which cost slightly more but do better at language modelling.

ON-PREMISES EXAMPLE

A hospital uses ReLU in the convolutional network it relies on for medical image classification; the model trains quickly on the hospital's existing GPU and adds no compute overhead at inference.

Common questions

Why is ReLU used instead of sigmoid?

Sigmoid saturates for large values and its derivative nears zero, so gradients vanish in deep networks. ReLU does not saturate for positives and is very cheap to compute.

What is the dying neuron problem?

If a neuron's input stays negative, its output and derivative are always zero and it never learns again. Leaky ReLU prevents this with a small slope for negatives.

Sources

In the glossary: Glossary, R to Z

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.