What are vanishing and exploding gradients, and how do you fix them?
medium- In deep networks, chain-rule products can shrink toward zero (vanishing) or blow up (exploding), stalling learning.
- Fixes: better initializations (He for ReLU, Xavier for tanh), normalization (BatchNorm, LayerNorm), skip connections (ResNet), non-saturating activations (ReLU family), gradient clipping (for RNNs and large models), and appropriate learning rates.