A company uses Amazon SageMaker to train a model. The training job fails with an 'OutOfMemory' error. The training data is stored in S3 and the instance type is ml.m5.xlarge. What is the most efficient way to resolve this issue?
Larger instance provides more memory.
Why this answer
The 'OutOfMemory' error indicates that the ml.m5.xlarge instance (4 vCPUs, 16 GiB memory) does not have enough RAM to hold the training data and model during processing. Upgrading to ml.m5.2xlarge (8 vCPUs, 32 GiB memory) directly increases available memory, resolving the issue without requiring code changes or architectural modifications. This is the most efficient solution because it requires no script alterations and leverages SageMaker's built-in instance scaling.
Exam trap
The trap here is that candidates often choose 'Reduce the batch size' (Option B) as a quick fix, but the question asks for the 'most efficient' solution—changing instance type requires no code changes and is faster to implement, whereas batch size reduction requires debugging and retesting the training script.
How to eliminate wrong answers
Option A is wrong because managed spot training reduces cost by using spare EC2 capacity but does not increase memory capacity; it can actually cause interruptions that exacerbate resource issues. Option B is wrong because reducing batch size decreases memory usage per step but may not resolve the OOM error if the model itself or the total dataset size exceeds instance memory; it also requires code changes and can slow convergence. Option C is wrong because increasing the number of instances via distributed training (e.g., data parallelism) does not increase the memory of a single instance; each instance still has only 16 GiB, so the OOM error would persist on each worker.