A team trains an image-and-text model. The loss spikes and then becomes NaN after a few hundred steps. Which change most directly improves training stability?
- Exam domain
- Core Machine Learning and AI Knowledge20% of the exam
- Difficulty
- Medium
- In this mock
- 10 questions on this domainPractise this domain
Why the exam asks this
Core Machine Learning and AI Knowledge (20% of the exam)
Objective in the exam guide: Control training stability in multimodal settings.
Multimodal training mixes encoders with different scales, so instability is common.
Why D is the answer
Lower the learning rate, add warmup and clip gradients
Loss spikes and NaNs usually mean exploding updates. A lower learning rate, a warmup period and gradient clipping keep updates bounded. Mixed-precision loss scaling also matters when FP16 is used.
Remember: Bound the updates: lower LR, warmup, clipping.
How it works
Training instability shows as loss spikes or NaNs. Learning rate schedules, warmup, gradient clipping, normalization and loss scaling control it.
Clues in the question
The words that point to the answer, and what each one tells you.
- becomes NaN
- Numeric overflow from exploding updates.
In detail
- Exploding gradients cause spikes and NaNs.
- Warmup, clipping and smaller steps are the first fixes.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Remove the validation set so training sees more dataWrong
Validation data does not affect stability.
B. Switch the text encoder off and train on images only, then add text back at the endWrong
Dropping a modality hides the problem and changes the task.
C. Raise the learning rate so training passes the spike fasterWrongMost tempting
A higher rate makes divergence worse.
Why it tempts: It sounds like pushing through, but larger steps diverge further.
D. Lower the learning rate, add warmup and clip gradientsRight
Bound the updates: lower LR, warmup, clipping.
Use case
An illustrative scenario, not a real incident.
Illustrative: adding 1,000 warmup steps and clipping gradient norm at 1.0 stops the spikes in a captioning model.
See it in different ways
stateDiagram-v2 state "Training" as s0 state "Loss spike" as s1 state "NaN" as s2 state "Restarted" as s3 state "Stable training" as s4 [*] --> s0 s0 --> s1: large update s1 --> s2: overflow s2 --> s3: lower LR, warmup, clipping s3 --> s4 s4 --> [*]
How to read this chart
- It starts at "Training".
- From "Training", "large update" moves it to "Loss spike".
- From "Loss spike", "overflow" moves it to "NaN".
- From "NaN", "lower LR, warmup, clipping" moves it to "Restarted".
- From "Restarted", it moves to "Stable training".
- It ends at "Stable training".
mindmap
root(("Training stability"))
n1["Optimizer"]
n2["Lower learning rate"]
n3["Warmup"]
n4["Gradients"]
n5["Clipping"]
n6["Precision"]
n7["Loss scaling for FP16"]
n8["Data"]
n9["Normalize inputs"]How to read this chart
- The centre is "Training stability".
- "Optimizer" covers "Lower learning rate", "Warmup".
- "Gradients" covers "Clipping".
- "Precision" covers "Loss scaling for FP16".
- "Data" covers "Normalize inputs".
Related questions
Learn more
- Our lesson: Deep learning foundations for multimodal models
- Practise Core Machine Learning and AI Knowledge questions in the mock exam
- Source: Train With Mixed Precision (NVIDIA Docs)
- Source: PyTorch documentation
- Fundamentals of Deep Learning (NVIDIA DLI)
- PyTorch documentation
- Deep Residual Learning for Image Recognition (arXiv)
- Transfer learning tutorial (PyTorch)