KatInterview

Diagnosing and Fixing Stalled Optimization in Deep Networks

Machine LearningModel answer
HardModel answerMachine Learningoptimizationdeep-learningdebugging

Last updated

Identify why gradient descent halts at high loss and apply targeted fixes for saddles, poor conditioning, vanishing gradients, or true minima.

You're optimizing a deep neural network for time-series prediction. Training halts: the loss plateaus far above your target, and the gradient norm ||∇L(θ)||₂ falls below 1e-5.

The immediate assumption is that the optimizer is "stuck in a bad local minimum." But in high-dimensional non-convex landscapes, early stalling has several distinct root causes:

  • Saddle points or flat regions with near-zero gradients but escape directions available
  • Pathological curvature: steep, narrow valleys where the optimizer oscillates instead of descending
  • Vanishing gradients from deep architecture or saturated activations
  • Hyperparameter decay that dropped the learning rate prematurely
  • Implementation errors like broken gradient flow or numerical instability

Your task is to build a systematic diagnostic and remediation plan.

Part 1: Diagnostic Protocol

Design a testing procedure to distinguish between these failure modes. Specifically:

  • Curvature analysis: How do you check whether you're at a saddle point, a flat plateau, or a genuine local minimum—without computing an intractable full Hessian matrix in high dimensions?
  • Conditioning assessment: How do you detect whether the loss surface is poorly scaled or ravine-shaped, causing the optimizer to waste steps oscillating rather than progressing?
  • Gradient health vs. hyperparameter issues: How do you determine if gradients are vanishing due to model architecture versus an overly aggressive learning-rate schedule?

Part 2: Targeted Interventions

For each diagnosed root cause, propose concrete algorithmic or architectural changes:

  • Trapped near a saddle with exploitable negative curvature
  • Navigating a narrow, ill-conditioned region
  • Suffering from vanishing or exploding gradients in deep layers
  • Genuinely stuck in an isolated basin with high loss

Structure your answer with practical metrics, computational costs, and specific remedies tied to each diagnosis.

Hints

Hint 1

Check for implementation bugs and scaling issues before analyzing optimization geometry—broken gradient flow or unnormalized inputs are common and cheap to rule out.

Hint 2

Use Hessian-vector products to probe curvature in O(d) memory via power iteration or Lanczos; the sign and magnitude of extreme eigenvalues reveal saddles versus flat regions.

Hint 3

Compare layer-wise gradient norms and update ratios across depth; exponential decay toward early layers signals architectural vanishing, while uniformly tiny updates point to learning-rate starvation.