If a training run's loss diverges to infinity within the first ten steps, what is your initial debugging step?

Quick Overview

Describe how you would start debugging a training run whose loss diverges to infinity in the first ten steps. Tests checking the step-0 loss, confirming the applied learning rate, gradient norm and update ratio monitoring, input and loss sanity checks, and isolating the cause one component at a time.

If a training run's loss diverges to infinity within the first ten steps, what is your initial debugging step?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

If a training run's loss diverges to infinity within the first ten steps, what is your initial debugging step? ```hint Start before the first update What should the loss be at step 0 for a freshly initialized model, and what would it tell you if it is already far from that value? ``` ```hint One cheap experiment Think of a single change you can make in seconds that tells you whether the size of the updates alone explains the blow-up. ``` ### What a Strong Answer Covers - Why divergence this early points to a setup bug, and which measurements to take first - What the step-0 loss should be and what a wrong value implies - How to confirm the learning rate actually applied and test whether step size is the cause - Input, label and loss-function checks that can produce non-finite values - How to isolate the cause by simplifying the setup and adding pieces back ### Follow-up Questions - The original learning rate was tuned on 8 GPUs and the run now uses 64, and only a 10x lower rate is stable. What happened, and how do you fix it? - The run is stable in FP32 but diverges under FP16 mixed precision. What do you check? - How would you find the first layer or operation that produces a NaN? - When is gradient clipping a fix, and when does it hide a bug?

Overview: Describe how you would start debugging a training run whose loss diverges to infinity in the first ten steps. Tests checking the step-0 loss, confirming the applied learning rate, gradient norm and update ratio monitoring, input and loss sanity checks, and isolating the cause one component at a time.

PracHub logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

If a training run's loss diverges to infinity within the first ten steps, what is your initial debugging step?

What a Strong Answer Covers Guidance

  • Why divergence this early points to a setup bug, and which measurements to take first
  • What the step-0 loss should be and what a wrong value implies
  • How to confirm the learning rate actually applied and test whether step size is the cause
  • Input, label and loss-function checks that can produce non-finite values
  • How to isolate the cause by simplifying the setup and adding pieces back

Follow-up Questions Guidance

  • The original learning rate was tuned on 8 GPUs and the run now uses 64, and only a 10x lower rate is stable. What happened, and how do you fix it?
  • The run is stable in FP32 but diverges under FP16 mixed precision. What do you check?
  • How would you find the first layer or operation that produces a NaN?
  • When is gradient clipping a fix, and when does it hide a bug?