[KongchangAI]
· 3 min read· 1,711 words

Demand Forecasting Across 40 Locations: Global or Local Models?

Demand Forecasting Across 40 Locations: Global or Local Models?

Multi-location demand forecasting should weigh global, local, and hybrid models while guarding against synthetic data pitfalls.

The article addresses an undergraduate's demand forecasting modeling dilemma across 40 locations with 1.1 million synthetic retail records. The core question is whether to train separate models per location or a single global model. Both strategies have trade-offs: local models capture location specificity but have high maintenance costs and data fragmentation; global models offer high data utilization but need location ID features or embeddings to preserve location differences. Hybrid strategies like clustering locations by demand pattern and global models with location-level residual correction are viable compromises. The article highlights synthetic data pitfalls: use temporal splits to avoid leakage, evaluate stratified by location, and review feature importance to prevent learning generation artifacts. Gradient boosted trees are a strong baseline, and a simple baseline should be kept for comparison. Ultimately, evaluation criteria should incorporate downstream inventory planning cost metrics.

Problem Background: The Model Selection Dilemma in Multi-Location Demand Forecasting

An undergraduate student at the Indian Institutes of Technology posed a practical problem on Reddit that arose in a multi-agent supply chain optimization project: they have roughly 1.1 million synthetic retail records covering 40 different locations, and the goal is to forecast product-level demand at each location for downstream inventory planning and supply chain decisions. The core question: should they train a separate model for each location, or a single global model?

reddit source: Best approach for demand forecasting across 40 locations? Separate models or one global model?

This problem is very typical in retail and supply chain. When data is naturally grouped by geography, the choice of modeling strategy directly affects forecast accuracy and engineering complexity. Below, drawing on the specific concerns in the original post, we break down the conditions under which each mainstream approach applies.

Global vs Local Models: No Absolute Answer

Local models (one model per location) have the advantage of fully capturing demand patterns unique to that location, free from interference by other locations' data. But 40 models mean 40 training pipelines and 40 rounds of hyperparameter tuning, with maintenance costs growing linearly. More critically, each location receives only 1/40 of the total data, so for products with sparse demand or short history windows, local models are prone to underfitting.

Global models (joint training across all locations) learn general demand patterns from all 1.1 million records by sharing parameters, achieving higher data utilization and being especially suitable for cold-start scenarios. The original poster worried that "a global model will average out regional patterns"—a legitimate concern: if the model architecture has no explicit mechanism to distinguish locations, it may indeed learn "average demand" rather than "location-specific demand."

In practice, a global model can preserve location differences in two ways: first, feed location ID as a categorical feature so the model learns location offsets; second, introduce location-level static features (e.g., regional population, store size, if available in the data). Gradient boosted trees (such as LightGBM and XGBoost) have good native support for categorical features, while neural network models can handle location IDs through embedding layers.

Gradient Boosting Decision Tree (GBDT) is a class of supervised models based on ensemble learning. Its core idea is to train multiple decision trees sequentially, where each new tree aims to fit the residuals (i.e., the negative gradient direction) of the preceding model's predictions, and the final prediction is a weighted sum of the outputs of all trees. LightGBM and XGBoost are two mainstream engineering implementations: XGBoost adopts a level-wise growth strategy and performs a second-order Taylor expansion of the loss function, offering high accuracy but larger memory footprint; LightGBM introduces histogram binning, leaf-wise growth, and single-side gradient sampling, making training significantly faster on large-scale tabular data. These models have native support for categorical features—XGBoost can handle them via one-hot or target encoding, while LightGBM can directly declare categorical_feature and use categorical binning to find optimal splits. This makes it naturally feasible to feed location ID and product ID as features and let the model automatically learn location-level offsets, without the need to design embedding layers specifically as with neural networks.

An embedding layer is a common technique in neural networks for handling discrete categorical variables. It is essentially a learnable lookup table: each category (e.g., each location ID, each product ID) is assigned a dense vector of fixed dimension; during forward propagation, the corresponding vector is retrieved by ID and concatenated with other features before being fed into subsequent network layers. Compared with one-hot encoding, embedding layers compress high-dimensional sparse representations into low-dimensional dense ones, and parameter sharing enables the model to generalize across categories—embeddings of similar locations will converge during training, thereby implicitly capturing similarities between locations. The dimension is usually much smaller than the total number of categories (e.g., 4–8 dimensions for 40 locations) to avoid parameter explosion. For demand forecasting tasks, location embeddings can interact with time features and product features, helping a global model preserve location specificity while sharing parameters. Note, however, that embedding layers require sufficient data to learn meaningful representations; with too few samples they easily overfit, in which case tree models' categorical feature handling is often more robust.

Data leakage in time series forecasting refers to the model having access to information during training that would not be available at the actual prediction time, leading to inflated validation metrics and a sharp drop in performance after deployment. Random splitting is common in tabular tasks but causes severe leakage when used for time series: the model may see future demand values during training and thus "memorize" future trends or seasonality, making evaluation results fail to reflect true generalization ability. The correct approach is to split in chronological order—train on earlier time windows, validate and test on later windows, simulating the real deployment scenario of "using history to predict the future." If the data contains multiple locations, ensure that the time boundaries of each location are consistent after splitting, avoiding the situation where some locations' validation periods mix with other locations' training periods. For retail demand with obvious seasonality, the validation window should ideally cover at least one full seasonal cycle; otherwise error estimates will be distorted by differing seasonal phases.

Hybrid Strategies: Grouped Modeling and Global + Local Adjustment

The hybrid idea mentioned in the original post deserves serious consideration. One pragmatic approach is to cluster locations by demand pattern: first use simple statistics (such as demand mean, variance, and seasonality strength) to cluster the 40 locations, grouping locations with similar patterns together, and train one model per group. This avoids the fragmentation of 40 independent models while preserving between-group differences better than a single global model.

Another hybrid approach is global model + location-level residual correction: first train a global model to obtain baseline predictions, then fit a lightweight correction model for each location (e.g., linear regression or simple rules) that learns only the systematic deviation of that location from the global baseline. This method is more robust than fully independent modeling when data is limited, and its engineering complexity is far lower than 40 full models.

Which strategy to choose depends on how large the differences in demand patterns are across locations. If the demand curves of the 40 locations have similar shapes and differ only in level, a global model with location features is sufficient; if seasonality shapes and promotional response patterns differ significantly across locations, grouping or local stratification is more necessary.

Special Pitfalls of Synthetic Data: Don't Let the Model Learn Artifacts of the Generation Process

The original poster uses a synthetic dataset and explicitly asked about precautions for evaluating generalization. This is an easily overlooked but critical issue. Synthetic data is produced by a specific generation process and may contain patterns that do not exist in real data—for example, overly smooth seasonality, lack of real-world promotional shocks, or artificially fixed correlations between products.

If the model overfits to these artifacts, performance will plummet on real data. For evaluation, we recommend:

  • Hold out complete time windows for validation, rather than random splitting. Time series forecasting must use temporal splits; random splitting causes future information to leak into the training set.
  • Evaluate stratified by location, not just looking at globally aggregated error. The original poster emphasized "prioritizing location-level accuracy," so the error distribution of each location should be reported to identify whether some locations are systematically ignored by the global model.
  • Check whether the model relies on features it should not rely on. If demand is artificially strongly correlated with certain auxiliary variables during synthetic data generation, and that relationship does not exist in real scenarios, the model will learn an incorrect mapping. A feature importance review can confirm that key drivers align with business common sense.

Model Architecture and Validation Strategy Recommendations

For this type of tabular time series forecasting task, gradient boosted trees (LightGBM/XGBoost) are usually the preferred baseline: fast training, friendly to feature engineering, and able to directly handle categorical encoding of location IDs and product IDs. On the deep learning side, embedding-based MLPs or Temporal Fusion Transformer-style architectures can be tried, but when the data volume is only on the order of millions and feature dimensionality is not high, tree models often offer better cost-effectiveness.

The core of the validation strategy is strict temporal splitting + evaluation by location. It is also advisable to keep a simple baseline (such as historical mean or seasonal naive forecast per location per product) to determine whether the complex model truly adds incremental value. If the improvement of the complex model over the baseline is uneven across locations, the modeling strategy needs adjustment—some locations may indeed require localized treatment.

Finally, in multi-agent projects, the evaluation criteria for the demand forecasting module should be defined by the downstream task: the inventory planning agent cares about how forecast errors translate into inventory costs, not pure MSE. When conditions permit, calibrating the choice of forecasting model inversely using downstream metrics will be more practically meaningful than simply pursuing statistical error.

One-line Summary

Multi-location demand forecasting should weigh global models, local models, and hybrid strategies, while guarding against synthetic data pitfalls.

Paragraph Summary

The article centers on an undergraduate's modeling dilemma for demand forecasting across 40 locations with 1.1 million synthetic retail records. The core question is whether to train a separate model for each location or a single global model. The article notes that both strategies have pros and cons: local models capture location specificity but have high maintenance costs and data fragmentation; global models achieve high data utilization but need to explicitly preserve location differences through location ID features or embedding layers. Hybrid strategies such as clustering locations by demand pattern and global models with location-level residual correction are viable compromises. The article particularly emphasizes the special pitfalls of synthetic data: temporal splits must be used to avoid leakage, evaluation should be stratified by location, and feature importance should be reviewed to prevent the model from learning artifacts of the generation process. On model architecture, gradient boosted trees are a strong baseline, and a simple baseline should be kept for comparison. Ultimately, evaluation criteria should incorporate the actual cost metrics of downstream inventory planning.

#demand forecasting#multi-location supply chain#global vs local models#synthetic data#gradient boosting#time series validation#inventory planning
Share:

Related articles