The Activation Function article closed by naming the specific function this phase has been building toward: the one that became the practical, near-universal default across modern deep learning. That function is ReLU.
The simple definition
ReLU (Rectified Linear Unit) is an activation function that passes positive values through completely unchanged, and turns any negative value into exactly zero. It’s about as mathematically simple as an activation function can be:
ReLU(x) = max(0, x)
In plain terms: if the input is positive, output the exact same number; if the input is zero or negative, output zero. That’s the entire function — no curves, no smooth squashing, just a hard cutoff at zero.
flowchart LR
A[Input: 5.4] --> B{Positive or negative?}
A2[Input: -3.1] --> B
B -->|Positive| C[Output: 5.4, unchanged]
B -->|Negative or zero| D[Output: 0]
Why something this simple became the industry default
Recall from the Activation Function article that sigmoid and tanh were the historically popular choices before ReLU. Both share a real, serious weakness directly connected to the vanishing gradient problem first introduced in the Backpropagation article: for very large or very small inputs, sigmoid and tanh’s curves flatten out almost completely — meaning the gradient calculated at those points is extremely close to zero. Recall from the Gradient and Backpropagation articles that training relies entirely on gradients to know which direction to adjust weights; a near-zero gradient means a near-zero update, meaning that part of the network essentially stops learning. In a genuinely deep network — many layers, as covered in the Hidden Layer article — this problem compounds across layers, making very deep sigmoid- or tanh-based networks extremely difficult to train effectively.
ReLU largely sidesteps this. For any positive input, ReLU’s gradient is a clean, constant 1 — no flattening, no shrinking, full gradient signal passed straight through. This single property, more than anything else, is why ReLU enabled training genuinely deep networks that had been impractically difficult to train well with sigmoid or tanh.
ANALOGY vs. TECHNICAL REALITY
Analogy: Think of a one-way valve in a pipe. Water flowing in the allowed direction passes through completely unrestricted, at full pressure. Water trying to flow the wrong direction is blocked entirely — not slowed down gradually, just stopped outright. ReLU behaves the same way with numbers: positive values pass through at full strength, negative values get shut off completely.
Where this breaks down: A physical valve is a mechanical object with real, gradual friction and wear. ReLU is a perfectly sharp, instantaneous mathematical cutoff — there’s no partial, in-between state the way a real valve might partially restrict flow; a value is either passed through completely unchanged or reduced to exactly zero, nothing in between.
The real, well-documented history behind this choice
This isn’t a purely theoretical improvement — it has a specific, well-documented origin point worth knowing. ReLU was proposed as an activation function around 2010, but it became genuinely famous after being used in AlexNet, the deep convolutional neural network that won the 2012 ImageNet competition by a dramatic margin — the same landmark result mentioned in the Dropout article, where dropout also played a role. AlexNet’s use of ReLU, instead of the traditional tanh and sigmoid functions, was specifically credited as one of the key factors that made training its unusually deep architecture practical, and the technique spread rapidly across the field afterward, becoming the standard default for hidden layers in the years since.
A real, genuine limitation: the “dying ReLU” problem
It’s worth being honest about ReLU’s own real weakness, not just its advantage over sigmoid and tanh. Because ReLU outputs exactly zero for any negative input, and its gradient at that point is also exactly zero, a node can occasionally get stuck: if its weights end up producing consistently negative outputs, it stops contributing any gradient signal at all, and — since gradient descent has nothing to work with — it may never recover, effectively becoming a permanently “dead,” useless node in the network. This well-documented issue, called the dying ReLU problem, is a genuine, real trade-off that comes with ReLU’s simplicity, and it’s part of why several variants have been developed since — Leaky ReLU, which allows a small, non-zero output for negative inputs instead of a hard zero, and GELU, a smoother variant used in models like BERT and confirmed as part of the architecture in several modern large language models, both designed specifically to reduce this dying-node risk while keeping most of plain ReLU’s core benefits.
ReLU as a gate, one number at a time
ReLU follows one tiny rule:
ReLU(x) = max(0, x)
flowchart LR
A[Input x] --> B{x is greater than 0?}
B -->|Yes| C[Output x unchanged]
B -->|No| D[Output 0]
For a vector, ReLU is applied independently to every value:
Before ReLU: [-1.4, 0.0, 0.59, 2.3]
After ReLU: [ 0.0, 0.0, 0.59, 2.3]
In the loan network, both hidden pre-activations—0.59 and 0.58—are positive, so ReLU passes both through unchanged. If the first node had produced -0.20, its output would instead be zero.
What ReLU does during backpropagation
Backpropagation needs the activation’s slope:
For x > 0, ReLU slope = 1 → gradient can pass backward
For x < 0, ReLU slope = 0 → gradient stops at that activation
At exactly zero, implementations choose a conventional derivative, commonly zero. The zero-gradient side explains the dying ReLU problem: if a node remains negative for all its inputs, it keeps outputting zero and may stop receiving useful weight updates.
Common alternatives include Leaky ReLU, which keeps a small slope for negative inputs, and smooth activations such as GELU, widely used in Transformer architectures. ReLU is important and common, but it is not the default choice for every modern architecture.
A concrete example, layered
Simple example: two inputs through ReLU
For a positive pre-activation:
Input to ReLU = 3.2
Output = max(0, 3.2)
= 3.2
For a negative pre-activation:
Input to ReLU = -1.7
Output = max(0, -1.7)
= 0
The positive signal passes through unchanged. The negative signal contributes zero to the next layer for that particular example.
Historic production-scale example: AlexNet
AlexNet’s landmark 2012 ImageNet system used ReLU throughout its hidden layers. The published research reported that ReLU-based units trained several times faster than tanh-based units under its comparison.
That measured training advantage helped establish ReLU as a practical default across much of deep learning. Modern architectures may use ReLU, GELU, SiLU, or gated variants depending on their design.
Focused infographic: ReLU compared with a smooth Transformer activation
flowchart LR
A[Negative input] --> B[ReLU: exactly 0]
A --> C[GELU: usually small, smoothly scaled value]
D[Positive input] --> E[ReLU: pass value through]
D --> F[GELU: smoothly scale toward the value]
This is a conceptual comparison, not a claim that the functions produce identical positive outputs. ReLU has a sharp corner at zero; GELU changes smoothly.
Real-model connection: ReLU teaches the idea, GPT-2 uses GELU
The public GPT-2 model code applies GELU inside its feed-forward block. This does not make ReLU outdated. ReLU remains widely used, especially in many convolutional and ordinary feed-forward networks, while Transformer families commonly use GELU or gated variants.
Classic hidden node: weighted sum → ReLU → output
GPT-2 feed-forward unit: linear projection → GELU → linear projection
The shared principle is nonlinearity. The specific function is chosen to fit the architecture and training behavior.
Common misconception
A frequent beginner assumption: that ReLU, being so mathematically simple, must be a less sophisticated or lower-quality choice than smoother options like sigmoid or tanh. As this article has shown, the opposite is closer to true in practice — ReLU’s very simplicity is exactly what solves the vanishing gradient problem that made deep sigmoid- and tanh-based networks so hard to train well, and its computational cheapness (a simple comparison and pass-through, versus sigmoid’s more expensive exponential calculation) makes it faster to compute at scale, too. Simplicity here is a genuine engineering advantage, not a compromise.
Closing out this phase
This article completes the Neural Networks phase, and it’s worth tracing the full anatomy it built up: a Neural Network is made of Nodes, each performing a weighted sum, bias, and activation calculation; nodes group into Layers; an Input Layer holds raw data, Hidden Layers progressively transform it into increasingly abstract representations, and an Output Layer converts that representation into a usable prediction; and the Activation Function applied inside every node — commonly ReLU — is what makes all of that layered depth mathematically meaningful in the first place. From here, the glossary is ready to move into Deep Learning proper, and the specific architectures — like the Transformer referenced throughout earlier phases — that put all of these pieces together into today’s most capable AI systems.
In one sentence
ReLU is a strikingly simple activation function — pass positive values through, zero out negatives — that solved a real, well-documented training problem and became, since its breakthrough use in AlexNet in 2012, the practical default activation function across most of modern deep learning.
Related Terms
- Author
- TechByteByByte Editorial Team
- Reviewed by
- TechByteByByte Admin
- Published
- Last reviewed