Monitoring

Observe production AI systems across service health, data, model quality, safety, outcomes, and cost.

Deployment is the beginning of a model's operational life, not the end of the project. Real-world data, customer behavior, upstream systems, policies, and business goals change. Dependencies fail, traffic spikes, labels arrive late, and new user groups appear. Monitoring helps teams detect these changes early, understand their impact, and decide whether to repair infrastructure, correct data, roll back, retrain, recalibrate, or retire the system.

Monitoring is useful only when it supports decisions. Collecting thousands of metrics without ownership, thresholds, investigation context, and response actions creates noise rather than reliability.

Monitoring Is More Than Uptime

LayerQuestionExample signals
InfrastructureAre the runtime resources healthy?CPU, memory, accelerator use, disk, network, node and container health
ServiceCan users obtain a timely response?Traffic, errors, timeouts, p50/p95/p99 latency, saturation, queue depth
DataAre inputs valid and representative?Schema, types, missingness, ranges, categories, freshness, drift
FeaturesAre training and serving calculations consistent?Feature freshness, nulls, skew, lookup failures, distribution changes
ModelIs predictive behavior acceptable?Prediction distribution, confidence, calibration, slice quality, ground-truth metrics
Safety and fairnessIs the system behaving within policy?Harmful outputs, policy events, subgroup errors, overrides, escalations
ProductDoes the model still create value?Conversion, resolution, acceptance, loss, complaints, human corrections
CostIs operation economically sustainable?Cost per request or outcome, token use, accelerator utilization, data transfer
PipelineCan the system produce and release a valid replacement?Data job failures, training duration, gate failures, deployment and rollback status

Start With Objectives and Baselines

Define what good behavior means before creating dashboards. A service-level indicator (SLI) is a measurement such as successful-request ratio or prediction latency. A service-level objective (SLO) is its target over a time window. AI systems also need model and product objectives, because availability alone does not prove usefulness.

  • Establish offline evaluation baselines and expected production ranges before release.
  • Define objectives for availability, latency, model quality, safety, business outcomes, and unit cost.
  • Measure representative slices such as region, product, device, language, or other justified groups—not only global averages.
  • Record assumptions about traffic, seasonality, label delay, data freshness, and normal variation.
  • Choose response actions and owners for each important threshold.

Golden Signals for the Serving System

  • Traffic: requests, predictions, payload sizes, tenants, and concurrency.
  • Errors: failed requests, invalid input, dependency failures, model-load failures, and fallback use.
  • Latency: median and tail latency for the complete request and important dependencies.
  • Saturation: CPU, memory, accelerator, connection pools, concurrency, queue depth, and throttling.
  • Availability: successful usable responses, not merely a running process.
  • Cold starts and warm-up: startup duration, model download, compilation, and first-inference latency.

Use percentiles rather than averages for latency because averages can hide slow experiences. Segment metrics by endpoint, model version, release, region, tenant class, and response status when that cardinality is controlled and useful.

Data Quality Monitoring

Many apparent model failures begin upstream. Validate schema, required fields, types, units, ranges, category vocabularies, uniqueness, timestamps, volume, and freshness. Compare live preprocessing with training logic and monitor feature lookup errors. A currency-unit change or an empty source table can damage predictions even when model code is unchanged.

ProblemPossible signalTypical response
Broken contractMissing column or incompatible typeReject or quarantine data and contact the owning producer
Stale feedFreshness exceeds limitPause downstream work, use approved fallback, investigate ingestion
Unexpected valuesRange, category, or null-rate violationTrace transformation and source changes
Training-serving skewOnline feature differs from training definitionRestore compatible transformation and evaluate affected predictions
Volume anomalyRows or events differ sharply from baselineCheck outage, duplication, seasonality, or product change

Drift and Model Performance

Data Drift

Data drift is a change in the distribution of model inputs. It can be measured with feature statistics or distribution distances. Drift might reflect seasonality, a new customer population, a product launch, a sensor change, or a pipeline bug. It is evidence to investigate—not proof that predictions are worse.

Prediction Drift

Prediction drift is a change in scores, classes, confidence, or output patterns. It can reveal a changing population or upstream defect, but it can also be expected when the business changes.

Concept Drift

Concept drift occurs when the relationship between inputs and the desired outcome changes. Detecting it generally requires new ground truth, experiments, or strong proxy outcomes; input drift alone cannot establish concept drift.

Performance Degradation

When labels arrive, calculate task-appropriate metrics such as precision, recall, false-positive rate, calibration, ranking quality, or forecast error. Evaluate the same important slices used during release approval. Account for label delay and avoid comparing incomplete recent cohorts with mature historical cohorts.

Models Without Immediate Labels

Fraud, recommendations, credit, forecasting, and other systems often receive ground truth days or months later. Use multiple layers of evidence while labels mature.

  • Schema, data-quality, feature-freshness, and distribution checks.
  • Prediction volume, confidence, abstention, and fallback trends.
  • Human review, corrections, appeals, or support contacts from sampled cases.
  • Carefully selected proxy outcomes whose limitations are documented.
  • Backfilled ground-truth metrics by prediction cohort once labels become available.
  • Periodic shadow evaluation against a champion, rules, or reviewed evaluation set.

Generative AI Monitoring

Generative AI requires service monitoring plus behavior-specific evidence. Track model and prompt versions, token usage, truncation, refusals, structured-output validity, grounding and citation quality, safety-policy events, retrieval quality, tool calls, tool authorization failures, and human feedback. Sample outputs for reviewed evaluation under an approved privacy policy.

ComponentSignals
Prompt and modelVersion, latency, tokens, refusals, output-schema validity
RetrievalNo-result rate, retrieved relevance, freshness, permission-filter behavior
GenerationGroundedness, factuality checks, safety events, repetition, language quality
Tools and agentsTool selection, authorization, arguments, failures, loops, external side effects
User outcomeAcceptance, edits, escalation, task completion, complaint and correction rates
ProviderQuota, throttling, dependency errors, model-version changes, regional availability

Logging, Metrics, and Traces

TelemetryBest useExample
MetricsAggregated trends and alertsError rate, p95 latency, prediction distribution
LogsDetailed event investigationValidation failure with request and model IDs
TracesFollowing work across dependenciesGateway to feature lookup to model to database
Prediction recordsModel and outcome analysisVersioned input metadata, score, outcome link
Audit recordsWho changed or accessed whatModel approval, deployment, permission, or configuration change

Use a stable request or prediction ID to correlate telemetry. Attach release, model, data, feature, prompt, policy, and configuration versions where relevant. Do not log raw personal, confidential, or security-sensitive values by default; redact, tokenize, aggregate, restrict, and retain only what has a justified purpose.

Dashboards for Different Audiences

  • On-call dashboard: availability, errors, latency, saturation, queues, dependencies, and current releases.
  • ML dashboard: data quality, drift, prediction distribution, ground-truth quality, slices, and model comparisons.
  • Product dashboard: user behavior, business outcomes, feedback, corrections, and harmful-impact indicators.
  • Cost dashboard: resource usage, tokens, data processing, cost by model and tenant, and cost per outcome.
  • Governance dashboard: approved versions, review status, policy events, audit changes, owners, and expiration dates.

Keep dashboards focused on decisions. Every panel should answer a question, support diagnosis, or verify recovery. Display release annotations so changes in behavior can be connected to deployments, configuration updates, upstream data releases, or incidents.

Alert Design

Alert on symptoms that require timely action, not every unusual value. Use sustained windows, minimum traffic, severity levels, and multi-signal conditions to reduce noise. Static thresholds work for hard limits; baselines and change detection can help with seasonal signals, but they still need testing and ownership.

Output
Actionable alert
Condition: p95 latency exceeds the user objective for 10 minutes
Scope: production prediction endpoint with sufficient traffic
Context: release, model, region, dependency, queue, and saturation panels
Owner: serving-platform on-call
Runbook: validate impact -> stop rollout -> mitigate capacity/dependency -> roll back if needed -> verify recovery
Escalation: ML owner if model loading or model behavior contributes
  • Each alert needs an owner, severity, affected users, dashboard link, runbook, and escalation path.
  • Page for urgent user impact; create tickets or reports for slower trends and maintenance work.
  • Deduplicate related alerts and suppress downstream noise during a known root incident.
  • Test alerts and runbooks with drills; an untested alert may fail when it matters.
  • Review false positives, missed incidents, and alert response time after incidents.

Monitoring During Deployment

Attach version labels to all telemetry and compare a candidate with the current production release during shadow, canary, blue/green, or A/B rollout. Promotion gates should include service health, capacity, model quality, safety, important slices, product outcomes, and cost. Stop traffic expansion or roll back when trusted guardrails breach.

Output
Candidate release
-> staging health and synthetic prediction checks
-> shadow comparison on representative traffic
-> small canary with technical + model + safety gates
-> gradual traffic increase
-> full release with continued cohort monitoring
-> promote, pause, roll back, or investigate

From Alert to Incident Response

  • Confirm the signal and estimate user, business, safety, and data impact.
  • Identify the affected release, model, features, tenants, regions, and prediction time range.
  • Contain harm with traffic reduction, fallback, disabled action, quarantined data, or rollback.
  • Diagnose infrastructure, dependency, data, feature, model, prompt, policy, and configuration changes.
  • Verify recovery using service signals, synthetic requests, model checks, and user outcomes.
  • Reconcile affected predictions or external actions and notify stakeholders according to policy.
  • Record the timeline and root cause, then improve tests, thresholds, dashboards, and runbooks.

Retraining Decisions

Do not retrain automatically because one drift metric crosses a threshold. First determine whether the cause is data corruption, a feature bug, seasonality, a policy change, a new population, or genuine performance decay. Retraining should use governed data and produce a candidate that passes the normal evaluation and release process. Sometimes recalibration, a rules update, a source fix, or model retirement is the correct response.

Monitoring Architecture

Output
Requests + applications + model servers + data pipelines
-> metrics, structured logs, traces, prediction and audit records
-> protected telemetry storage with retention controls
-> dashboards, cohort analysis, drift and quality jobs
-> alert rules and anomaly detection
-> on-call, ML, product, security, and governance owners
-> mitigate, roll back, repair, retrain, recalibrate, or retire

Common Monitoring Mistakes

MistakeWhy it failsBetter approach
Monitor uptime onlyHealthy services can return bad predictionsInclude data, model, safety, outcome, and cost signals
Use global averagesTail latency and weak slices disappearUse percentiles, cohorts, and justified slice analysis
Alert on every anomalyNoise causes alert fatiguePage only on actionable, sustained user-impact symptoms
Retrain whenever drift appearsDrift can be expected or caused by a bugInvestigate cause and validate a candidate through gates
Log every inputCreates privacy, security, and cost riskMinimize, redact, sample, aggregate, and control retention
No version labelsTeams cannot connect behavior to a releaseAttach immutable model and system versions
No delayed-label designRecent performance appears unknowable or biasedTrack cohorts and backfill metrics when labels mature
Dashboard without ownerProblems remain visible but unresolvedAssign decisions, alerts, runbooks, and review cadence

Practical Exercise

  • Instrument a prediction API with request count, error count, latency histogram, saturation, model version, and structured logs.
  • Create input-schema, missing-value, range, freshness, prediction-distribution, and one slice-quality check.
  • Build an on-call dashboard and an ML-quality dashboard with release annotations.
  • Define one SLO and an error-budget or burn-rate view for the API.
  • Create a warning alert and an urgent alert, each with owner, context, severity, and runbook.
  • Simulate a dependency timeout, schema break, traffic spike, and degraded candidate release.
  • Demonstrate containment, rollback, recovery verification, and incident documentation.
  • Review telemetry for sensitive data, access, sampling, cardinality, retention, and cost.

Production Monitoring Checklist

Output
[ ] Owners, objectives, baselines, important slices, and response actions defined
[ ] Traffic, errors, latency, saturation, availability, dependency, and queue signals collected
[ ] Schema, quality, freshness, feature, input, and prediction distributions monitored
[ ] Ground-truth, safety, fairness, product outcome, feedback, and cost signals planned
[ ] Request and prediction telemetry carries immutable release and model versions
[ ] Sensitive data minimized, redacted, protected, sampled, and retained by policy
[ ] Dashboards support on-call, ML, product, cost, and governance decisions
[ ] Alerts are actionable, tested, owned, deduplicated, and linked to runbooks
[ ] Canary comparison, rollback, fallback, reconciliation, and incident procedures tested
[ ] Drift and quality investigations feed evaluation, retraining, and retirement decisions