Monitoring AI solutions · Topic 2 of 2

Model Monitoring, Drift and Evaluating Gen AI

Configure Model Monitoring for skew, data drift and attribution drift, set up continuous evaluation, and monitor, test and evaluate gen AI apps.

  • 6 min
  • Includes a diagram
In a nutshell
  • Skew compares serving with training data; drift compares serving data over time.
  • Concept drift shows up in accuracy against labels, not always in input distributions.
  • Model Monitoring settings: target, baseline, features, thresholds, sampling, schedule, alerts.

What it is

A model that was accurate at launch can quietly get worse. Model Monitoring on Gemini Enterprise Agent Platform watches production inputs, outputs and attributions and alerts when they move away from a baseline. Continuous evaluation compares predictions with real outcomes as labels arrive.

Gen AI applications need their own checks: quality, safety and groundedness of free-text answers, plus cost and latency.

Production requestsLogged inputs and outputsCompare to baselinetraining data or past windowAlertthreshold crossedInvestigateretrain or fix

How it works

Common issues to monitor

Skew versus drift: training-serving skew is serving data that differs from the training dataset, often from a pipeline bug, while data drift is serving data that changes between an earlier and a recent window because the world changed.

IssueWhat changedDetect it by
Training-serving skewServing data differs from the training dataCompare serving feature distributions with the training dataset
Data driftServing data changes over timeCompare recent serving data with an earlier serving window
Prediction driftThe distribution of outputs changesTrack predicted classes or values over time
Concept driftThe relationship between inputs and the label changesFalling accuracy once labels arrive; input monitoring alone may not show it
Feature attribution driftWhich features drive predictions changesCompare feature attributions over time or with training

Skew often comes from a pipeline bug, such as different units or preprocessing in serving. Drift comes from the world changing: new customers, seasons, products or fraud patterns.

Configuring Model Monitoring

SettingMeaning
TargetThe model version or endpoint to watch
BaselineThe training dataset (for skew) or a previous serving period (for drift)
Features and outputsWhich inputs, predictions and attributions to track
ThresholdsHow far a distribution may move before alerting, per feature
Sampling rateShare of requests analysed, trading cost against sensitivity
ScheduleHow often monitoring jobs run, or on demand
AlertsEmail or Cloud Monitoring notification channels, for example Pub/Sub to trigger retraining

Distribution distance is measured with statistics such as Jensen-Shannon divergence for numeric features and L-infinity distance for categorical ones. Attribution monitoring needs explanations enabled on the model.

Exam tip

Skew detection needs the training data as baseline. If a stem says the training dataset is not available to the monitoring job, only drift between serving windows can be measured.

Continuous evaluation

Distributions show change; only labels show whether the model is wrong.

  1. Log requests and predictions, for example with endpoint request-response logging to BigQuery.
  2. Join ground-truth labels when they arrive (a purchase, a chargeback, a human review).
  3. Compute the production metrics on a schedule and on slices.
  4. Alert or trigger retraining when a metric falls below its threshold.

Troubleshooting by symptom

SymptomLikely causeAction
Accuracy fell right after launchTraining-serving skewCompare preprocessing and feature values between training and serving
Accuracy declines slowly over monthsData or concept driftRetrain on recent data; review features
Drift alert but accuracy unchangedHarmless shiftAdjust the threshold or baseline; confirm before retraining
Attributions shift to a new featureLeakage or a changed upstream fieldInspect that feature's source
Latency or errors riseCapacity, cold starts, bad requestsCheck endpoint metrics and logs; scale or fix inputs

Monitoring, testing and evaluating gen AI solutions

StageWhat to do
Before releaseBuild an evaluation dataset of real prompts with expected answers or rubrics; score with computation-based metrics and LLM-as-a-judge
Regression testsRe-run the evaluation set for every change of prompt, model version, retrieval settings or tuning
Red teamingTest with adversarial prompts: injection, jailbreaks, requests for sensitive data
In productionTrack latency, token usage and cost, error rates (including 429), safety filter blocks, and Model Armor findings
Quality in productionSample live responses and score groundedness, relevance and safety with a judge model; collect user feedback such as thumbs up or down
RAG appsCheck retrieval quality (are the right passages returned?) separately from answer quality

Gen AI quality can change without your code changing, for example when a model version is updated or source documents change. Pin model versions and rerun evaluations before moving to a new one.

A worked example

A demand model's error doubled one week after a release. Monitoring shows skew on price: serving sends prices in cents, training used dollars. The serving code is fixed and the feature is added to skew monitoring with a tight threshold.

Months later, accuracy falls slowly as buying habits change. Drift alerts on several features confirm data drift, and the scheduled retraining pipeline with fresh data restores accuracy.

Error doublesSkew alertprice featureFix serving unitsLaterslow declineDrift alertRetrain on recent data

How the exam asks about this

  • "A model performs worse in production than in testing from day one." Investigate training-serving skew: enable skew detection against the training data and compare preprocessing.
  • "Labels arrive weeks later; detect problems sooner." Monitor input feature and prediction drift with Model Monitoring.
  • "Measure a support chatbot's answer quality after each prompt change." Run the same evaluation dataset with model-based metrics (LLM-as-a-judge) as a regression test before release.

What to remember for the exam

  • Skew compares serving with training data; drift compares serving data over time.
  • Concept drift shows up in accuracy against labels, not always in input distributions.
  • Model Monitoring settings: target, baseline, features, thresholds, sampling, schedule, alerts.
  • Continuous evaluation joins logged predictions with labels to track real accuracy.
  • Gen AI: evaluation sets, regression tests on every change, red teaming, and live quality, safety, cost and latency tracking.
Watch out

A drift alert is not automatically a reason to retrain. Confirm with labels or evaluation; retraining on a temporary blip can make the model worse.

Common mistakes

Confusing skew and drift. Skew is training versus serving; drift is serving now versus serving before.

Monitoring inputs only. Concept drift can leave inputs unchanged while accuracy falls; evaluate against labels.

Changing prompts without re-testing. A small prompt edit can break formats or safety; rerun the evaluation set first.

Check yourself

  • What baseline does skew detection need?

    The training dataset, so serving feature distributions can be compared with what the model was trained on.

  • Why can concept drift go undetected by input monitoring?

    The inputs can look the same while their relationship to the label changes, so only accuracy measured against ground truth reveals it.

  • How should a gen AI app be tested before changing its prompt or model version?

    Rerun a fixed evaluation dataset with computation-based and model-based metrics and compare results with the current version.

Topic 2 of 2 in Monitoring AI solutions

Test yourself on Monitoring AI solutions

The full Google Cloud Professional Machine Learning Engineer question bank has 749 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Google Cloud. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.