Offline vs. Online Model Evaluation and Rare-Event Diagnostics
Statistics & ExperimentsModel answerLast updated
Analyze why a model shows offline gains but no live improvement, using paired scenario replay and diagnosing power, exposure, and distribution drift issues.
You're working on a machine learning system where outcomes of interest occur infrequently. Your team has deployed a new model version that demonstrated strong performance gains during offline testing. However, after rolling it out to production, the live metrics show no measurable difference compared to the baseline.
You have access to a library of historical scenarios that can be replayed under both the old and new model versions in a controlled simulation environment.
Your task:
-
Describe how you would use the historical scenario replay to compare the two model versions. What metrics would you track, and how would you quantify uncertainty?
-
Investigate why the offline improvement didn't translate to a detectable live effect. Walk through the diagnostic steps you'd take, paying special attention to challenges introduced by rare events.
-
What conditions would lead you to conclude the new version truly offers no benefit versus concluding your measurement approach lacks sufficient sensitivity?
Hints
Hint 1
For paired comparisons, consider what constitutes an independent observation and how to measure variability at that level.
Hint 2
Flat live results can stem from measurement issues, deployment problems, or real lack of effect—check instrumentation and exposure before concluding the model doesn't work.
Hint 3
Rare events create power challenges; calculate the sample size needed to detect your observed offline effect size at your actual event rate.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer
Part 1: Paired Scenario Replay Evaluation
Metric Selection and Pairing
Use a paired difference design where each historical scenario is scored by both the old and new models. The unit of analysis is the scenario itself. For each scenario, compute the outcome under both versions (e.g., predicted score, decision quality, or downstream success metric) and take the difference.
The primary metric should be the mean paired difference with confidence intervals. For rare binary outcomes, track the difference in event rates or use a continuous proxy metric that correlates with the rare event (for example, predicted risk scores or ranking position).
Quantifying Uncertainty
Since scenarios may come from sessions, users, or other clustered sources, compute standard errors that respect this structure. If scenarios are independent, a simple paired t-test or bootstrap over scenario-level differences works. If they're nested within users or time periods, use clustered standard errors or a hierarchical model.
Report both the point estimate of improvement and a 95% confidence interval. For rare events specifically, ensure you have enough scenarios where the event could occur—if the event rate is 0.1% and you replay 10,000 scenarios, you expect around 10 events, which gives very wide intervals.
Avoiding Overfitting
Confirm that the scenarios used for evaluation were held out from any tuning or hyperparameter selection. If the new model was tuned on a dev set, the replay set must be separate. Check whether the scenario distribution matches the live traffic distribution in key dimensions (user type, context, time of day).
Part 2: Diagnosing the Offline-Online Disagreement
Step 1: Verify Exposure and Instrumentation
Before concluding anything about model performance, confirm the new version is actually serving:
- Check deployment logs to verify the rollout percentage and that traffic is being assigned correctly.
- Inspect feature logs to ensure the new model's predictions are being recorded and acted upon.
- Compare prediction distributions between offline replay and live logs—large shifts suggest a data pipeline or feature computation bug.
Step 2: Statistical Power Analysis
Rare events severely limit detection power. Calculate the minimum detectable effect (MDE) given your sample size and event rate.
If your offline replay showed a 10% relative lift on an outcome with 0.1% base rate, you need hundreds of thousands to millions of observations to detect that lift with 80% power in a live A/B test. Compute the required sample size:
[ n \approx \frac{(z_{\alpha/2} + z_{\beta})^2 \cdot (p_1(1-p_1) + p_0(1-p_0))}{(p_1 - p_0)^2} ]
If your live experiment hasn't reached that size, a null result is inconclusive—you lack power, not evidence of no effect.
Step 3: Metric and Event Definition Alignment
Confirm that the live metric definition matches the offline one:
- Are you measuring the same event (e.g., conversion, click, error) with the same attribution window?
- Did the event rate in the live control group match the historical base rate? A mismatch indicates distribution shift.
- For rare events, check whether guardrail metrics or more frequent proxy metrics show movement in the expected direction.
Step 4: Distribution Shift and Scenario Coverage
Compare the distribution of live traffic to your replay scenarios:
- Plot feature distributions, user segments, and context variables for live vs. replay data.
- If the live population differs significantly (new user cohorts, seasonal changes, different traffic sources), the offline evaluation may not generalize.
- Rare events are especially sensitive to shift—if the circumstances that trigger events have changed, the model's learned patterns may no longer apply.
Step 5: Model Behavior in Production
Examine model outputs in production:
- Are predictions well-calibrated, or did calibration drift?
- Does the new model produce a different score distribution than expected?
- Is there an interaction with other system components (e.g., ranking, filtering, or downstream rules) that neutralizes the model's recommendations?
Part 3: Concluding True Lack of Benefit vs. Insufficient Sensitivity
Conclude insufficient sensitivity (inconclusive) if:
- The live experiment's confidence interval is very wide and includes the offline effect size.
- The required sample size for adequate power has not been reached.
- Instrumentation or exposure checks reveal issues (logging gaps, partial rollout, pipeline bugs).
- Proxy or guardrail metrics show trends consistent with the offline direction, even if the rare event metric doesn't move.
Conclude true lack of benefit if:
- The live experiment has reached the pre-computed sample size for adequate power, and the effect estimate is centered near zero with a narrow confidence interval excluding the offline effect.
- The live control group's baseline matches historical data, ruling out drift.
- All instrumentation and exposure checks pass.
- Other metrics (proxies, segment analyses) also show no signal in the expected direction.
- Post-hoc investigation reveals that the offline scenarios were unrepresentative or the tuning process overfit to the replay set.
Common Mistakes
- Treating scenario replay as a substitute for live testing rather than a complement.
- Ignoring clustering or dependence in scenarios, leading to over-confident conclusions.
- Concluding "no effect" from an underpowered live experiment.
- Failing to check that the new model is actually deployed and serving correctly.
- Not accounting for distribution shift between historical replay data and current live traffic.