Resolving SageMaker GPU OOM Errors: The Batch Size Solution
This MLS-C01 practice question tests your understanding of machine learning implementation and operations. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
2023-01-15 10:30:45,123 INFO - Training job started
2023-01-15 10:30:50,567 INFO - Epoch 1/10: loss=2.345, accuracy=0.45
2023-01-15 10:31:00,789 INFO - Epoch 2/10: loss=2.123, accuracy=0.52
2023-01-15 10:31:10,012 INFO - Epoch 3/10: loss=1.987, accuracy=0.58
...
2023-01-15 10:32:30,456 ERROR - OutOfMemoryError: CUDA out of memory. Tried to allocate 2.00 GiB (GPU 0; 15.90 GiB total capacity; 14.00 GiB already allocated; 1.50 GiB free; 14.10 GiB reserved in total by PyTorch)
2023-01-15 10:32:30,457 ERROR - Training terminated
Refer to the exhibit. A data scientist is training a PyTorch model on a SageMaker ml.p3.2xlarge instance (16 GB GPU memory). The training fails with the shown error. Which change should the scientist make to resolve the error?
Exhibit
2023-01-15 10:30:45,123 INFO - Training job started
2023-01-15 10:30:50,567 INFO - Epoch 1/10: loss=2.345, accuracy=0.45
2023-01-15 10:31:00,789 INFO - Epoch 2/10: loss=2.123, accuracy=0.52
2023-01-15 10:31:10,012 INFO - Epoch 3/10: loss=1.987, accuracy=0.58
...
2023-01-15 10:32:30,456 ERROR - OutOfMemoryError: CUDA out of memory. Tried to allocate 2.00 GiB (GPU 0; 15.90 GiB total capacity; 14.00 GiB already allocated; 1.50 GiB free; 14.10 GiB reserved in total by PyTorch)
2023-01-15 10:32:30,457 ERROR - Training terminated
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Reduce the batch size in the training script.
The error is an out-of-memory (OOM) condition on the GPU. Reducing the batch size directly decreases the memory footprint per training step, allowing the model to fit within the 16 GB GPU memory of the ml.p3.2xlarge instance. This is the most immediate and effective fix for a GPU memory exhaustion error in PyTorch.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
Read the scenario before looking for a memorised answer.
✗
Increase the number of instances to 2.
Why it's wrong here
More instances do not reduce per-GPU memory usage.
✗
Use SageMaker Managed Spot Training.
Why it's wrong here
Spot does not solve memory errors.
✗
Increase the number of epochs.
Why it's wrong here
More epochs will still run out of memory.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates may confuse distributed training (more instances) with reducing per-instance memory pressure, or assume cost-saving features like Spot Training address resource exhaustion, when in fact only reducing batch size directly lowers GPU memory usage.
Detailed technical explanation
How to think about this question
GPU memory is consumed by model parameters, gradients, optimizer states, and activations for each batch. Reducing batch size lowers the size of activation tensors stored during forward and backward passes, which is often the dominant memory consumer. In PyTorch, using `torch.cuda.empty_cache()` or gradient accumulation can also help, but batch size reduction is the most direct fix.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A startup's cloud architect reviews their monthly bill and notices costs are higher than expected for a long-running batch job. Switching from on-demand instances to Reserved Instances — or using Spot/Preemptible VMs — can reduce compute costs by up to 72 %. Questions like this test whether you understand the tradeoffs between commitment, flexibility, and cost across cloud pricing models.
Visual reference
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Machine Learning Implementation and Operations — This question tests Machine Learning Implementation and Operations — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Reduce the batch size in the training script. — The error is an out-of-memory (OOM) condition on the GPU. Reducing the batch size directly decreases the memory footprint per training step, allowing the model to fit within the 16 GB GPU memory of the ml.p3.2xlarge instance. This is the most immediate and effective fix for a GPU memory exhaustion error in PyTorch.
What should I do if I get this MLS-C01 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This MLS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLS-C01 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.