Prepare and test your skills
Prepare and test your skills
Evaluating model performance and fairness across slices is the practice of measuring prediction quality overall and within predefined data subsets to catch unequal behavior before deployment. Vertex AI Model Evaluation (opens in a new tab) provides the managed evaluation capability that runs alone or as a pipeline component, compares model versions on defined metrics and datasets, and logs results to Vertex ML Metadata (opens in a new tab) for lineage and tracking. A model is ready for production only when it meets fixed thresholds for predictive quality, satisfies operational limits, and performs similarly across sensitive slices.
Optimizing metrics and satisficing metrics separate predictive effectiveness from operational constraints that a model must satisfy. Optimizing metrics measure how well the model predicts, including accuracy and f-measure for classification, mean absolute percentage error for regression and forecasting, discounted cumulative gain for ranking, and perplexity and BLEU scores for language models. Satisficing metrics measure limits such as prediction latency below 200 milliseconds or model size small enough for mobile and embedded devices. A higher optimizing value means a better model, while any model that breaks a satisficing threshold is rejected even with strong predictions.
| Metric type | What it measures | Decision rule |
|---|---|---|
| Optimizing metrics | Predictive effectiveness such as accuracy, f-measure, and BLEU | Improve the value during experimentation; higher is better |
| Satisficing metrics | Operational constraint such as latency or model size | Must stay within a fixed threshold, for example latency under 200 milliseconds |
For fairness, optimizing metrics must also be compared across slices such as customer demographics. Similar effectiveness across slices indicates equitable behavior, while a large gap between slices signals bias even when overall accuracy looks high.
Exam tip: A model with high overall accuracy can still fail fairness review if one demographic slice scores much lower; always gate deployment on per-slice thresholds, not only the aggregate metric.
A streamlined evaluation routine is a repeatable procedure that takes any model and dataset and returns the same set of evaluation metrics. The routine works regardless of model type, such as decision trees or neural networks, or framework, such as TensorFlow or scikit-learn, so different experiments can be compared directly. Experiment discipline keeps that comparison honest and reproducible by fixing thresholds, baselines, and data splits before decisions are made.
The routine depends on four practices that connect experiments to deployment decisions:
Vertex AI TensorBoard (opens in a new tab) visualizes training metrics like loss and accuracy over time, model graphs, and embeddings to compare runs, while Vertex AI Experiments (opens in a new tab) logs parameters, code versions, dataset versions, and results to build linkage across parameters, metrics, and dataset and model artifacts through Vertex ML Metadata.
Sliced evaluation is the analysis of overall performance alongside performance on predefined data slices to identify disparate performance affecting specific subgroups. The workflow starts by defining fairness measures that match the use case, then evaluating the model for potential bias across different slices. Training data is also analyzed for skew in feature distributions across demographic groups or sensitive attributes, because imbalanced representation propagates into predictions. Addressing imbalanced classes early with the right evaluation metric, upweighting minority instances, or downsampling majority instances reduces this risk.
Vertex AI Workbench instances support this analysis with built-in libraries like scikit-learn plus interactive tools. The What-If Tool (WIT) interactively analyzes models for bias on a dataset without changing code, and the Language Interpretability Tool (LIT) provides visual, interactive analysis of natural language processing model behavior. For generative AI, the Gen AI evaluation service computes quality, factuality, safety, and style metrics, including a grounding metric that checks factuality against provided source text, and supports custom human-evaluation workflows.
Explainability connects a fairness gap to its causes by showing which inputs drove predictions. Vertex Explainable AI generates feature attributions that detail the importance of each input feature for tabular and image custom-trained models, helping teams verify that features and predictions align with domain knowledge and ethical guidelines. For tabular models deployed on Vertex AI endpoints, feature attributions identify the features that contributed most to each prediction. The What-If Tool integrates with TensorBoard for model-agnostic exploration of behavior and bias, while large language model agents can be explained through trace logs that show the process the agent followed and through citations and reasoning steps in retrieval-augmented generation (RAG) applications.
Explainability data flows from the model endpoint or evaluation run into monitoring dashboards and application interfaces where trust matters for decisions. Model limitations, intended use cases, and known potential biases are then documented as part of the model metadata in Vertex Model Registry (opens in a new tab), so deployment approvers see fairness context alongside binaries, training parameters, evaluation metrics, and dataset version.
Deployment gating is the decision that promotes a model version only after automated evaluation proves it meets performance and fairness thresholds. The gated sequence runs in a fixed order where evaluation results flow into comparison, lineage logging, and then promotion control. Only versions that pass all gates are registered and allowed to receive traffic, which prevents biased or regressed models from reaching production.
The gated sequence runs in order:
Once deployed, Vertex Model Monitoring tracks prediction distributions, spikes in low-confidence predictions, data drift, and prediction drift against training baselines. Monitoring jobs use configured thresholds and alerts, feed results into Cloud Monitoring dashboards with custom business metrics, and trigger notification channels and automated remediation or retraining pipelines when drift indicates emerging bias or unfairness. For generative AI endpoints, monitoring extends to toxicity, coherence, and safety compliance, with output validation against expected ranges, formats, and schemas.
Data quality and drift detection pipelines are automated checks that validate data as it enters and moves through ingestion, preprocessing, training, and serving. TensorFlow Data Validation (TFDV) (opens in a new tab) provides schema and statistical validation, Cloud Dataflow (Dataflow) (opens in a new tab) runs programmatic validation at scale for batch and streaming data, and BigQuery (opens in a new tab) supports large-scale SQL-based checks and historical tracking. The pipeline computes descriptive statistics, enforces an expected schema, and compares feature distributions to catch errors before they propagate into training or predictions.
Automated validation in ingestion and preprocessing pipelines embeds TFDV checks where raw data is collected, transformed, and fed to training or serving. Data flows from source tables, files, or streams into validation logic, then only validated data flows forward to feature engineering and training, while validation metrics flow to observability and retraining triggers. BigQuery handles declarative SQL-based quality rules over large tables, Dataflow handles complex programmatic rules and streaming windows with Apache Beam, and TFDV generates statistics and validates schema conformance.
| Validation approach | Best for | How data flows |
|---|---|---|
| TensorFlow Data Validation (TFDV) | Schema inference, statistical profiles, and skew or drift comparison | Statistics flow from batch data into TFDV, and anomalies flow from TFDV to alerts and logs |
| BigQuery | Large-scale SQL-based data quality checks | Query results flow from source tables into check queries, and check results flow into BigQuery tables for analysis |
| Cloud Dataflow (Dataflow) | Complex programmatic validation on batch or streaming data | Records flow from Pub/Sub, Cloud Storage, or BigQuery through Dataflow transforms, and failures flow to dead-letter outputs or alerts |
Validation results and metrics are stored in BigQuery for analysis and historical tracking, while validation artifacts are archived in Cloud Storage (opens in a new tab). This separation lets the pipeline query trends over time from BigQuery and retain full artifacts in Cloud Storage for audit, debugging, and reproducibility.
Schema enforcement in TFDV pipelines defines the expected feature types, required fields, value ranges, and categorical domains, then rejects or flags batches that violate the schema. The TFDV pipeline infers a baseline schema from trusted training data, applies that schema to each new batch of training or serving data, and emits anomalies when features are missing, mistyped, or out of range. Because the schema depends on the baseline dataset, any intentional evolution such as a new category must update the versioned schema before the pipeline accepts the new data.
Distribution monitoring extends schema checks by tracking how feature statistics shift over time. The pipeline computes per-feature distributions with TFDV, visualizes trends through tools integrated with Cloud Monitoring (opens in a new tab), and automatically triggers a model retraining pipeline when patterns change significantly. This closed loop means drift signals flow from validation to Cloud Monitoring alerts to the orchestrator, which then launches data preparation and training only after a meaningful shift is confirmed.
Data skew in BigQuery ML monitoring is a significant difference between the feature distribution in training data and the feature distribution in serving data in production. Data drift is a significant change in feature distribution in production over time, detected across consecutive spans of serving data such as different days. Both conditions degrade accuracy even when model code has not changed, because the model performs best on serving data that resembles its training data.
The two checks differ in their inputs and dependencies. Skew detection compares serving statistics to training statistics that were saved during model training, so the original training data is not required to run skew detection. Drift detection compares two sets of serving data, such as current serving data versus a historical table snapshot or versus features served at a point in time, which lets teams receive notice while serving data is diverging and before retraining becomes urgent.
Exam tip: Use skew validation for training versus serving, and drift validation for serving versus serving; skew detection reuses training statistics saved at model creation without needing the original training table.
Basic monitoring with BigQuery ML uses built-in functions for quick skew and drift checks without managing fine-grained TFDV protocol buffers. ML.DESCRIBE_DATA computes descriptive statistics for a training or serving table to confirm both datasets are within expected parameters. ML.VALIDATE_DATA_SKEW computes statistics for serving data and compares them to the training statistics saved when the BigQuery ML model was created, and it only computes statistics for serving columns that match training feature columns for better performance and lower cost. ML.VALIDATE_DATA_DRIFT computes and compares statistics for two serving datasets to identify anomalous differences.
Basic data skew monitoring follows an ordered workflow:
ML.DESCRIBE_DATA on training and serving data to verify ranges, nulls, and distributions.ML.VALIDATE_DATA_SKEW to compare serving statistics against the saved training statistics.Basic data drift monitoring follows a parallel workflow for serving-over-time comparison:
ML.DESCRIBE_DATA on training and serving data to verify baseline comparability.ML.VALIDATE_DATA_DRIFT to compare two serving datasets, for example current serving data versus a table snapshot or versus output from ML.FEATURES_AT_TIME.Advanced monitoring with TFDV functions in BigQuery provides fine-grained statistics for integration with existing monitoring solutions and Vertex-side visualization. ML.TFDV_DESCRIBE computes fine-grained descriptive statistics and provides the same behavior as the TensorFlow tfdv.generate_statistics_from_csv API. ML.TFDV_VALIDATE compares two statistics payloads and provides the same behavior as the TensorFlow validate_statistics API. Both functions operate on the TensorFlow DatasetFeatureStatisticsList protocol buffer in JSON format, which can be generated by ML.TFDV_DESCRIBE or loaded from outside BigQuery.
The advanced workflow preserves statistics over time so future serving data can be compared to past training and serving points:
ML.TFDV_DESCRIBE on training and serving tables at intervals appropriate to the monitoring solution and save query results with a timestamp.ML.TFDV_VALIDATE with the two JSON statistics payloads and a 'SKEW' or drift mode to evaluate training-versus-serving skew or serving-versus-serving drift.Some monitoring functions integrate with Model Monitoring on Gemini Enterprise Agent Platform so charts and graphs can analyze function output. In that integration, statistics and validation results flow from BigQuery into the monitoring job, and visual analysis flows back to engineers for root-cause investigation before retraining is triggered.
Validating model robustness and operational characteristics proves that a model remains correct, safe, and performant when inputs are corrupted or hostile and when load and data conditions change in production. Vertex AI Pipelines (opens in a new tab) orchestrates corruption tests, adversarial simulations, bulk evaluations, and stress tests, while Cloud Monitoring (opens in a new tab) and Model Monitoring on Vertex AI validate latency, throughput, error rate, and resource efficiency against service level objectives (SLOs). Robustness validation must pass before traffic shifts, so operational gates protect live users from fragile or inefficient versions.
Resilience assessment measures how model predictions hold up under unexpected, corrupted, or maliciously modified inputs before deployment. For all models, test for common data corruptions and potentially malicious data modifications, and orchestrate these tests with Gemini Enterprise Agent Platform Managed Training or Vertex AI Pipelines. For security-critical models, conduct adversarial attack simulations to expose vulnerabilities that corruption tests miss, and for models deployed in containers, use Artifact Analysis in Artifact Registry (opens in a new tab) to scan base images for vulnerabilities. Feed drift and skew findings from Model Monitoring on Vertex AI back into re-evaluation or retraining cycles so resilience validation is continuous rather than one-time.
Exam tip: Test all models for common corruptions and malicious modifications, but reserve full adversarial attack simulations for security-critical models.
Stress testing validates model behavior under realistic traffic spikes, diverse datasets, and changing data integrity conditions using automated pipelines. Vertex AI Pipelines runs automated model evaluation as a pipeline component, alone or with other components, compares model versions against defined metrics and datasets, and logs results to Vertex AI ML Metadata for lineage and tracking. To simulate realistic workloads, use tools like Locust, Grafana k6, or Apache JMeter, and integrate Cloud Build with BigQuery for large-scale data analysis and with Dataflow for feature and pipeline validation. Perform bulk evaluations across diverse datasets, validate data integrity before retraining, and monitor latency, error rate, and resource utilization during the test to identify bottlenecks.
Stress tests for generative AI must add content-specific evaluation beyond code and load tests. Automated metrics such as perplexity for language models cover text quality, image fidelity, and code functionality, while human-in-the-loop evaluation covers creativity and safety. Vertex AI Pipelines can automate prompt management, batched inference, response filtering, and human-in-the-loop evaluation, including checks of generated outputs against quality metrics and safety guidelines. Automated workflows can also include data augmentation to improve prompt diversity and model robustness, and continuous training can update models with new data or prompts selected from Model Garden.
Operational validation quantifies whether a model meets production SLOs for speed, capacity, and cost-efficient resource use. Define SLOs from the user perspective and quantify them with explicit targets, such as 99.9% of API calls returning success, 95th percentile inference latency below 300 ms, time to first token (TTFT) below 500 ms for 99% of requests, and harmful output rate below 0.1%. For training efficiency, track model FLOPS utilization (MFU), iterations per second, tokens per second, and tokens per device; for serving, track prediction latency, throughput, error rates, and input-output token counts. Before shifting traffic to a new version, perform automated endpoint testing for prediction correctness, latency, throughput, and API function.
Monitor the four golden signals for AI applications to connect user impact to infrastructure saturation:
| Signal | What it measures |
|---|---|
| Latency | Time to respond to requests, including inference latency and TTFT and token streaming for large language models (LLMs) |
| Traffic | Volume of requests or workload, including prediction requests per second |
| Error rate | Rate of failed requests or operations, including model-specific failures such as hallucination or query resolution failures |
| Saturation | Utilization of CPU, memory, and GPU or TPU accelerators, indicating proximity to capacity limits |
Collect infrastructure metrics for processor usage, memory usage, network throughput and latency, and disk I/O from both managed training and serving and self-managed resources like Google Kubernetes Engine (GKE) (opens in a new tab) nodes and Cloud Run instances. Collect and visualize metrics with Cloud Monitoring, including metrics that Vertex AI exports to Cloud Monitoring, and integrate specialized serving frameworks such as vLLM or NVIDIA Triton Inference Server via Google Cloud Managed Service for Prometheus (opens in a new tab). Use Cloud Logging for event and error context, Cloud Trace to pinpoint latency across distributed inference microservices, Cloud Profiler to find bottlenecks inside function blocks, and NVIDIA Data Center GPU Manager (DCGM) for per-process GPU utilization, memory use, and temperature.
Orchestrated validation in Vertex AI Pipelines ensures that robustness and efficiency gates must pass before a model receives production traffic. The pipeline flows from evaluation components to a deployment decision, where Cloud Build builds containers, versions artifacts, and triggers deployment to Vertex AI endpoints that pull versioned artifacts from Artifact Registry. Traffic management then validates the new version under live load, so promotion depends on live SLO compliance rather than offline scores alone.
Traffic management then validates the new version under live load:
Implement model signing and verification in the same pipeline to protect operational integrity. For containerized models, use Binary Authorization to verify signatures; for models deployed directly to Vertex AI endpoints, use custom checks in deployment scripts; and for any model, use Cloud Build for model signing. Store all deployment and traffic-splitting configurations in version control and configure them programmatically with the Vertex AI software development kit (SDK) or API.
Optimizing metrics measure predictive effectiveness such as accuracy, f-measure, and BLEU scores where a higher value means a better model, while satisficing metrics measure operational constraints such as prediction latency below 200 milliseconds or model size for mobile devices. A model that breaks a satisficing threshold is rejected even with strong predictions, and for fairness optimizing metrics must also be similar across slices because a large gap between slices signals bias even when overall accuracy looks high.
Data skew is a significant difference between the feature distribution in training data and the feature distribution in serving data in production, while data drift is a significant change in feature distribution in production over time detected across consecutive spans of serving data. Skew detection compares serving statistics to training statistics saved during model training without requiring the original training table, while drift detection compares two sets of serving data such as current serving data versus a historical table snapshot.
Deployment gating promotes a model version only after automated evaluation proves it meets performance and fairness thresholds through evaluating with Vertex AI model evaluation, comparing versions against defined metrics and per-slice thresholds, logging results to Vertex ML Metadata, and registering the passing version in Vertex Model Registry. Traffic management then routes a small subset of production traffic to the new version and rolls out to all traffic only after latency, throughput, error, and safety metrics meet service level objectives, otherwise traffic reverts to the prior stable version.
Last updated