ML-SYSTEMS
    intermediate

    Model Development & Offline Evaluation

    ML Engineer path · lesson 72 of 80
    The idea
    A runner reporting a finishing time with no distance, no course and no field. The number is real, precisely measured, and tells you nothing until you know what it beat.
    How to use
    On the slices tab, drag the majority share and watch which of two models wins on overall accuracy — while their per-slice numbers never change.
    Four phases, and the first one contains no machine learning at all.
    1. Before machine2. Simplest machine3. Optimizing simple4. Complex models
    1. Before machine learning
    Start with the simplest heuristics. Predicting the next English letter by showing the top three most common — "e", "t" and "a" — might get 30% accuracy. Facebook's newsfeed launched in 2006 with posts in chronological order and no intelligent algorithm; it was not until 2011 that Facebook started ranking by interest.
    Martin Zinkevich, "Rules of Machine Learning": "If you think that machine learning will give you a 100% boost, then a heuristic will get you 50% of the way there."
    Two of the six model-selection tips worth internalising
    Avoid the state-of-the-art trap
    “A model being state of the art often means that it performs better than existing models on some static datasets.” It does not mean it is fast or cheap enough, or that it will perform better on your data. If there is a solution much cheaper and simpler than state-of-the-art models, use the simpler solution.
    Avoid human biases in selecting models
    An engineer excited about an architecture spends more time on it and gets better results from it. “If you run 100 experiments for an architecture, it is not fair to only run a couple of experiments for the architecture you are evaluating it against.”
    Classical ML is not going away. Many recommenders still use collaborative filtering and matrix factorization, and tree-based algorithms including gradient-boosted trees still power many classification tasks with strict latency requirements — sometimes with neural networks, as when a pretrained model generates embeddings for a logistic regression.
    Good performance now versus good performance later
    Learning curves — performance against the number of training samples — will not tell you the exact gain from more data, but they tell you whether to expect any. The book's case: a collaborative filtering model outperformed a simple neural network offline, but the neural network could update itself with each incoming example. They deployed both, served from collaborative filtering and continually trained the network — and after two weeks the simple neural network outperformed it.

    Key insight

    Phase 2 exists for a reason that is not about accuracy. A simple model that is easy to deploy lets you build the entire pipeline end to end while every component is still easy to debug — so when the complex model arrives, the only new thing in the system is the model.

    Phases of model development

    Sequence

    Order the phases a team should move through.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    1. 1Drop a step here
    2. 2Drop a step here
    3. 3Drop a step here
    4. 4Drop a step here
    4 pieces left to place

    Test your knowledge

    20 questions
    Question 1 of 20
    Score: 0

    What does the book say a heuristic gets you, if ML would give a 100% boost?

    The short version

    A runner reporting a finishing time with no distance, no course and no field. The number is real, precisely measured, and tells you nothing until you know what it beat.

    In more depth

    Model Development & Offline Evaluation

    Four phases

    1.Before machine learning — start with heuristics. The top three English letters, "e", "t", "a", might get 30% accuracy. Facebook's newsfeed launched in 2006 chronologically; ranking by interest came in 2011. Zinkevich: "If you think that machine learning will give you a 100% boost, then a heuristic will get you 50% of the way there."
    2.Simplest ML models — logistic regression, gradient-boosted trees, k-NN. Visibility, validation, and an end-to-end pipeline while everything is still debuggable.
    3.Optimizing simple models — tuning, features, ensembles. Melis et al. (2018): weaker models with well-tuned hyperparameters can outperform stronger, fancier models. "It's crucial to never use your test split to tune hyperparameters."
    4.Complex models — and experiment to find how quickly your model decays in production.

    Baselines — "evaluation metrics, by themselves, mean little"

    An engineer excited about F1 0.90 on a task where the positive class appears 90% of the time — a model randomly outputting positive 90% of the time scores about the same.

    Five baselines: random (uniform gives F1 0.167 / acc 0.5; the label distribution gives F1 0.1 / acc 0.82 on a 90/10 task) · simple heuristic · zero rule (always the most common class — if that's right 70% of the time, beat it significantly) · human · existing solutions.

    "A good system isn't necessarily useful, and a bad system isn't necessarily useless."

    Evaluation methods

    Perturbation tests — the COVID-cough model that worked on hospital clips and was near-random on real users. Choose the model that works best on the perturbed data, not the clean data.
    Invariance tests — 1.3 million creditworthy Black and Latino applicants rejected 2008–2015; with race identifiers deleted, accepted. Better: exclude the sensitive information from the training features.
    Directional expectation tests — increasing lot size shouldn't decrease a predicted price.
    Calibration — "out of all the times this prediction is made, the predicted outcome matches the actual outcome 70% of the time." 70% predicted, 60% observed ⇒ not calibrated. Fix with Platt scaling. Logistic regression is the best-calibrated model in scikit-learn's toy example, because it directly optimizes logistic loss.
    Confidence measurement — a metric for each individual sample, not an average. Below threshold: discard, loop in humans, or ask for more information.

    Slice-based evaluation

    Table 6-3, 90% majority: Model A 98% / 80% = 96.2% overall; Model B 95% / 95% = 95%. Choosing A hides bias against an underrepresented group.

    Simpson's paradox (Charig et al., BMJ 1986): A wins both groups (93% vs 87%, 73% vs 69%) and loses overall (78% vs 83%). Berkeley 1973: 44% of 8,442 men admitted vs 35% of 4,321 women, yet women's rates were higher in four of six departments.

    Three ways to find slices: heuristics-based · error analysis · slice finders. Slicing also reveals non-ML problems — a model was poor on mobile because a button was half hidden on small screens.

    Interview Questions

    Google
    Meta
    Netflix
    Amazon
    Netflix
    Google
    Meta
    Spotify
    Google
    Meta
    Microsoft
    Apple
    Google
    Apple
    Anthropic
    Tesla

    Love this visualization?

    Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.

    100% free • No credit card required