Running demand forecasting machine learning models at scale

Maarten Sukel12 Dec 2023

Problem

Picnic is an online grocery retailer that orders from suppliers automatically, so purchasing depends on a daily forecast of what customers will order. A bad forecast creates food waste or unavailable products. Deep models such as the Temporal Fusion Transformer (TFT) need retraining as data and concepts drift. New articles and warehouses keep appearing too. The system makes hundreds of millions of predictions a day for tens of thousands of products across several countries, and a model can misbehave even after careful offline evaluation.

Example from the article: a prediction that fails the validation schema is not passed to operations. Purchasing keeps using the latest known accurate prediction while the team investigates.

Solution in brief

Validate data at every stage, retrain on a schedule and deploy a new model only if it beats the current one on several data subsets. Log every prediction and monitor it by subset. Precompute all frequently requested predictions in batches, so a stored older prediction is always available as a fallback.

Questions this case answers
  • How to run many forecasting models in production so that a faulty model or bad input never causes an operational incident
  • How to retrain and redeploy a compute-heavy forecasting model automatically while guarding against drift and regressions
  • How to keep production demand forecasts reliable when the model can silently misbehave?
  • How to serve hundreds of millions of forecasts a day with low latency and a built-in fallback?

Tools and methods

  • Temporal Fusion Transformer — the deep forecasting model run in production
  • Pandera — schema validation of input tables and predictions
  • Model tracker — compares evaluation metrics of new and current models
  • Snowflake data warehouse — source of features for training
  • Precomputed predictions — batch inference with stored fallbacks
Continue reading — it's free

Google or a one-time email code. No password.