
ReLU Activation Function
Why Sigmoid saturation limits hidden layers, and how the ReLU activation function sets negative scores to zero while passing positive scores forward.
At the end of Lesson 1, we wrote the linear step for both layers of our network:
Before we can compute Layer 2, we need the activation step that completes Layer 1 () and provides the output for Layer 2 to compute on.
In Topic 3, we passed Layer 1's linear scores through the Sigmoid function () because those three neurons were the final outputs of our model—we needed each score compressed into a human-readable probability between and ( to ).
Now that Layer 1 is a Hidden Layer whose only job is to pass intermediate scores forward to Layer 2, should we keep using Sigmoid—or does a hidden layer need a different activation function?
The Problem With Sigmoid Inside a Hidden Layer
A human is no longer the audience of the hidden layer's output—the audience is Layer 2. Look at what happens when we pass 'Die Hard in Space''s three linear scores from Topic 3 () through Sigmoid:
Compare what Sigmoid does on each side of zero:
1. Below Zero (): The Floor Works
'Die Hard in Space' scored poorly on the Oscar neuron ().
For 'Die Hard in Space', having Oscar potential is just an added bonus—not the main goal of the movie. But if the Oscar neuron passed raw into Layer 2, lacking awards buzz would actively drag down the movie's greenlight score despite its strong commercial and international scores.
When a hidden neuron's score is negative (), we want it to output so it simply stays inactive—just as Sigmoid pushed down to .
2. Above Zero (): The Ceiling Destroys Positive Strength
'Die Hard in Space' scored strongly on Hit () and even higher on International ().
Passing both through Sigmoid squashes them flat against the probability ceiling ( and ). To Layer 2, and now look virtually identical ()—erasing the difference in how strongly those two neurons scored.
The Goal of Hidden Layer Activation
Inside a hidden layer, the goal is clear: keep the floor that zeroes out negative scores , but remove the ceiling so positive scores pass through unchanged.
The ReLU Activation Function
To create this one-way gate, modern neural networks use the ReLU activation function—short for Rectified Linear Unit. It simply replaces any negative score with and keeps positive scores at their actual values—written mathematically as ("keep whichever is larger between and "):

Computing the Hidden Layer Activations
In our studio's neural network, Layer 1 uses the exact same weight matrix and bias vector from Topic 3, but replaces Sigmoid with ReLU to compute the hidden activation vector :
Just like Sigmoid in Topic 3, is applied element-wise to each value in the linear score vector :
Using the linear score vectors we already computed in Topic 3, let's calculate the hidden layer activations for both scripts.
🎬 'Die Hard in Space': Hidden Layer Activation
| Hidden Neuron | Linear Score (z(1) = W(1)x + b(1)) | ReLU Rule (max(0, z(1))) | Activation (a(1)) | Neuron State |
|---|---|---|---|---|
| Hit | +7.5 | max(0, +7.5) | 7.5 | Active |
| Oscar | −8.5 | max(0, −8.5) | 0.0 | Inactive |
| International | +10.0 | max(0, +10.0) | 10.0 | Active |
Look at what ReLU hands off to Layer 2:
- Hit () and International () stay distinct: Both positive scores pass straight through, preserving the fact that International Appeal () scored higher than Commercial Hit ().
- Oscar () is inactive: Instead of passing a damaging negative score () forward, ReLU sets the negative Oscar score to . As far as Layer 2 is concerned, the Oscar neuron contributes nothing for this script.
🎬 'The Notebook 2': Hidden Layer Activation
| Hidden Neuron | Linear Score (z(1) = W(1)x + b(1)) | ReLU Rule (max(0, z(1))) | Activation (a(1)) | Neuron State |
|---|---|---|---|---|
| Hit | −3.5 | max(0, −3.5) | 0.0 | Inactive |
| Oscar | +0.5 | max(0, +0.5) | 0.5 | Active |
| International | 0.0 | max(0, 0.0) | 0.0 | Inactive |
Look at what ReLU hands off to Layer 2:
- Oscar () passes through: Only the Oscar neuron scored above zero (), passing forward to Layer 2.
- Hit () and International () are inactive: Whether a neuron scores well below zero like Hit () or lands right on zero like International (), ReLU outputs for both.
Comparing the Scripts After Hidden Layer Activation
Instead of passing every score forward indiscriminately or squashing large positive scores against a ceiling, a ReLU hidden layer acts as a selective filter—setting negative scores to while passing positive scores forward unchanged.