Courseiva
mediumMultiple Choice

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

    Gradient accumulation lets the engineer shrink the per-step batch to 8, cutting activation memory below the GPU limit, while four accumulation steps preserve the effective batch size of 32. This resolves the CUDA out-of-memory failure without changing instance type or cost.

  • ✗

    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

    Spot Training merely discounts compute; it does not increase GPU memory, and the CUDA out-of-memory error persists on the larger instance at the same batch size and sequence length. Spot capacity is tempting for cost reduction, but the constraint is per-GPU memory, addressed by reducing batch size or sequence length.

  • ✗

    Switch to a CPU-based instance like ml.c5.2xlarge to avoid GPU memory constraints.

    Why it's wrong here

    CPU instances lack the CUDA architecture the Hugging Face estimator's GPU-enabled training container requires, so fine-tuning BERT cannot proceed and training time balloons. It is tempting because CPU instances sidestep GPU memory limits, and they suit small-scale inference or shallow scikit-learn workloads where GPU acceleration offers no benefit.

  • ✗

    Reduce the maximum sequence length to 128 tokens to lower memory consumption.

    Why it's wrong here

    Truncating sequences to 128 tokens discards most review text, degrading sentiment accuracy, and the stem fixes 512 as the required input length. It is tempting because shorter sequences genuinely cut activation memory, and this works when downstream tasks tolerate truncated context, such as short headline classification.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

Courseiva writes every MLA-C01 question from scratch — 665 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 →

How Courseiva writes practice questions · Editorial policy

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.