Professional Machine Learning Engineer
Model evaluation across slices is the process of measuring machine learning model behavior and fairness on distinct data subsets rather than on the entire dataset alone, because aggregate metrics can hide poor performance or unfair outcomes on critical subgroups. In Google Cloud, you use Vertex AI Model Evaluation to assess predictive effectiveness across predefined data slices such as demographic cohorts or feature-value ranges. This approach reveals hidden disparities that would be invisible if you only looked at overall accuracy.
Evaluation metrics are split into two categories: optimizing metrics that measure predictive effectiveness, and satisficing metrics that define strict operational constraints that the model must not violate. Optimizing metrics include classification accuracy, precision, recall, and F-measure for classification models, plus mean absolute percentage error for regression models. Satisficing metrics include hard limits like a maximum latency of 200 milliseconds or a maximum model file size for low-power hardware. During evaluation on each data slice, you work to improve the optimizing metrics while confirming that no satisficing metric threshold is broken.
Fairness analysis uses diagnostic tools to detect two kinds of bias: data bias in the training distribution and model bias in post-training predictions, measured across categories such as race, gender, or class. Vertex AI Model Evaluation provides metrics that identify disparate performance and statistical skew across slices. In Vertex AI Workbench, you can use the What-If Tool (WIT) to inspect dataset bias interactively and the Language Interpretability Tool (LIT) to analyze language model behaviors. Vertex Explainable AI generates feature attributions for tabular and image models, showing which input features contribute most to each prediction. By comparing attributions across slices, you can detect whether the model is relying on biased reasoning or data skew.
Automated validation in Vertex AI Pipelines evaluates candidate models against consistent quality benchmarks before they are allowed to serve traffic. A pipeline component tests the trained model on an isolated holdout test split and compares its performance against a predefined baseline, such as a simple heuristic or a mean predictor. If the model exceeds the baseline and meets all optimizing and satisficing thresholds across every slice, the pipeline imports the model into Vertex AI Model Registry. Only after achieving this validation readiness does Cloud Deploy release the verified model version to Vertex AI endpoints.
Data quality and drift detection pipelines are automated systems that check incoming data against expected schemas, monitor statistical changes in data distributions, and ensure consistency between training and serving datasets. These pipelines are critical for maintaining model reliability in production by catching data issues before they degrade predictions.
TensorFlow Data Validation (TFDV) is a library in the TensorFlow Extended (TFX) ecosystem that analyzes training and serving data to find schema skew, data value skew, and anomalies. TFDV computes descriptive statistics on datasets and compares them against an expected schema to flag unexpected features, missing required fields, or out-of-range values. The library outputs statistics in a standardized format that can be stored over time, enabling teams to track quality trends and trigger alerts when distributions shift significantly. TFDV integrates with BigQuery ML through the ML.TFDV_DESCRIBE and ML.TFDV_VALIDATE functions, which run the same validation logic directly within BigQuery SQL queries. These functions accept data in the TensorFlow DatasetFeatureStatisticsList protocol buffer format and can be used in existing TFDV workflows while leveraging BigQuery's compute infrastructure.
BigQuery ML provides dedicated functions for monitoring data skew and drift without needing the original training data, because training statistics are saved during model creation. The ML.DESCRIBE_DATA function computes descriptive statistics for any training or serving dataset, producing baseline metrics that can be compared across time periods. The ML.VALIDATE_DATA_SKEW function compares serving data statistics against the training statistics stored with a model to detect skewâwhen feature value distributions differ between training and production. The ML.VALIDATE_DATA_DRIFT function compares two serving datasets, typically current production data against historical data, to detect driftâwhen the statistical properties of inputs change over time. For advanced monitoring, you can run ML.TFDV_DESCRIBE at regular intervals, save results to a table, and then use ML.TFDV_VALIDATE with a skew or drift detection mode to see if serving data has diverged from historical baselines, enabling integration with external dashboards and automated alerting.
Vertex AI Model Monitoring is a managed service that continuously watches deployed models for feature skew and drift, sending alerts when serving data diverges from training data or from recent serving baselines. For skew detection, the monitoring job compares production input data against the training statistics saved during model training, needing only a reference to the training dataset rather than the raw data itself. For drift detection, the service monitors changes in serving data statistics over time and triggers alerts when features shift beyond configured thresholds. The service supports numerical and categorical features, integrates with Cloud Monitoring for visualization and alerting, and allows you to adjust alert sensitivity to balance detection of real issues against false positives. Vertex AI Model Monitoring also integrates with Vertex Explainable AI feature attributions, enabling detection of cases where the model begins relying on different input features in production than it did during trainingâa subtle form of degradation that traditional statistical drift detection might miss.
Vertex AI Pipelines orchestrates data validation and monitoring components as part of an automated ML workflow, connecting data ingestion, validation, training, evaluation, and deployment into a directed acyclic graph (DAG). Each pipeline component runs as a containerized task, with outputs from upstream steps passed automatically to downstream steps. The pipeline can halt execution when data validation detects schema violations or significant skew, preventing bad data from propagating into training and causing silent degradation. Pipeline triggers can run on schedules, in response to new data arriving in Cloud Storage or BigQuery, or from Cloud Logging events such as drift alerts from Vertex AI Model Monitoring. When a monitoring alert triggers pipeline execution, the retraining workflow ingests recent serving data, validates it against the schema, compares statistics to training baselines, and if validation passes, retrains the model with the updated dataset. This automated cycle keeps models adapted to changing data patterns without manual intervention.
In TFX-based ML systems, the data validation component runs immediately after data extraction and before data transformation, ensuring that only data conforming to the established schema reaches downstream steps. The component generates an anomalies report documenting any schema violations or statistical outliers. You can configure the pipeline to stop when anomalies are detected, requiring investigation before proceedingâthis prevents training on corrupted or misaligned data. The TFX pipeline also includes model validation steps that evaluate the trained model against test data before promotion, comparing metrics against the current deployed model and business requirement thresholds. This ensures that new models pass all data quality checks and also deliver improved or maintained predictive performance before replacing production versions.
Validating model robustness and operational characteristics means testing a machine learning model's performance, reliability, and efficiency under realistic and stressful conditions before and after deployment. This ensures the model can handle production demands like varying data patterns, high request volumes, and adversarial inputs without degrading in quality or availability.
Adversarial and stress testing deliberately challenges a model with unexpected or extreme inputs to evaluate its resilience. On Google Cloud, you orchestrate these tests using Vertex AI Pipelines to automate the validation workflow. A pipeline first prepares a test dataset that includes edge cases or synthetic adversarial examples, then runs the model against that data to identify vulnerabilities like sensitivity to input perturbations or performance degradation under data drift. For generative AI models, testing must also evaluate the quality of generated content, such as text quality, image fidelity, or code functionality. You can integrate load-testing tools like Locust, Grafana k6, or Apache JMeter within the pipeline to simulate realistic high-volume workloads and monitor system response.
Model latency is the time for a single prediction request, and throughput is the number of requests the system handles per second. These metrics are critical for user-facing applications. In GCP, you configure and test these characteristics using Vertex AI Inference. When deploying a model to a Vertex AI endpoint, you select a machine type and can add GPUs to optimize for low latency or high throughput. Stress tests orchestrated through Vertex AI Pipelines send controlled bursts of prediction requests to the endpoint. You use Cloud Monitoring to track metrics like prediction latency and request count in real time, then compare observed values against the satisficing metricsâthe predefined operational constraints, such as a 200-millisecond latency thresholdâthat the model must meet for production acceptance.
Resource efficiency validation ensures the model uses computational resources like CPU, memory, and accelerators cost-effectively under load. On Vertex AI Inference, you validate efficiency by analyzing resource utilization (e.g., GPU memory, CPU load) of the prediction nodes during stress tests executed by the pipeline. You also configure autoscaling policies for the endpoint to adjust the number of nodes up or down based on demand, optimizing cost and performance. For batch prediction jobs, you validate efficiency by right-sizing the machine types specified for the job. The validation outcome determines whether the chosen resource configuration meets performance targets without excessive over-provisioning, balancing operational cost against latency and throughput requirements.
Continuous monitoring for model degradation extends validation after deployment. Vertex AI Model Monitoring automatically detects data drift (changes in production input data over time) and feature skew (differences between training and serving data). You configure monitoring jobs by setting alert thresholds for statistical shifts; when a threshold is breached, an alert goes to Cloud Monitoring, which can trigger re-validation or retraining. For complex models, including generative AI, you also monitor shifts in output quality and safety compliance. Additionally, you can use Vertex Explainable AI to track changes in feature attributions, which can be an early indicator of model degradation even for complex feature types like embeddings, providing a more nuanced signal than traditional statistical drift detection.
ML.TFDV_DESCRIBE and ML.TFDV_VALIDATE functions.Data skew refers to a difference between the feature value distributions in training data and serving data, while data drift refers to a change in the statistical properties of serving data over time compared to historical serving data. Skew is detected by comparing serving data to training statistics, and drift is detected by comparing two serving datasets.
Vertex AI Model Monitoring integrates with Vertex Explainable AI to track feature attributions over time. If the attributions change significantlyâmeaning the model assigns importance to different input features in production than it did in trainingâthis can signal model degradation even when traditional drift metrics look normal.
Use BigQuery ML functions like ML.VALIDATE_DATA_SKEW and ML.VALIDATE_DATA_DRIFT when your data already resides in BigQuery and you want to run validation directly within SQL queries without setting up a separate monitoring service. Use Vertex AI Model Monitoring when you need continuous automated monitoring, alerting, and integration with Cloud Monitoring for deployed endpoints.
Prepare and test your skills
Prepare and test your skills