PROFESSIONAL-MACHINE-LEARNING-ENGINEER · Question #230
Your company manages an ecommerce website. You developed an ML model that recommends additional products to users in near real time based on items currently in the user's cart. The workflow will…
The correct answer is A. Write a Cloud Function that loads the model into memory for prediction. Configure the function to. To achieve near real-time predictions with minimal latency and model update effort for an e-commerce recommendations model, a Cloud Function configured to load the model into memory and triggered by Pub/Sub is highly efficient.
Question
Options
- AWrite a Cloud Function that loads the model into memory for prediction. Configure the function to
- BCreate a pipeline in Vertex AI Pipelines that performs preprocessing, prediction, and
- CExpose the model as a Vertex AI endpoint. Write a custom DoFn in a Dataflow job that calls the
- DUse the RunInference API with WatchFilePattern in a Dataflow job that wraps around the model
How the community answered
(48 responses)- A83% (40)
- B10% (5)
- C2% (1)
- D4% (2)
Why each option
To achieve near real-time predictions with minimal latency and model update effort for an e-commerce recommendations model, a Cloud Function configured to load the model into memory and triggered by Pub/Sub is highly efficient.
Cloud Functions are ideal for event-driven, low-latency, real-time prediction scenarios, as they can load the model into memory for warm instances, reducing prediction latency. They are easily triggered by Pub/Sub messages and support seamless model updates via function deployment, minimizing operational effort.
A Vertex AI Pipeline is for orchestrating ML workflows (training, evaluation), not typically for low-latency, real-time online inference serving.
While a Vertex AI Endpoint is suitable for real-time predictions, using a Dataflow job to call it would introduce unnecessary overhead and complexity for single-item, event-driven predictions, potentially increasing latency.
The RunInference API with WatchFilePattern in a Dataflow job is primarily for batch or streaming inference, adding significant overhead and latency compared to a direct serverless function for near real-time, single-item predictions.
Concept tested: Serverless real-time inference with Cloud Functions
Source: https://cloud.google.com/functions/docs/tutorials/calling-pubsub
Topics
Community Discussion
No community discussion yet for this question.