forecasting errors aren’t attributable to unhealthy time-series fashions.
They’re attributable to ignoring construction.
SKUs don’t behave independently. They work together via shared crops, product teams, warehouses, and storage areas. A requirement shock to at least one SKU typically propagates to others — but most forecasting programs mannequin every SKU in isolation.
In my previous article, we confirmed that explicitly modeling these connections issues. Utilizing an actual FMCG supply-chain graph, a easy Graph Neural Community (GraphSAGE) diminished SKU-level forecast error by over 27% in comparison with a robust naïve baseline, purely by permitting data to circulation throughout associated SKUs.
However GraphSAGE makes a simplifying assumption: all relationships are equal.
A shared plant is handled the identical as a shared product group. Substitutes and enhances are averaged right into a single sign. This limits the mannequin’s capacity to anticipate actual demand shifts.
This text explores what occurs when the mannequin is allowed not simply to see the supply-chain community, however to perceive the which means of every relationship inside it.
We present how Heterogeneous Graph Transformers (HGT) introduce relationship-aware studying into demand forecasting, and why that seemingly small change produces extra anticipatory forecasts, tighter error distributions, and materially higher outcomes — even on intermittent, every day per-SKU demand — turning linked forecasts into meaning-aware, operationally grounded predictions.
A short recap: What GraphSAGE instructed us
Within the earlier article, we skilled a spatio-temporal GraphSAGE mannequin on an actual FMCG supply-chain graph with:
- 40 SKUs
- 9 crops
- 21 product teams
- 36 subgroups
- 13 storage areas
Every SKU was linked to others via shared crops, teams, and areas — making a dense internet of operational dependencies. The temporal traits displayed lumpy manufacturing and intermittent demand, a typical situation in FMCG.
GraphSAGE allowed every SKU to combination data from its neighbors. That produced a big soar in forecast high quality.
| Mannequin | WAPE (SKU-daily) |
|---|---|
| Naïve baseline | 0.86 |
| GraphSAGE | ~0.62 |
On the hardest attainable stage — every day, per-SKU, intermittent demand — a WAPE of ~0.62 is already virtually production-grade in FMCG.
However the error plots confirmed one thing vital:
- The mannequin adopted developments properly
- It dealt with zeros properly
- However it smoothed away excessive spikes
- And it reacted as an alternative of anticipating
As a result of GraphSAGE assumes that all relationships are equal. Assuming all relations have equal weightage means the mannequin can’t study that:
- A requirement spike in a complementary SKU in the identical plant ought to improve my forecast
- However a spike in a substitute SKU in the identical product group ought to scale back it
Let’s see how Heterogeneous Graph Transformer (HGT) addresses the problem.
What HGT provides: Relationship-aware studying
Heterogeneous Graph Transformers are constructed for graphs the place:
- There are a number of sorts of nodes (SKUs, crops, warehouses, teams) and/or
- There are a number of sorts of edges (shared crops, product teams and many others.)
On this case, whereas all nodes within the graph are SKUs, the relationships between them are heterogeneous. Right here, HGT shouldn’t be used to mannequin a number of entity sorts, however to study relation-aware message passing.
The mannequin learns separate transformation and a spotlight mechanisms for every sort of SKU–SKU relationship, permitting demand indicators to propagate otherwise relying on why two SKUs are linked.
It learns:
“How ought to data circulation throughout every sort of relationship?”
Formally, as an alternative of 1 aggregation operate, HGT learns:
[
h_i = sum_{r in {text{plant}, text{group}, text{subgroup}, text{storage}}}
sum_{j in N_r(i)} alpha_{r,i,j} W_r h_j
]
the place
- r represents the kind of operational relationship between SKUs (shared plant, product group, and many others.)
- Wᵣ permits the mannequin to deal with every relationship otherwise
- αᵣ,ᵢ,ⱼ lets the mannequin deal with essentially the most influential neighbors
- The set Nr(i) incorporates all SKUs which are instantly linked to SKU i via a shared relationship r.
This lets the mannequin study, for instance:
- Plant edges propagate capability and manufacturing indicators
- Product-group edges propagate substitution and demand switch
- Warehouse edges propagate stock buffering
The graph turns into economically significant, not simply topologically linked.
Implementation (high-level)
Identical to within the GraphSAGE mannequin, we use:
- The identical SupplyGraph dataset, temporal options, log1p normalization and sliding window of 14 days.
The distinction is within the spatial encoder. The next is an outline of the structure.
- Heterogeneous Graph Encoder
- Nodes: SKUs
- Edges: shared plant, shared group, shared sub-group and shared storage
- HGT layers study relation-specific message passing
- Temporal Encoder
- A time-series encoder processes the final 14 days of embeddings
- This captures how the graph evolves over time
- Output Head
- A regressor predicts next-day log1p gross sales per SKU
The whole lot else — coaching, loss, analysis — stays an identical to GraphSAGE. So any distinction in efficiency comes purely from higher structural understanding.
The housing market analogy — now with which means
Within the earlier article, we used a easy housing-market analogy to elucidate why graph-based forecasting works.
Let’s improve it.
GraphSAGE: construction with out which means
GraphSAGE is like predicting the value of your home by taking a look at:
- The historic worth of your home
- The typical worth motion of close by homes
This already improves over treating your home in isolation. However GraphSAGE makes a essential simplifying assumption:
All neighbors affect your home in the identical means.
In follow, this implies GraphSAGE treats all close by entities as an identical indicators. A luxurious villa, a faculty, a shopping center, a freeway, or a manufacturing unit are all simply “neighbors” whose worth indicators get averaged collectively.
The mannequin learns that homes are linked — however not why they’re linked.
HGT: construction with which means
Now think about a extra lifelike housing mannequin.
Each information level remains to be a home — there aren’t any completely different node sorts.
However homes are linked via completely different sorts of relationships:
- Some share the identical college district
- Some share the identical builder or development high quality
- Some are close to parks
- Others are close to highways or industrial zones
Every of those relationships impacts costs otherwise.
- Faculties and parks have a tendency to extend worth
- Highways and factories typically scale back it
- Luxurious homes matter greater than uncared for ones
A Heterogeneous Graph Transformer (HGT) learns these distinctions explicitly. As an alternative of averaging all neighbor indicators, HGT learns:
- which sort of relationship a neighbor represents, and
- how strongly that relationship ought to affect the prediction.
That distinction is what turns a linked demand forecast right into a meaning-aware, operationally grounded prediction.
Comparability of Outcomes
Right here is the comparability of WAPE of HGT with GraphSAGE and naive baseline:
| Mannequin | WAPE |
| Naive baseline | 0.86 |
| GraphSAGE | 0.62 |
| HGT | 0.58 |
At a daily-per SKU WAPE under 0.60, the Heterogeneous Graph Transformer (HGT) delivers a transparent production-grade step-change over each conventional forecasting and GraphSAGE. The outcomes depict a ~32% discount in misallocated demand vs. conventional forecasting and an additional 6–7% enchancment over GraphSAGE
The next scatter chart depicts the precise vs predicted gross sales on the log1p scale for each GraphSAGE (purple dots) and HGT (cyan dots). Whereas each fashions are good, there’s a higher dispersion of purple dots of GraphSAGE as in comparison with the tight clustering of the cyan HGT ones, akin to the 6% enchancment in WAPE.
On the scale of this dataset (≈ 1.1 million models), that enchancment interprets into ~45,000 fewer models misallocated over the analysis interval.
Operationally, lowering misallocation by this magnitude results in:
- Fewer emergency manufacturing adjustments
- Decrease expediting and premium freight prices
- Extra secure plant and warehouse operations
- Higher service ranges on high-volume SKUs
- Much less stock trapped within the mistaken areas
Importantly, these enhancements come with out including enterprise guidelines, planner overrides, or handbook tuning.
And the bias comparability is as follows:
| Mannequin | Imply Forecast | Bias (Items) | Bias % |
| Naïve | ~701 | 0 | 0% |
| GraphSAGE | ~733 | +31 | ~4.5% |
| HGT | ~710 | ~8.4 | ~1.2% |
HGT introduces a very small constructive bias — roughly 1–2%.
That is properly inside production-safe limits and aligns with how FMCG planners function in follow, the place a slight upward bias is usually most popular to keep away from stock-outs. The next histogram confirms a Gaussian distribution centered round zero, indicating unbiased efficiency on typical forecasting days.

The true distinction between GraphSAGE and HGT is obvious after we examine the forecasts for the top-4 SKUs by quantity. Right here is the GraphSAGE chart:

And the identical for HGT :

The excellence is obvious from the world highlighted within the first chart and throughout all of different SKUs:
- HGT shouldn’t be reactive like GraphSAGE. It’s a stronger forecast, anticipating and monitoring the peaks and troughs of the particular demand, relatively than smoothing out the fluctuations.
- This can be a results of the differential studying of the structural relations between neighboring SKUs, which lets it predict the change in demand confidently earlier than it has already began.
And eventually, the efficiency throughout SKUs with non-zero volumes clearly exhibits that all the high-volume SKUs have a WAPE < 0.60, which is fascinating for a manufacturing forecast and is an enchancment over GraphSAGE.

Explainability
HGT makes it sensible to implement explainability to the forecasts — important for planners to trust on the causality of options. When the mannequin predicts a dip, and we are able to present it’s as a result of “Neighbor X in the identical subgroup is trending down,” planners can validate the sign in opposition to real-world logistics, turning an AI prediction into actionable enterprise perception.
Lets have a look at the affect of various spatial and temporal options through the forecast for the primary 7 days and final 7 days of the length for the SKU with most quantity (SOS001L12P). Right here is the comparability of the temporal options:

And the spatial options:

The charts present that completely different options and SKU/edges play a job throughout completely different time intervals:
- For the primary 7 days, Gross sales Lag(7d) has the utmost affect (23%) which adjustments to Rolling Imply (21%) for the final 7 days.
- Equally through the preliminary 7 days, there may be heavy reliance on
SOS005L04P, probably a major storage node or precursor SKU that dictates rapid availability. By the top of the check length, the affect redistributes.SOS005L04Pshares the stage withSOS002L09P(~40% Share every) each from the identical subgroup as our goal SKU. This means the mannequin is now aggregating indicators from a broader subgroup of associated merchandise to type a extra holistic view.
One of these evaluation is essential to know and forecast the impacts of selling campaigns and promotions or exterior elements equivalent to rates of interest on particular SKUs. These must be included within the spatial construction as extra nodes within the graph with the SKUs linked to it.
Not All Provide Chains Are Created Equal
The use case here’s a comparatively easy case with solely SKUs as nodes. And that’s as a result of in FMCG, crops and warehouses act largely as buffers — they clean volatility however not often hard-stop the system. That’s the reason, HGT might study a lot of their impact purely from edge sorts like shared plant or shared warehouse with out modeling them as express nodes. Provide chains may be way more complicated. For instance, automotive provide chains are very completely different. A paint store, engine line, or regional distribution heart is a arduous capability bottleneck: when it’s constrained, demand for particular trims or colours collapses no matter market demand. In that setting, HGT nonetheless advantages from typed relationships, however it additionally requires express Plant and Warehouse nodes with their very own time-series indicators (capability, output, backlogs, delays) to mannequin how supply-side physics work together with buyer demand. In different phrases, FMCG wants structure-aware graphs; automotive wants causality-aware graphs.
Different elements which are frequent throughout industries are promotions, advertising spends, seasonality, exterior elements equivalent to financial situations (eg; gas costs) or competitor launches in a phase. These additionally have an effect on SKUs in numerous methods. For eg; gas worth improve or a brand new regulation could dampen gross sales of ICE automobiles and improve sale of electrical ones. Such elements have to be included within the graph as nodes and their relations to the SKUs included within the spatial mannequin. And their temporal options want to incorporate the historic information when the occasions occurred. This might allow HGT to study the consequences of those elements on demand within the weeks and months following the occasion.
Key Takeaways
- Provide-chain demand is not only linked — it’s structured. Treating all SKU relationships as equal leaves doesn’t harness the complete predictive potential.
- GraphSAGE proves that networks matter: merely permitting SKUs to trade data throughout shared crops, teams, and areas delivers a big accuracy soar over classical forecasting.
- Heterogeneous Graph Transformers go one step additional by studying why SKUs are linked. A shared plant, a shared subgroup, and a shared warehouse don’t propagate demand in the identical means — and HGT learns that distinction instantly from information.
- That structural consciousness interprets into actual outcomes: decrease WAPE, tighter forecast dispersion, higher peak anticipation, and materially fewer misallocated models — with out enterprise guidelines, handbook tuning, or planner overrides.
- Explainability turns into operational, not beauty. Relation-aware consideration permits planners to hint forecasts again to economically significant drivers, turning predictions into trusted selections.
- The broader lesson: as provide chains develop extra interdependent, forecasting fashions should evolve from time-series-only to relationship-aware programs. In FMCG this implies structure-aware graphs; in additional constrained industries like automotive, it means causality-aware graphs with express bottlenecks.
In brief: when the mannequin understands the which means of connections, forecasting stops being reactive — and begins changing into anticipatory.
What’s subsequent? From Ideas to Code
Throughout this text and the previous one, we moved step-by-step via the evolution of demand forecasting — from remoted time-series fashions, to GraphSAGE, and at last to Heterogeneous Graph Transformers — displaying how every shift progressively improves forecast high quality by higher reflecting how actual provide chains function.
The subsequent logical step is to maneuver from ideas to code.
Within the subsequent article, we are going to translate these concepts into an end-to-end, implementable workflow. Utilizing centered code examples, we are going to stroll via easy methods to:
- Assemble the supply-chain graph and outline relationship sorts
- Engineer temporal options for intermittent, SKU-level demand
- Design and practice GraphSAGE and HGT fashions
- Consider efficiency utilizing production-grade metrics
- Visualize forecasts, errors, and relation-aware consideration
- Add explainability so planners can perceive why a forecast modified
The objective is not only to indicate easy methods to practice a mannequin, however easy methods to construct a production-ready, interpretable graph-based forecasting system that practitioners can adapt to their very own provide chains.
If this text defined why construction and which means matter, the subsequent one will present precisely easy methods to make them work in code.
Join with me and share your feedback at www.linkedin.com/in/partha-sarkar-lets-talk-AI
Reference
SupplyGraph: A Benchmark Dataset for Supply Chain Planning using Graph Neural Networks : Authors: Azmine Toushik Wasi, MD Shafikul Islam, Adipto Raihan Akib
Pictures used on this article are generated utilizing Google Gemini. Charts and underlying code created by me.
