TL;DR
Master Google Cloud Vertex AI with this comprehensive guide covering MLOps, model development, deployment, and monitoring for production ML systems
Google Cloud Vertex AI: Complete Guide to ML Operations
Executive Summary
Vertex AI is Google Cloud's managed platform for building, training, deploying, and monitoring machine learning models. It consolidates what used to be separate services for data preparation, AutoML, custom training, model registry, endpoints, batch prediction, pipelines, and monitoring into one surface with one API and one IAM model. After reading this guide you will be able to decide when AutoML is sufficient and when custom training is justified, how to structure a repeatable pipeline instead of notebook-driven training, how online and batch prediction differ operationally, and what monitoring has to be in place before a model can be trusted in production.
Why This Matters
Most ML projects do not fail because the model architecture was wrong. They fail because training was not reproducible, the features used in training did not match the features served at prediction time, nobody noticed when input data drifted, or a model that performed well offline degraded silently after deployment. A notebook that produces a good metric is a prototype. Production ML requires versioned data, versioned code, versioned models, controlled promotion, and continuous observation. Vertex AI does not remove that work, but it gives you managed places to do it: a registry for model versions, pipelines for repeatable training, a feature store for consistent features, and monitoring jobs that alert when distributions shift. Skipping those pieces means every retrain is manual, every rollback is improvisation, and every incident starts with archaeology.
Core Concepts
AutoML Versus Custom Training
AutoML trains a model from a managed dataset with minimal code. You supply labelled data, choose an objective, set a training budget, and Vertex AI searches architectures and hyperparameters for you. It is the right starting point for common image, text, tabular, and video classification or regression problems where the data shape is standard and the team does not need a bespoke architecture.
from google.cloud import aiplatform
def create_automl_training_job(
project: str,
display_name: str,
dataset_id: str,
location: str = "us-central1",
model_type: str = "CLOUD",
):
aiplatform.init(project=project, location=location)
dataset = aiplatform.ImageDataset(dataset_id)
job = aiplatform.AutoMLImageTrainingJob(
display_name=display_name,
prediction_type="classification",
)
model = job.run(
dataset=dataset,
model_display_name=display_name,
training_fraction_split=0.8,
validation_fraction_split=0.1,
test_fraction_split=0.1,
budget_milli_node_hours=8000,
)
return modelCustom training is the opposite trade: you bring a training container or a supported framework environment, define the worker pool, accelerators, and distributed strategy, and own the training code end to end. Choose it when you need a specific architecture, custom loss, transfer learning with unusual preprocessing, or training logic AutoML cannot express. The cost is responsibility: data loading, checkpointing, failure handling, and metric reporting are yours.
Datasets, Experiments, and the Model Registry
A Vertex AI dataset is a managed reference to data in Cloud Storage or BigQuery, with train, validation, and test splits recorded alongside it. That matters because a model metric is meaningless without knowing which split produced it. Experiments track runs and parameters so two training jobs can be compared on more than memory. The Model Registry is the promotion boundary: trained models are uploaded or registered with a version, labels, and a description, and deployment should only ever pull from the registry, never from an ad hoc training output path. Version discipline here is what makes rollback a configuration change instead of a rebuild.
Pipelines for Repeatable Training
A pipeline turns training from a sequence of manual steps into a compiled, parameterised job: ingest, validate, transform, train, evaluate, and conditionally register. If evaluation fails a threshold you define, the pipeline stops and the model is never promoted.
from google.cloud import aiplatform
from google.cloud.aiplatform import pipeline_jobs
def create_training_pipeline(
project: str,
location: str,
pipeline_name: str,
training_container_uri: str,
model_display_name: str,
):
pipeline_job = pipeline_jobs.PipelineJob(
display_name=pipeline_name,
template_path="pipeline.json",
pipeline_root=f"gs://{project}-pipeline-root",
parameter_values={
"project": project,
"location": location,
"training_container_uri": training_container_uri,
"model_display_name": model_display_name,
},
)
pipeline_job.run()
return pipeline_jobPipelines built with Kubeflow Pipelines or TFX components also record lineage in Vertex ML Metadata, so you can answer which dataset version and which code produced the model currently in production.
Feature Store and Training-Serving Skew
Training-serving skew happens when the feature computed offline for training differs, subtly, from the feature computed online for prediction: a different window, a different null handling, a different join. The Feature Store exists to prevent that class of bug by defining each feature once and serving the same definition to both paths, with point-in-time correctness for training sets and low-latency lookup for online serving.
from google.cloud import aiplatform_v1
from google.cloud.aiplatform_v1 import FeaturestoreServiceClient
from google.cloud.aiplatform_v1 import Feature
def create_feature_store(
project: str,
location: str,
featurestore_id: str,
entity_type_id: str,
):
client = FeaturestoreServiceClient()
parent = f"projects/{project}/locations/{location}"
featurestore = client.create_featurestore(
parent=parent,
featurestore_id=featurestore_id,
featurestore={
"name": f"{parent}/featurestores/{featurestore_id}",
"labels": {"environment": "production"},
},
)
entity_type = client.create_entity_type(
parent=featurestore.name,
entity_type_id=entity_type_id,
entity_type={
"description": "Customer features for recommendation model",
},
)
features = [
Feature(
name="purchase_count",
value_type=Feature.ValueType.INT64,
description="Number of purchases in last 30 days",
),
Feature(
name="total_spend",
value_type=Feature.ValueType.DOUBLE,
description="Total spend in last 30 days",
),
]
for feature in features:
client.create_feature(
parent=entity_type.name,
feature=feature,
feature_id=feature.name,
)
return featurestoreA feature store is an investment. For a single model with a handful of features it is overhead. For several models sharing customer, product, or account features, it removes duplicated pipelines and a whole category of subtle production bugs.
Online Prediction Versus Batch Prediction
Online prediction deploys a model to an endpoint with a chosen machine type, accelerator, and replica range. Traffic splitting lets you send a portion of requests to a new version before committing to it.
from google.cloud import aiplatform
def deploy_model(
project: str,
location: str,
model_id: str,
machine_type: str = "n1-standard-2",
):
aiplatform.init(project=project, location=location)
model = aiplatform.Model(model_id)
endpoint = model.deploy(
machine_type=machine_type,
min_replica_count=1,
max_replica_count=3,
accelerator_type=None,
accelerator_count=0,
)
return endpointAn undeployed endpoint still costs money if models remain deployed to it, so endpoint hygiene is a real operational task. Batch prediction is the asynchronous path: give the model a table or files in Cloud Storage, receive predictions in BigQuery or Cloud Storage. Use it for scoring jobs, backfills, and any workload where an answer in minutes or hours is acceptable and per-request latency is irrelevant.
def create_batch_prediction_job(
project: str,
location: str,
model_id: str,
gcs_source: str,
gcs_destination: str,
):
aiplatform.init(project=project, location=location)
model = aiplatform.Model(model_id)
batch_prediction_job = model.batch_predict(
job_display_name=f"batch-predict-{model_id}",
gcs_source=gcs_source,
gcs_destination_prefix=gcs_destination,
sync=False,
)
return batch_prediction_jobMonitoring: Drift, Skew, and Attribution
Vertex AI Model Monitoring compares live prediction inputs, and optionally ground truth, against the training baseline. It watches for skew between training and serving distributions and drift in serving data over time, and can compute feature attribution drift for supported model types. A monitoring job is only useful if someone owns the alert: define the threshold, the notification channel, and the response, which is usually investigation first and retraining second, not automatic retraining on every signal.
from google.cloud import aiplatform_v1
from google.cloud.aiplatform_v1 import ModelMonitoringJob
def create_monitoring_job(
project: str,
location: str,
endpoint_id: str,
display_name: str,
):
client = aiplatform_v1.ModelMonitoringJobServiceClient()
parent = f"projects/{project}/locations/{location}"
monitoring_job = ModelMonitoringJob(
display_name=display_name,
endpoint=f"{parent}/endpoints/{endpoint_id}",
monitor_config={
"feature_monitoring_config": {
"target_field": "prediction",
"feature_stats_anomaly_detection": {
"enabled": True,
},
},
},
schedule_config={
"monitor_interval": {"seconds": 86400},
},
)
operation = client.create_model_monitoring_job(
parent=parent,
model_monitoring_job=monitoring_job,
)
return operation.result()CI/CD and Promotion
The pipeline that trains should be triggered like any other build: on a schedule, on new data, or from your CI system, with the training container built and pushed first. Promotion to production should be a separate, reviewable step gated on evaluation metrics recorded by the pipeline, not an automatic consequence of a training job finishing.
# cloudbuild.yaml steps: - name: 'gcr.io/cloud-builders/docker' args: ['build', '-t', 'gcr.io/$PROJECT_ID/training', './training'] - name: 'gcr.io/cloud-builders/docker' args: ['push', 'gcr.io/$PROJECT_ID/training'] - name: 'gcr.io/google-cloud-sdk' entrypoint: 'gcloud' args: - 'ai' - 'custom-jobs' - 'create' - '--region=us-central1' - '--display-name=training-job' - '--config=job_config.yaml'
Decision Framework
| Situation | Recommendation |
|---|---|
| Standard classification or regression on tabular, image, or text data, small team | Start with AutoML, baseline it, and only go custom if the baseline is not good enough |
| Custom architecture, custom loss, or unusual preprocessing | Custom training in your own container |
| Same features reused by several models or teams | Adopt the Feature Store before building a second feature pipeline |
| Interactive, low-latency predictions | Online endpoint with traffic splitting for releases |
| Scoring large volumes where latency does not matter | Batch prediction to BigQuery or Cloud Storage |
| Model quality complaints with no data evidence | Enable monitoring and check skew and drift before retraining |
| One-off experiment or proof of concept | Workbench notebook and a manual training job; skip pipeline and feature store until it repeats |
Implementation Checklist
Trade-offs
Vertex AI is managed, which means you trade control for convenience. AutoML hides architecture and hyperparameter choices, which speeds delivery but limits tuning and makes some behaviour hard to explain. Endpoints are billed while models are deployed, so always-on serving for a rarely used model can cost more than a serverless or batch alternative. Pipelines and the Feature Store add upfront structure that a single small model does not need. Region availability, quotas for accelerators, and data residency requirements can also constrain design in ways that only appear late if you do not check them early. Finally, deep integration with BigQuery, Cloud Storage, and Google Cloud IAM is a strength inside Google Cloud and a switching cost outside it.
When Not to Use
Do not use Vertex AI as the default answer for every ML-shaped problem. If the workload is a single scheduled scoring job with no online serving and no reuse, a training job plus batch prediction, or even BigQuery ML for SQL-expressible models, is simpler. If your estate is committed to another cloud or to on-premises GPU clusters with strict data residency, a portable stack built on open components may fit better than a Google-specific platform. If the problem is actually calling a pre-trained model, use the managed model APIs directly instead of building training infrastructure. And if the team cannot yet produce clean, labelled, versioned data, no platform fixes that; invest in the data first.
Conclusion
Vertex AI earns its place when it is used as an operating system for models, not just a place to train them. Register every model, train through pipelines, serve features consistently, split traffic on release, and monitor what production actually sends. Teams that adopt those habits get reproducible training and controlled change. Teams that only use the training button get a faster way to produce models nobody can maintain.
References
Why This Matters
Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.
Trade-offs to Consider
Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.
When NOT to Use This
Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.
Decision Framework
Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.