api
    New
    2026-04-13

    Drift Detection

    Monitor deployed models for data drift, concept drift, and performance degradation with configurable thresholds and automated rollback.

    drift
    monitoring
    model-health
    psi
    rollback

    How It Works

    The scheduled_drift_scan Celery Beat task runs every DRIFT_CHECK_INTERVAL_MINUTES (default 60). It queries all production models, runs a drift check for each with a baseline, and triggers model revert if auto_rollback=true and severity is critical.

    text
    11. Capture baseline statistics on promotion
    22. Celery Beat runs drift check every 60 min
    33. Compare current distribution vs baseline
    44. If drift_score > threshold → create DriftReport
    55. If auto_rollback + critical → trigger model revert

    Capturing a Baseline

    Capture reference statistics at the time of promotion to production.

    bash
    1curl -X POST /api/v1/drift/models/{model_id}/baseline \
    2  -d '{
    3    "workspace_id": "ws-prod",
    4    "dataset": "transactions-2026-q1",
    5    "features": {
    6      "amount": { "mean": 142.3, "std": 89.1 },
    7      "merchant_category": { "distribution": { "grocery": 0.34 } }
    8    },
    9    "target_distribution": { "fraud": 0.023, "legit": 0.977 }
    10  }'

    Drift Metrics

    Four statistical tests are applied depending on the data type.

    MetricMethodApplies to
    Feature distributionPopulation Stability Index (PSI)Continuous + categorical features
    Concept driftKL divergence on target distributionClassification targets
    Performance driftAUC / accuracy delta vs baselineWhen ground truth labels available
    Data qualityNull rate, schema changesAll feature types

    Configuring Thresholds

    Set per-model thresholds with optional auto-rollback.

    bash
    1curl -X PUT /api/v1/drift/models/{model_id}/threshold \
    2  -d '{
    3    "warning_threshold": 0.2,
    4    "critical_threshold": 0.5,
    5    "auto_rollback": true,
    6    "workspace_id": "ws-prod"
    7  }'

    Drift Report

    Run a drift check manually or query historical reports. When a drift check produces a DriftReport with any severity level, a drift.detected webhook fires. This event also triggers the IncidentResponseAgent — severity is classified as critical if the drift severity is critical, and the agent notifies Slack, JIRA, and PagerDuty accordingly. If auto_rollback=true and severity is critical, the model is automatically reverted to the previous production version before the agent fires.

    bash
    curl -X POST /api/v1/drift/models/{model_id}/check \
      -d '{ "workspace_id": "ws-prod", "current_dataset": "transactions-2026-q2-week1" }'
    json
    1{
    2  "id": "report-uuid",
    3  "drift_score": 0.34,
    4  "severity": "warning",
    5  "features_drifted": ["amount", "merchant_category"],
    6  "auto_rollback_triggered": false
    7}
    Edit this page on GitHub