ML Pipeline Automation
MLOps and pipeline automation represent one of the highest-weighted exam domains (~18%). This lesson covers Vertex Pipelines, Kubeflow, CI/CD for ML, and experiment tracking — the backbone of production ML on GCP.
MLOps Maturity Levels
Google defines three MLOps maturity levels. The exam tests your ability to recommend the right level for a given organization:
| Level | Description | Characteristics |
|---|---|---|
| Level 0: Manual | Manual, script-driven, interactive process | Jupyter notebooks, manual deployment, no CI/CD, no monitoring |
| Level 1: ML Pipeline Automation | Automated ML pipeline, continuous training | Orchestrated pipeline, automated retraining on new data, feature store |
| Level 2: CI/CD Pipeline Automation | Automated CI/CD for pipeline code | Source control, automated testing, automated pipeline deployment, monitoring |
Vertex AI Pipelines
Vertex AI Pipelines is the managed pipeline orchestration service on GCP. It is the primary pipeline service tested on the exam.
Key Features
- Serverless execution: No cluster management required
- KFP v2 SDK: Define pipelines using the Kubeflow Pipelines SDK v2 in Python
- TFX support: Run TFX pipelines on Vertex AI Pipelines
- Artifact lineage: Track inputs, outputs, and metadata for every pipeline run
- Scheduling: Run pipelines on a schedule using Cloud Scheduler
- Caching: Reuse outputs from previously completed steps to save time and cost
Pipeline Components
A Vertex Pipeline is composed of components. Each component is a self-contained unit of work:
Google Cloud Pipeline Components
Pre-built components for common GCP operations: BigQuery queries, Vertex AI training, model upload, endpoint deployment, batch prediction. Use these to minimize custom code.
Custom Components
Write your own components using the @component decorator. Each component runs in its own container. Input/output types are validated at compile time.
Container Components
Wrap any Docker image as a pipeline component. Useful for non-Python workloads, legacy code, or specialized tools that require specific environments.
Kubeflow Pipelines vs. Vertex Pipelines
The exam may ask you to compare these two. Know the key differences:
| Feature | Vertex AI Pipelines | Kubeflow Pipelines (on GKE) |
|---|---|---|
| Infrastructure | Fully managed, serverless | Self-managed GKE cluster |
| Setup complexity | Low (API call to run) | High (install KFP on GKE) |
| Cost model | Pay per pipeline step execution | Pay for GKE cluster (always on) |
| Customization | Limited to supported component types | Full Kubernetes flexibility |
| GCP integration | Native (IAM, logging, monitoring) | Requires manual configuration |
| Best for | Most production ML workloads | Highly customized pipelines, multi-cloud |
CI/CD for ML on GCP
CI/CD for ML extends traditional CI/CD to handle data, models, and pipelines. The GCP stack for ML CI/CD:
| Stage | GCP Service | Purpose |
|---|---|---|
| Source control | Cloud Source Repositories / GitHub | Version pipeline code, training scripts, configs |
| Build & test | Cloud Build | Run unit tests, build custom containers, validate pipeline configs |
| Container registry | Artifact Registry | Store and version custom training/serving containers |
| Pipeline deployment | Cloud Build triggers | Automatically submit pipeline runs when code changes |
| Model validation | Vertex AI Evaluator / custom | Gate deployments based on model quality metrics |
| Model deployment | Vertex AI Model Registry + Endpoints | Deploy validated models to production endpoints |
Experiment Tracking with Vertex AI Experiments
Vertex AI Experiments provides centralized tracking for ML experiments. Key capabilities:
- Run tracking: Log parameters, metrics, and artifacts for each training run
- Comparison: Compare metrics across runs in a tabular or visual format
- Lineage: Track which data, code, and parameters produced each model
- Integration: Works with Vertex AI Training, custom training, and notebooks
- TensorBoard: Vertex AI TensorBoard provides managed TensorBoard instances for visualization
Cloud Composer (Apache Airflow)
Cloud Composer is GCP's managed Apache Airflow service. It orchestrates broader data workflows (not just ML). Know when to use it vs. Vertex Pipelines:
- Use Cloud Composer when: You need to orchestrate a mix of data engineering and ML tasks (e.g., trigger Dataflow, then BigQuery, then Vertex Pipeline)
- Use Vertex Pipelines when: The workflow is primarily ML (data prep, train, evaluate, deploy)
- Cloud Composer can trigger Vertex Pipelines as a step in a larger DAG
Practice Questions
A. Set up Kubeflow Pipelines on a GKE cluster
B. Create a Vertex AI Pipeline that automates data prep, training, evaluation, and deployment
C. Write a bash script that runs on a Compute Engine VM with a cron job
D. Use Cloud Composer with custom Airflow operators
A. Use a faster machine type for data preparation
B. Enable pipeline step caching in Vertex AI Pipelines
C. Move data preparation to a separate Cloud Function
D. Run the pipeline more frequently with smaller data batches
A. In the Cloud Build pipeline, before pushing the container image
B. In the Vertex AI Pipeline, after the evaluation step and before the deployment step
C. In the model monitoring configuration, after deployment
D. In the Jupyter notebook, during development
A. Vertex AI Pipelines
B. Cloud Composer (Apache Airflow)
C. Cloud Workflows
D. Cloud Scheduler
Lilly Tech Systems