Your model’s first outage will be a data outage

Models rarely fail the way software does. They keep answering, confidently, on inputs that quietly stopped meaning what they meant. What to watch, and the three checks that would have caught every incident I have been paged for.

Software fails loudly. A service that is broken returns 500, fills a log with stack traces and wakes somebody up.

A model fails politely. It keeps returning 200 with a number in it. The number is wrong, the dashboards are green, and the first person to notice is usually a customer.

In every incident I have been paged for, the model itself was fine. What changed was the data going into it.

What it looks like

  • An upstream team starts sending the amount in lira instead of kuruş. Every payment now looks a hundred times smaller, and very safe.
  • A column begins to arrive empty. The pipeline fills the gap with zero, as it was told to, and zero happens to mean “brand new merchant”.
  • A feature job stops on Tuesday. Nothing errors; the feature store simply keeps serving Tuesday.
  • A new app release adds a value to an enum. The encoder has never seen it and files it under “other”, next to the fraud.

None of these raises an exception. Latency is normal, the error rate is zero, and the model is confidently answering a question nobody asked.

Check the shape at the door

The cheapest defence is a contract: what each field is, what range it lives in, which values it may take. Enforce it on every request and on every training batch, with the same definition.

from typing import Literal
from pydantic import BaseModel, conint, constr

class Payment(BaseModel):
    amount_minor: conint(ge=0, le=5_000_000)   # kuruş, never lira
    currency: Literal["TRY", "EUR", "USD"]
    merchant_age_days: conint(ge=0)
    card_country: constr(min_length=2, max_length=2)

A request that fails the contract is not scored. It gets the fallback, and it gets counted: the rate of rejected requests is the first graph on the dashboard.

Check the age

Every feature carries the time it was computed, and every feature has an agreed maximum age. A value older than that is treated as missing, not as true.

This one check would have caught the frozen feature job within the hour instead of within the week.

Check the distribution

A value can be well-formed, fresh and still wrong. The unit change above passes both checks. What gives it away is that the distribution moved.

import numpy as np

def psi(expected: np.ndarray, actual: np.ndarray, bins: int = 10) -> float:
    """Population stability index: training sample against live traffic."""
    edges = np.quantile(expected, np.linspace(0, 1, bins + 1))
    edges[0], edges[-1] = -np.inf, np.inf
    e = np.histogram(expected, edges)[0] / len(expected)
    a = np.histogram(actual, edges)[0] / len(actual)
    e, a = np.clip(e, 1e-6, None), np.clip(a, 1e-6, None)
    return float(np.sum((a - e) * np.log(a / e)))

Run it per feature, every hour, against the sample the model was trained on. Below 0.1 nothing happened. Above 0.25 something did, and a person should look. Do the same for the scores the model returns: when the inputs drift in a way that matters, the outputs drift too.

Fail in a known direction

When a check trips, the system should not improvise. Decide in advance what happens: the previous model, a handful of rules, or a plain “send to review”. All three are worse than a healthy model and far better than a confident wrong one.

Then page the owner of the data, not the owner of the model. That is where the fix is.

The only real monitor arrives late

All of the above are proxies. The truth is the outcome: was the payment fraud or not. It arrives a day or a month later, and when it does it has to be joined back to the prediction, automatically, for every prediction.

Until it arrives you are flying on instruments. So build the instruments first, before the model is clever, while there is still time to be bored by them.