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

  1. Profile — the @ms.monitor() decorator intercepts your predict function and builds statistical profiles of input features and output distributions.
  2. Detect — profiles are compared against a baseline using PSI (Population Stability Index) and KS tests. Severity: stable / warning / critical.
  3. Alert — when drift crosses threshold, ModelSentry sends an email directly from your machine via SMTP. No cloud backend required.

Raw feature values and raw predictions are never written to disk or transmitted. Only anonymized statistical summaries are stored in ~/.modelsentry/.


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"

Profile handler (advanced)

ms.init(
    model_id="churn-v3",
    profile_window=500,
    profile_handler=lambda profile: print(f"New profile: {profile}"),
)

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.0.tar.gz (21.0 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.0-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: modelsentry-0.1.0.tar.gz
  • Upload date:
  • Size: 21.0 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.0.tar.gz
Algorithm Hash digest
SHA256 ec100a7ddd7f2339211f0a57be128f8a02b324d225e8827425dd142af7d342a4
MD5 eff941b814c6e265b019322654755c40
BLAKE2b-256 bcbd3131423d2df61da2dc1924ece7e3c09a90209324185cc7d8a6e77b13ff31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: modelsentry-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8470d06dcfa55bd8727dd63a720ba527230dec35f54b54f091222d9c00168f55
MD5 d48bc9d181109dfd17e648aadb6f4b23
BLAKE2b-256 1440296b014235fa23413aabd6d0d82a81a8682463d4cadb2d22b41262fa8968

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