MLS-C01 Question 180
Single answerA retail company wants to implement a machine learning system to recommend products to customers. The recommendation model is already trained and stored in Amazon SageMaker. The company needs to decide whether to use a batch or real-time inference approach. Their requirements are: 1) Recommendations need to be generated instantly when a customer visits the website, and 2) Latency must be minimal to ensure a seamless user experience. Which approach should they choose?
- A
Use batch inference with Amazon SageMaker Batch Transform to generate recommendations for all customers in advance.
- B
Use real-time inference with Amazon SageMaker endpoints to generate recommendations instantly for each visitor.
- C
Use batch inference with a custom script to periodically precompute recommendations and store them in Amazon S3.
- D
Use real-time inference by deploying the model to an Amazon EC2 instance and handling requests manually.
Show answer and explanation
Correct answer: B
Explanation
The company's requirements clearly indicate the need for real-time predictions with minimal latency for a seamless user experience. Amazon SageMaker endpoints are specifically designed for real-time inference, providing the necessary infrastructure for low-latency, on-demand predictions without requiring manual scaling or management. Batch inference, whether using SageMaker Batch Transform or custom scripts, is unsuitable as it precomputes predictions and does not meet the instant response requirement.
- A. Incorrect.
Batch inference with Amazon SageMaker Batch Transform is not suitable here because it generates predictions for a large dataset in one go, which does not meet the requirement of generating recommendations instantly for website visitors.
- B. Correct.
Real-time inference with Amazon SageMaker endpoints is the correct choice because it is designed for low-latency, on-demand predictions, perfectly aligning with the requirement for minimal latency and instant recommendations.
- C. Incorrect.
Batch inference with a custom script would still result in precomputed recommendations, which does not satisfy the need for generating predictions instantly on user visits.
- D. Incorrect.
While deploying the model to an Amazon EC2 instance could technically provide real-time inference, it requires significant manual effort to handle scaling, monitoring, and fault tolerance, which makes it less optimal compared to using SageMaker endpoints.