Skip to main content
Case StudiesManufacturing

This case study describes a real engagement. Client identity, proprietary details, and specific metrics are anonymized or approximated under NDA.

Manufacturing

Demand Forecasting for FMCG Distribution

The Problem

Inventory stockouts running at 8% and overstock waste at 14%. Demand planning was based on spreadsheet extrapolation and category manager intuition — no systematic use of sales history, seasonality, or external signals. SKU-level accuracy was insufficient for procurement planning.

The Solution

ML pipeline ingesting sales history, seasonal patterns, and external signals to produce SKU-level demand forecasts at weekly and monthly horizons, integrated into the procurement planning workflow.

34%
Forecast Accuracy Improvement
61%
Stockout Reduction
23%
Overstock Reduction
Overview

This engagement replaced a spreadsheet-based demand planning process with a production ML forecasting system covering 1,200+ active SKUs across 8 distribution zones. The system was built as a weekly batch pipeline using Airflow for orchestration, with Metabase dashboards surfacing forecasts and accuracy metrics to category managers. Integration with the existing ERP procurement module was done via CSV export initially, with a REST API endpoint added in week 7 to support direct import. The forecasting models are retrained weekly on rolling 24-month sales history, with automatic fallback to the previous model version if retraining degrades validation metrics.

Challenge

The Challenge

FMCG demand data is structurally messy. Sales history contained gaps from stockout periods (where zero sales reflected supply constraints rather than zero demand), promotional events that created artificial spikes, and distributor bulk-buy patterns that had no relationship to end consumer demand. Cleaning and feature engineering this data correctly — distinguishing genuine demand signal from supply-side and channel artifacts — was more work than the modeling itself. Seasonal patterns in the portfolio varied significantly by category, requiring per-category feature sets rather than a single global model. External signals (regional festivals, school calendars, weather) were relevant for some categories but not others, requiring feature selection to avoid overfitting.

Approach

How We Built It

01

Data audit and feature engineering (Weeks 1–3): We audited 24 months of sales transaction data across all SKUs, identifying stockout gaps, promotional windows, and distributor bulk-buy events. Each data quality issue required a specific imputation or exclusion strategy — stockout gaps were imputed using regional sibling-SKU demand interpolation, promotional spikes were flagged and excluded from baseline training data. Feature engineering produced a per-SKU time-series dataset with lag features (1-week, 4-week, 12-week), rolling averages, seasonal index by calendar week, promotional flags, and external signals (festival calendar, regional event flags) for applicable categories.

02

Model development and selection (Weeks 4–6): We evaluated three model classes: gradient boosting (LightGBM), ARIMA-family time series, and a simple exponential smoothing baseline. LightGBM with the engineered feature set outperformed ARIMA on 78% of SKUs at the 4-week forecast horizon, with ARIMA performing better on slower-moving SKUs with less history. The final system uses a model routing layer that assigns each SKU to the best-performing model class based on training validation metrics, with the exponential smoothing baseline as a fallback for new SKUs with insufficient history.

03

Pipeline infrastructure and orchestration (Weeks 7–8): The forecasting pipeline runs weekly in Airflow: data extraction from the ERP, feature computation, model inference, accuracy metric calculation against the prior week's actuals, and output delivery to Metabase and the procurement CSV endpoint. PostgreSQL stores forecast history for accuracy tracking and the model registry. The retraining job runs on the same schedule as the inference job, with a validation gate that blocks promotion of a retrained model if accuracy on the held-out validation set degrades more than 5% relative to the production model.

04

Dashboard delivery and category manager training (Weeks 8 — post-launch): Metabase dashboards surface forecast accuracy by SKU and category alongside confidence intervals for the current forecast horizon. Category managers see the forecast with the accuracy history of that specific model, giving them a calibrated basis for overriding when they have local market knowledge the model cannot capture. Override logging feeds back into the training dataset, allowing systematic category manager knowledge to improve model accuracy over time.

Results

What We Delivered

Stockout rate across the portfolio dropped from 8% to 3.1% in the 8 weeks following full deployment. Overstock waste fell from 14% to 10.8%. These changes are attributed to the improvement in 4-week forecast accuracy, which went from an average of 61% within-10% accuracy at the SKU level to 81% — a 34% improvement in forecast accuracy.

Procurement planning cycle time decreased from 3 days per planning cycle to approximately 4 hours. Category managers now spend planning time reviewing and selectively overriding AI forecasts rather than building them from spreadsheets, which has shifted their work toward higher-value category strategy and supplier negotiation preparation. Override rates have stabilized at around 12% of SKUs per weekly cycle.

The accuracy tracking infrastructure built into the pipeline has provided visibility that did not exist before the engagement. Category managers can now identify which SKU categories have systematically poor forecast accuracy (typically new product launches and SKUs with high promotional dependency) and flag them for different inventory buffering strategies rather than treating all forecast uncertainty uniformly.

Tech Stack
Pythonscikit-learnPostgreSQLAirflowMetabaseAWS
Timeline
8 weeks
Team Size
2 engineers

Ready to build something like this?

Tell us what you are building. We will scope it, price it honestly, and give you a clear plan.

Start a Conversation

Free 30-minute scoping call. No obligation.