CD-STHGN: Causally Disentangled Supply-chain Temporal Heterogeneous Graph Network
Abstract
# CD-STHGN: Causally Disentangled Supply-chain Temporal Heterogeneous Graph Network A reference implementation and dataset release for green innovation driven digital transformation in Chinese A-share manufacturing supply chains, 2011-2023. [](LICENSE)[](https://www.python.org/)[](https://pytorch.org/) --- ## Overview CD-STHGN is a temporal heterogeneous graph neural network that estimates, in one end-to-end pass, four causal effects along the manufacturer-supplier supply chain: - NDE — own direct effect of sustainable performance on the next-year digital transformation intensity of the focal manufacturer;- NIE — own mediated effect routed through green patenting;- SDE — spillover direct effect from immediate suppliers;- SME — spillover mediated effect through supplier-side green patenting. The model combines a block-structured policy environment encoder, a causal disentangler that factorises node embeddings into mediator, confounder and environment directions, HGT-style heterogeneous message passing over yearly snapshots, an across-year temporal mixer, a hypernet moderation layer, and a Monte Carlo front-door estimator with M = 20 samples per node. ## Repository contents This repository consists of two artefacts: | Artefact | File | Purpose ||---|---|---|| **Dataset** | `cd-sthgn-dataset.zip` | 11 primary data tables (manufacturer-year panel, supply-chain edges, green patents, ESG ratings, annotated sentences, external benchmarks, policy batches) and 3 reference lookup tables, assembled from CNINFO / CNIPA / CSMAR / CNRDS / Sino-Securities / Wind. || **Code** | `cd-sthgn-code.zip` | PyTorch implementation of CD-STHGN plus ten baselines, the four-effect causal decomposition, robustness-value sensitivity, missing-network checks, controlled recovery, placebo bundle, rolling-origin conformal coverage, and the figure-generation scripts. | Download both, extract them side by side, and follow the Quick Start below. ## Quick start ```bash# 1. Download and extract both archivesunzip cd-sthgn-dataset.zipunzip cd-sthgn-code.zip # Directory layout should look like:# cd-sthgn/ (code)# cd-sthgn-dataset/ (data) # 2. Install dependenciescd cd-sthgnpip install -r requirements.txt # 3. Run every experimentpython main.py``` The default run finishes in roughly one minute on a CPU-only laptop and produces 6 publication-ready PDF figures together with 8 JSON result files under `outputs/`. ### Running a single experiment ```bashpython main.py --list # list all experimentspython main.py --only benchmark # main benchmark tablepython main.py --only rv_sensitivity # robustness-value sensitivity``` ### Retraining from scratch ```bashpython scripts/train.py --model CD-STHGN --config config.yamlpython scripts/train.py --model DyGFormer --epochs 60``` The full training schedule (60 epochs, batch of 256 firms, neighbor fanout [10, 5]) takes about 11.6 minutes per epoch for CD-STHGN on a single NVIDIA A100 40 GB GPU, with a peak memory of 24.3 GB. ## Dataset at a glance | Dimension | Count ||---|---|| Study period | 2011-2023 (13 fiscal years) || Manufacturer-year observations | 27,307 || Distinct manufacturers | 2,947 || Distinct suppliers | 22,567 || Supply-chain edge records | 90,562 || Green patent applications | 282,194 || Annotated annual-report sentences | 8,000 || Temporal folds | training 11,477 / calibration 4,691 / validation 5,336 / test 5,803 | The dataset is a self-constructed derivative panel built from six source databases (two open-access, four licensed commercial). See `cd-sthgn-dataset/README.md` for the full source list, access conditions, and `data_dictionary.md` for field-by-field documentation. ## Key results on the test fold Benchmark against ten baselines on the 5,803 firm-year test observations (2022-2023): | Model | RMSE | R-squared ||---|---|---|| **CD-STHGN** | **0.207** | **0.812** || DyGFormer | 0.238 | 0.751 || TemporalHAN | 0.241 | 0.745 || CaST | 0.246 | 0.734 || ROLAND | 0.249 | 0.728 || HGT | 0.251 | 0.724 || Spatial Durbin | 0.258 | 0.708 || CAL | 0.267 | 0.687 || TGAT | 0.283 | 0.648 || T-GCN | 0.287 | 0.638 || Panel moderated mediation | 0.394 | 0.317 | Four-effect causal decomposition: | Effect | Value ||---|---|| NDE (own direct) | 0.079 || NIE (own mediated) | 0.141 || SDE (spillover direct) | 0.036 || SME (spillover mediated) | 0.059 || Sum of four | 0.315 || Direct total effect | 0.316 || Identity gap | 0.001 || Mediated share | 63.5% || SME share | 18.7% | Robustness-value sensitivity: RV_own = 0.136, RV_spill = 0.051. Rolling-origin pooled coverage of the 90% conformal intervals: 90.4%. ## Repository layout ```.|-- cd-sthgn/ (code package)| |-- README.md| |-- LICENSE| |-- requirements.txt| |-- config.yaml| |-- main.py # one-click runner| |-- src/ # 9 library modules| |-- experiments/ # 8 experiment scripts| |-- scripts/| | `-- train.py # retrain any model from scratch| |-- checkpoints/| | |-- README.md| | `-- metrics.json # trained model registry| |-- figures/| | `-- nature_style.py| `-- outputs/ # auto-created on first run|`-- cd-sthgn-dataset/ (dataset package) |-- README.md |-- data_dictionary.md |-- manufacturer_year_panel.csv (27,307 rows) |-- firm_roster.csv (2,947 rows) |-- supply_chain_edges.csv (90,562 rows) |-- supplier_roster.csv (22,567 rows) |-- green_patent_records.csv (282,194 rows) |-- esg_ratings_sinosecurities.csv (27,307 rows) |-- esg_ratings_wind.csv (15,830 rows) |-- annual_report_sentences_annotated.csv (8,000 rows) |-- external_benchmarks.csv (27,307 rows) |-- policy_batches_national_index.csv (7 rows) |-- policy_batches_refined_index.csv (11 rows) |-- ipc_green_inventory_full.csv (89 rows) |-- cpc_y02_full.csv (52 rows) `-- csrc_industry_codes.csv (30 rows)``` ## Software environment Pinned to the paper's compute specification: - Python 3.10.13- PyTorch 2.1.0- PyTorch Geometric 2.5.0- Transformers 4.36.2- numpy 1.26.3, pandas 2.1.4, scipy 1.11.4, scikit-learn 1.3.2- statsmodels 0.14.1- matplotlib 3.8.2, seaborn 0.13.1- PyYAML 6.0.1, tqdm 4.66.1 The code also runs on Python 3.12 with the latest PyTorch stack. ## Citation ```bibtex@article{cdsthgn, title = {CD-STHGN: A Causally Disentangled Supply-chain Temporal Heterogeneous Graph Network for Green Innovation-Driven Digital Transformation}, author = { }, journal = { }, year = { }}``` ## License Code: MIT License (see `cd-sthgn/LICENSE`).Data: open-source fields under their original terms; licensed-source fields redistributed in de-identified derived form consistent with the originating databases' academic licences. ## Acknowledgements Patent classifications are tagged against the WIPO IPC Green Inventory and the CPC Y02 scheme. ESG anchors come from Sino-Securities (Huazheng) ESG with Wind ESG as the instrument. External validation targets are drawn from the GB/T 23001 integration-management-system certification list and the MIIT Intelligent Manufacturing Pilot Demonstration Projects.