Sub topic 14
Revisiting Baselines After Deployment
This chapter assumes you can build a baseline and compare it to a candidate model on held-out data. It also assumes you know the good-enough criteria from the previous chapters: a metric, a minimum useful gain over the baseline, and a cost limit. Here you apply them again after the model is live.
Why the baseline expires
A baseline measures a gap on the data you had at the time. Deployment changes that data in three ways:
- Drift. Inputs or the relationship between inputs and labels change. A seasonal pattern shifts, or users behave differently.
- A moving floor. The trivial baseline may get stronger. If the target becomes more stable, "predict yesterday" gets cheaper to beat or harder to beat, and your gain changes without the model changing.
- Feedback effects. The model's own decisions change which labels you observe. Loan approvals, recommendations and fraud flags all censor the data you later train and evaluate on.
A model that was good enough at launch can fall below its criteria while its raw score still looks acceptable. The comparison to the baseline is what shows this.
Re-score the baseline on live data
Compute the baseline's score on the same recent window as the model's score. Do not reuse the baseline number from launch. Then apply the same minimum-gain rule you used before shipping.
The example below monitors a forecaster against the naive "tomorrow equals today" forecast in two-week windows. The model degrades halfway through.
import numpy as np
rng = np.random.default_rng(0)
n = 141
y = 100 + np.cumsum(rng.normal(size=n))
# Model forecasts: accurate for the first 70 days, noisy afterwards (drift).
noise_scale = np.where(np.arange(n) < 70, 0.5, 2.0)
model_pred = y + rng.normal(size=n) * noise_scale
actual = y[1:]
naive = y[:-1]
model = model_pred[1:]
window = 14
min_relative_gain = 0.20 # model must cut naive error by at least 20%
for start in range(0, len(actual) - window + 1, window):
sl = slice(start, start + window)
mae_model = np.mean(np.abs(actual[sl] - model[sl]))
mae_naive = np.mean(np.abs(actual[sl] - naive[sl]))
gain = 1 - mae_model / mae_naive
status = "ok" if gain >= min_relative_gain else "REVIEW"
print(f"days {start:3d}-{start + window - 1:3d} "
f"model={mae_model:.2f} naive={mae_naive:.2f} "
f"gain={gain:+.0%} {status}")Windows from day 70 onward should report REVIEW, because the model's error exceeds the naive error. Looking only at the model's MAE, you would have to decide whether 1.6 is acceptable. Looking at the gain, the answer is clear.
The review loop
Common errors
- Labels arrive late. Many systems get ground truth days or months after prediction. Monitor input distributions and prediction rates in the meantime, and score the gain once labels land.
- Comparing across different windows. If the model is scored on this week and the baseline on launch-time test data, the gap means nothing. Score both on the same rows.
- Ignoring noise. A single bad window can be chance. Use the uncertainty reasoning from earlier: require several windows below the threshold, or compare a rough lower bound on the gain to the minimum.
- Never promoting the baseline. Once a retrained model is stable, it becomes the new reference. Keep the trivial baseline too, as a sanity floor.
- Fixed criteria. If the product requirement changes, such as a stricter error cost, rewrite the good-enough criteria and record why.
What to record
Keep a short log per review: the window, metric, baseline score, model score, gain, and decision. Over months this log shows whether the model is decaying slowly, failing in one slice, or losing its edge because the baseline improved.
Exercise
A deployed classifier's balanced accuracy drops from 0.82 to 0.78 over a month. The majority-class baseline stays at 0.50 and your minimum useful gain is 0.20 over the baseline. Should you trigger a review, and what would you check first?
Show answer
Yes. The gain fell from 0.32 to 0.28, but that is still above 0.20, so on the stated criterion the model still passes. A review is not forced by the criterion, but the downward trend is worth watching. First check that both scores come from the same recent window, then check whether the drop is concentrated in one slice or caused by input drift. If the next windows keep falling toward 0.70, the criterion will be breached and you should plan a retrain.