Concepts / Online Testing in Production

Online Testing in Production

The central reason online testing matters is that changing what users are shown can change how they behave, and that behavior change is part of the system's outcome.

  • Programming

Why a Strong Test Score Is Not Enough

Imagine you have built a model that scores well on a test set you collected in advance. It is tempting to conclude that the model is ready to serve real users. For a system that users interact with directly, such as a recommendation feed or a search engine, that conclusion skips an important step.

The reason is that the model's predictions are only one part of a larger system, and the people using that system respond to what they are shown. A list of recommended items or a set of search results is not a neutral output. Once people see it, they may click differently, stay for different lengths of time, or move through the site in new ways. A strong score on a fixed dataset cannot tell you how those responses will play out.

This article follows the path machine learning teams take from checking predictions on a fixed dataset to measuring what happens when an algorithm is live. You will see why A/B testing is the standard tool for that transition, what kinds of surprises it can uncover, and where bandit algorithms fit in as a more elaborate extension.

What Offline Evaluation Actually Measures

Definition

Offline evaluation means evaluating algorithmic predictions based on a test set that was collected beforehand. The model is run on this pre-collected data, its predictions are compared against the known answers, and the results are summarized with whatever metric suits the problem.

Notice what is absent from that process. Nothing is deployed to users. The model never reaches a real person, so the only thing being measured is how well its predictions match answers that were already known. This makes offline evaluation the natural starting point: it is controlled, and the same test set can be reused again and again to compare candidate models under identical conditions.

What do you think happens?

A new ranking model scores higher than the current model on a fixed offline test set. Does that guarantee the new model will produce better results for real users?

  • Yes, a higher offline score always means better live results

  • No, offline scores do not guarantee better live results

  • Only if the test set is very large

Reveal answer
Answer:

No, offline scores do not guarantee better live results.

Offline evaluation checks predictions against a pre-collected test set and never shows the model to users. Changing what people are shown can change how they behave, and those behavior changes are not part of the test set, so they cannot be observed offline.

Key point

Offline evaluation answers the question: how accurate are the predictions on data we already have? It does not answer the question: what happens to the system and its users when those predictions are shown to them?

Where Live Testing Sits in the Pipeline

For a user-facing system, offline evaluation is only the first stage. The next stage is usually online testing, sometimes called live testing. Online testing evaluates the consequences of employing an algorithm in the overall system, so the question shifts from how accurate the predictions are to what the algorithm does once it is running with real users, real traffic, and real behavior.

Pre-collected testsetOffline evaluationpredictions scored againstknown answersReady for users?a strong offline score isnot enoughOnline testingalgorithm runs in the livesystemSystem and useroutcomesrun the modelcompare resultsserve to real usersmeasure consequences
What stages does a model pass through before and after deployment, and where does live testing sit relative to offline scoring on a held-out test set?

Read the diagram from left to right. The first two stages happen with no users involved. Only after the model passes that check does it move into live testing, where the thing being measured is the outcome for the system as a whole.

Why Behavior Changes Escape the Test Set

The central reason online testing matters is that changing what users are shown can change how they behave, and that behavior change is part of the system's outcome. Offline evaluation cannot observe these effects because the users who would react are not part of the test set at all.

QuestionOffline evaluationOnline testing
What is measured?How well predictions match known answersConsequences of the algorithm in the overall system
Whose data is used?A test set collected beforehandReal users interacting with the live product
Are users affected?No, nothing is deployed to usersYes, users see the algorithm's output
Can behavior change be seen?No, reacting users are not in the test setYes, through recorded success metrics
Is it repeatable on identical conditions?Yes, the same test set can be reusedConditions depend on live traffic over a set period

Offline evaluation and online testing answer different questions

How an A/B Test Divides Users

In an A/B test, a selected portion of users is served the service or website running algorithm A, while the remaining users are served the service running algorithm B. For both groups, relevant success metrics are recorded over a set period of time. When that period ends, the metrics for the two algorithms are compared, and a choice between the two approaches is made according to those metrics.

Incoming usersTraffic splitselected portion vsremaining usersAlgorithm Aoften the new modelSuccess metrics for ACompare and decideAlgorithm Bestablished baselineSuccess metrics for Beach user entersselected portionremaining usersrecord outcomesrecord outcomesover a set periodover a set period
How are incoming users routed to variant A or variant B, and where does each user's outcome get recorded for comparison?

Follow one user through the diagram. The user arrives, the traffic split assigns them to a group, and the algorithm serving that group determines what they see. Their resulting behavior is recorded as part of their group's success metrics. The two groups are then compared side by side. Each user contributes to only one group, so the comparison is between the two algorithms, not between two versions of the same user.

Choosing the Candidate and the Baseline

In practice, algorithm A is often the new model being evaluated, and algorithm B is the established system that is already running. The established system serves as the baseline, and the question is whether the new model does better on the metrics that matter. Keeping the baseline running for the other group gives the team a live reference point, rather than comparing the new model against an imagined expectation.

Reading an A/B Result Step by Step

Worked example

A news site tests a new article recommender

A team runs an A/B test on a news site. Algorithm A is a new recommender, and algorithm B is the current recommender. Users are split between the two, and a success metric is recorded for each group over two weeks. How should the team read the result?

  1. 1
    Identify the groups

    Users served the new recommender form group A. Users served the current recommender form group B. Neither group knows which version it received, because the study is blind.

  2. 2
    Confirm the metric was fixed in advance

    The team chose the success metric before the test began, so both groups are judged by the same measure of winning.

  3. 3
    Compare the two groups over the same period

    Both metrics were recorded over the same set period. The team sets the recorded values for A and B side by side rather than comparing one group's result to a number from an earlier time.

  4. 4
    Look for effects the test set could not show

    Changed recommendations may have changed how readers click, how long they stay, and how they move through the site. These live behavior changes are exactly what the A/B comparison captures and an offline test set would miss.

  5. 5
    Make the decision from the measurements

    The choice between the two recommenders follows from the recorded metrics. A new model that looked strong offline still has to show its result in the live comparison.

Result

The team decides based on which recommender performed better on the agreed metric over the same period, using measured live behavior rather than the offline test score alone.

In the real world

This is also why most user-facing services use A/B testing as a protective measure. Changing the recommendations or search results a website shows can drastically change behavior. Rather than shipping a change to everyone and hoping for the best, a team can expose only a selected portion of users to the change, observe the outcome, and make a decision based on what was measured.

Surprises Live Testing Can Reveal

The main benefit of A/B testing is that it lets you evaluate algorithms in the wild, meaning under the actual conditions in which users interact with the product. This is where unexpected consequences tend to appear. A change that looked harmless on a test set may alter what users see, and therefore alter what they do. Because the change reaches real users, its side effects become visible in the recorded metrics.

Kind of surpriseWhat it looks like after deploymentWhy offline evaluation misses it
Changed user behaviorUsers click differently or stay for different lengths of timeThe users who would react are not part of the test set
Changed navigationUsers move through the site in new waysNavigation depends on live responses to what is shown
Unexpected side effectsA change that looked harmless alters what users see and doThe test set does not include the people who would be affected
Metric mismatchA gain in one measure comes with a loss in what the team cares aboutOffline scores track prediction accuracy, not the live success metrics

Surprises that only live testing reveals

The common thread is that a fixed test set freezes the world at one moment and only includes the predictions, not the people reacting to them. Live testing restores the reacting people, which is where the surprises come from. The source describes these effects as the consequences of employing an algorithm in the overall live system.

Bandits as an Extension of A/B Testing

A/B testing is not the only way to run online tests. There are more elaborate mechanisms that go beyond it, and bandit algorithms are one example. They belong to the same family of online testing methods, and they build on the same basic idea: testing algorithms in a live system rather than only on a fixed dataset.

Offline test setfixed predictions, no usersA/B testingfixed two-group design inthe wildBandit algorithmsmore elaborate onlinemethodsadd live usersextend the approach
How do the stages of testing progress from a fixed offline check to the more elaborate online methods?

At this stage of your learning, the key point is awareness. Bandit algorithms are a natural next topic once the fixed two-group design of A/B testing is clear. Recognizing that they are a more elaborate family of online testing methods is enough for now; their detailed mechanics are a subject for later study.

Mistakes to Avoid When Reading Online Tests

  • Common mistake

    Treating a strong offline test score as proof a model is ready for users

    What it looks like

    A ranking model beats the current one on a fixed test set, so the team ships it to everyone at once.

    Why it fails

    Offline evaluation never shows the model to users, so changed user behavior cannot be observed.

    Do this instead

    Run an online comparison, such as an A/B test, before treating the model as proven.

  • Common mistake

    Comparing the new algorithm to a remembered number instead of a live baseline

    What it looks like

    The team compares this week's metrics for the new model against last year's figures.

    Why it fails

    Conditions change over time, so the comparison no longer isolates the algorithm.

    Do this instead

    Keep the established system running as algorithm B and record both groups over the same set period.

  • Common mistake

    Choosing the success metric after seeing which group did better

    Why it fails

    The metric then defines a winner that suits the result rather than the goal.

    Do this instead

    Decide the success metrics before the test begins, since they define what counts as winning.

  • Common mistake

    Assuming each user can be counted in both groups when comparing results

  • Common mistake

    Ignoring side effects that appear in metrics outside the one being optimized

Practice Interpreting an Online Test

MEDIUM

A search engine team has a new ranking model that scores 3 percent higher than the current model on a fixed offline test set. Before running any live test, list three things the offline score cannot tell the team about how real users will respond. Then explain how an A/B test would help answer them.

Hints
  • Think about who is missing from a pre-collected test set.
  • Consider what users might do differently after seeing new search results, such as clicking, staying, or moving through the site.
  • For the A/B part, think about which group serves which algorithm and what gets recorded for each group over a set period.

Key Takeaways

  • Offline evaluation scores a model's predictions on a test set collected beforehand, and it is only the first step for a user-facing system because nothing is shown to real users during that process.
  • Online testing evaluates the consequences of an algorithm in the overall live system, since changed recommendations or search results can change user behavior in ways a fixed test set cannot capture.
  • In an A/B test, a selected portion of users is served algorithm A and the rest are served algorithm B, blind to the assignment; success metrics are recorded for both groups over a set period and compared to choose an approach.
  • A/B testing lets teams discover unexpected consequences in the wild, and bandit algorithms are a more elaborate family of online testing methods that extend this same idea beyond the fixed two-group design.

Related concepts

More concepts starting with O