Deploying Retrained ML Models for Real-Time Anomaly Detection on Dataflow?

PMLE By islever Editorial Last updated

Short answer

D Deploy a Dataflow streaming pipeline with the Runlnference API, and use automatic model refresh.

Question

Your work for a textile manufacturing company. Your company has hundreds of machines, and each machine has many sensors. Your team used the sensory data to build hundreds of ML models that detect machine anomalies. Models are retrained daily, and you need to deploy these models in a cost-effective way. The models must operate 24/7 without downtime and make sub millisecond predictions. What should you do?
  1. Deploy a Dataflow batch pipeline and a Vertex AI Prediction endpoint.
  2. Deploy a Dataflow batch pipeline with the Runlnference API, and use model refresh.
  3. Deploy a Dataflow streaming pipeline and a Vertex AI Prediction endpoint with autoscaling.
  4. Deploy a Dataflow streaming pipeline with the Runlnference API, and use automatic model refresh. Correct Answer

Key Takeaways

The question tests your knowledge of Dataflow's RunInference transform for real-time, in-pipeline ML inference and the automatic model refresh feature that handles daily retrained models seamlessly.

To deploy hundreds of daily retrained ML models that must run 24/7 with sub-millisecond predictions, the community recommends a Dataflow streaming pipeline using the RunInference API with automatic model refresh. This approach delivers real-time inference and model updates without redeploying the pipeline.

Common mistake: Choosing C (Dataflow streaming + Vertex AI Prediction endpoint) is the most common mistake. Test takers see 'streaming' and 'autoscaling' as sufficient, but a separate Vertex AI endpoint adds network latency that prevents true sub-millisecond predictions and does not natively automate model refresh for daily retraining.

Expert Analysis

Why the Answer Is Correct

Dataflow streaming pipelines process sensor data in real time, meeting the 24/7 and low-latency requirements. The RunInference API lets you call ML models directly inside the Apache Beam pipeline, avoiding the overhead of a separate prediction service. The automatic model refresh feature ensures that when models are retrained daily, the pipeline picks up the new version without redeployment. As comment [1] notes, this eliminates the need for separate endpoints and enables on-the-fly inference.

Why the Other Options Are Wrong

A and B use batch pipelines, which are not suitable for 24/7 continuous anomaly detection with sub-millisecond latency. C uses a streaming pipeline but relies on a Vertex AI Prediction endpoint; this introduces network round-trip latency and requires manual autoscaling configuration, making it less cost-effective for hundreds of models. Comment [3] incorrectly assumes online prediction requires Vertex AI endpoints, but RunInference provides a lower-latency, more integrated alternative. Comment [4] also picked C based on 'GCP solution' thinking, missing that RunInference is a GCP-native option.

Community Comment Notes

The majority of commenters (74 votes for D) emphasize real-time processing and automatic model refresh. Comment [5] specifically highlights that RunInference transform automatically updates the model handler, so you don't need to redeploy the pipeline. Comment [2] points out that 24/7 availability suggests streaming and recommends RunInference for the daily retraining loop. The minority (26 votes for C) often overestimates Vertex AI Prediction endpoints, but as comment [1] explains, RunInference inside Dataflow is designed exactly for this use case.

Official Reference

https://beam.apache.org/documentation/ml/about-ml/

This link opens the official vendor documentation in a new tab.

Exam Strategy

If a question requires 24/7 operation and sub-millisecond predictions for models retrained daily, choose a Dataflow streaming pipeline with RunInference and automatic model refresh. Remember that 'cost-effective' and 'no downtime' favor in-pipeline inference over a separate Vertex AI endpoint.

Community Votes

D
74%
C
26%

74% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 6 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 6

  1. fitri001 👍 8 Answered D
    why D? Real-time Predictions: Dataflow streaming pipelines continuously process sensor data, enabling real-time anomaly detection with sub-millisecond predictions. This is crucial for immediate response to potential machine issues. RunInference API: This API allows invoking TensorFlow models directly within the Dataflow pipeline for on-the-fly inference. This eliminates the need for separate prediction endpoints and reduces latency. Automatic Model Refresh: Since models are retrained daily, automatic refresh ensures the pipeline utilizes the latest version without downtime. This is essential for maintaining model accuracy and anomaly detection effectiveness. Why not C? Dataflow Streaming Pipeline with Vertex AI Prediction Endpoint with Autoscaling: While autoscaling can handle varying workloads, Vertex AI Prediction endpoints might incur higher costs for real-time, high-volume predictions compared to invoking models directly within the pipeline using RunInference.
  2. b1a8fae 👍 4 Answered D
    Needs to be active 24/7 -> streaming. RunInference API seems like the way to go here, using automatic model refresh on a daily basis. https://beam.apache.org/documentation/ml/about-ml/
  3. guilhermebutzke 👍 3 Answered C
    My Answer: C The phrase: “The models must operate 24/7 without downtime and make sub millisecond predictions” configures a case of online prediction (option B or C) The phrase: “Models are retrained daily, and you need to deploy these models in a cost-effective way”, choose between “ Vertex AI Prediction endpoint with autoscaling” instead “Runlnference API, and use automatic model refresh” looks better because always update with retrained models, and the scalability. https://cloud.google.com/blog/products/ai-machine-learning/streaming-prediction-with-dataflow-and-vertex
  4. sonicclasps 👍 2 Answered C
    low latency - > streaming C & D could both work, but C is the GCP solution. So I chose C
  5. pinimichele01 👍 1 Answered D
    With the automatic model refresh feature, when the underlying model changes, your pipeline updates to use the new model. Because the RunInference transform automatically updates the model handler, you don't need to redeploy the pipeline. With this feature, you can update your model in real time, even while the Apache Beam pipeline is running.
Show 1 more comment
  1. gscharly 👍 1 Answered D
    agree with fitri001

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All PMLE Questions

Access 65 questions with complete answers and detailed explanations.

View Full PMLE Practice Test →

← Back to PMLE Study Guide