AgentStack
SKILL verified MIT Self-run

Model Monitoring

skill-ashutoshsrivastava17-skill-library-model-monitoring · by ashutoshsrivastava17

>

No reviews yet
0 installs
12 views
0.0% view→install

Install

$ agentstack add skill-ashutoshsrivastava17-skill-library-model-monitoring

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Model Monitoring? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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:

| Field | Description | Required | |---|---|---| | Model name and version | Identifier for the deployed model | Yes | | Model type | Classification, regression, ranking, generative, embedding, etc. | Yes | | Serving infrastructure | Cloud endpoint, edge, batch pipeline, streaming | Yes | | Input data sources | APIs, databases, event streams, user input | Yes | | Prediction volume | Requests per second / day / month | Yes | | SLA requirements | Latency P50/P95/P99, uptime, error rate targets | Yes | | Ground truth availability | Is labeled feedback available? Delay? | Yes | | Business context | What decisions depend on this model's output? | Yes | | Upstream dependencies | Data pipelines, feature stores, third-party APIs | Yes | | Deployment cadence | How often is the model retrained and redeployed? | Yes |

Step 2 — Configure Drift Detection

Set up monitoring for data and concept drift:

| Drift Type | What to Monitor | Detection Method | Threshold Guidance | |---|---|---|---| | Feature drift | Distribution of each input feature vs. training distribution | PSI (Population Stability Index), KS test, Jensen-Shannon divergence | PSI > 0.2 = significant; > 0.25 = critical | | Prediction drift | Distribution of model outputs over time | PSI on predicted probabilities or values, moving average comparison | Output distribution shift > 2 std from baseline | | Concept drift | Relationship between inputs and true outcomes changes | Monitor accuracy/F1/AUC on labeled data windows, ADWIN, Page-Hinkley | Performance drop > 5% from baseline over rolling window | | Label drift | Distribution of ground truth labels changes | Chi-squared test on label proportions, entropy monitoring | Label ratio change > 15% from training distribution | | Covariate shift | Input distribution changes but P(Y|X) remains the same | Domain classifier (train model to distinguish train vs. production data) | Domain classifier AUC > 0.7 indicates significant shift |

Feature-Level Monitoring Matrix

| Feature Type | Metrics to Track | Alert When | |---|---|---| | Numeric continuous | Mean, median, std, min, max, percentiles, null rate | Value outside 3-sigma, null rate > 2x baseline | | Categorical | Cardinality, frequency distribution, new categories | New unseen category appears, top-K distribution shifts > 20% | | Text / NLP | Token distribution, vocabulary overlap, embedding centroid drift | Vocabulary overlap threshold | | Temporal | Seasonality patterns, trend changes, stationarity | Breaks in expected seasonality, trend reversal | | Boolean / binary | Proportion, flip rate | Proportion shift > 10% from baseline |

Step 3 — Track Performance Metrics

Define model-type-specific performance monitoring:

| Model Type | Primary Metrics | Secondary Metrics | Monitoring Window | |---|---|---|---| | Binary classification | Accuracy, Precision, Recall, F1, AUC-ROC | FPR, FNR, calibration error, Brier score | Daily rolling + weekly aggregate | | Multi-class classification | Macro/Micro F1, per-class precision/recall, confusion matrix | Top-K accuracy, class-specific drift | Daily rolling + weekly aggregate | | Regression | MAE, RMSE, MAPE, R-squared | Residual distribution, prediction intervals coverage | Daily rolling + weekly aggregate | | Ranking | NDCG, MRR, MAP, Precision@K | Click-through rate, position bias metrics | Hourly rolling + daily aggregate | | Generative (LLM) | Faithfulness, relevance, toxicity score, hallucination rate | Latency per token, cost per request, refusal rate | Per-request + hourly aggregate | | Embedding | Retrieval recall@K, embedding space density, nearest-neighbor consistency | Cosine similarity distribution, cluster stability | Daily rolling |

Step 4 — Monitor Operational Health

Track infrastructure and serving metrics:

| Metric | Target | Warning | Critical | |---|---|---|---| | Latency P50 | 1.5x baseline | > 3x baseline | | Latency P95 | 2x baseline | > 4x baseline | | Latency P99 | 2.5x baseline | > 5x baseline | | Error rate | 0.5% | > 2% | | Throughput | [X] req/s | 80% | > 95% | | GPU utilization | 40-80% | > 90% sustained | > 95% sustained or 3x normal | > 10x normal | | Model load time | 2x baseline | > 5x baseline | | Prediction timeout rate | 0.1% | > 1% |

Step 5 — Implement Data Quality Checks

Monitor input data quality in real time:

| Check Type | Implementation | Alert Condition | |---|---|---| | Schema validation | Validate input schema on every request (field names, types, required fields) | Any schema violation | | Range validation | Check numeric features are within expected min/max bounds | Value outside training-time min/max with buffer | | Null / missing rate | Track null percentage per feature per time window | Null rate > 2x training-time null rate | | Cardinality check | Monitor unique values for categorical features | Cardinality change > 20% or new unseen category | | Volume anomaly | Track request volume over time windows | Volume outside 3-sigma of hourly/daily pattern | | Staleness check | Monitor timestamps of input data sources | Data source > [X] minutes stale | | Duplicate detection | Track duplicate request rate | Duplicate rate > 5% (may indicate upstream retry storm) | | Distribution snapshot | Compare rolling distribution to reference distribution | KL divergence or PSI exceeds threshold |

Step 6 — Configure Alerting and Response

Design the alerting framework:

| Severity | Criteria | Notification | Response SLA | Example | |---|---|---|---|---| | P0 — Critical | Model serving is down, error rate > 5%, complete data pipeline failure | PagerDuty + Slack + Email | 15 minutes | Model endpoint returning 500s | | P1 — High | Performance degradation > 15%, significant drift detected, SLA breach | Slack + Email | 1 hour | AUC dropped from 0.92 to 0.78 | | P2 — Medium | Moderate drift detected, latency degradation, data quality warning | Slack | 4 hours | PSI > 0.2 on key feature | | P3 — Low | Minor drift, informational anomalies, capacity planning signals | Dashboard + Weekly digest | Next business day | Gradual 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

| Scenario | How 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 distributions | Monitor each segment independently. Aggregate metrics can mask segment-specific degradation. | | Seasonal data with expected distribution shifts | Build 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 version | Establish a burn-in period (e.g., 24-48 hours) where baselines are being rebuilt. Use tighter manual monitoring during burn-in. | | High-cardinality categorical features | Monitor 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 chain | Monitor 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 traffic | Adjust statistical test sample sizes. Use sequential testing methods that handle low-volume data without excessive false positives. |

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.