Activation Functions & Vanishing Gradients
Q: Why ReLU? What are vanishing/exploding gradients?
| Activation | Formula | Notes |
|---|---|---|
| Sigmoid | 1/(1+e^{−x}) | saturates → gradients ≤ 0.25 vanish; outputs not zero-centred; use for binary outputs/gates |
| Tanh | (eˣ−e^{−x})/(eˣ+e^{−x}) | zero-centred, still saturates |
| ReLU | max(0, x) | cheap, no saturation for x>0; "dead ReLU" units |
| Leaky ReLU / ELU | small slope for x<0 | avoids dead units |
| GELU / SiLU (Swish) | x·Φ(x), x·σ(x) | smooth; standard in transformers |
Deep chains multiply many Jacobians: norms below 1 → vanishing, above 1 → exploding. Fixes: ReLU-family activations, careful initialization (Xavier/Glorot for tanh, He/Kaiming for ReLU), normalization layers, residual connections (gradient highway), gradient clipping (exploding, esp. RNNs), LSTM/GRU gating.