ML in Production is doing WORSE than locally
First, congratulations on getting your model to production. That was no easy task!
Remember that typically models in production will perform (at least) slightly worse than offline models, even if you used the same metrics to evaluate them, because the model is seeing data is hasn't seen before. But what are some reasons for why the difference is big?
Part I: Possible Reasons
If you're seeing a large difference in model performance between what you saw when you ran it locally to what's now happening in production, here are some possible reasons:
Overfitting on the local version
Assessment: How did it perform locally on a brand new out-of-sample data that it’s never seen before?
Bug in data processing/ETL pipeline/etc.
Data sample/split used for model training is missing seasonality in production process
Metrics on live model are different than what was optimized for locally
Model drift, for instance because customer behavior's changed
Intervened to stop poor performance when model went live
(Most likely cause) Leakage on local version
Part II: Diving Deeper into Leakage
What is leakage? Data leakage happens when training data has information you’re trying to predict [ref].
e.g. (Most common) Leaking information from future into past [ref]
Assessment: Are you seeing 99.9% accuracy in your offline model?
e.g. “Leaking data from the test set into the training set” [ref]
Examples of Leakage:
Creating leaky variables by accident
ICML Whale challenge: variables file size, timestamp, and clip order were leaky
Kaggle PetFinder: leakage used in cheating
Predicting likes from views* of content
Including completion date when forecasting construction project going over budget
Including date of first payment into loan repayment prediction model
Part III: Recommended Next Steps
Depending on the model performance reason, you may want to consider turning off the live model, and explore locally -- on an old and also fresher data extract -- the potential reasons (above) for seeing such different model performance live vs offline.
Do you need a second pair of eyes to help you figure out what happened? Please reach out.
Keywords: AI/ML in production, data products, customer understanding
You may also like:
More tips on leakage detection, by Abhay Pawar
What’s your ML test score? A rubric for ML production systems, by Google (2016)
Introducing the 5 Pillars of Data Observability, by Barr Moses