Diagnose Recurring Loss Spikes During Large Language Model Pretraining
Last updated: November 29, 2026
Quick Overview
Midway through a multi-week pretraining run on TPUs, the loss periodically spikes and sometimes fails to recover; lay out how you would diagnose the cause and what mitigations you would apply without restarting from scratch.
0
0
0 solved
Midway through a multi-week pretraining run on TPUs, the loss periodically spikes and sometimes fails to recover; lay out how you would diagnose the cause and what mitigations you would apply without restarting from scratch.
Large runs at Google DeepMind are expensive enough that on-call researchers must triage instability quickly, and interviewers use this scenario to see structured debugging under ambiguity. They want hypotheses ordered by likelihood, the telemetry that separates them, and safe interventions.
What the Interviewer Expects
- Separates data causes from optimization and numerical causes
- Names specific telemetry: per-layer gradient norms, attention logit magnitudes, Adam second-moment statistics, batch identifiers
- Checks for bad data shards by replaying the offending batches
- Proposes mitigations such as rollback and skip, lower learning rate, QK-norm, z-loss, epsilon changes
- Discusses bfloat16 overflow and precision of reductions
- Explains how to resume without corrupting optimizer state
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- How would you tell a bad batch from a genuine optimization instability?
- Why do attention logits grow over training, and how does QK normalization help?
- What is the risk of simply clipping gradients harder?
- How would you design automatic spike detection and rollback for future runs?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Facts to gather first: spike frequency and shape (sharp single-step jump versus slow climb), whether gradient norm spikes before or with the loss, whether it correlates with specific data shards or po...
Approach
Three hypothesis families. (1) Data: corrupted or degenerate batches, such as long runs of repeated tokens, binary junk, or a misformatted shard. Signature: spikes tied to specific batch ids, reproduc...