hardMultiple Choice
MLA-C01 Practice Question: A machine learning engineer is deploying a…
A machine learning engineer is deploying a pre-trained NLP model on Amazon SageMaker for real-time inference. The model expects input sequences of variable length, and performance is critical. The engineer wants to minimize latency while handling the variable-length inputs efficiently. Which approach should the engineer choose?
⚠ Common exam trap
AWS often tests the misconception that padding to the maximum length is always necessary or efficient, but the trap here is that dynamic batching with length-based grouping is a more sophisticated technique that balances batching efficiency with minimal padding overhead.
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
✓
Use dynamic batching with a custom inference script that groups requests by sequence length.
Dynamic batching with a custom inference script that groups requests by sequence length minimizes padding overhead and maximizes hardware utilization. By batching similar-length sequences together, the model avoids excessive padding to the maximum length in the batch, which reduces wasted computation and latency. This approach is particularly effective for variable-length NLP inputs on SageMaker, where the inference container can be customized to implement the grouping logic.
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 model size by pruning and quantization.
Why it's wrong here
Pruning and quantization reduce model size and can speed inference, but they do not handle variable-length sequences; padding or bucketing is required. They would be correct when the goal is shrinking a fixed-input model to cut memory and latency.
- ✗
Pad all input sequences to the maximum length in the batch.
Why it's wrong here
Fixed padding forces every sequence to the batch maximum, so shorter inputs waste compute on padding tokens and inflate latency. Dynamic padding per batch, or frameworks that pack variable-length sequences, avoids this. Padding remains the standard approach for offline batch scoring where throughput, not per-request latency, is the priority.
- ✓
Use dynamic batching with a custom inference script that groups requests by sequence length.
Why this is correct
Dynamic batching groups incoming requests into a single inference call, while the custom script sorts by sequence length so padding is minimised. This cuts per-request latency and GPU waste, directly addressing the variable-length input constraint without retraining or changing the model.
- ✗
Process each request individually to avoid padding overhead.
Why it's wrong here
Serialising each request forfeits batching, so the accelerator processes one sequence at a time and per-request latency rises sharply. The stem demands minimised latency with variable-length inputs, which sorted batching with dynamic padding delivers. Single-request processing suits low-volume debugging or strict isolation, not latency-critical real-time inference.
Go deeper
Related to this question
About these practice questions
One of 665 original MLA-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.