PATTERN Cited by 1 source
Two-stage forecast + optimisation pipeline¶
Problem¶
Decision-making systems under uncertainty (inventory / replenishment / capacity / pricing) have two distinct ML workloads with different cost structures and cadences:
- A forecasting workload — expensive, model-heavy, produces probabilistic predictions over a horizon.
- An optimisation workload — cheaper per-run, consumes forecasts plus current state to find the best decision.
Running both as one monolithic pipeline means every optimisation re-runs the forecast; running them with inconsistent state means optimisation operates on stale or mismatched inputs.
Pattern¶
Decouple the two workloads into two pipelines with independent cadences that share a forecast output contract:
- Stage-1 pipeline — forecasting.
- Runs on a slow cadence (weekly / hourly / whatever matches the signal's natural refresh rate).
- Produces a probabilistic forecast per entity per time-bucket, persisted to storage consumable by stage 2.
-
Includes drift monitoring of forecast quality.
-
Stage-2 pipeline — optimisation.
- Runs on a fast cadence (daily batch + real-time online), or continuously.
- Consumes the stage-1 forecast plus current state (inventory, price, lead times, stock in transit) as a feature vector per entity.
- Runs the optimiser (typically Monte Carlo + gradient-free black-box).
- Includes drift monitoring of optimisation performance.
Why it works¶
- Cadence decoupling matches real workloads. Forecasts don't need to refresh as often as state — weekly forecast
- daily optimise + online what-if is the natural cadence for inventory problems.
- Reusable forecast. One probabilistic forecast can drive replenishment optimisation, pricing optimisation, capacity planning — the team-boundary between the two pipelines maps naturally onto these consumer relationships.
- Cost control. The expensive stage (forecast) runs less often; the cheap stage (optimise) can iterate fast.
Canonical instance (Zalando ZEOS)¶
"We break the inventory optimisation problem into two isolated but connected building blocks: Demand Forecast and Inventory Optimisation. The Demand Forecast pipeline is a batch prediction pipeline that produces probabilistic forecasts for articles at a weekly cadence. The Inventory Optimisation pipeline offers daily batch predictions, as well as a real-time inference endpoints to enable our B2B partners to interactively plan inventory settings."
Stage 1 → systems/zeos-demand-forecaster (weekly, 5M SKUs, LightGBM + Nixtla, 12-week horizon, < 2h wall-clock).
Stage 2 → systems/zeos-replenishment-recommender (daily batch SageMaker Batch Transform + online SQS/Lambda, Monte Carlo + black-box optimiser).
Parent system: systems/zeos-inventory-optimisation-system.
Seen in¶
Related¶
- concepts/two-stage-forecast-optimise-pipeline — concept page.
- patterns/weekly-batch-forecast-daily-batch-optimise-cadence — cadence specialisation of this pattern.
- companies/zalando