Offline metric improved, but the A/B test is flat. Why?
Question
A shop's new recommendation model predicts clicks with an AUC of 0.80 offline, up from 0.78. You run an A/B test for two weeks, with 40,000 users in each arm. The share of users who buy is 5.0% in the control arm and 5.1% with the new model. The difference is not significant.
The team says the new model doesn't work. Give three reasons the offline gain may not show up. Then check one with numbers: how many users per arm would you need to detect a change from 5.0% to 5.1%?
Show hints (3)
- "WHAT WAS MEASURED"
Offline you measured clicks. The test measures purchases. Does a better click ranking have to sell more?
- "WHO CHOSE THE ITEMS"
The offline clicks were collected while the old model chose what users saw. What do you know about items it never showed?
- "ENOUGH USERS"
Use the usual sample size formula for two proportions, with 5% significance and 80% power. Compare the answer with 40,000.
Show checked explanation
A flat test doesn't prove the model is useless. The offline metric may not track purchases, the offline data only covers items the old model showed, and novelty or dilution can hide the gain. The test is also far too small. Detecting 5.0% to 5.1% needs about 753,000 users per arm. With 40,000, the power is only about 10%.
from statistics import NormalDist norm = NormalDist() z_alpha = norm.inv_cdf(1 - 0.05 / 2) # 5% significance, two-sided z_power = norm.inv_cdf(0.80) # 80% power p_a, p_b = 0.050, 0.051 # share who buy: control, new model spread = p_a * (1 - p_a) + p_b * (1 - p_b) needed = (z_alpha + z_power) ** 2 * spread / (p_b - p_a) ** 2 print(f"users needed per arm: {needed:,.0f}") n = 40_000 shift = abs(p_b - p_a) / (spread / n) ** 0.5 power = norm.cdf(shift - z_alpha) + norm.cdf(-shift - z_alpha) print(f"power with {n:,} per arm: {power:.0%}") lift = (z_alpha + z_power) * (2 * p_a * (1 - p_a) / n) ** 0.5 print(f"smallest lift it can detect: {p_a:.1%} -> {p_a + lift:.1%}")
users needed per arm: 752,700 power with 40,000 per arm: 10% smallest lift it can detect: 5.0% -> 5.4%
Code run on CPython 3.12 against the example above. Checked by an editor other than the author.
Walkthrough
First ask: could this test see the effect at all? Power is the chance that a test finds a real effect of a given size. The usual targets are 5% significance and 80% power.
| users per arm | power for 5.0% to 5.1% |
|---|---|
| 40,000 | 10% |
| 752,700 | 80% |
With 40,000 per arm, the smallest change this test detects with 80% power is about 5.0% to 5.4%, roughly 9% more buyers. The real change is a 2% relative lift. It hides in the noise.
Then look for reasons the real gain is smaller than the offline one:
- Different goal. Offline you measured clicks. The business goal is purchases. A model can rank clickable items better without selling more.
- Data from the old model. The logs only hold reactions to items the old model showed. Offline AUC can't judge the new model's own picks. If unshown items count as non-clicks, a model that copies the old ranking looks better than it is.
- Novelty. Users may click on anything new for a few days, or ignore it at first. Plot the effect by day, and run whole weeks: weekday and weekend users differ.
- Dilution. If only 1 user in 5 ever opens the widget, the average effect over all users is 5 times smaller. Compare only users who reached the widget, in both arms.
- Skew. If online features differ from the training features, the model online is not the model you evaluated.
Common mistakes
- Reading "not significant" as "no effect". With 10% power, a real lift of this size looks flat about 90% of the time.
- Stopping the test the first time the p-value dips below 0.05. Checking again and again raises false positives. Fix the sample size first, or use a method built for repeated checks.
- Expecting an AUC gain to turn into sales. AUC 0.78 to 0.80 says nothing direct about how many more people buy.
Follow-up questions
- "You can't get 750,000 users per arm. What now?" Use a less noisy metric closer to the change, like add-to-cart from the widget, and confirm purchases later. Cut variance with each user's behaviour before the test (CUPED). Or accept that you can only detect bigger lifts, and say so up front.
- "How would you make offline results predict A/B results better?" Measure offline what the business wants, like purchases from recommendations. Show a small share of users random items, so you get labels the old model didn't choose. Over several launches, track how offline gains compare with online gains.
What a strong answer covers
Doesn't read a flat test as proof of no effect. Computes the power or the needed sample size. Names reasons offline gains don't transfer: a different metric, logs from the old model, novelty, dilution, skew. Proposes a less noisy metric or variance reduction.
Open in interactive practice deck →