Neural networks

ReLU

/ RAY-loo /

ReLU is the simplest useful activation function imaginable, and it powers most of modern deep learning. The rule is one line: if the input is positive, pass it through unchanged; if it's negative, output zero. That's it. Picture a one-way valve — signal flows freely in the positive direction and is blocked entirely in the negative. Despite its plainness, this little bend is enough to give a network all the nonlinearity it needs.

Why did ReLU dethrone the smooth S-curves? Two reasons. First, it doesn't saturate on the positive side — for any positive input the slope is exactly 1, so the learning signal passes back through unweakened, dodging the vanishing-gradient problem that plagued sigmoid and tanh in deep networks. Second, it's dirt cheap to compute: just "keep it or zero it," with none of the costly curves of an exponential. Together these let researchers train networks far deeper than before, which is much of what made the deep-learning era possible.

ReLU isn't flawless. Because it outputs a flat zero for all negative inputs, a neuron can sometimes get stuck always outputting zero — a so-called "dead" neuron that never recovers, since zero output means zero learning signal. A common fix is leaky ReLU, which lets a small trickle through on the negative side (say, the input times 0.01) instead of a hard zero, keeping the neuron alive. Variants like this are everywhere, but the plain ReLU remains the sensible default.

Send the values -5, -0.1, 0, 2, and 100 through ReLU and you get 0, 0, 0, 2, and 100. Everything negative is flattened to zero; everything positive passes untouched. Leaky ReLU would instead turn -5 into -0.05 and -0.1 into -0.001 — a faint negative whisper that keeps those neurons from going permanently silent.

ReLU: keep positives, zero out negatives. Leaky ReLU lets a faint trickle through below zero.

ReLU is the standard default for hidden layers — but not for outputs. Use sigmoid or softmax at the output when you need probabilities. And watch for "dead" neurons stuck at zero; a too-large learning rate makes them more common.

Also called
rectified linear unitrectifierleaky ReLU修正线性单元整流线性单元線性整流單元