mediumMultiple ChoiceObjective-mapped
MLA-C01 Practice Question: A machine learning engineer is developing a text…
A machine learning engineer is developing a text classification model using Amazon SageMaker. The dataset consists of 1 million customer reviews, with labels indicating sentiment (positive, negative, neutral). The engineer uses a pre-trained BERT model from the Hugging Face Model Hub and fine-tunes it on the dataset using SageMaker's Hugging Face estimator with a ml.p3.2xlarge instance. After 2 hours of training, the training job fails with a 'ResourceExhaustedError: CUDA out of memory' error. The error occurs during the forward pass of the first epoch. The engineer confirms that the batch size is set to 32, the maximum sequence length is 512 tokens, and the dataset is stored in a S3 bucket in the same AWS region. The engineer needs to complete fine-tuning without increasing instance costs. Which course of action should the engineer take?
⚠ Common exam trap
Many candidates think reducing sequence length (Option D) is the simplest fix, but they overlook that it can severely impact model performance for sentiment analysis on long reviews, while gradient accumulation (Option A) is the standard technique to handle GPU memory limits without sacrificing batch size or accuracy.
Answer choices
Why each option matters
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 to 8 and enable gradient accumulation with 4 steps to maintain effective batch size.
Reducing the batch size to 8 directly lowers GPU memory usage per forward pass, and enabling gradient accumulation with 4 steps allows the model to simulate the original effective batch size of 32 (8 × 4 = 32) without increasing memory footprint. This approach resolves the CUDA out-of-memory error while keeping the same instance type (ml.p3.2xlarge) and without incurring additional costs.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Reduce the batch size to 8 and enable gradient accumulation with 4 steps to maintain effective batch size.
Why this is correct
Reducing batch size lowers GPU memory usage, and gradient accumulation allows the model to see the same number of samples per update without increasing memory.
- ✗
Enable SageMaker Managed Spot Training to reduce costs and use the savings to upgrade to a ml.p3.8xlarge instance.
Why it's wrong here
This increases instance costs (even with spot savings) and does not address the immediate out-of-memory error without additional configuration.
- ✗
Switch to a CPU-based instance like ml.c5.2xlarge to avoid GPU memory constraints.
Why it's wrong here
CPU instances are much slower for deep learning training and would extend training time significantly, potentially exceeding time budgets.
- ✗
Reduce the maximum sequence length to 128 tokens to lower memory consumption.
Why it's wrong here
Reducing sequence length may cause loss of important context in reviews, degrading model accuracy.
Visual reference
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
Courseiva writes every MLA-C01 question from scratch — 835 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLA-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 MLA-C01 exam.