Skip to main content

Early warning when production ML models degrade

Project description

ModelSentry

Early warning when your production ML models start degrading.

ModelSentry computes statistical profiles of your model's inputs and outputs locally — nothing leaves your machine. When feature distributions drift from baseline, you get an alert before your stakeholders notice.

PSI 0.83 ↑  income     CRITICAL
PSI 2.43 ↑  age        CRITICAL
PSI 0.01    tenure     stable
PSI 0.00    country    stable

Install

pip install modelsentry

Requires Python 3.11+. No Docker. No cloud account. No infrastructure.


Quickstart

import modelsentry as ms

ms.init(model_id="churn-v3", profile_window=500)

@ms.monitor()
def predict(features_df):
    return model.predict(features_df)

Then start the local dashboard:

modelsentry serve --model churn-v3 --alert-email you@company.com

Open http://localhost:8080 to see live drift scores, feature distributions vs. baseline, and alert history. The dashboard updates every 60 seconds and shows an explicit "all systems nominal" state when no drift is detected — so you always know the system is alive.


How it works

ModelSentry runs as two independent processes — you don't need both running at the same time.

In your model (SDK side)

@ms.monitor() captures inputs and outputs on every predict() call. Every 500 predictions (configurable via profile_window), it computes a statistical profile on a background thread and saves it to ~/.modelsentry/{model_id}/. The first profile is automatically saved as the baseline. Your predict function is not blocked — monitoring overhead is under 1ms.

In your browser (dashboard side)

modelsentry serve reads those profile files whenever you open it. You don't need the dashboard running continuously — just open it when you want to check in, or after receiving a drift alert email. It auto-refreshes every 60 seconds.

Storage: roughly 5–20 KB per profile. At 10,000 predictions/day with profile_window=500, that's ~20 profiles/day — around 200–400 KB/day.


Configuration

Email alerts via CLI

modelsentry serve \
  --model churn-v3 \
  --alert-email you@company.com \
  --smtp-host smtp.gmail.com \
  --smtp-port 587 \
  --smtp-user you@gmail.com \
  --smtp-password "your-app-password"

Custom storage location

ms.init(
    model_id="churn-v3",
    profile_window=500,
    storage_path="/data/modelsentry",
)

Dashboard

The local dashboard at localhost:8080 shows:

  • Model health overview (green / yellow / red)
  • Prediction volume — total monitored since install
  • Per-feature distribution charts vs. baseline
  • PSI and KS drift scores, color-coded by severity
  • Last updated timestamp (auto-refreshes every 60 seconds)
  • Alert history with timestamps
  • Explicit "all systems nominal" state when no drift is detected

Links


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modelsentry-0.1.1.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modelsentry-0.1.1-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file modelsentry-0.1.1.tar.gz.

File metadata

  • Download URL: modelsentry-0.1.1.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.0 CPython/3.11.9 Darwin/25.4.0

File hashes

Hashes for modelsentry-0.1.1.tar.gz
Algorithm Hash digest
SHA256 982c349f434484711a751407a0d73e13b706463a70d503487f3d309b90cbaf48
MD5 cb18b1a08a77c9d1eaf028755cea79a6
BLAKE2b-256 94abed43259348cca8cb6e869482293be06e941df73adc0c6e2798ed14070881

See more details on using hashes here.

File details

Details for the file modelsentry-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: modelsentry-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.0 CPython/3.11.9 Darwin/25.4.0

File hashes

Hashes for modelsentry-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ed76f11610077a6933781bc8f7750b05e8245f5fd318832d45be7c32c945f93
MD5 f0f7d2262ead8163e39b423c82bb4754
BLAKE2b-256 0722778d1e09199d6aa88f4e65def1c17aeffc903f2d8f174e1cc4819c5d8a03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page