Skip to content
RED SAGSkills
mediumMachine Learning Engineer interview question

Your neural network loss is not decreasing. How do you debug it?

What the interviewer wants to hear

  • Check data and labels, input pipeline, normalisation
  • Try to overfit a tiny batch
  • Check learning rate, initialisation, loss function choice
  • Inspect gradients for vanishing or exploding values
  • Remove complexity and compare against a known baseline

Model answer

I start with the data. I look at a few batches to confirm inputs and labels match, are normalised and are not all the same, and that augmentation has not broken them. Next I try to overfit a tiny batch of 10 to 50 examples. If the model cannot drive loss close to zero on that, there is a bug in the model, loss or training loop. I check common mistakes: wrong loss for the task, applying softmax twice, forgetting optimizer.zero_grad(), or a frozen layer. Then I sweep the learning rate, since too high or too low are both common causes. I log gradient norms per layer to spot vanishing or exploding gradients, and use gradient clipping or better initialisation if needed. Finally I simplify: smaller model, no regularisation, and compare against a simple baseline to rebuild step by step.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Machine Learning Engineer questions