## Automated formula search lowers inventory costs across retail simulations

URL: https://theprimary.com/ai-tech/2026-12-03/ai-inventory-formula-search
Published: 2026-12-03T14:29:08.040Z
Updated: 2026-12-03T14:29:08.399Z
Category: AI-Tech

A combination of generative models and numerical solvers discovers hybrid supply rules that cut inventory holding and shortage expenses by up to 30 percent in mathematical tests.

Managing store shelves and distribution centers looks straightforward until deliveries take time to arrive and empty shelves permanently turn away customers. When a shopper finds an empty hook or a cleared pallet, that customer frequently walks away, forfeiting the transaction. Ordering surplus merchandise creates punishing holding costs and clutters stockroom floor space, but ordering too cautiously forfeits sales immediately. Balancing those twin pressures becomes notoriously difficult when a supplier requires days or weeks to fulfill a shipment, because every replenishment decision must account not only for what sits in the stockroom today, but also for what is already moving along highway corridors and freight lines.

For decades, commercial logistics has resolved this dilemma by relying on predefined mathematical rules. The most common approach, called a base-stock policy, sets a single target inventory level, inspects the sum of items on hand and items on order, and buys exactly enough to bring that total back up to the target. It is mathematically elegant and simple to run, but in supply networks where stockouts mean permanently lost sales, simple base-stock rules frequently overreact. If an unexpected demand surge empties the warehouse while previous orders are still in transit, a base-stock formula commands a massive new purchase. Days later, when both the earlier shipments and the emergency shipment arrive at once, the warehouse overflows with expensive surplus inventory.

A team of researchers has demonstrated that artificial intelligence can systematically generate entirely new formulas for inventory control, discovering rules that outperform conventional industry benchmarks. Fenghua Yang, Preet Baxi, and Stefanus Jasin at the University of Michigan, Yi Zhang at Stanford University, Yanzhe Lei at Queen's University, Mo Liu at the University of North Carolina at Chapel Hill, and Parshan Pakiman at the University at Buffalo describe this approach in a preprint posted to the arXiv repository. Their method does not ask an artificial intelligence model to make daily purchasing calls directly. Instead, it pairs a large language model with an external numerical solver in an iterative loop, directing the model to invent algebraic policy structures while the solver calculates their exact mathematical parameters.

## Why do traditional inventory rules break down?

Traditional inventory formulas break down because they treat products on the warehouse shelf and products moving on a delivery truck as interchangeable quantities. In a classic base-stock framework, an item that will arrive in five days is added directly to an item available for sale this afternoon. When customer backorders are allowed, this simplification works reasonably well, because unmet demand simply queues up until shipments roll into the loading dock. In lost-sales environments, however, customer demand does not wait. An item stuck on a truck cannot satisfy a shopper standing in an aisle today, and the revenue from that lost shopper is gone forever.

This fundamental asymmetry makes replenishment decisions sensitive to the exact distribution of inventory across the transit pipeline. If a supply manager orders aggressively whenever stock runs low, those purchase orders stack up in transit. Once the lead time elapses, shipments land in rapid succession, generating high storage fees and working-capital drag. To prevent this whiplash effect, operations researchers have spent decades handcrafting specialized heuristics, such as capping the maximum size of any single replenishment or projecting how much inventory will actually sit on shelves several periods into the future. Yet human mathematicians can only invent and analyze a small number of structural variations, leaving vast regions of possible decision rules untested.

The causal sequence that governs inventory control makes this combinatorial challenge acute. First, an inventory controller observes current shelf inventory and outstanding pipeline orders. Second, the controller applies a decision rule to calculate a replenishment order. Third, that order travels through a multi-period lead time, during which customer demand arrives stochastically each day. Fourth, if demand exceeds shelf stock, sales are permanently forfeited rather than deferred. Fifth, the placed order arrives at the warehouse, replenishing physical stock and shifting the baseline for the next order. When lead times are positive, every decision influences inventory states across multiple future periods, meaning a minor structural flaw in an ordering rule cascades into cyclical shortages and severe overstocking.

The central question facing modern inventory design is whether computational search can discover useful formula structures without human intervention. Standard numerical algorithms can tune the numbers inside a formula, but they cannot invent the formula itself. Conversely, generative language models excel at proposing symbolic computer code and algebraic expressions, but they struggle with precise continuous numerical calculations. The research team realized that separating the structural invention from the numerical optimization could bridge this divide.

## How does automated policy search discover replenishment rules?

Automated policy search discovers replenishment rules by dividing the task into an evolutionary cycle where a language model writes candidate policy code and a numerical solver optimizes the parameters inside that code. The researchers named this framework Automated Inventory Policy Search, or AIPS. The system begins with basic operational data describing the supply environment, including customer demand history, vendor lead times, per-unit inventory holding costs, and per-unit penalties for lost sales. Using these inputs, the language model generates an initial collection of computer programs, each defining a parameterized policy class, which is a mathematical formula that takes warehouse inventory and pipeline shipments as inputs and outputs an order quantity.

Once the language model produces these candidate formulas, the numerical solver takes over. For each formula class, the solver tests parameters through extensive simulations against historical demand trajectories, adjusting coefficient values to minimize total holding and lost-sales expenses. The best-performing optimized formulas, along with their precise numerical parameters and empirical cost scores, are returned to the language model as contextual prompts for the next round of generation. Guided by this empirical feedback, the language model proposes modified and combined formula structures in subsequent generations, exploring functional spaces that prior literature never examined.

In computational experiments across 30 lost-sales inventory test problems, the paper reports that this combined feedback loop produced rapid performance improvements. After just one generation of search, the best formulas discovered by the framework achieved an average cost reduction of 17.5 percent compared with optimized base-stock benchmarks. By the tenth generation, the mean cost reduction expanded to 30.0 percent relative to those same optimized benchmarks. The authors found that parameter optimization was vital to steering this search: an ablation variant relying solely on the language model without numerical optimization performed substantially worse, proving that quantitative feedback is necessary to direct the model toward superior structural classes.

Fenghua Yang, the lead author of the study, explained that the core problem with unassisted language models stems from how parameter errors distort structural learning. Yang told Primary that the primary failure mode in pure language model search is that poor parameter tuning conceals whether a policy structure is fundamentally sound or flawed. Under a simple policy where the model only selects a single threshold, language models often moved the number back and forth without understanding whether the policy ordered too much or too little. Once parameter tuning and structural design become entangled, a model whose formula performs poorly because of bad coefficients will mistakenly abandon or scramble the underlying algebraic structure.

By introducing an external numerical optimizer, the framework uncouples those two tasks. As Yang told Primary, when the optimizer identifies effective parameters for a candidate formula first, the language model receives clean feedback on the remaining structural weaknesses of the design. The model can then determine what architectural mechanism is missing, allowing it to explore sophisticated algebraic combinations rather than getting trapped in cyclical adjustments around simple baseline rules. Yanzhe Lei, a co-author on the study, agreed that this structural division makes practical sense, telling Primary that "a promising formula should not be rejected simply because its initial coefficients were poorly chosen." Lei observed that optimizing parameters only on the final rule failed to recover the performance lost when numerical optimization was absent during the search, confirming that the solver actively steers structural discovery.

## What structural patterns emerge from the search?

The structural patterns that emerge from automated search combine recognizable operational mechanisms into novel functional arrangements that human designers had not previously combined. When the authors analyzed the strongest discovered policy classes, they observed that the formulas avoided opaque black-box computation. Instead, the generated code repeatedly assembled interpretable inventory-control motifs, including hard limits on order sizes, threshold triggers for reordering, and discounted weightings for inventory still in transit.

One recurring mechanism involves discounting pipeline inventory based on how far away it remains from the warehouse. Rather than giving equal weight to every unit in transit, the discovered rules assign smaller weights to orders placed recently and larger weights to shipments nearing delivery. Another frequent motif establishes dynamic order caps that prevent large replenishment spikes after temporary stockouts. While prior academic studies had examined capped base-stock policies and projected-inventory rules in isolation, the automated search synthesized and blended these distinct concepts into richer, multi-parameter functional forms that, to the authors' knowledge, had not appeared in previous lost-sales literature.

This synthesis addresses a longstanding bottleneck in supply-chain mathematics. In remarks to Primary, Yang noted that the underlying operational building blocks were not completely novel to human researchers, but the combinatorial challenge of merging them had proven insurmountable for manual analysis. Because distinct motifs interact in complex ways across different demand settings, human researchers have historically been limited to exploring only small, mathematically tractable variations. Lei told Primary that "tractability has constrained the breadth of exploration, rather than made hybrid design impossible." As Lei explained, because replenishment decisions with positive lead times depend on both on-hand stock and the entire pipeline, the underlying control problem becomes high-dimensional as lead times lengthen, meaning a formula that takes one line to write can remain extremely difficult to analyze mathematically.

By contrast, expressing replenishment logic as executable computer code allowed the language model to assemble diverse motifs rapidly, test them inside a simulation engine, and iteratively discover high-performing hybrid structures. Lei noted that while the fundamental ingredients such as order caps and pipeline adjustments are familiar, the automated framework recombined these mechanisms into richer functional forms without having those combinations specified beforehand. Yang observed that the system acts as an evolutionary explorer over inventory representations, enabling rapid trial and error across functional spaces that would take human analysts years to evaluate manually.

The discovered rules also demonstrated strong generalization across unfamiliar operating conditions. To test whether the formulas captured universal inventory principles rather than overfitting to specific test data, the authors transferred three discovered policy classes to 10,064 new inventory environments featuring varied lead times, different holding-to-penalty cost ratios, and diverse demand distributions, ranging from light-tailed to heavily skewed settings. After re-optimizing the parameters for each new environment, the three discovered classes maintained average cost reductions between 21.75 percent and 22.60 percent relative to optimized base-stock policies, confirming that the structural formulas retained their efficiency across broad operational shifts.

Yang emphasized to Primary that maintaining a cost advantage across more than 10,000 diverse demand environments demonstrates that the performance gains reflect genuine structural advances rather than simulation artifacts. Because the comparison pitted the discovered classes against base-stock benchmarks whose own parameters had been rigorously tuned by numerical solvers, the persistent double-digit savings confirm that the newly generated formulas possess superior functional mechanics. Lei added that the roughly 22 percent reductions are averages across synthetic environments rather than guarantees for every corporate supply chain, telling Primary that "these findings justify that validation, rather than promise a particular level of real-world savings."

## What can these results not tell supply managers?

These computational results demonstrate structural discovery in simulated environments, but they do not constitute direct field measurements of physical retail supply chains. The performance figures reflect mathematical simulations of stationary lost-sales systems, meaning the underlying experiments assume customer demand distributions and lead-time delays remain statistically consistent over the evaluation horizon. In physical retail settings, supply chains frequently confront severe nonstationary disruptions, supplier bankruptcies, port strikes, and sudden shifts in consumer preferences that violate stationary assumptions.

Yang highlighted these exact boundaries in conversation with Primary, pointing out three specific conditions where current formulas could struggle. First, the experiments assumed deterministic supplier lead times, whereas actual transport networks experience unpredictable delays, port bottlenecks, and supplier fulfillment swings. Second, real-world customer demand exhibits seasonal trends, promotional spikes, and regime shifts rather than stationary probability distributions. Third, actual enterprise data contains outliers, stock record inaccuracies, and reporting gaps that clean mathematical distributions do not reflect. While the specific algebraic formulas identified in the paper might require adaptation under such disruptions, Yang noted that the underlying architecture of pairing generative code exploration with numerical optimization remains directly applicable to nonstationary and stochastic lead-time settings.

Lei also identified practical operational hurdles that arise when transferring these formulas to physical enterprise software. Lei told Primary that "an unrealistic simulator could reward policies that fail in practice," and noted that running iterative simulations across thousands of stock-keeping units and warehouse locations could create severe computational bottlenecks. Lei stressed that commercial deployment requires rules that managers understand, that respect physical storage limits, and that receive ongoing operational monitoring. Furthermore, Lei noted that under abrupt retail shifts such as marketing promotions, static formulas that lack promotional schedules could stumble, warning that "an order cap that controls overreaction under normal conditions might delay replenishment after a sudden demand increase."

The study also evaluated six distinct foundation models as backbones, including GPT-5 Nano, Gemini 2.5 Flash-Lite, Grok 4.1 Fast Non-Reasoning, GPT-5 Mini, DeepSeek V3, and Gemini 3 Flash. The researchers reported that while choice of language model backbone altered the economic performance of generated policies, external parameter optimization narrowed the performance gap between different models without eliminating it entirely. Yang told Primary that stronger reasoning models excelled at grasping whether an operational failure stemmed from improper parameter settings or structural limitations, enabling them to venture into richer functional spaces, whereas lightweight models like GPT-5 Nano frequently struggled with initial parameter reasoning and tended to remain clustered near familiar baseline designs.

Furthermore, the underlying paper is an exploratory preprint posted to the arXiv repository, which has not yet undergone formal peer review. Regarding code reproducibility, Yang noted in response to Primary that the prompt templates and numerical optimization modules have been made publicly available on GitHub, allowing researchers to replicate the experimental evaluations, although the extensive raw generation logs were withheld due to storage size constraints. Implementing these discovered formulas in commercial enterprise resource planning software would require organizations to build integration pipelines that connect simulation engines, optimization solvers, and language model programming interfaces.

Despite these practical constraints, the research highlights a compelling shift in how artificial intelligence can support enterprise operations. Rather than treating language models as real-time dispatchers making unassisted numerical guesses, the framework positions them as symbolic code generators operating within an empirical optimization harness. By leaving numerical calculations to specialized mathematical solvers and using generative models to explore structural functional forms, supply-chain designers can uncover elegant, human-interpretable decision rules that systematically outshine legacy industry formulas.
