Prepare and test your skills
Prepare and test your skills
Vertex AI custom training is a serverless training mode where user-supplied code runs on managed virtual machines (VMs) defined by a CustomJob resource. The CustomJob carries a job_spec containing one or more worker_pool_specs, and each worker pool defines a machine_spec, a replica_count, and either a container_spec or a python_package_spec. The Vertex AI SDK submits this specification to a regional API endpoint, and Vertex AI provisions the compute, pulls the code artifact, and runs training to produce a model artifact registered on the Models page.
Custom container packaging is the method that bundles customized training code into a Docker image that Vertex AI runs directly. The workflow depends on Artifact Registry for hosting the image, Cloud Storage for staging data and outputs, and Identity and Access Management (IAM) for the service account identity. Training data flows from Cloud Storage buckets into the training container, and trained outputs flow from the container back to Cloud Storage and Model Registry.
The prerequisite workflow runs in a fixed order:
CustomJob that references the image URI in container_spec and monitor progress in near real time in Vertex AI TensorBoard (opens in a new tab).Because the container owns its operating system, libraries, and entrypoint, this path supports any framework, system dependency, or custom binary that does not fit a Google-provided image.
Vertex AI SDK submission is the process that creates a regional JobServiceClient and calls create_custom_job with a parent resource and a job specification. The client is initialized once with client_options set to a regional endpoint such as us-central1-aiplatform.googleapis.com, then reused for multiple requests. The parent names both sides of the placement boundary as projects/{project}/locations/{location}, which determines where the control-plane request routes and where training VMs run.
A custom container job defines display_name and job_spec.worker_pool_specs with explicit compute and container fields. The machine_spec sets machine_type such as n1-standard-4, plus accelerator_type such as NVIDIA_TESLA_K80 and accelerator_count such as 1 when accelerators are needed. The container_spec sets image_uri to the pushed custom image, with command and args controlling the container entrypoint; empty arrays use the image default. The replica_count sets how many VMs in that pool run the container, so replica_count: 1 is single-node training and higher counts scale the pool for distributed training.
The training environment choice determines who builds the container image and how code is packaged. A pre-built environment uses a Google-provided executor image and a Python source package, while a custom container environment uses a user-built image that already contains the code.
| Environment | Code packaging | Image control |
|---|---|---|
| Pre-built Python package | python_package_spec with executorImageUri such as us-docker.pkg.dev/vertex-ai/training/training-tf-cpu.2-1:latest, packageUris such as gs://my-bucket/my-training-application/trainer.tar.bz2, and pythonModule such as my-trainer.trainer | Google builds and patches the base image; user controls only the Python tarball and module entrypoint |
| Custom container | container_spec with image_uri to the user-pushed image, plus command and args | User builds the full image, including framework version, system libraries, and training code |
Choose the pre-built Python package when standard TensorFlow or PyTorch CPU images are sufficient and the training app can be shipped as a Python module tarball from Cloud Storage. Choose a custom container when the job needs custom system packages, a specific framework build, non-Python code, or full control over startup behavior. The same worker_pool_specs structure carries either choice, so compute, accelerator, and replica decisions remain consistent across both paths.
Distributed training configuration lives in worker_pool_specs, where each pool binds compute, accelerators, and code together. The machine_spec on each pool selects the VM family and accelerators, the replica_count on each pool selects how many identical VMs run, and the container_spec or python_package_spec on each pool selects what each replica executes. Scaling from one replica to many replicas increases parallelism but requires training code written to coordinate across workers and to use accelerators when configured.
Accelerator selection pairs machine_type with accelerator_type and accelerator_count on each VM in the pool. Training code must already be written to use graphics processing units (GPUs) before the pool requests them, otherwise the GPUs remain idle. Vertex AI supports the following GPU types for serverless training:
Using smaller machine types such as n1-highmem-2 with GPUs can cause logging to fail for some workloads because of central processing unit (CPU) constraints. If a GPU training job stops returning logs, selecting a larger machine type restores log delivery without changing the accelerator request itself.
Exam tip: GPU training pools must use an A2, N1, or G2 machine type; other machine families cannot attach GPUs even if accelerator_type and accelerator_count are set.
Monitoring connects training logs, interactive debugging, and experiment visualization to the running CustomJob. Training logs flow from each training container to Cloud Logging and are viewed by opening the Training page in the Google Cloud console, selecting the job name, and clicking View logs. An interactive shell can attach to running training containers while the pipeline runs to inspect files, processes, and environment state without stopping the job.
Vertex AI TensorBoard provides near-real-time curves for loss, metrics, model graphs, and profiling data once the job streams summaries to the configured Cloud Storage location. After submission, job progress is tracked on the Vertex AI Experiments page, and profiling with Cloud Profiler helps pinpoint bottlenecks to train faster and at lower cost. When serverless training completes, the trained model appears on the Models page, where it can be deployed to an endpoint, tuned further with hyperparameter tuning, or scheduled based on resource availability.
Kubeflow on Google Kubernetes Engine (GKE) (opens in a new tab) is the approach for running containerized model training as orchestrated, multi-step workflows on Kubernetes instead of single ad-hoc jobs. GKE provides the cluster control plane and accelerator node pools, while pipeline steps run as containers that read data and write predictions, checkpoints, and models to Cloud Storage. This organization makes training scalable, reproducible, and resource-efficient because infrastructure, workflow steps, and artifacts are all versioned and automated together.
Containerized training on GKE packages training code, libraries, and dependencies into container images that run as Pods on GPU or TPU nodes. A TensorFlow training container deployed to a GKE Standard cluster, for example, pulls input data, uses allocated accelerators for computation, and then writes predictions and model outputs to a Cloud Storage bucket for downstream use. GKE Standard mode requires explicit creation and management of clusters and GPU node pools, while GKE Autopilot mode reduces setup steps by managing node provisioning automatically.
The training workload depends on the node pool for accelerators, depends on Cloud Storage for durable data and artifact storage, and depends on Identity and Access Management (IAM) roles for permission to select projects, enable APIs, and access buckets. Workload organization separates stable platform configuration from per-experiment code. Platform teams manage the cluster, node pools, quotas, and storage buckets, while data scientists submit containerized pipeline steps that request specific CPU, memory, and accelerator resources. Because each step runs in its own container with declared resource requests, the Kubernetes scheduler places training Pods only on nodes that satisfy those requests, and failed steps can be retried without rebuilding the cluster.
GPU and TPU node pool provisioning on GKE is the process of defining which accelerators are available for training and how capacity is obtained under cost and availability constraints. Dynamic Workload Scheduler (DWS) (opens in a new tab) powers on-demand accelerator obtainability through Flex-start and Calendar modes, while ComputeClasses define a hierarchy of node configurations that GKE prioritizes during autoscaling. GKE offers NVIDIA H100, A100, and L4 GPUs, plus A3 Ultra H200 and A4 B200 configurations for large-scale training, with L4 GPUs commonly used for inference and A100, H100, H200, or B200 GPUs used for training. For complex multi-GPU topology and colocation, Cluster Director manages accelerator groups across GKE and Slurm, and Ray on Vertex AI abstracts distributed compute so applications request resources without directly managing VMs and containers.
Capacity choices trade stability against cost and preemption risk:
| Option | Duration and commitment | Choose when |
|---|---|---|
| Committed use discounts (CUDs) | 24x7 stable commitment for VMs and accelerators | Training or inference has fixed, predictable capacity needs |
| Spot VMs | Preemptible, lowest price with disruption risk | Evaluation, experimentation, and fault-tolerant batch work can tolerate node loss |
| DWS Flex-Start | Up to 7 days, pay-as-you-go with up to 53% discount on vCPUs, GPUs, TPUs, and Local SSDs | Complex batch training needs high-end GPUs without a fixed start date |
| DWS Calendar mode | Up to 3 months reservation for H100, H200 GPUs and Trillium TPUs | Longer training must guarantee specific accelerators at a future time |
Use Spot VMs combined with Flex-start as a fallback when Spot capacity is unavailable, and define ComputeClasses profiles that prefer reserved GPUs or TPUs first and then fall back to Spot VMs. Plan quotas proactively by analyzing historical utilization in Cloud Monitoring, running load tests to find bottlenecks, and requesting quota increases with forecasting data.
Exam tip: Choose Flex-Start for batch training up to seven days without a fixed start date, and choose Calendar mode for reservations up to three months for H100, H200, and Trillium capacity.
Orchestration with infrastructure as code (IaC) defines GKE clusters, storage, and serving resources in versioned templates so multi-step training workflows are repeatable and promotable across environments. Terraform is the declarative tool for provisioning AI infrastructure, and Cluster Toolkit provides Google-curated Terraform blueprints for ready-to-use high-performance computing (HPC), AI, and machine learning (ML) clusters on Slurm or GKE. Config Connector then manages Google Cloud resources as Kubernetes objects from YAML manifests applied to the GKE cluster, so datasets, models, endpoints, Cloud SQL instances, Pub/Sub topics, and Cloud Storage buckets evolve with the same workflow as application code.
Core IaC resources for a training platform include:
Manage ongoing changes declaratively by storing modular Terraform configurations in version control, templating environment differences, and integrating provisioning into continuous integration and continuous delivery (CI/CD) pipelines with Cloud Build and Infrastructure Manager. A pipeline first runs validate and plan for automated testing, then applies changes on code commit, stores configurations as versioned artifacts, and promotes the same code through distinct dev, staging, and prod configurations. IAM policies and service accounts are also implemented in IaC so each pipeline step receives only the permissions needed to read data and write artifacts.
Experiment tracking and artifact lineage on Google Cloud is the system for recording what was trained, with what data and code, and where the resulting model is stored. Vertex AI Experiments automatically logs parameters, code versions, dataset versions, and results for each training and evaluation run, while Model Registry registers versioned trained artifacts after each successful run or stores them directly in Cloud Storage. This lineage connects a trigger, such as new data arrival, data drift, or a schedule, to the exact training container, hyperparameter tuning trial, distributed training configuration, and evaluation score that produced a model.
Continuous training pipelines enforce validation before promotion through an ordered lifecycle:
Monitor both model behavior and platform health with Cloud Logging for centralized logs, Cloud Monitoring and Google Cloud Managed Service for Prometheus for metrics like queries per second (QPS), token throughput, and first-token latency, Error Reporting for exceptions, Cloud Trace for distributed latency, and Cloud Profiler for CPU and memory bottlenecks. Track deployment status including canary releases and rollbacks with Cloud Deploy integrated with Cloud Monitoring, and set custom alerts for business thresholds integrated with incident tools such as PagerDuty or Slack.
Automated machine learning and tabular workflows on Vertex AI (opens in a new tab) are managed approaches for training models on structured data without manually designing architectures or provisioning infrastructure. Vertex AI AutoML provides prebuilt training routines for common problems such as tabular regression, classification, and forecasting, handling architecture search, preprocessing, hyperparameter tuning, and machine provisioning. Data flows from BigQuery tables or managed datasets to the managed training service, and the resulting model flows to Vertex AI endpoints for serving or to an external device for edge deployment.
Vertex AI AutoML is a managed training environment that automates nearly all aspects of training and serving for supported data types and model objectives. When a job starts, the service selects candidate architectures, applies built-in transformations for preprocessing, runs hyperparameter search, provisions training infrastructure, and packages the best model for deployment. This automation removes manual iteration over architectures, input configurations, and hardware choices, which is evaluated through aggregate metrics such as accuracy, precision, and recall on held-out test data.
AutoML is appropriate when data and problem match a supported format with supported data types and objectives, and when the model can be served from Google Cloud or deployed to an external device. For text, video, or tabular models, the application must tolerate inference latencies greater than 100ms. AutoML tabular models can also be trained from the BigQuery ML environment, which keeps tabular data and training in one system.
Vertex AI SDK for Python (opens in a new tab) training classes are the job objects that create, train, and return models, plus supporting classes for tuning and orchestration. A tabular workflow depends on a dataset resource such as TabularDataset, a training job class, and a run() call that links the dataset, target column, and splits to the returned model. Use HyperparameterTuningJob to tune a training job's hyperparameters with Vertex AI Vizier, and use PipelineJob to automate and monitor the end-to-end machine learning workflow.
Structured-data AutoML in the SDK includes the following peer job classes:
AutoMLTabularTrainingJob is configured with a display name, an optimization_prediction_type such as regression, and an optimization_objective such as minimize-rmse. The run() call then takes the dataset, a target_column name, and split fractions such as training_fraction_split and validation_fraction_split to control how managed data flows into training, validation, and test partitions.
Automated feature engineering in this workflow means preprocessing is handled inside the platform rather than in hand-written training code. If the model is built with BigQuery ML, the transformations built into BigQuery ML preprocess the data, and if the model is built with AutoML, the transformations built into AutoML preprocess the data. For custom models, using BigQuery transformations may still be the most cost-effective method before data flows to the training service.
Structured and semi-structured data should be stored in BigQuery, with intermediate processed data also stored in BigQuery for reuse. For maximum training speed, store materialized tables instead of using views or subqueries as training inputs, and consider partitioning for large datasets. After preprocessing, a managed dataset in Vertex AI creates a clear link between data and custom-trained models through Vertex ML Metadata, provides descriptive statistics, and supports automatic or manual splitting into train, test, and validation sets.
Training budgets and quality in AutoML tabular workflows are controlled through the optimization type, optimization objective, and data splits defined in the SDK. The optimization_prediction_type defines the task, such as regression or classification, while the optimization_objective defines the metric the search optimizes, such as minimize-rmse. The training_fraction_split, validation fraction, and test fraction define what portion of rows from the TabularDataset flows to each phase, so evaluation on test data measures generalization rather than memorization.
Hyperparameter tuning is the automated enhancer provided by the managed training service, which uses Google Cloud processing infrastructure and Vertex AI Vizier to test different hyperparameter configurations across training runs. Tuning removes manual adjustment over numerous runs to reach optimal values and is tracked with Vertex AI TensorBoard and Vertex AI Experiments. TensorBoard visualizes metrics such as loss and accuracy over time, model graphs, and embeddings, while Experiments logs linkage across parameters, metrics, and dataset and model artifacts in Vertex ML Metadata.
Exam tip: Choose AutoML forecasting unless the use case specifically benefits from Seq2seq-plus or temporal fusion transformer; AutoML tabular models tolerate inference latencies greater than 100ms and can be trained from BigQuery ML.
Prebuilt routines and custom training divide by data location, SQL comfort, problem fit, and control needs. BigQuery ML brings data, infrastructure, and predefined model types into a single SQL system, AutoML handles architecture, tuning, and provisioning for supported formats, and custom training on serverless architecture supports any model type with additional services for tuning and monitoring.
| Environment | Managed scope | Choose when |
|---|---|---|
| BigQuery ML | Data, infrastructure, and predefined model types in BigQuery | All data is in BigQuery, you are comfortable with SQL, and an available model type matches the problem |
| Vertex AI AutoML | Architecture choice, hyperparameter tuning, machine provisioning, and serving packaging | Data and problem match a supported AutoML format and objective, and latency greater than 100ms is acceptable for text, video, or tabular models |
| Vertex AI custom training | Serverless training with optional tuning and monitoring | The problem does not match BigQuery ML or AutoML criteria, or training must stay consistent with on-premises or other-cloud code |
Choose custom training when lineage control, custom splitting in training code, or framework consistency across platforms outweighs automation. Choose managed datasets when lineage between data and model and reproducible splits matter, and skip them when custom splitting logic or minimal tracking is preferred.
A pre-built Python package environment uses a Google-provided executor image with a Python source package defined by python_package_spec, packageUris and pythonModule, while a custom container environment uses a user-built image that already contains the code defined by container_spec with image_uri, command and args. Choose the pre-built environment when standard TensorFlow or PyTorch CPU images and a Python module tarball from Cloud Storage are sufficient, and choose a custom container when the job needs custom system packages, a specific framework build, non-Python code, or full control over startup behavior.
Flex-Start supports batch training up to 7 days without a fixed start date with pay-as-you-go pricing, while Calendar mode reserves H100, H200 graphics processing units and Trillium tensor processing units up to 3 months for a future time. Choose Flex-Start when complex batch training needs high-end graphics processing units without a fixed start date, and choose Calendar mode when longer training must guarantee specific accelerators at a future time.
GPU training pools must use an A2, N1, or G2 machine type, and training code must already be written to use graphics processing units or the accelerators remain idle. If a GPU job stops returning logs on a smaller machine type such as n1-highmem-2 because of central processing unit constraints, selecting a larger machine type restores log delivery without changing the accelerator request.
Last updated