Unit 8 of 8 · about 5 hours · measure

Diagnosing failed runs: divergence, stale state, slices and seeds

Loss curves alone never name the broken mechanism. Diagnosis is a designed experiment per failure, and this unit turns the section checkpoint into a repeatable drill.

You'll be able to

  • Localize flat, diverging, NaN and eval-gap failures to objective, optimization, state or data causes using competing controls.
  • Instrument the first invalid value and per-slice errors, and report seed variation instead of single-run conclusions.
  • Repair a failing compact run, add a regression test, and defend the configuration with measured evidence.

Covers

Nonlearning, divergence, NaN and Inf diagnosisTrain-evaluation mismatch and stale stateLearning curves, per-slice errors and seed variation
1

Read

In this order, only the parts listed

0 of 4 done

  1. Error sources and learning curvesUnderstanding Deep Learning - fitting, gradients and regularization

    Chapter 8, Sections 8.1 through 8.3 (pp. 118 to 126): training a simple model, sources of error, and reducing error

    Read Sections 8.1 through 8.3. Skip double descent in 8.4 here.

  2. Overfitting, interpolation and early stoppingD2L - optimization and regularization slice

    Revisiting Overfitting and Regularization, Early Stopping, and Classical Regularization Methods for Deep Networks

  3. Debugging optimization failuresDeep Learning Tuning Playbook FAQ: debugging optimization failures

    FAQ How can optimization failures be debugged and mitigated: Identifying unstable workloads, Potential fixes, Learning rate warmup, Gradient clipping

  4. Train and eval state revisitedD2L - optimization and regularization slice

    Batch Normalization During Prediction and Dropout in Practice, revisited with a stale-state lens: frozen statistics, eval mode, and what a mode gap proves

2

Focus on

  • Flat from the start means no learning signal: check objective wiring and LR scale before touching the architecture. Diverging or NaN means too much update: halve the LR, enable clipping, then bisect to the first invalid op.
  • An eval gap that vanishes in eval mode was stale state, not overfitting. Compare modes before comparing curves.
  • Aggregate metrics hide slice failures. Cut errors by source, length or class, and rerun the fix on a second seed; one seed proves nothing about stability.
  • Patience-based early stopping needs a no-improvement threshold and a fixed budget. Without both, stopping decisions are hindsight.
Common mistakes · 3
  • Reading any falling training loss as progress. Memorization falls too; only held-out slices and controls tell fitting from learning.
  • Fixing NaN by switching to float64 or adding an somewhere. Either can hide the first invalid op; find it first, then decide between learning rate, clipping, initialization and objective order.
  • Reporting the best of many seeds as the result. Report the spread across at least two seeds, with the same seeds for the baseline and the fix, before claiming a fix.
3

Try it yourself

Closed-book, before checking anything

Closed-book, write the five-branch drill: flat, diverging, NaN or Inf, eval gap, noisy plateau. For each, name the first measurement, the control that splits two causes, and the fix you try first.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Loss is exactly flat from step 0 with a nonzero learning rate. Name three causes and the two measurements that split them.Answer

    Gradients are zero (broken or detached graph, dead units); gradients are nonzero but parameters do not move (optimizer built on other parameters, zero_grad between backward and step, a missing step); or parameters move but the loss ignores them (loss computed from a detached tensor or from the targets). Log the gradient norm and the parameter-update norm per step.

  2. 2.Loss explodes to NaN at step 200 after falling. What is the ordered response?Answer

    Halve the LR and rerun to test update scale; enable global-norm clipping; log the first step whose activations or gradients go non-finite and inspect that op's inputs. Change one thing per rerun.

  3. 3.Eval error exceeds train error only when dropout and batch norm are in training mode. Diagnosis?Answer

    Stale evaluation state, not overfitting. Eval must use frozen statistics with dropout off; the gap measures mode mismatch until modes are fixed.

  4. 4.A fix works on seed 0 but fails on seed 1. What do you conclude and what next?Answer

    The fix is not established; seed variation dominates. Rerun both configs on at least two more seeds and compare means and spreads before keeping it.

You're done when

Given a fresh failing run, you name the branch, run its control, repair it and show the fix holding on a second seed.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 9 more in the section
  • Understanding Deep Learning - fitting, gradients and regularizationSimon J. D. Prince · primary

    Use Chapters 6-9 and targeted parts of Chapter 20 for optimization, initialization, measurement, regularization and why training works. Re-derive the update rules you keep in the trainer.

  • D2L - optimization and regularization sliceD2L authors · required

    Use MLP implementation, dropout, deep generalization, numerical stability, optimization introduction, SGD, minibatch SGD, momentum, AdaGrad, RMSProp, Adam and learning-rate scheduler. Implement momentum, AdamW, initialization, dropout, one normalization, clipping and one schedule.

  • Deep Learning Tuning Playbook FAQ: debugging optimization failuresGoogle Research · reference

    Read How can optimization failures be debugged and mitigated (identifying unstable workloads, warmup, clipping) and Batch normalization implementation details.

Also in this section