Skip to content
ML Academy

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

  1. Situation

    A deep plain network trains no better than a shallower one, or its early layers barely change from initialization.

  2. 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.

  3. 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.

  4. 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