A neural network for tabular data runs out of GPU memory during training. Which technique reduces memory with little accuracy cost?
- Exam domain
- Machine Learning15% of the exam
- Difficulty
- Medium
- In this mock
- 7 questions on this domainPractise this domain
Why the exam asks this
Machine Learning (15% of the exam)
Objective in the exam guide: Using GPU memory-optimization techniques, such as batching and mixed precision, to train machine learning models
GPU memory optimization is named.
Why A is the answer
Use mixed precision and a smaller batch size
Mixed precision halves activation memory for most operations, and smaller batches reduce memory per step. Data can stream in batches.
Remember: Mixed precision and batch size control training memory.
How it works
Batching and mixed precision are GPU memory-optimization techniques for training.
In detail
- Mixed precision saves memory.
- Tune batch size to fit.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Use mixed precision and a smaller batch sizeRight
Mixed precision and batch size control training memory.
B. Switch all tensors to float64Wrong
float64 doubles memory.
C. Load the full dataset to GPU memory at onceWrong
Loading everything at once wastes memory.
D. Double the batch size so each step processes more rows and fewer steps are needed overallWrongMost tempting
Larger batches use more memory.
Why it tempts: Bigger batches are often faster.
Use case
An illustrative scenario, not a real incident.
Illustrative: mixed precision plus batch 512 instead of 2,048 fits on a 24 GB GPU.
See it in different ways
flowchart TD
Q{"Which lever?"}
Q -->|"Activations too big"| A0["Mixed precision"]
Q -->|"Batch too large"| A1["Smaller batch or gradient accumulation"]
Q -->|"Data too big"| A2["Stream batches"]How to read this chart
- At "Which lever?": if "Activations too big", go to "Mixed precision"; if "Batch too large", go to "Smaller batch or gradient accumulation"; if "Data too big", go to "Stream batches".
flowchart LR S0["Enable mixed precision"] --> S1["Lower batch size"] --> S2["Accumulate gradients"] --> S3["Stream data"]
How to read this chart
- Read it in order: Enable mixed precision, then Lower batch size, then Accumulate gradients, then Stream data.