There's a moment every ML engineer knows and nobody really talks about.
You finish training. The validation accuracy looks great. You run model.predict(), it works, and you ship it.
Then the quiet questions start.
Is it still accurate, or is it slowly getting worse? Has the incoming data drifted away from what it trained on? When the model says it's "92% confident," is it actually right 92% of the time, or is it just loud? Is the input data even valid, or is some silent schema change quietly poisoning every prediction? And the one that actually keeps you up at night: how would you even know if something broke?
Building a model is mostly a solved problem now. Knowing whether you can trust it once it's in production is not. That gap is the thing I wanted to close.
Meet ModelSentinel
ModelSentinel is an open-source Python toolkit for everything that happens after model.predict(). It evaluates, monitors, and stress-tests ML models through one consistent API.
import modelsentinel as ms
monitor = ms.Monitor(task="classification", name="my-model")
monitor.evaluate(y_true, y_pred, y_score) # accuracy, F1, ROC-AUC, confusion matrix
monitor.calibration(y_true, y_score) # are the probabilities trustworthy?
monitor.detect_drift(reference_df, live_df) # has the data shifted since training?
monitor.profile_data(live_df) # missing values, dupes, outliers, schema
print(monitor.health_score())
# {'overall': 99.2, 'grade': 'EXCELLENT', 'components': {...}}
monitor.generate_report("report.html")
Everything rolls up into a single Model Health Score, one number you can set an alert on instead of squinting at five dashboards.
I didn't want to demo it on toy data, so I audited my own model
Talk is cheap, so I pointed ModelSentinel at a real system I'd already built: DeepGuard, an EfficientNet-B4 deepfake detector. Not a toy example. The actual PyTorch model, the actual weights, the actual face images.
And I didn't just run it once. I tested it against two different datasets built with two different face-generation methods: a held-out split of the 140k Real and Fake Faces set (StyleGAN style), and a separate set I generated myself with inswapper_128 face-swapping. If the detector had only memorized one kind of fake, this would have caught it.
Here's what ModelSentinel reported, straight from the model:
| Metric | 140k test split (held-out) | inswapper_128 set |
|---|---|---|
| Accuracy | 0.9975 | 0.9938 |
| F1 | 0.9975 | 0.9938 |
| ROC-AUC | 0.99999 | 0.9989 |
| Brier / ECE | 0.0028 / 0.0075 | 0.0086 / 0.0147 |
| Health Score | 99.65 (EXCELLENT) | 99.23 (EXCELLENT) |
Confusion matrices (rows = true [real, fake]): [[398, 2], [0, 400]] and [[396, 4], [1, 399]].
Two things jumped out that a plain accuracy number would never have told me. First, the detector stays above 99% on both generation methods, so it's generalizing across techniques rather than just fitting its training distribution. Second, the very low ECE (0.0075) means the confidence scores are actually calibrated. When DeepGuard says 95%, you can more or less believe it. That's a claim you can only make after you measure calibration, which most projects just never do.
I'll be honest about one thing. One of those datasets is the same domain the model trained on, so treat 99% as an upper bound rather than a promise about the messy real world. The point is that ModelSentinel gives you the numbers to reason about it at all.
What's actually under the hood
No magic, and nothing that pretends "AI is monitoring your AI." It's just solid, well-understood statistics wired together cleanly.
- Evaluation: classification and regression metrics, plus probability calibration (Brier, ECE, MCE) and decision-threshold tuning (F1 and Youden's J).
- Drift detection: Kolmogorov-Smirnov and Population Stability Index for numeric features, chi-square and Jensen-Shannon divergence for categorical ones, all aggregated into a single dataset-level verdict.
- Data quality: missing values, duplicates, constant columns, IQR outliers, and schema validation between training and production.
- Health score: a weighted roll-up that renormalizes gracefully when one of the checks is missing.
The metrics match a hand computation to six decimal places, because underneath it leans on scikit-learn and scipy, the boring and battle-tested stuff. ModelSentinel's job is just to make all of it effortless to use.
Built like a library, not a notebook
This is the part I care about most. A reliability tool that isn't reliable itself is a bit of a joke, so I built ModelSentinel like a real open-source project. It's fully typed and documented, has a pytest suite, passes ruff linting cleanly, runs CI across Python 3.9 to 3.12, ships as a buildable wheel, includes real benchmarks with timings, and keeps a semantic-versioned changelog. You install it with pip install -e ".[dev]" and the tests go green on a clean machine.
Where it's going
ModelSentinel ships new versions regularly, and the roadmap is deliberately ambitious.
- v0.4: explainability (Grad-CAM and SHAP) and framework adapters for scikit-learn, PyTorch, and TensorFlow.
- v0.5: a FastAPI monitoring server with real-time drift.
- v0.6 and beyond: LLM and RAG evaluation, including hallucination, faithfulness, and toxicity checks.
The goal is one toolkit that can answer "can I trust this model?" whether the model is a classifier, a vision network, or an LLM.
Try it, break it, build on it
ModelSentinel is MIT-licensed and open to contributions. If you've ever shipped a model and felt that little flicker of doubt about whether it's still working, this one is for you.
Star the repo, fork it, and tell me which reliability check you'd want next. New versions are landing regularly, and honestly the best ideas tend to come from people who have been burned by a silent model failure.
Built by Sowaiba Arshad. Feedback and PRs genuinely welcome.
Sowaiba-01
/
ModelSentinel
Open-source Python toolkit that checks whether a trained ML model is still healthy: metrics, data drift, calibration, data quality, and a weighted health score.
ModelSentinel
AI reliability & observability toolkit — monitor, evaluate, explain, and protect machine-learning models with a single, consistent Python API.
Shipping a model is easy. Knowing whether it is still trustworthy in production is not. ModelSentinel answers the questions that come after model.predict():
- Is my model still accurate, or is performance quietly degrading?
- Has the incoming data distribution drifted away from training?
- Is the input data even valid — missing values, duplicates, schema changes?
- Are my predicted probabilities calibrated, or overconfident?
- What single number tells me if this model is healthy right now?
Install
pip install modelsentinel # from PyPI (once published)
pip install -e ".[dev]" # from source, with dev tools
30-second quick start
import modelsentinel as ms
monitor = ms.Monitor(task="classification", name="DeepGuard-B4")
# 1. How good are the predictions?
monitor.evaluate(y_true, y_pred…
Top comments (0)