Product Context
MercatoNow is an omnichannel retail platform that powers buy-online-pickup-in-store, same-day delivery, and in-store fulfillment across 4,200 stores and 35 regional warehouses. Customers and store associates rely on accurate real-time inventory availability, but raw stock ledgers are noisy due to delayed scans, shrinkage, returns, substitutions, and concurrent reservations.
Scale
| Signal | Value |
|---|
| DAU | 18M shoppers + 120K store associates |
| Peak read QPS | 220K inventory availability lookups |
| Peak write QPS | 55K stock mutations (sales, returns, transfers, reservations) |
| SKU catalog | 9M global SKUs |
| Active store-SKU pairs | 1.1B |
| Warehouses | 35 |
| Stores | 4,200 |
| p99 latency budget | 120ms for availability API |
Task
Design an end-to-end ML system that predicts sellable inventory in real time while preserving strong correctness guarantees for reservations and order placement.
Address the following:
- Define the functional and non-functional requirements, including what must remain strictly correct vs what can be predicted.
- Propose a multi-stage architecture for availability serving, including candidate source selection, ML scoring, and final correctness checks before reservation.
- Design the offline and online data pipelines, feature store, labels, and retraining strategy.
- Choose models for each stage and explain tradeoffs against simpler rules-based approaches.
- Define offline and online evaluation, including business guardrails for oversell, undersell, and fulfillment quality.
- Identify major failure modes such as feature drift, training-serving skew, stale events, and regional outages.
Constraints
- Reservation and checkout must be strongly consistent; recommendations shown to users may use probabilistic estimates.
- Inventory events arrive out of order from POS, warehouse management, returns, and manual cycle counts.
- New products and low-velocity store-SKU pairs have sparse history.
- Compliance requires a full audit trail for every inventory decision and reservation.
- Serving cost target is under $0.0015 per availability request at peak load.