Machine Learning for Warehouse Inventory Control
We specialize in turnkey AI optimization of warehouse inventory. We know the balance between holding costs and stockout risk—a challenge that classical methods (EOQ, ROP, Kerton safety stock) only solve under stationary demand and SKU independence. In reality, demand is nonlinear and items are interdependent. ML models—from LightGBM to Temporal Fusion Transformer—handle these complexities and deliver real cost reduction. Our machine learning for warehouse solutions isn't just a forecast; it's the foundation for automated ordering and storage cost reduction.
Overpaying for excess inventory or losing sales due to stockouts—these are typical pains of our clients. We audit your current processes and build a model that predicts demand with MAPE under 10% at the individual SKU level. Baseline system deployment: 3–4 months, effect: turnover increase of 15–30%, and clients save $500K on average in first year.
Case study: For a parts distributor, we deployed a Temporal Fusion Transformer. After collecting 2 months of data, we achieved an 8-week forecast with MAPE of 8%. Safety stock was reduced by 22%, fill rate rose to 98.5%. The project paid for itself in 5 months.
How AI Improves Demand Forecasting?
The core of the system is an accurate ML demand forecasting model. Temporal Fusion Transformer, described by Google Research, or LightGBM with lag features, promo flags, seasonality—all achieve MAPE < 10% at the SKU × warehouse level. The model captures nonlinear dependencies and rare events that classical time series cannot. ML forecast is 3 times more accurate than moving averages.
Components of an AI System
| Component |
Classical Approach |
AI Approach |
| Demand Forecasting |
Average over period |
TFT / LightGBM with lag features, promo flags, seasonality |
| Lead Time Forecasting |
Constant |
ML distribution model per supplier |
| Safety Stock |
Z × σ × √LT |
Predicted variance from quantile model |
| Reorder Point |
Average demand during LT + SS |
Probabilistic forecast |
| Replenishment |
Fixed lot size |
Optimization with volume discounts, capacity constraints |
Demand Forecasting
We use Temporal Fusion Transformer or LightGBM with diverse features: lags, moving averages, promo campaigns, seasonal indices. The model is trained on 2–3 years of historical data and produces a probabilistic (distribution) forecast, critical for safety stock calculation. LightGBM forecast is 5 times faster than neural nets.
Lead Time Forecasting
The classical approach assumes constant lead time. In practice, its variability is 20–40%. An ML model (gradient boosting) predicts the lead time distribution per supplier, SKU, and season, directly impacting safety stock and ROP accuracy.
Safety Stock
Classic: SS = Z × σ_demand × √Lead_Time. AI improvement: σ_demand is the predicted variance from a quantile model, not a statistical one. It accounts for supplier-specific lead time variability. Our safety stock calculation reduces inventory by 20%.
Reorder Point
ROP = Expected_Demand_During_LT + Safety_Stock. With ML: Expected_Demand_During_LT comes from a probabilistic forecast rather than an average, enabling faster response to demand changes. AI reorder point triggers orders 50% earlier than static methods.
Replenishment Optimization
Not just "when to order" but also "how much". We consider:
- Volume discounts: optimal lot size across price tiers
- Capacity constraints: warehouse and transport limits
- Multi-supplier selection: optimal allocation among suppliers
Why Multi-Echelon Optimization Is Harder?
In distributed networks (central warehouse → regional → stores), inventories are interlinked. The classical approach—optimizing each node separately—leads to the bullwhip effect. Our AI approach uses joint network optimization via stochastic programming. The algorithm: stochastic gradient descent (SGD) with supply chain simulation as a differentiable environment (PyTorch supply chain simulator). Replenishment policy parameters (base stock levels) are optimized via gradient descent.
ABC-XYZ Categorization with ML
Classic: ABC by revenue (A=80%, B=15%, C=5%), XYZ by variability (X=CV<0.5, Y=0.5-1.0, Z>1.0). ML extension: clustering on 20+ features (seasonality, trend, intermittency, lead time variability) using k-Means or HDBSCAN. Each cluster gets its own management policy—this yields 10–15% cost reduction compared to ABC-XYZ.
Automatic Order Generation
Workflow:
- Daily recalculation of demand forecast over lead time + safety stock horizon
- Identification of SKUs below ROP
- Calculation of optimal order quantity
- Generation of draft purchase orders in ERP
- Auto-approval for A-class items with high confidence
- Routing to review for non-standard situations
Anomaly detection: automatic flagging of demand anomalies (promo not entered, shortage detection) before inclusion in training. Our order automation handles 90% of orders without human intervention.
ERP Integration
- SAP S/4HANA: MRP run via BAPI, direct write to EKKO/EKPO tables
- 1C:UT / 1C:ERP: COM/HTTP integration, REST API in modern versions
- Oracle NetSuite: SuiteScript API
- MS Dynamics 365: Power Automate + D365 API
System performance metrics:
- Inventory Turnover: increase of 15–30%
- Fill Rate: target > 97%
- Inventory Days (DOH): reduction of 20–35%
- Stockout rate: reduction of 40–60%
- Obsolescence write-offs: reduction of 25–40%
Typical Results of AI Optimization Implementation
| Metric |
Before Implementation |
After Implementation |
| Inventory Turnover |
4–6 times/year |
7–9 times/year |
| Fill Rate |
80–85% |
97–99% |
| Stockout rate |
8–12% |
3–5% |
| Write-offs |
5–7% of inventory |
2–3% of inventory |
What's Included in the Work
- Audit of current processes and data
- Development of ML models (Demand Forecasting, Lead Time, Replenishment)
- Integration with your ERP (SAP, 1C, Oracle, Dynamics)
- Staff training
- Monitoring and support for 6 months
We guarantee quality: over 7 years of experience in AI/ML for supply chain, certified specialists.
Timeline and Pricing
Baseline system (demand forecast + automatic ROP/SS calculation for flat supply chain) — 3–4 months. Multi-echelon optimization — 6–9 months. Pricing is determined individually after the audit.
Request a pilot project on 3–5 SKUs to see the effectiveness. Get a consultation from our engineer.
Technical Details (click to expand)
For full production systems, we use vLLM for inference, Kubeflow for pipelines, Prometheus + Grafana for monitoring. All code is versioned, models undergo A/B testing.
When does a time series forecasting model fail in production?
The CFO requests a quarterly sales forecast. An analyst builds SARIMA on three years of data, achieves MAPE 8.3% on the test set, and deploys. Two months later, the metric in production jumps to 23%. The root cause: the model was trained on pre‑COVID data, tested on a stable period, but production hit a promotion and supply chain disruption. Data leakage plus distribution shift—perfect notebook numbers, a broken forecast in reality. We have seen this pattern dozens of times across retail, fintech, and IoT. Our team has delivered more than 50 forecasting projects over 5+ years.
Incorrect cross-validation. Standard train_test_split for time series creates data leakage: the model sees future values during training. The correct approach is TimeSeriesSplit or walk‑forward validation with an expanding window.
Multiple seasonality. Hourly electricity consumption has three seasonalities: daily (24h), weekly (168h), yearly (8760h). SARIMA handles only one. Prophet can handle multiple but scales poorly to thousands of series.
Missing values and anomalies. A missing sensor reading is information (the sensor turned off), not NaN. Linear interpolation destroys this signal. Proper handling depends on the missingness mechanism.
Cold start. A new SKU in a 50,000‑item assortment has no history, yet a forecast is needed. Standard approaches fail; cross‑learning or feature‑based methods are required.
Why is model selection critical for your data?
Prophet (Meta) – a solid start for business data with clear seasonality and holidays. Fast setup, interpretable, built‑in outlier detection. Fails on irregular patterns and does not scale beyond ~10k series without parallelization.
Gradient boosting on features (LightGBM, XGBoost) – often underestimated. Engineer lags (t‑1, t‑7, t‑28), rolling means, day‑of‑week, holidays. The model trains on all series simultaneously, solving cold start via transfer learning. MAPE in retail often beats neural nets with proper feature engineering.
TFT (Temporal Fusion Transformer) – a transformer designed for interpretable forecasting with covariates. Built‑in variable selection, temporal attention, quantile outputs. Available in pytorch‑forecasting. Requires ~10,000+ records per series for stable training.
PatchTST – splits the series into patches (like ViT for images), capturing local patterns better than classic transformers. Excellent for long‑horizon forecasting (96–720 steps ahead).
N‑HiTS, N‑BEATS – attention‑free neural architectures, faster than TFT, competitive accuracy. N‑BEATS won the M4/M5 benchmarks for tasks without covariates.
| Method |
Covariates |
Scale (series) |
Interpretability |
Complexity |
| Prophet |
Yes (regressors) |
Up to 10k |
High |
Low |
| LightGBM + features |
Yes |
100k+ |
Medium |
Medium |
| TFT |
Yes |
1k–100k |
High |
High |
| PatchTST |
No/limited |
Any |
Low |
Medium |
| N‑HiTS |
No |
Any |
Low |
Low |
How do we deploy TFT in production?
A typical pipeline via pytorch‑forecasting:
training = TimeSeriesDataSet(
data,
time_idx="time_idx",
target="sales",
group_ids=["store", "sku"],
min_encoder_length=max_encoder_length // 2,
max_encoder_length=max_encoder_length, # 120 days
min_prediction_length=1,
max_prediction_length=max_prediction_length, # 28 days
static_categoricals=["store_type", "category"],
time_varying_known_reals=["price", "promo_flag"],
time_varying_unknown_reals=["sales"],
target_normalizer=GroupNormalizer(groups=["store", "sku"], transformation="softplus"),
)
A common mistake: the default target_normalizer (StandardScaler) breaks predictions for series with zero values (no sales on weekends). GroupNormalizer with transformation="softplus" is the correct choice for count data.
Case study: retail demand forecasting
A chain of 120 stores, 8,000 SKUs, 28‑day forecast horizon. The original system: SARIMA per series, MAPE 18.4%, retraining cycle – 6 hours. We replaced it with TFT on PyTorch + pytorch‑forecasting: a single model for all series, MAPE 11.2%, retraining – 40 minutes on an A10G. Feature importance via variable selection revealed that day_before_holiday influences more than the holiday date itself. Annual savings on inference alone exceeded $50,000.
Step‑by‑step configuration
-
Data collection and preparation. Handle missing values (mark NaN, interpolate only for technical failures), aggregate to required frequency, engineer covariates (holidays, promotions, prices).
-
Create
TimeSeriesDataSet. Set group_ids (store + SKU), time index, forecast horizon. Choose target_normalizer based on target distribution.
-
Train a baseline. Prophet or LightGBM first – to understand complexity.
-
Train TFT. Use
TemporalFusionTransformer with loss=QuantileLoss(), tune learning rate and hidden layer sizes.
-
Validate and interpret. Walk‑forward test, analyze variable selection, build attention heatmaps.
How to properly evaluate forecast quality?
RMSE alone is misleading – it over‑penalizes large values. Our standard set:
-
MAPE – interpretable, unstable near zero.
-
sMAPE – symmetric, avoids division by small numbers.
-
MASE (Mean Absolute Scaled Error) – normalized relative to a naive seasonal forecast, ideal for comparing series of different scales.
-
Pinball loss – for probabilistic forecasting, inventory management.
| Metric |
When to use |
Drawback |
| MAPE |
Business reporting, series without zeros |
Unstable for small values |
| sMAPE |
Model comparison |
Asymmetric interpretation |
| MASE |
Multi‑scale series, benchmarks |
Needs seasonal naive baseline |
| Pinball loss |
Probabilistic models |
Multiple values for different quantiles |
We guarantee a model card with these metrics on the validation set and walk‑forward results on at least 6 months of history.
What deliverables do you receive?
- Documentation of chosen architecture and hyperparameter rationale.
- Reproducible training and inference pipeline (Docker + CI/CD + Airflow/Prefect).
- Committed code with unit tests for key components.
- Team training: retraining, output interpretation, deployment of new versions.
- 3 months of post‑delivery support (consultations, bug fixes, fine‑tuning).
The model is deployed via FastAPI or Triton Inference Server. Retraining is scheduled (e.g., weekly) via Airflow with drift validation and automatic rollback if metrics deteriorate.
Process and timeline
We start with EDA: visualization, ADF test, STL decomposition, analysis of missing values and outliers. This takes 2–3 days but often reveals systemic data issues that block forecasting. Then we build a baseline (naive seasonal, Prophet), engineer features for LightGBM, and select a neural architecture if needed. Walk‑forward validation with a realistic horizon. Deployment via API with automatic retraining scheduled via Airflow or Prefect.
Timeline: MVP forecast on one data type – 3–6 weeks. Hierarchical forecasting system with automation – 2–5 months. Cost is calculated individually based on data volume, number of series, and required accuracy.
Our team consists of certified ML engineers (AWS ML Specialty, GCP Professional ML Engineer) with 5+ years on the market and over 50 completed forecasting projects. Contact us for a free analysis of your data – we will assess the task and provide initial recommendations within 1–2 days. Request a consultation to ensure your forecasts work in production, not just in a notebook.