MLA-C02

Free MLA-C02 practice questions

10 questions from our MLA-C02 practice tests, each with the correct answer and a written explanation. Read them with the answers shown, or switch to quiz mode and answer first.

Back to the MLA-C02 practice exams

Question 1 of 10, Data Preparation for ML and AI

A team is assembling 20,000 prompt-response pairs from several internal sources to fine-tune a model. Some pairs have empty responses, some are exact duplicates, and some contain toxic language copied from forum posts. Which approach BEST validates training data integrity before the fine-tuning job?

  1. AFine-tune on all pairs, then attach a Bedrock guardrail to the custom model's inference requests in production
  2. BPreprocess the data to drop empty and duplicate pairs and screen each pair with the Bedrock ApplyGuardrail API Correct answer
  3. CFine-tune on the raw pairs and rely on the fine-tuning job's validation loss to downweight broken examples
  4. DDeduplicate the pairs with an AWS Glue job and then increase the epoch count so that clean examples dominate

Answer and explanation: Data integrity checks belong before training: removing empty and duplicate pairs and screening content with ApplyGuardrail, which evaluates text without invoking a model, keeps the model from learning toxic or broken behavior. Validation loss is reported by the job but does not filter or downweight training examples. Deduplicating alone still leaves empty and toxic pairs, and extra epochs make the model memorize them more strongly. An inference-time guardrail filters outputs but leaves the toxic behavior learned in the model.

Question 2 of 10, Data Preparation for ML and AI

A team oversampled the minority class by duplicating rows and then randomly split the data into training and validation sets. Validation recall is excellent, but recall in production is poor. What is the MOST likely cause?

  1. ADuplicated minority rows landed in both splits and inflated validation recall Correct answer
  2. BProduction data has drifted away from the training distribution since the model was deployed
  3. CDuplicating rows shifted the predicted probabilities, so the threshold needs recalibration
  4. DThe validation split was too small, so its recall estimate had high variance

Answer and explanation: Resampling before splitting puts copies of the same minority records in both sets, so the model is evaluated on examples it memorized; resampling must be applied only to the training split. A small validation set adds variance but does not systematically inflate recall. Probability shift from oversampling affects calibration in both validation and production alike, so it does not explain the gap. Drift is possible but is not the most likely cause when the validation result was produced by leaked duplicates.

Question 3 of 10, Data Preparation for ML and AI

A model uses a 'country' feature with about 190 distinct values and a 'product_size' feature with the ordered values small, medium, and large. The model is a neural network. Which encoding approach is MOST appropriate?

  1. AUse one-hot encoding for product_size and ordinal encoding for country to keep the input layer small
  2. BUse ordinal encoding for both features so that each feature becomes a single compact integer column
  3. CUse an embedding or one-hot encoding for country, and ordinal encoding for product_size Correct answer
  4. DUse target encoding for both features, replacing each category with its mean label value

Answer and explanation: Country is nominal, so it should not be given an artificial order; one-hot or a learned embedding represents it correctly. Product size has a natural order, so ordinal encoding preserves that information compactly. Ordinal encoding country implies a meaningless ranking between countries, even if it keeps the input small. Target encoding both features discards product_size's natural order in favor of label means and risks target leakage without careful cross-fitting.

Question 4 of 10, ML Model and Foundation Model (FM) Development

A team is training a 70-billion-parameter model that does not fit in the memory of a single GPU, even with a batch size of 1. Which approach should the ML engineer use on SageMaker AI?

  1. AGradient accumulation over many micro-batches on a single large GPU
  2. BPure data parallel training with the full model replicated on every GPU
  3. CThe SageMaker model parallelism library with sharded or tensor parallelism Correct answer
  4. DMixed-precision training on one GPU with activation checkpointing

Answer and explanation: Model parallelism techniques, such as sharding parameters, gradients, and optimizer states or splitting tensors across GPUs, let a model larger than one GPU's memory train. Pure data parallelism replicates the full model, which still does not fit. Gradient accumulation reduces activation memory per step but does not shrink the weights and optimizer state. Mixed precision and checkpointing save memory but 70 billion parameters with optimizer states still exceed a single GPU.

Question 5 of 10, ML Model and Foundation Model (FM) Development

A team measures retrieval quality for its RAG system. For each test question, it knows which document chunk contains the answer. The relevant chunk appears in the top 5 results for only 55% of questions. Which metric is the team measuring, and what change would MOST directly improve it?

  1. AContext relevance; switch to a larger generation model
  2. BPrecision at 5; reduce top-k to 1
  3. CFaithfulness; lower the generation temperature to reduce drift
  4. DRecall at 5; improve chunking, embeddings, or add reranking Correct answer

Answer and explanation: The share of questions whose relevant chunk appears in the top k is recall at k (hit rate), a retrieval metric improved by better chunking, embeddings, hybrid search, or reranking. Faithfulness measures grounding of the answer, and temperature does not help retrieval. Precision at 5 measures the fraction of relevant results among the five, and returning one result lowers recall. A larger generator does not change which chunks are retrieved.

Question 6 of 10, ML Model and Foundation Model (FM) Development

A latency-sensitive application uses a large foundation model on Amazon Bedrock for intent classification of short user messages. Responses take too long, and costs are high. Accuracy of a smaller model in the same family was only slightly lower in evaluation. What should the ML engineer do?

  1. AKeep the large model and raise the temperature so that it commits to an intent label more quickly
  2. BKeep the large model and raise the maximum output tokens so that each classification completes in a single response
  3. CSwitch to the smaller model, or distill the large model into it, and validate accuracy on the evaluation dataset Correct answer
  4. DBuy Provisioned Throughput for the large model to lower the effective per-token price and guarantee capacity

Answer and explanation: Smaller models have lower latency and per-token cost, and distillation can recover accuracy close to the larger model for a narrow task; validating against the evaluation set confirms the tradeoff. More output tokens increase latency and cost. Temperature does not affect speed and adds randomness to classification. Provisioned Throughput guarantees capacity but is usually more expensive for variable traffic and does not reduce model latency the way a smaller model does.

Question 7 of 10, Deployment and Orchestration of ML and AI Workflows

A Bedrock agent must call an internal API that only the client application can reach because of network restrictions and user-specific credentials held in the browser session. The agent should decide when the API call is needed, but the application should perform the call. Which agent feature should the ML engineer use?

  1. AA knowledge base that stores periodic exports of the API responses as documents for retrieval
  2. BAn action group backed by a Lambda function in a public subnet that calls the internal API with a service account
  3. CAn action group backed by a Lambda function in the application's VPC that forwards the user's session token
  4. DAn action group with return of control, so the agent hands the action parameters back to the application Correct answer

Answer and explanation: Return of control makes the agent return the elicited action and parameters to the calling application, which executes the call with its own network access and the user's credentials and returns the result. A public-subnet Lambda function with a service account cannot reach the restricted API and does not use per-user credentials. Exported responses in a knowledge base are stale and are not an API call. Forwarding the browser session token to a Lambda function moves user credentials out of the client and still does not let the application perform the call as required.

Question 8 of 10, Deployment and Orchestration of ML and AI Workflows

A SaaS company has trained a separate small XGBoost model for each of 3,000 customers. Each model is invoked infrequently, and all models use the same framework container. The company wants to minimize hosting cost. Which deployment approach should the ML engineer choose?

  1. AA serverless endpoint per customer so that each scales to zero when idle
  2. BOne real-time endpoint per customer on the smallest ml.t2 instance type
  3. CA multi-container endpoint that hosts one container per customer model
  4. DA multi-model endpoint that loads models from Amazon S3 on demand Correct answer

Answer and explanation: Multi-model endpoints host many models that share one container on shared instances and dynamically load and cache them from S3, which suits thousands of infrequently used models. Thousands of separate endpoints multiply instance cost even on small instances. Multi-container endpoints support at most 15 containers and are meant for different frameworks. Thousands of serverless endpoints mean thousands of resources to deploy, update, and raise quotas for, plus cold starts on every infrequent call.

Question 9 of 10, Operating, Monitoring, and Securing ML and AI Solutions

A streaming chat application built on the Bedrock ConverseStream API sometimes shows responses that end mid-sentence. Logs show the stop reason max_tokens for those responses. What should the ML engineer do?

  1. AAdd a guardrail word filter for incomplete phrases so that truncated responses are blocked before they reach users
  2. BRaise the maxTokens inference parameter or request more concise outputs, and alarm when max_tokens stop reasons become frequent Correct answer
  3. CSwitch from ConverseStream to the non-streaming InvokeModel API, which returns the complete response only after generation finishes
  4. DLower the temperature to 0 so that the model produces shorter, more deterministic responses that finish within the limit

Answer and explanation: A max_tokens stop reason means the output was truncated by the token limit, so increasing the limit or shortening expected outputs fixes it, and monitoring the stop reason detects regressions. Temperature affects randomness, not the length limit. Non-streaming calls are subject to the same token limit and truncate the same way. Word filters block terms and do not affect length; blocking truncated answers still leaves users without a complete response.

Question 10 of 10, Operating, Monitoring, and Securing ML and AI Solutions

A customer support assistant must block users from entering credit card numbers into prompts so that the numbers never reach the model, and must mask any account numbers that appear in responses. Which guardrail configuration should the ML engineer apply?

  1. AA word filter containing the word account and common card number prefixes, which blocks any prompt or response containing them
  2. BA denied topic named credit cards with sample phrases, so that any conversation that mentions card payments is rejected by the guardrail policy
  3. CA sensitive information filter that BLOCKs credit card numbers on input, plus a custom regex entity that MASKs account numbers on output Correct answer
  4. DContent filters set to HIGH strength for hate, insults, violence, and misconduct on both the prompts and the model responses

Answer and explanation: Sensitive information filters can block or mask predefined PII types and custom regex patterns, with separate input and output behavior. Content filters address harmful categories such as hate or violence, not PII. A denied topic blocks whole discussions rather than specific number patterns and cannot mask anything. A word filter blocks ordinary text containing those terms and does not mask account numbers.