TL;DR
Researchers at Amazon have developed a scalable Bayesian framework that combines the feature-driven power of Generalized Linear Models (GLMs) with the temporal smoothness of state-space models. By reducing complex Newton-Raphson optimization to linear-time Kalman smoothing, they created a system capable of forecasting demand for hundreds of thousands of "intermittent" and "bursty" items—where sales are mostly zero with occasional spikes—at an industrial scale.
The Challenge of Large-Scale Inventory Forecasting
In massive e-commerce catalogs, demand forecasting isn't just about predicting a single number; it’s about understanding the probability of sales to optimize inventory. Traditional methods, such as ARIMA or standard Exponential Smoothing, assume normal (Gaussian) distributions. While this works for high-volume items, it fails miserably for the "long tail" of inventory.
Most items in a large warehouse exhibit intermittent demand (long stretches of zero sales) and bursty demand (sudden, high-volume spikes). For these items, a Gaussian model might predict physical impossibilities—like negative sales—or fail to capture the uncertainty required for sound inventory decisions. Furthermore, existing statistical solutions for intermittent demand struggle to scale to millions of items or handle long-term features like upcoming holidays and promotions.
A Hybrid Latent State Forecasting Methodology
The authors propose a Latent State Forecasting methodology that blends two distinct modeling approaches:
- Generalized Linear Models (GLMs): These utilize "features" (e.g., holidays, price changes, seasonality) to handle medium-to-long-term trends.
- Innovation State Space Models (ISSMs): These provide temporal continuity, allowing the model to "smooth" predictions based on recent history.
Key Technical Innovations
- Multi-stage Likelihood: Instead of a simple Poisson distribution, the model uses a three-stage approach: Is there a sale (0 vs >0)? Is it a single sale (1 vs >1)? If it's a "burst," how many items were sold (Poisson for $z \ge 2$)?
- Newton-Raphson to Kalman Reduction: Finding the best parameters for non-Gaussian data usually requires $O(T^3)$ computation (where $T$ is time), which is prohibitively slow. The authors demonstrate that each step of the Newton-Raphson algorithm can be mathematically reduced to a Kalman smoothing operation, which runs in $O(T)$ (linear time).
- Twice Logistic Transfer Function: Standard models use an exponential function to ensure sales counts are positive, which can "explode" during holiday spikes and crash the optimization. The authors introduced a "twice logistic" function that grows linearly rather than exponentially, making the model significantly more robust to bursty data.
Key Insights and Ideas
The "Aha" on Optimization: While many researchers rely on L-BFGS for optimization, the authors found it frequently failed to converge on real-world demand data. By switching to Newton-Raphson and mapping it to Kalman smoothing, they achieved both superior accuracy and the speed necessary for production.
Handling "Out of Stock": One of the biggest noise factors in retail data is when an item doesn't sell simply because it isn't on the shelf. The Bayesian nature of this model allows "out of stock" days to be treated as missing observations, preventing the model from mistakenly learning that demand has dropped to zero.
Feature Integration: Unlike previous intermittent demand models that only look at past sales, this model can ingest external signals (like "Prime Day" or "Black Friday") through its GLM component, which is essential for medium-term planning.
Datasets and Key Results
The model was evaluated on three distinct datasets:
- Parts: A publicly available dataset of monthly demand for US automobile spare parts (~20,000 items).
- EC-sub: A medium-sized internal Amazon dataset of fast and medium-moving items (~40,000 items).
- EC-all: A massive internal Amazon dataset containing over 500,000 items and 150 million item-days.
- Superior Accuracy: On the internal Amazon datasets, the proposed model (LS-feats) consistently outperformed standard industry benchmarks like ETS (Exponential Smoothing) and NegBin (Negative Binomial models), particularly in predicting the "tails" (quantiles) of demand.
- Scalability: Implemented in Apache Spark, the system successfully processed hundreds of millions of data points. The linear-time scaling allowed it to handle problems several orders of magnitude larger than previous academic work.
- Robustness: The "twice logistic" function successfully resolved the numerical instability issues that typically plague Laplace approximations when dealing with high-count sales spikes.
Limitations and Future Work
- Dynamic Volatility: The current model assumes the "randomness" (innovation variance) is constant over time. In reality, demand is much more volatile during peak seasons. The authors suggest making this variance time-dependent in future iterations.
- Cross-Item Learning: The model currently forecasts each item independently. Future work could involve hierarchical priors that allow the system to learn patterns from similar items (e.g., if one brand of toaster is trending, similar toasters might too).
- Direct Seasonality Integration: While seasonality is currently handled via features, the authors plan to integrate it directly into the latent state for more dynamic tracking.
Summary updated