Personal project · 2026

MLOps: a claims model that only ships when it's better

The model lifecycle I supported at Molina, rebuilt on synthetic data: MLflow tracking and Model Registry, a promotion gate, drift monitoring, and a service that serves whatever the champion is.

PythonDockerFastAPI
Role
On my own
When
2026
Type
Personal project
Stack
Python, Docker, FastAPI
12tests in CI0.002AUC margin to promote0.27prediction PSI on a shifted batch

Raw claims go through one build_features function shared by training and serving. Each training run logs parameters, metrics, the model and the training feature baseline to MLflow and registers a new version. A promotion gate moves the champion alias only if the new version beats it by 0.002 AUC; otherwise it stays registered with the reason logged. A FastAPI service serves models:/claims_denial@champion, and a drift monitor computes PSI per feature and on predictions against the training baseline.

How it works

  • One build_features function is used by both training and serving, so there's no second implementation to drift.
  • Each run logs parameters, metrics, the model and the training feature baseline to MLflow, and registers a new version.
  • A promotion gate moves the champion alias only if the new version beats it by 0.002 AUC. Refused versions stay registered with the reason logged.
  • A FastAPI service serves models:/claims_denial@champion, so promoting or rolling back is just moving an alias.

A real run

Seed 7, 5,000 synthetic claims, 25% holdout. Gradient boosting (ROC AUC 0.692) became champion first; logistic regression (0.715) beat it and was promoted; a baseline using age only (0.471) was registered but refused, and the champion didn't change.

Against the training baseline, a normal batch stayed quiet (prediction PSI 0.010). A shifted batch with bigger amounts, more out-of-network claims and slower submission raised an alert: prediction PSI 0.269, with days_to_submit at 0.320.

A decision worth explaining

Promotion needs a margin, not just a higher score: a 0.0001 AUC gain on a holdout is noise, and requiring 0.002 stops champion churn.

Status

12 tests in CI, each against a fresh MLflow registry. Runs locally with Docker (train, then serve). Not deployed; on Databricks the registry would be Unity Catalog models.

From the code

The promotion gate. A new model version gets the champion alias only if it beats the current champion by a margin, and the decision and reason are logged on the run.

mlops-claims-model/src/claims_model/train.pyView on GitHub
prev = champion_auc(client)
if prev is None:
    promoted, reason = True, "no champion yet"
elif metrics["roc_auc"] >= prev + min_gain:
    promoted, reason = True, f"roc_auc {metrics['roc_auc']} beats champion {prev} by >= {min_gain}"
else:
    promoted, reason = False, f"roc_auc {metrics['roc_auc']} does not beat champion {prev} by {min_gain}"
if promoted:
    client.set_registered_model_alias(MODEL_NAME, CHAMPION, version)
mlflow.set_tags({"promoted": str(promoted), "promotion_reason": reason})

# The training feature distribution is stored with the run, as the drift baseline.
mlflow.log_text(X_tr.to_json(orient="records"), "reference/training_features.json")

Stack

PythonDockerFastAPI