Offline Evaluation of Machine Learning Models
Offline evaluation judges an algorithm on a test set collected beforehand and is the first step, but for user-facing systems it is not the last.
A Model That Looks Ready
Imagine a recommendation model that scores very well on a carefully prepared set of examples. Its predictions look accurate, its numbers look strong, and it seems ready to ship. The question is what happens next. Once real people start seeing its recommendations on a live website, their behavior may change in ways the test set never captured. This article explains how teams evaluate an algorithm once it is part of a working product, where people react to what it shows them.
What do you think happens?
A recommendation model scores very well offline. What do you expect once real visitors start seeing its recommendations?
Reveal answer
Visitor behavior may change in ways the test set never captured.
Changing what users see can change how they behave. A stored test set cannot show how people will respond once the algorithm's output is in front of them, so a strong offline score does not guarantee a strong live result.
Offline Evaluation as the First Step
Offline evaluation is where most evaluation starts. It judges an algorithm on a test set collected beforehand. Nothing about this step involves real users reacting to the algorithm. The test set is fixed, so results can be reproduced and candidate models can be compared with one another without putting anything in front of customers.
- 1Gather examples in advance.
- 2Hold some of the examples back to form the test set.
- 3Run the algorithm on the held-back examples.
- 4Measure how well its predictions match what was expected.
For a user-facing machine learning system, however, offline evaluation is only the first step. It tells you how the algorithm performs on past data. It does not tell you what happens when the algorithm's output is shown to people and they respond to it. The live test comes after the offline stage, as the next step in the same progression.
Why Offline Numbers Stop Short
The reason offline evaluation is not enough is that changing what users see can change how they behave. Altering the recommendations or search results a website shows can have a large effect on user activity, and that effect may be hard to predict from offline numbers. Online testing, also called live testing, exists to evaluate these consequences inside the real-world system.
| Aspect | Offline evaluation | Online testing |
|---|---|---|
| Data source | Stored examples collected beforehand | Real users interacting with the system |
| What it reveals | How predictions match what was expected | What follows from the algorithm being in place |
| Reproducibility | Fixed test set, so results can be reproduced | Measured over a set period of live use |
| Customer exposure | Nothing is shown to customers | Real customers see the algorithm's output |
Offline evaluation and online testing answer different questions.
What Online Testing Is Designed to Catch
Online testing is built to surface unexpected consequences before they affect everyone. The source describes these as effects that appear only when real people interact with the system. Offline numbers can miss them because the stored test set never contains the feedback loop that a live product creates.
- Shifts in user activity that offline numbers did not predict
- Effects that are hard to foresee from a stored test set
- Behavior in the wild that the test set never captured
- Large changes in how people use the service after the algorithm's output is shown to them
Splitting Users Into Two Groups
Most user-facing services use A/B testing to protect against surprises. In an A/B test, a selected portion of users is served the website or service running algorithm A, while the remaining users are served the version running algorithm B. Neither group knows which one it belongs to. Tracing a single arriving user through this process shows how the split works.
- 1A user arrives at the service.
- 2The system decides whether this user falls in the selected portion.
- 3A user in the selected portion is served algorithm A.
- 4A user in the remaining portion is served algorithm B.
- 5Relevant success metrics are recorded for both groups over a set period of time.
- 6The two groups are compared and the algorithm is selected from the results.
Comparing the Two Groups
A common arrangement is for algorithm A to be a new model and algorithm B to be the established system. The established system acts as the baseline. The new model has to show better metrics in live use before it is selected. This is the practical payoff of testing in the wild: you learn how real users respond, rather than relying only on the stored test set.
Reading a Live Comparison
A team tests a new recommendation model against the established system. Over one week, visitors are split between the two. The team wants to know whether to select the new model.
- 1Identify the roles
The new model is algorithm A and the established system is algorithm B, which serves as the baseline.
- 2Confirm the split was made before results
Visitors were divided into the two groups while the test ran, and neither group knew which algorithm it was seeing.
- 3Read the success metrics for both groups
Metrics for group A and group B are recorded over the same set period so they can be compared directly.
- 4Apply the selection rule
The new model is selected only if its live metrics are better than the baseline's.
The decision rests on live metrics compared against the baseline, not on the offline score alone.
Mistakes Teams Make With Live Tests
Common mistake Treating a strong offline score as proof that an algorithm is ready to ship
What it looks likeA model scores very well on the held-back test set and is released without a live test.
Why it failsThe offline score shows performance on past data and says nothing about how people respond to the output.
Do this insteadUse offline evaluation as the first step, then check consequences through online testing.
Common mistake Forgetting that the established system is the baseline
What it looks likeThe new model's live metrics are reported without comparing them to the group still running the established system.
Why it failsWithout the baseline, there is nothing to show that the new model performs better in live use.
Do this insteadCompare the new model's live metrics against the established system's metrics over the same period.
Common mistake Assuming a live test reveals users' identity or group membership to them
What it looks likeUsers are told which algorithm they are seeing during the test.
Why it failsIn the A/B arrangement described in the source, neither group knows which one it belongs to.
Do this insteadKeep group membership hidden from users while recording outcomes for each group.
Common mistake Expecting an A/B test to be complete in a single moment rather than over a set period of time
Where Bandit Algorithms Fit
A/B testing is not the only way to test online. There are more elaborate mechanisms for online testing that go beyond A/B testing, and bandit algorithms are one such mechanism. The source material treats them as a more advanced topic and recommends a dedicated introduction for readers who want the details. This article only places them within the progression.
Trace a Recommendation Test
A team runs an A/B test in which a selected portion of visitors sees a new recommendation model (algorithm A) and the rest see the established system (algorithm B). Trace one visitor from arrival to decision. Name the group that visitor lands in, the algorithm they see, what gets recorded, and what the team compares before selecting a model.
Hints
- Start with the split: the visitor either falls in the selected portion or does not.
- Remember that neither group knows which algorithm it belongs to.
- Think about which group serves as the baseline and what must be shown in live use before the new model is selected.
Key Takeaways
- Offline evaluation judges an algorithm on a test set collected beforehand. It is the first step, but for user-facing systems it is not the last.
- Changing what users see can change how they behave, so online testing evaluates the consequences of an algorithm inside the real-world system.
- In an A/B test, a selected portion of users is served algorithm A and the rest are served algorithm B, and success metrics are recorded for both groups over a set period before the two are compared.
- A/B testing is the standard form of online comparison, and bandit algorithms are a more elaborate online testing mechanism that goes beyond it.