By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Designing an end-to-end ML pipeline in Google Cloud means orchestrating data ingestion, feature engineering, model training, evaluation, deployment, and monitoring in a scalable, reproducible, and automated way. A real-world scenario: A retail company wants to deploy a real-time recommendation system that personalizes product suggestions based on user behavior. The pipeline must: - Ingest streaming clickstream data (Pub/Sub → Dataflow → BigQuery).- Compute and store features (Vertex AI Feature Store).- Train and evaluate models (Vertex AI Training with custom containers).- Deploy for low-latency inference (Vertex AI Endpoints with autoscaling).- Monitor for drift and performance decay (Vertex AI Model Monitoring).
A poorly designed pipeline leads to data leakage, training-serving skew, high latency, or cost overruns—all of which the exam tests.
Vertex AI Pipelines GCP’s serverless orchestration service for ML workflows (built on Kubeflow Pipelines). Best for automating training, evaluation, and deployment with pre-built components (e.g., AutoMLTrainingJobOp, ModelDeployOp).
AutoMLTrainingJobOp
ModelDeployOp
Vertex AI Training GCP’s managed training service for custom models (TensorFlow, PyTorch, XGBoost) or AutoML. Supports custom containers, distributed training (TPUs/GPUs), and hyperparameter tuning (Vertex AI Vizier).
Vertex AI Feature Store GCP’s centralized repository for storing, sharing, and serving ML features. Online store (low-latency for inference) + offline store (batch training). Prevents training-serving skew by ensuring consistent feature computation.
Vertex AI Model Registry A versioned repository for trained models. Tracks metadata (metrics, artifacts, lineage) and enables A/B testing via model aliases (e.g., champion, challenger).
champion
challenger
Vertex AI Endpoints GCP’s managed inference service for deploying models. Supports online prediction (REST API), batch prediction (async), and autoscaling. Can deploy multiple models per endpoint (traffic splitting for A/B tests).
Vertex AI Model Monitoring GCP’s drift detection service for deployed models. Monitors feature skew, prediction drift, and custom metrics. Alerts trigger retraining pipelines.
Cloud Dataflow GCP’s serverless stream/batch processing (Apache Beam). Used for ETL, feature engineering, and real-time data prep before training/inference.
BigQuery ML GCP’s SQL-based ML service for training models directly in BigQuery (e.g., CREATE MODEL with linear regression, XGBoost). Best for quick prototyping on structured data.
CREATE MODEL
TensorFlow Extended (TFX) on Vertex AI GCP’s managed TFX service for production-grade pipelines. Includes data validation (TFDV), feature engineering (TF Transform), and model analysis (TFMA).
Kubeflow Pipelines (KFP) Open-source ML orchestration framework (alternative to Vertex AI Pipelines). More flexible but requires GKE cluster management.
Training-Serving Skew When features differ between training and inference (e.g., computed differently, stale data). Vertex AI Feature Store mitigates this by ensuring consistent feature computation.
Data Leakage When future data "leaks" into training (e.g., using test-set statistics for feature scaling). TFX Data Validation or custom Dataflow jobs can detect this.
Define components (Python SDK): ```python from google.cloud import aiplatform from kfp.v2 import dsl
@dsl.component def train_model(data_path: str, model_dir: str): # Custom training code (e.g., TensorFlow) pass
@dsl.pipeline(name="fraud-detection-pipeline") def pipeline(project: str, region: str): train_task = train_model(data_path="gs://bucket/data", model_dir="gs://bucket/model") deploy_task = aiplatform.ModelDeployOp( model=train_task.outputs["model"], endpoint_name="fraud-endpoint" ) 2. Compile & run:bash pipeline.compile("pipeline.json") aiplatform.PipelineJob.from_json("pipeline.json").run() ``` 3. Schedule runs (Cloud Scheduler + Cloud Functions for triggers).
2. Compile & run:
python model = aiplatform.Model.upload( display_name="fraud-model", artifact_uri="gs://bucket/model", serving_container_image_uri="us-docker.pkg.dev/vertex-ai/prediction/tf2-cpu.2-12:latest" )
python endpoint = model.deploy( machine_type="n1-standard-4", min_replica_count=1, max_replica_count=10 # Autoscaling )
python endpoint.predict(instances=[{"feature1": 0.5, "feature2": 1.2}])
python endpoint = aiplatform.Endpoint("projects/123/locations/us-central1/endpoints/456") endpoint.deployed_model_monitoring_job.create( display_name="fraud-drift-monitor", objective_configs=[ aiplatform.ObjectiveConfig( feature_skew_detection_config=aiplatform.FeatureSkewDetectionConfig( skew_thresholds={"feature1": 0.1} ) ) ] )
Vertex AI Training vs. BigQuery ML:
Key Constraints:
Vertex AI Feature Store has a max online store size of 100K features per entity type.
Tricky Scenarios:
"How do you automate retraining when drift is detected?" → Vertex AI Model Monitoring → Pub/Sub → Cloud Functions → Vertex AI Pipeline trigger.
Cost Optimization:
Why: It provides a centralized feature repository with online/offline stores to prevent training-serving skew.
Your team needs to automate a pipeline that trains a model weekly, evaluates it, and deploys only if accuracy improves. Which GCP service should you use for orchestration?
Why: It’s serverless, integrates with Vertex AI services, and supports conditional logic (e.g., if accuracy > threshold: deploy).
if accuracy > threshold: deploy
A fraud detection model deployed on Vertex AI Endpoints is experiencing high latency during traffic spikes. What’s the most cost-effective way to handle this?
min_replica_count=1
max_replica_count=10
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.