SDE & MLE Prep

Training Tricks & Debugging

Q: Your model doesn't train. How do you debug it?

  1. Overfit a tiny batch first — if you can't reach ~0 loss, there's a bug (labels, loss, data pipeline, frozen params).
  2. Check inputs: normalization, shuffled labels, augmentation bugs, data leakage.
  3. Learning rate: run an LR range test; use warmup + decay; watch for loss spikes/NaNs.
  4. Monitor gradient norms, activation statistics, dead units; use gradient clipping.
  5. Compare against a simple baseline; check the initial loss (ln(num_classes) for CE).
  6. Scale up gradually: more data/model/epochs only after the small setup works.

Efficiency: mixed precision (bf16/fp16 + loss scaling), gradient accumulation, gradient checkpointing (trade compute for memory), data/tensor/pipeline parallelism, ZeRO/FSDP sharding.