Relational Database Distillation: From Structured Tables to Condensed Graph Data

Xinyi Gao, Jingxi Zhang, Lijian Chen, Tong Chen, Lizhen Cui, Hongzhi Yin

TL;DR

The paper introduces Table-to-Graph (T2G), the first framework for Relational Database Distillation (RDD). T2G compresses massive, multi-table relational databases into compact, synthetic heterogeneous graphs while preserving their predictive power. By replacing expensive training loops with a closed-form mathematical solver, T2G achieves over 500× data compression while maintaining highly competitive performance on downstream machine learning tasks.

What Problem Does This Paper Address?

Relational databases (RDBs) store over 70% of the world's structured data across interconnected tables. Recently, researchers have started converting RDBs into "Relational Entity Graphs" (REGs)—where rows become nodes and primary-foreign key relationships become edges—to leverage the power of Graph Neural Networks (GNNs).

While GNNs achieve state-of-the-art predictive accuracy on RDBs, scaling them is a nightmare. Iterative message passing across billions of rows distributed over multiple tables incurs massive storage overhead and prohibitive training times.

To fix this, the authors propose Relational Database Distillation (RDD). The goal is to synthesize a tiny, compact graph dataset that mimics the statistical and structural properties of the massive original database. However, distilling RDBs introduces unique hurdles:

  1. Multi-modal attributes: Tables contain a mix of numerical, categorical, and temporal data.
  2. Complex structural dependencies: Tables are linked hierarchically via foreign keys.
  3. Diverse downstream tasks: The distilled data must support both classification and regression tasks.

Methods

The authors design Table-to-Graph (T2G), a three-stage framework to address these challenges:

  1. Modality-specific Tokenizers: T2G independently encodes heterogeneous columns using lightweight tokenizers (linear projections for numerical data and lookup tables for categorical data) to map everything into a unified embedding space.
  2. Clustering-based Pre-training: A heterogeneous GNN processes these initial embeddings to capture inter-table dependencies. Online clustering then groups similar entities together, assigning structural pseudo-labels that form the foundation for the synthetic graph.
  3. Graph Generation via Heterogeneous SBM: Instead of sequentially reconstructing tables from parent to child (which is slow and complex), T2G uses a Stochastic Block Model (SBM) guided by the pseudo-labels to generate synthetic edges in parallel.
  4. KRR-based Feature Distillation: Traditional dataset distillation relies on an expensive, unstable bi-level optimization loop (training a model inside a model). T2G bypasses this by using Kernel Ridge Regression (KRR), which offers a closed-form mathematical solution. This allows direct, rapid optimization of the synthetic node features using a combination of task labels and pseudo-labels.
Figure 1: The pretraining and distillation procedures of T2G.

Datasets

The framework was evaluated on four real-world relational database benchmarks:

  • Rossmann: A retail dataset configured for regression tasks.
  • Walmart: A retail dataset configured for regression tasks.
  • Airbnb: A housing dataset configured for classification tasks (highly imbalanced).
  • IMDB: A movie dataset configured for classification tasks (complex multi-table structure).

Key Insights and Ideas

  • Bypassing the Bi-level Optimization Loop: The use of a closed-form KRR solver is a major win for efficiency. It makes distilling large-scale relational data computationally feasible where standard gradient-matching methods stall.
  • Parallel Structure Synthesis: By modeling cluster-to-cluster connection densities via SBM rather than row-to-row links, T2G avoids the need for hierarchical table generation, allowing synthetic structures to be generated rapidly and adaptively.
  • Dual-Supervision Alignment: Incorporating both task labels and structural pseudo-labels ensures that the distilled graph retains both the semantic meaning needed for predictions and the topological properties needed for graph-based message passing.

Key Results

  • Massive Storage Savings: On the Rossmann dataset, T2G compressed the training data from 35.0 MB to just 61.1 KB (over 500× compression) by retaining only 0.02% of the rows, yet downstream models trained on this tiny fraction achieved an MAE of 194.4 compared to 188.5 on the whole database.
  • Outperforming Baselines: T2G consistently outperformed traditional sampling (Random, Herding) and graph condensation methods (Coarsening, HGCond) across all datasets and compression ratios.
  • Excellent Generalizability: Synthetic graphs generated by T2G are architecture-agnostic. Models trained on T2G data maintained high performance whether evaluated on GraphSAGE, GIN, Heterogeneous Graph Transformers (HGT), HAN, or even a simple MLP that completely discards graph structure.
Figure 2: Hyper-parameter analysis on Rossmann and Airbnb. The compression ratios are 0.1%.

Limitations and Future Work

As an initial attempt at relational database distillation, T2G focuses on optimizing data for a single target table and a single task at a time. In real-world enterprise scenarios, databases often support multiple downstream tasks simultaneously. The authors note that extending RDD to cross-table and cross-task settings (multi-task distillation) remains an open and promising direction for future work.

Summary updated

BibTeX
@misc{gao2025relational,
  author = {Xinyi Gao and Jingxi Zhang and Lijian Chen and Tong Chen and Lizhen Cui and Hongzhi Yin},
  title = {{Relational Database Distillation: From Structured Tables to Condensed Graph Data}},
  year = {2025},
  eprint = {2510.06980},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.06980},
}
Figure