Neural networks, deep learning, NLP · insight-0427
Diagnose vanishing gradients with per-layer gradient norms, then fix the architecture
- Evidence type
- documented fact
- Difficulty
- medium
- Roles
- ML engineer
- Industries
- cross-industry
Summary: situation, action, reason, boundary
Situation
A deep plain network trains no better than a shallower one, or its early layers barely change from initialization.
Action
Plot gradient norm per layer for the first few hundred steps. If early layers are orders of magnitude smaller, add residual connections, normalization, non-saturating activations or gated units before adding more depth.
Reason
Repeated multiplication through many layers or time steps shrinks gradients; residual paths give gradients a shorter route, which helps very deep residual networks train.
Boundary
Deep MLPs and CNNs, and RNNs over long sequences.
Symptom or risk
Gradients shrink as they flow backward, so early layers learn little; adding depth then adds cost without benefit.
Exceptions
Small differences between layers are normal; act on orders of magnitude, not on ratios of two or three.
Trade-offs
Residual and normalization layers add parameters and code paths that complicate exporting.
Pitfalls
Raising the learning rate to compensate, which explodes the later layers instead.
Lessons and concepts
Claims and their sources
Bengio, Simard and Frasconi showed that learning long-term dependencies with gradient descent is difficult because gradients vanish or explode.
He et al. showed residual connections make very deep networks trainable.