Official implementation for Relational Database Distillation: From Structured Tables to Condensed Graph Data, published at WWW 2026.
T2G is a relational database distillation algorithm. It converts a large relational database into a compact heterogeneous graph while preserving the predictive utility needed by graph neural networks. Rows become nodes, primary-foreign key dependencies become typed edges, and multi-modal table columns are encoded as node features.
- Compact relational graphs: distills large multi-table databases into small heterogeneous graphs.
- Structure-aware synthesis: preserves table types, column features, and primary-foreign key dependencies.
- Efficient task utility: uses pseudo-labels and KRR-guided distillation for both classification and regression.
.
|-- src/ # Python implementation
|-- scripts/ # Bash entry points
|-- original_data/ # Manually downloaded raw datasets
|-- data/ # Preprocessed train/val/test files
|-- ckpt/ # Saved tokenizers, synthetic graphs, labels, and checkpoints
|-- result/ # CSV results
|-- requirements.txt # Python dependencies
`-- assets/ # Framework figure used in this README
Install the required Python packages with:
pip install -r requirements.txtAll datasets are public SDV multi-table demo datasets and first three datasets are directly downloaded from SyntheRela. Raw files should be downloaded manually and placed under original_data/.
| Dataset | Link |
|---|---|
rossmann |
SyntheRela |
walmart |
SyntheRela |
airbnb-simplified |
SyntheRela |
imdb_ijs_v1 |
SDV data |
Run all commands from the project root.
bash scripts/0process_data.shThis creates processed splits under:
data/<dataset>/
|-- train/
|-- val/
|-- test/
`-- task.pkl
bash scripts/1whole.shFull-database baselines are saved to:
result/<dataset>/whole.csv
ckpt/<dataset>/whole_model_<run_id>.pt
Use the dataset-specific scripts:
bash scripts/rossmann.sh
bash scripts/walmart.sh
bash scripts/airbnb-simplified.sh
bash scripts/imdb_ijs_v1.shEach script runs T2G at multiple compression ratios for the corresponding dataset. During distillation, GraphSAGE is used as the default evaluation backbone, and test results are automatically written to result/<dataset>/<ratio>/condensed.csv.
Evaluate the distilled graph with different downstream GNN backbones:
python src/evaluate.py --dataset-name rossmann --condensation-ratio 0.0002 --gpu 0 --num-run 1 --model-type GINsrc/evaluate.py evaluates the condensed graph with different downstream GNNs through --model-type. For final results, tune the downstream GNN hyperparameters separately for each dataset and backbone.
For each dataset and compression ratio:
result/<dataset>/<ratio>/pretrain.csv # pretraining performance and runtime
result/<dataset>/<ratio>/condensed.csv # distillation performance and runtime
result/<dataset>/<ratio>/evaluation.csv # downstream GNN evaluation
ckpt/<dataset>/<ratio>/pretrain_tokenizer_<run_id>.pt
ckpt/<dataset>/<ratio>/pseudo_label_<run_id>.pkl
ckpt/<dataset>/<ratio>/graph_syn_<run_id>.pt
ckpt/<dataset>/<ratio>/feat_syn_<run_id>.pkl
ckpt/<dataset>/<ratio>/label_syn_<run_id>.pt
If you use this code or build on T2G, please cite our paper:
@inproceedings{gao2026relational,
title = {Relational Database Distillation: From Structured Tables to Condensed Graph Data},
author = {Gao, Xinyi and Zhang, Jingxi and Chen, Lijian and Chen, Tong and Cui, Lizhen and Yin, Hongzhi},
booktitle = {Proceedings of the ACM Web Conference 2026},
series = {WWW '26},
year = {2026},
location = {Dubai, United Arab Emirates},
publisher = {ACM},
doi = {10.1145/3774904.3792734},
url = {https://doi.org/10.1145/3774904.3792734}
}