How to Reconfigure Architecture for Real-Time ML Recommendations?
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 include the following processes: 1. The website will send a Pub/Sub message with the relevant data and then receive a message with the prediction from Pub/Sub 2. Predictions will be stored in BigQuery 3. The model will be stored in a Cloud Storage bucket and will be updated frequently You want to minimize prediction latency and the effort required to update the model. How should you reconfigure the architecture?
Community Votes
65% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The exam tests your ability to choose a low-latency serving architecture that avoids a separate endpoint, with the trap being that a Cloud Function appears simple but suffers from cold starts and Pub/Sub synchronous-response limitations.
The recommended answer is to use the RunInference API with WatchFilePattern in a Dataflow job, which minimizes prediction latency and simplifies model updates by loading the model directly into the pipeline and automatically reloading it when the Cloud Storage model changes. Community consensus strongly favors this approach (61 votes) over a Cloud Function alternative (33 votes).
Option A (Cloud Function loading the model into memory) is the most common wrong answer. It ignores Cloud Function cold start latency, memory/timeout limits, the inability to easily return a prediction synchronously via Pub/Sub, and the operational overhead of reloading the model on every function invocation when the model is updated frequently.
Community Discussion (8 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option D uses the RunInference API in an Apache Beam/Dataflow pipeline, which embeds the model directly in the stream processing job. This avoids the extra network call to a separate Vertex AI endpoint, reducing latency. The WatchFilePattern feature automatically detects changes to the model in Cloud Storage and reloads it without manual redeployment, meeting the requirement to minimize model update effort. Comments highlight Google's documentation stating that RunInference provides flexibility and portability, and that automatic model updates are a key advantage.Why the Other Options Are Wrong
Option A has severe limitations for near real-time synchronous predictions: Cloud Functions are event-driven and asynchronous, making it hard to return a prediction directly to the publisher; cold starts add latency, and memory limits restrict model size. Model updates would require reloading from GCS on each invocation or redeploying the function. Option B relies on Vertex AI Pipelines, which are designed for batch orchestration, not low-latency streaming. Option C introduces a custom DoFn that calls a Vertex AI endpoint, adding network overhead and requiring endpoint versioning and management; it also increases latency compared to in-pipeline inference.Community Comment Notes
Comments with 6 likes and 3 likes support D, citing Google's blog that RunInference is a better approach for streaming predictions. The 33 votes for A reflect the intuitive appeal of a serverless function, but commenters [2] and [4] overlook cold starts and Pub/Sub request-response limitations. One comment [5] appears to confuse D and C, but the official documentation and suggested answer confirm D as the best choice.Official Reference
Exam Strategy
When asked to minimize prediction latency and model-update effort, look for an option that performs inference inside the stream processing job and automatically watches for model changes in Cloud Storage. Avoid options that require a separate serving endpoint or manual redeployment, even if they appear simpler at first glance.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →