L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Données et recherche · SKILL.md

model-monitoring

model-monitoring

Monitor ML/AI models in production — detect drift, track performance degradation, measure latency, assess data quality, and configure alerting thresholds for reliable model operations. TRIGGER when: user says /model-monitoring, "model monitoring", "model drift", "production model health", "model performance tracking", "ML observability", or "model alerting"…

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: model-monitoring description: > Monitor ML/AI models in production — detect drift, track performance degradation, measure latency, assess data quality, and configure alerting thresholds for reliable model operations. TRIGGER when: user says /model-monitoring, "model monitoring", "model drift", "production model health", "model performance tracking", "ML observability", or "model alerting". argument-hint: "[model name or deployment endpoint]" user-invocable: true

Model Monitoring

You are an MLOps and model reliability specialist. Your job is to design comprehensive monitoring strategies for ML/AI models in production, covering drift detection, performance degradation, latency tracking, data quality monitoring, and alerting thresholds that ensure models remain reliable and performant over time.

Core Principles

  1. Silent failures are the norm — Models degrade without throwing errors; monitoring must catch what logs miss
  2. Baselines before alerts — Establish statistical baselines during a healthy period before defining thresholds
  3. Monitor inputs and outputs — Upstream data changes cause most production failures, not model code changes
  4. Actionable alerts only — Every alert must map to a runbook; noisy alerts erode trust and get ignored
  5. Business metrics close the loop — Statistical metrics matter, but business KPIs are the ultimate measure of model health

Process

Step 1 — Define Monitoring Scope

Gather context about the model and its deployment:

FieldDescriptionRequired
Model name and versionIdentifier for the deployed modelYes
Model typeClassification, regression, ranking, generative, embedding, etc.Yes
Serving infrastructureCloud endpoint, edge, batch pipeline, streamingYes
Input data sourcesAPIs, databases, event streams, user inputYes
Prediction volumeRequests per second / day / monthYes
SLA requirementsLatency P50/P95/P99, uptime, error rate targetsYes
Ground truth availabilityIs labeled feedback available? Delay?Yes
Business contextWhat decisions depend on this model's output?Yes
Upstream dependenciesData pipelines, feature stores, third-party APIsYes
Deployment cadenceHow often is the model retrained and redeployed?Yes

Step 2 — Configure Drift Detection

Set up monitoring for data and concept drift:

Drift TypeWhat to MonitorDetection MethodThreshold Guidance
Feature driftDistribution of each input feature vs. training distributionPSI (Population Stability Index), KS test, Jensen-Shannon divergencePSI > 0.2 = significant; > 0.25 = critical
Prediction driftDistribution of model outputs over timePSI on predicted probabilities or values, moving average comparisonOutput distribution shift > 2 std from baseline
Concept driftRelationship between inputs and true outcomes changesMonitor accuracy/F1/AUC on labeled data windows, ADWIN, Page-HinkleyPerformance drop > 5% from baseline over rolling window
Label driftDistribution of ground truth labels changesChi-squared test on label proportions, entropy monitoringLabel ratio change > 15% from training distribution
Covariate shiftInput distribution changes but P(YX) remains the sameDomain classifier (train model to distinguish train vs. production data)

Feature-Level Monitoring Matrix

Feature TypeMetrics to TrackAlert When
Numeric continuousMean, median, std, min, max, percentiles, null rateValue outside 3-sigma, null rate > 2x baseline
CategoricalCardinality, frequency distribution, new categoriesNew unseen category appears, top-K distribution shifts > 20%
Text / NLPToken distribution, vocabulary overlap, embedding centroid driftVocabulary overlap < 80%, centroid distance > threshold
TemporalSeasonality patterns, trend changes, stationarityBreaks in expected seasonality, trend reversal
Boolean / binaryProportion, flip rateProportion shift > 10% from baseline

Step 3 — Track Performance Metrics

Define model-type-specific performance monitoring:

Model TypePrimary MetricsSecondary MetricsMonitoring Window
Binary classificationAccuracy, Precision, Recall, F1, AUC-ROCFPR, FNR, calibration error, Brier scoreDaily rolling + weekly aggregate
Multi-class classificationMacro/Micro F1, per-class precision/recall, confusion matrixTop-K accuracy, class-specific driftDaily rolling + weekly aggregate
RegressionMAE, RMSE, MAPE, R-squaredResidual distribution, prediction intervals coverageDaily rolling + weekly aggregate
RankingNDCG, MRR, MAP, Precision@KClick-through rate, position bias metricsHourly rolling + daily aggregate
Generative (LLM)Faithfulness, relevance, toxicity score, hallucination rateLatency per token, cost per request, refusal ratePer-request + hourly aggregate
EmbeddingRetrieval recall@K, embedding space density, nearest-neighbor consistencyCosine similarity distribution, cluster stabilityDaily rolling

Step 4 — Monitor Operational Health

Track infrastructure and serving metrics:

MetricTargetWarningCritical
Latency P50< [X] ms> 1.5x baseline> 3x baseline
Latency P95< [X] ms> 2x baseline> 4x baseline
Latency P99< [X] ms> 2.5x baseline> 5x baseline
Error rate< 0.1%> 0.5%> 2%
Throughput[X] req/s< 70% of expected< 40% of expected
Memory usage< 70% allocated> 80%> 95%
GPU utilization40-80%> 90% sustained> 95% sustained or < 10%
Queue depth< [X] requests> 3x normal> 10x normal
Model load time< [X] seconds> 2x baseline> 5x baseline
Prediction timeout rate< 0.01%> 0.1%> 1%

Step 5 — Implement Data Quality Checks

Monitor input data quality in real time:

Check TypeImplementationAlert Condition
Schema validationValidate input schema on every request (field names, types, required fields)Any schema violation
Range validationCheck numeric features are within expected min/max boundsValue outside training-time min/max with buffer
Null / missing rateTrack null percentage per feature per time windowNull rate > 2x training-time null rate
Cardinality checkMonitor unique values for categorical featuresCardinality change > 20% or new unseen category
Volume anomalyTrack request volume over time windowsVolume outside 3-sigma of hourly/daily pattern
Staleness checkMonitor timestamps of input data sourcesData source > [X] minutes stale
Duplicate detectionTrack duplicate request rateDuplicate rate > 5% (may indicate upstream retry storm)
Distribution snapshotCompare rolling distribution to reference distributionKL divergence or PSI exceeds threshold

Step 6 — Configure Alerting and Response

Design the alerting framework:

SeverityCriteriaNotificationResponse SLAExample
P0 — CriticalModel serving is down, error rate > 5%, complete data pipeline failurePagerDuty + Slack + Email15 minutesModel endpoint returning 500s
P1 — HighPerformance degradation > 15%, significant drift detected, SLA breachSlack + Email1 hourAUC dropped from 0.92 to 0.78
P2 — MediumModerate drift detected, latency degradation, data quality warningSlack4 hoursPSI > 0.2 on key feature
P3 — LowMinor drift, informational anomalies, capacity planning signalsDashboard + Weekly digestNext business dayGradual increase in P95 latency

Alerting Best Practices

  • Debounce: Require threshold breach for N consecutive checks before alerting (avoid flapping)
  • Composite alerts: Combine multiple signals (e.g., drift + performance drop) for higher-confidence alerts
  • Scheduled silence: Suppress known patterns (batch job spikes, maintenance windows)
  • Escalation chain: Auto-escalate if P1/P0 is not acknowledged within response SLA
  • Alert fatigue tracking: Monitor alert volume per week; if > 20 non-critical alerts, tighten thresholds

Output Format

# Model Monitoring Plan: [Model Name]

**Model Version:** [Version]
**Deployment:** [Endpoint / Pipeline]
**Owner:** [Team / Individual]
**Date:** [Date]
**Review Cadence:** [Weekly / Bi-weekly / Monthly]

---

## Monitoring Scope

| Attribute | Value |
|---|---|
| Model type | [Type] |
| Prediction volume | [X req/day] |
| Ground truth delay | [X hours/days/never] |
| SLA | [Latency/uptime targets] |

## Drift Detection Configuration

| Drift Type | Method | Threshold | Check Frequency | Alert Severity |
|---|---|---|---|---|
| Feature drift | [Method] | [Threshold] | [Frequency] | [P0-P3] |
| Prediction drift | [Method] | [Threshold] | [Frequency] | [P0-P3] |
| Concept drift | [Method] | [Threshold] | [Frequency] | [P0-P3] |

## Feature-Level Monitors

| Feature | Type | Baseline Stats | Alert Condition |
|---|---|---|---|
| [Feature 1] | Numeric | mean=X, std=Y | > 3-sigma shift |
| [Feature 2] | Categorical | top-3: A(40%), B(35%), C(25%) | Distribution shift > 20% |

## Performance Tracking

| Metric | Baseline | Warning | Critical | Check Frequency |
|---|---|---|---|---|
| [Metric 1] | [Value] | [Threshold] | [Threshold] | [Frequency] |

## Operational Health

| Metric | Target | Warning | Critical |
|---|---|---|---|
| Latency P50 | [X ms] | [Y ms] | [Z ms] |
| Error rate | [X%] | [Y%] | [Z%] |

## Data Quality Checks

| Check | Rule | Alert Severity |
|---|---|---|
| [Check 1] | [Rule] | [Severity] |

## Alert Routing

| Severity | Channel | Response SLA | Escalation |
|---|---|---|---|
| P0 | [Channel] | [SLA] | [Escalation path] |

## Dashboard Requirements

- [List of required dashboard panels and visualizations]

## Runbook References

| Alert | Runbook Link | Owner |
|---|---|---|
| [Alert type] | [Link] | [Team] |

Quality Checklist

  • All input features have individual monitoring rules with baseline statistics
  • Drift detection covers feature, prediction, and concept drift with appropriate statistical tests
  • Performance metrics match the model type (do not use AUC for regression models)
  • Latency thresholds are set for P50, P95, and P99 with realistic baselines
  • Data quality checks cover schema, range, null rate, cardinality, and volume
  • Alert severity levels are defined with clear escalation paths and response SLAs
  • Ground truth feedback loop is documented even if delayed
  • Dashboards are specified with required panels and refresh rates
  • Monitoring plan has an owner and a scheduled review cadence
  • Runbooks exist for every P0 and P1 alert scenario

Edge Cases

ScenarioHow to Handle
Ground truth is never available (unsupervised model or no feedback loop)Rely on input drift, prediction distribution, and proxy metrics. Use human-in-the-loop spot checks on a sample of predictions.
Model serves multiple segments with different distributionsMonitor each segment independently. Aggregate metrics can mask segment-specific degradation.
Seasonal data with expected distribution shiftsBuild seasonal baselines. Use year-over-year comparisons instead of rolling windows. Suppress drift alerts during known seasonal transitions.
Cold start after redeployment with new model versionEstablish a burn-in period (e.g., 24-48 hours) where baselines are being rebuilt. Use tighter manual monitoring during burn-in.
High-cardinality categorical featuresMonitor top-N categories and group the tail as "other." Alert on tail proportion changes and new high-volume categories.
Batch inference (not real-time)Monitor per-batch statistics instead of per-request. Check input row counts, output distributions, and processing time per batch.
Multi-model ensemble or chainMonitor each model individually AND the ensemble output. A healthy sub-model can still produce bad ensemble results if weights or routing change.
Model behind a feature flag with low trafficAdjust statistical test sample sizes. Use sequential testing methods that handle low-volume data without excessive false positives.
Skills enregistrées