Automatic model refresh

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.

Automatic model refresh provides two methods for updating machine learning (ML) models, watch mode and event mode.

Watch mode

Use one of the Apache Beam provided patterns, such as the WatchFilePattern class, to watch for the latest file in your Cloud Storage bucket. WatchFilePattern uses timestamps to match a file_pattern and emits the latest ModelMetadata, which the RunInference PTransform uses to update your ML model.

To learn more about using WatchFilePattern to automatically refresh ML models, see Use WatchFilePattern to auto-update ML models in RunInference in the Apache Beam documentation.

Event mode

Connect your pipeline to an unbounded source, such as Pub/Sub, to send update events directly to the transform, which initiates a model update. You configure a custom side input PCollection that defines the logic for the model update.

To follow a tutorial that demonstrates how to update your model in production by using a side input PCollection, see Update ML models in running pipelines.

What's next