Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

T2G: Relational Database Distillation

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.

T2G framework

Highlights

  • 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.

Repository

.
|-- 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

Environment

Install the required Python packages with:

pip install -r requirements.txt

Datasets

All 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

Usage

Run all commands from the project root.

1. Preprocess data

bash scripts/0process_data.sh

This creates processed splits under:

data/<dataset>/
|-- train/
|-- val/
|-- test/
`-- task.pkl

2. Train on the full database

bash scripts/1whole.sh

Full-database baselines are saved to:

result/<dataset>/whole.csv
ckpt/<dataset>/whole_model_<run_id>.pt

3. Run T2G Distillation

Use the dataset-specific scripts:

bash scripts/rossmann.sh
bash scripts/walmart.sh
bash scripts/airbnb-simplified.sh
bash scripts/imdb_ijs_v1.sh

Each 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.

4. Evaluation for different GNNs

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 GIN

src/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.

Outputs

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

Citation

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}
}

About

[WWW 26] Relational Database Distillation: From Structured Tables to Condensed Graph Data.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages