Model Evaluation — Offline and Online

Rigorous offline validation and controlled online experiments to safely promote ML models to production.

Overview

Two phases of evaluation

Offline evaluation happens before deployment on held-out data. Online evaluation measures behavior on live traffic. Offline metrics alone are not enough: a model that scores well on a static test set can still fail in production from distribution shift, latency limits or interactions with other components.

Each phase runs its techniques in order, and each technique answers one question. Offline, before deployment, none of them touches users.

  • Holdout test set: does the model generalize to unseen labeled data?
  • K-fold or walk-forward cross-validation: how stable is that estimate?
  • Fairness slices: does any subgroup fail?

The last offline step is threshold selection: choosing the operating point the model will run at.

Online, on live traffic, exposure grows step by step.

  • Shadow mode: with zero user impact, does it crash, run slow or show a distribution mismatch on real traffic?
  • Champion / challenger: with a small share of traffic, does the challenger meet its success criteria?
  • A/B test: with a split of users, does it move the business metric?

The rest of this chapter walks through these techniques in that order.

Interview questions

  • How would you design an offline evaluation framework for a production recommendation model that handles temporal leakage and per-segment fairness?
  • Design an A/B test to evaluate a new fraud detection model. Cover sample size, assignment, metric selection, and stopping rules.
  • Explain the shadow mode deployment pattern and describe the operational infrastructure needed to support it.

Sign up free to read the full topic

More MLOps & LLMOps topics

Start free on Cariara · Coding problems · System design studio