Sub topic 2
The monitoring gap: what you can and cannot know today
This chapter assumes you know binary classification metrics (accuracy, precision, recall, ROC AUC), basic pandas and scikit-learn, and what a deployed model's prediction log looks like. It builds on the previous chapter, which explained why labels arrive late. Here we define the gap that delay creates in monitoring, and we sort what you can know today from what you cannot.
What the monitoring gap is
A model scores a transaction, a loan application, or a customer today. The true outcome (fraud, default, churn) shows up days or months later. The monitoring gap is the period during which a model is live and making decisions, but you cannot compute its real performance on those decisions because the labels are not in yet.
The gap is not a single moment. Every prediction has its own gap, which runs from the time of the prediction until its label arrives. At any instant, your prediction log is a mix of three kinds of rows:
- Rows whose label has arrived and is final.
- Rows whose label has not arrived, but will.
- Rows whose label will never arrive, such as a declined loan applicant whose repayment you never observe.
Most monitoring mistakes come from treating these three groups as one.
Why the naive metric misleads
Suppose your team runs a nightly job that joins the prediction log with whatever labels exist, then computes AUC. Two things go wrong.
- Recent predictions are missing or mislabeled. For a fraud model where chargebacks arrive within 60 days, yesterday's predictions have almost no positive labels yet. If you fill missing labels with 0, recent data looks like it contains almost no fraud. If you drop unlabeled rows, you evaluate only the few rows whose labels arrived quickly.
- The labeled subset is not a random sample. Labels often arrive faster for some outcomes than others. Confirmed fraud may be reported in days, while a lack of fraud is only certain after the full window. The labeled subset then over-represents the fast outcome.
The result is a metric that moves for reasons unrelated to the model. A drop in nightly AUC might mean the model degraded, or it might mean a batch of labels is still in transit.
The table below compares common ways to handle unlabeled rows.
| Approach | What it computes | Main failure mode |
|---|---|---|
| Join and fill missing labels with 0 | Metric on all recent rows | Recent positives are counted as negatives, so recall and AUC look wrong |
| Join and drop rows without labels | Metric on rows that already have labels | Biased toward outcomes that arrive fast |
| Score only matured predictions | Metric on rows old enough to be final | Accurate, but stale by the maturity window |
| Estimate without labels | Predicted metric for recent rows | Valid only if its assumptions hold |
The third and fourth rows are the two tools this tutorial develops. The matured-cohort approach is exact but late. Estimation is current but conditional.
What you can know today
Even with no labels for recent predictions, you have solid information in several places.
Everything about the inputs and outputs. You know the feature values, the model's scores, and the decisions taken. You can compare their distributions with a reference period. This is the basis for drift detection, covered in a later chapter.
Performance on matured predictions. Predictions older than the maturity window have essentially final labels. Performance there is a true measurement, but of the model's behavior some time ago.
Performance on the original test set. You know how the model did on held-out data at training time. That is a measurement of a different time and possibly a different population.
Operational facts. Volume, latency, null rates, schema changes, and the rate of positive decisions are all available immediately and often catch real failures, such as a broken upstream feature.
What you cannot know today
Without labels for recent rows, you cannot directly measure:
- Accuracy, precision, recall, or AUC on recent predictions.
- Whether a change in input distribution has actually hurt performance.
- Whether the relationship between features and outcome has changed (concept drift), unless you assume it has not.
The last point is the central limit. Inputs and scores are observable. The link between inputs and outcomes is only observable through labels. Any label-free method must therefore assume something about that link. Later chapters make those assumptions explicit: calibrated probabilities, an unchanged conditional distribution P(y given x), or a learned error model that generalizes.
Measuring the gap on your own system
Before choosing a method, measure how large your gap is. For each labeled row, compute the delay between prediction and label arrival. Then look at the distribution, not only the mean.
import pandas as pd
def label_delay_summary(preds: pd.DataFrame, labels: pd.DataFrame) -> pd.Series:
"""Summarize how long labels take to arrive.
preds: columns id, predicted_at
labels: columns id, labeled_at
"""
joined = preds.merge(labels[["id", "labeled_at"]], on="id", how="inner")
delay_days = (joined["labeled_at"] - joined["predicted_at"]).dt.total_seconds() / 86400
return delay_days.describe(percentiles=[0.5, 0.9, 0.99])
if __name__ == "__main__":
preds = pd.DataFrame({
"id": [1, 2, 3, 4],
"predicted_at": pd.to_datetime(["2026-01-01"] * 4),
})
labels = pd.DataFrame({
"id": [1, 2, 3],
"labeled_at": pd.to_datetime(["2026-01-03", "2026-01-10", "2026-02-20"]),
})
print(label_delay_summary(preds, labels))This summary only covers rows that have been labeled so far, so it understates the true delay. Rows with the longest delays are the ones missing from the data. This is a form of censoring, and the chapter on censoring and selection bias returns to it. Treat the percentiles as lower bounds until enough time has passed.
Pay attention to the tail. If the median delay is 3 days but the 99th percentile is 90 days, a metric computed after one week has a different meaning than one computed after three months.
Common errors
- Reading a young cohort's metric as final. A cohort that looks excellent after a week may only look excellent because its positives are not labeled yet.
- Filling missing labels with 0 without checking. This is valid only after the label window has closed and only if absence of a label means a negative outcome. It is wrong for recent rows.
- Alerting on a mixed metric. A single number that blends mature and immature rows changes whenever the mix changes. Report metrics per prediction-time cohort instead.
- Assuming no drift means no degradation. Stable inputs do not guarantee a stable input-output relationship. Concept drift is invisible without labels.
- Assuming drift means degradation. Inputs can shift without hurting the model, for example when the shift is in a feature the model ignores.
- Ignoring feedback from the model's own decisions. If you only observe outcomes for approved applicants, labels exist only for a subset the model chose. The next chapters treat this selection effect.
A practical stance
Think of monitoring as three layers with different delay and certainty:
- Immediate checks on data quality, volumes, and score and feature distributions. Fast, cheap, indirect.
- Estimates of current performance from calibrated scores or reweighted labeled data. Fast, direct, conditional on assumptions.
- Matured-cohort evaluation on final labels. Slow, direct, assumption-light.
Each layer covers weaknesses of the others. The final chapters show how to check layer 2 against layer 3 once labels arrive, and how to build alerts across all three.
Exercise
A churn model predicts at the start of each month whether a customer will cancel within 90 days. Today is the 20th of the month. A dashboard shows recall for last week's predictions at 0.12, down from 0.65 for predictions made four months ago. Name the most likely explanation, and say what you would compute instead.
Show answer
Most of last week's churners have not yet cancelled, because the 90-day window is still open. Their labels are currently negative or missing, so recall appears very low. The drop reflects label immaturity, not model failure. Instead, compute recall only on cohorts whose predictions are at least 90 days old, and report the share of predictions that qualify. For current performance, use a label-free estimate and flag it as conditional on its assumptions.
Exercise
List one quantity you can observe today with no labels, one you can observe only after a maturity window, and one you can never observe without labels or an extra assumption.
Show answer
Observable today: the distribution of model scores, or any feature distribution. Observable after the maturity window: the model's AUC on predictions old enough to have final labels. Not observable without labels or an assumption: whether the relationship between features and outcome has changed, which is concept drift. Label-free methods must assume it has not, or assume something else about it, such as calibration.