LightGBM Forecasting Reframes Inventory Control for Intermittent Hospital Drugs

Hospital pharmacies face a stubborn operational problem: the medicines most likely to create trouble are often the ones that are too expensive to overstock and too irregular to predict. High-value, intermittent-demand drugs do not follow the steady patterns that manual ordering systems handle well. When demand arrives in bursts, a conservative purchasing habit can protect cash flow in the short term while creating costly shortages at the bedside.

A retrospective study from a large tertiary hospital in Beijing tested whether machine-learning could improve that balance. Investigators developed a LightGBM-Tweedie regression model to forecast weekly demand for high-value drugs with irregular use patterns, then compared its performance with common forecasting approaches used in inventory planning. The goal was practical rather than theoretical: reduce the financial harm of stockouts without forcing pharmacy staff into bloated stock levels that sit unused on shelves.

Weekly Demand Data From a Large Tertiary Hospital

The analysis used weekly pharmacy usage data collected between January 2021 and December 2024. Data from 2021 through 2023 formed the training set, and 2024 served as the testing set. Stock keeping units were sorted with the Syntetos–Boylan average demand interval and coefficient of variation squared framework, which separates products into smooth, erratic, lumpy, and intermittent demand patterns.

That classification mattered because not every drug behaves the same way. Smooth products can often be forecast with conventional time-series methods, while erratic and lumpy items produce long stretches of no use followed by sudden demand spikes. Those are the products that most often break manual ordering logic and generate shortages that are expensive to fix after the fact.

The LightGBM-Tweedie model was measured against naïve forecasting, autoregressive integrated moving average, random forest, and long short-term memory models. Performance was judged using weighted mean absolute percentage error, or wMAPE, on the 2024 test set. Financial impact was then estimated by comparing model-based forecasts with historical manual procurement orders using overstock and shortage cost proxies.

Forecast Accuracy Held Up Best in Complex Demand Patterns

In the targeted analysis of complex demand patterns, the model achieved a wMAPE of 21.4%. Performance improved by about 3% compared with the naïve baseline. In inventory management terms, that is not a cosmetic gain. Even a modest improvement can change how much capital gets tied up in reserve stock and how often a pharmacy is forced into urgent, reactive purchasing.

The result also points to an important property of the Tweedie framework. Pharmacy demand data for expensive, intermittent drugs often contain many zero-use weeks mixed with occasional positive counts. A regression method that can handle that mix without forcing the data into a standard normal pattern is better aligned with how these drugs are actually consumed in practice. LightGBM, with its gradient-boosting structure, adds flexibility for nonlinear relationships that simpler methods may miss.

Financial Tradeoffs Favored Fewer Shortages Over Minimal Stock

Manual procurement produced minimal overstock, but shortage costs were substantially higher than overstock costs. In plain clinical operations terms, the pharmacy saved on holding inventory while accepting a much larger penalty when drugs were unavailable. The model reversed part of that imbalance.

By introducing a strategic inventory buffer, the forecasting system reduced estimated financial losses from stockouts by approximately 70% for erratic-demand drugs compared with manual practice. Holding costs did rise, but the increase was moderate relative to the avoided shortage burden. For a hospital pharmacy, that tradeoff is often easier to defend than repeated emergency replenishment or delayed access to medication.

This is the core operational lesson. A lean shelf is not automatically a safe shelf.

Why the Model Fit the Pharmacy Problem Better Than Rule-Based Ordering

Manual procurement often depends on experience, recent memory, and institutional habit. Those tools can work well when demand is stable, but they become fragile when consumption is sporadic and expensive. A single overlooked spike can leave the pharmacy exposed for weeks, especially when supply chains are slow or replacement orders require administrative approval.

The model did not replace professional judgment. Instead, it created a quantitative layer that can support it. By estimating risk more systematically, the framework offers pharmacy staff a way to distinguish between a temporary lull and a real signal that demand is about to rise. That distinction is especially relevant for erratic-demand drugs, where one missed replenishment can cause a cascading shortage and force clinicians to substitute or defer treatment.

The study also has a practical appeal for hospitals that already maintain digital pharmacy records. The input data were operational, not exotic. Weekly usage history, demand-pattern classification, and existing procurement records were enough to generate the model. That makes the approach more realistic for implementation than systems that require elaborate new infrastructure before they can function.

Implications for Hospital Pharmacy Policy

The findings point to a decision-support role for machine learning in hospital inventory management. For high-value intermittent drugs, a forecasting tool that slightly improves accuracy while materially reducing shortage exposure can change policy discussions around reorder thresholds, safety stock, and procurement timing. It also gives administrators a clearer basis for balancing cash preservation against continuity of care.

For pharmacies under pressure to limit waste, the temptation is to trim inventory as tightly as possible. The study suggests that approach can backfire when it pushes the system into chronic under-ordering. A model that estimates demand more reliably may help hospitals accept a controlled increase in stock when the cost of being wrong is higher on the shortage side than on the holding side.

Single-Centre Data Leave the Next Step Unsettled

The analysis comes from one tertiary hospital, so the results should be read as evidence of feasibility rather than a universal rule for every pharmacy system. Demand structures, prescribing patterns, supplier reliability, and procurement rules differ across institutions. A model that works in Beijing may need recalibration before it performs the same way elsewhere.

Even so, the clinical operations question is now sharper than before. Can hospitals use predictive inventory systems to reduce stockouts without creating wasteful overstock? This study provides a credible answer for one setting: yes, with careful demand classification and a model built for intermittent data. What remains open is how well the approach scales across different drug formularies, different hospitals, and different purchasing environments.


Reporting by Dr. A. Nikhil Krishnan, MBBS for Medicine World Foundation, with additional data provided by BMJ Open.