Inventory Optimisation: Safety Stock Set by a Model, Not a Guess
Last updated:
Why the same rule for every product costs you twice
Walk into most distributors and ask how safety stock is set and you will hear something like two weeks of cover, or a minimum that someone set in 2019 and nobody has touched since. The rule is simple. It is also wrong in both directions at once.
Steady sellers with reliable suppliers carry far more buffer than they need, which is cash sitting on shelves. Erratic lines with a supplier who ships from overseas carry far too little, which is lost orders and angry phone calls. The average looks fine on a stock report. The individual products are not fine.
What safety stock actually depends on
Safety stock exists to absorb two kinds of uncertainty during the time between placing a purchase order and receiving it.
- Demand uncertainty: how far actual sales stray from the forecast over the lead time
- Supply uncertainty: how much the lead time itself varies, and how often deliveries arrive short
- Target service level: the probability of not running out that you are willing to pay for
The textbook formula multiplies a service-level factor by the combined spread of those uncertainties. It is sound. The trouble in practice is the inputs: most businesses use sales history as the forecast and a supplier's quoted lead time as the lead time, and both are optimistic.
Where machine learning improves the numbers
A model does not replace the formula. It gives the formula honest inputs.
- Probabilistic demand forecasts. Instead of a single number, a forecast that says the 50th percentile is 120 units and the 95th is 190. Quantile regression or gradient-boosted models do this well and account for promotions, seasonality and price changes.
- Lead time prediction. Actual lead times learned from purchase order and goods-received dates, by supplier, by product group and by season. The quoted fourteen days often turns out to be nineteen, with a long tail around Chinese New Year.
- Intermittent demand handling. Slow movers that sell zero most weeks and six occasionally need different methods, and a model can pick the right approach per product.
If you want to see how the forecasting side is built, we have written about time-series forecasting for demand planning separately. This post is about what you do with the forecast once you have it.
A worked example with two products
| Product A: cleaning concentrate | Product B: imported spare part | |
|---|---|---|
| Average weekly sales | 400 units | 30 units |
| Forecast error (weekly) | Low and stable | High, lumpy orders |
| Quoted lead time | 5 days, UK supplier | 6 weeks, overseas |
| Actual lead time spread | 4 to 6 days | 5 to 11 weeks |
| Current rule | 2 weeks cover = 800 | 2 weeks cover = 60 |
| Model-based safety stock (illustrative, 97% service) | Around 250 | Around 140 |
Notice that Product B's buffer barely depends on its average sales. It is driven by the five-week spread in when the container actually turns up. That is why a weeks-of-cover rule, which only looks at sales, gets imported lines so badly wrong.
The numbers are illustrative, but the direction is the usual finding. The steady local line is overstocked by several hundred units. The imported part is dangerously thin because the rule ignored the lead time variability entirely. Across a few thousand SKUs, that pattern is where the working capital goes.
Choosing service levels is a business decision
The model will happily calculate stock for a 99.5% service level on every product. That is expensive, because buffer rises steeply as you approach 100%. The useful conversation is which products deserve that.
- High-margin lines and anything that loses the whole order if missing: high service level
- Products with easy substitutes: moderate service level
- Long-tail items where customers accept a lead time: low service level or make-to-order
We usually group products into three or four tiers and let the finance and sales leads agree the tier targets. That meeting is more valuable than any hyperparameter tuning.
When a spreadsheet formula is enough
If you stock a few hundred products, demand is fairly steady and suppliers are reliable, the classic formula with measured lead times in a spreadsheet will get you most of the benefit. Honestly, measuring actual lead times from your own purchase order history is the single most valuable step, and it needs no model at all.
Machine learning starts to pay when you have thousands of SKUs, promotions that distort demand, seasonal patterns, or suppliers whose lead times drift. It also helps when nobody has the hours to recalculate the formula for every product each month.
How we approach an inventory optimisation project
At SpiderHunts we begin with a stock health report built from your own history: which products ran out, which sat for months, and what the actual lead times were. That report alone often changes purchasing behaviour before any model exists.
Then we build the forecasts and lead time models, calculate recommended safety stock and reorder points per product, and push them back into the ERP or stock system as suggested values a buyer approves. After a quarter of approvals with few overrides, the suggestions can update automatically. This is standard data science work, and most of the effort is in data cleaning, particularly goods-received dates that were keyed in late.
Frequently asked questions
What is the formula for safety stock?
Can machine learning reduce inventory without more stockouts?
How often should safety stock be recalculated?
Does this work with our ERP?
What is a sensible service level to aim for?
Too much stock in some lines and stockouts in others?
Share a year of sales and purchase order history. We will show you which products carry the wrong buffer and what a model-based policy would change.