RelBench: A Benchmark for Deep Learning on Relational Databases

Joshua Robinson, Rishabh Ranjan, Weihua Hu, Kexin Huang, Jiaqi Han, Alejandro Dobles, Matthias Fey, Jan Eric Lenssen, Yiwen Yuan, Zecheng Zhang, Xinwei He, Jure Leskovec

TL;DR

RelBench is a new comprehensive benchmark designed to move machine learning on relational databases away from manual "table flattening" and toward Relational Deep Learning (RDL). By treating databases as temporal graphs and using Graph Neural Networks (GNNs), RDL models match or outperform expert data scientists while reducing human labor by 96% and code complexity by 94%.

What Problem Does This Paper Address?

Relational databases are the backbone of the digital economy, yet most machine learning workflows still rely on a "flattening" process. To train a model, data scientists manually write complex SQL queries to join tables and engineer features into a single, flat spreadsheet-like table.

This approach has three major flaws:

  1. Information Loss: Manual features often miss subtle, high-order interactions between entities across multiple tables.
  2. Human Inefficiency: Feature engineering is labor-intensive, error-prone, and must be repeated for every new task.
  3. Software Complexity: Massive SQL pipelines are difficult to maintain and frequently introduce "data leakage" (accidentally using future data to predict the past).

The authors propose a shift to Relational Deep Learning (RDL), which represents the entire database as a graph where entities are nodes and relationships (Primary/Foreign keys) are edges, allowing GNNs to learn representations end-to-end.

Methods

The paper introduces a standardized framework for RDL to streamline the process from raw data to evaluated models.

The complete RelBench pipeline, illustrating the flow from relational databases to graph loaders, model training, evaluation, and leaderboard ranking.
  • Graph Representation: Databases are converted into heterogeneous temporal graphs. Each row in a table becomes a node, and primary-foreign key links become edges.
  • Deep Tabular Encoders: Instead of manual feature engineering, the authors use models like PyTorch Frame to automatically extract initial embeddings from raw table columns (text, numerical, categorical).
  • GNN Architecture: They utilize standard GNNs (like GraphSAGE) and Identity-aware GNNs (ID-GNN) to propagate information across the database schema.
  • Temporal Splitting: To ensure real-world validity, the benchmark uses a rigorous "seed time" approach, ensuring models only see data available at the moment a prediction would actually be made.

Datasets

RelBench introduces 7 diverse, real-world relational databases with a total of 30 predictive tasks:

  • Domains: E-commerce (rel-amazon, rel-hm), Social Media (rel-stack, rel-event), Sports (rel-f1), Medical (rel-trial), and Classifieds (rel-avito).
  • Scale: Datasets range from 74,000 to 41 million entities, with up to 15 tables and 140 columns.
  • Task Types: The benchmark covers entity classification (e.g., churn prediction), entity regression (e.g., lifetime value), and recommendation (link prediction).

Key Insights and Ideas

  • The "Data Scientist" User Study: In a unique move, the authors recruited an experienced data scientist to solve these tasks the "old-fashioned" way. This provided a realistic "gold standard" baseline for manual feature engineering.
  • Automation vs. Intuition: RDL models discovered predictive signals that the human expert missed, particularly in complex recommendation tasks where multi-hop relationships are critical.
  • Drastic Efficiency Gains: The most striking "aha moment" is the economic argument. While the data scientist spent an average of 12.3 hours per task, the RDL approach required only 30 minutes of human effort.
  • Inductive vs. Transductive Learning: The benchmark is designed to test how well models handle new entities appearing over time, a common challenge in production databases.

Key Results

  • Predictive Power: RDL outperformed the single-table LightGBM baseline by an average of 20.4% in classification and 277% in recommendation tasks.
  • Human Comparison: RDL matched or beat the expert data scientist in 11 out of 15 tasks.
  • Code Reduction: RDL required only ~56 lines of task-specific code on average, compared to ~878 lines of SQL and Python for the manual approach.
  • Recommendation Excellence: RDL showed its greatest strength in link prediction (recommendations), where the graph structure provides a massive advantage over flattened tables.

Limitations and Future Work

  • Regression Struggles: RDL currently struggles more with regression tasks (predicting continuous numbers) than classification. The authors suggest that the standard MLP "heads" used in GNNs might be poorly suited for regression on relational data.
  • Scaling GNNs: While the results are promising, training GNNs on databases with hundreds of millions of rows remains a significant computational challenge.
  • Model Architectures: The authors view their current RDL implementation as a "pilot." They expect future research into specialized GNN architectures and better tabular-to-graph encoders to further widen the gap over manual methods.

Summary updated

BibTeX
@inproceedings{robinson2024relbench,
  author = {Joshua Robinson and Rishabh Ranjan and Weihua Hu and Kexin Huang and Jiaqi Han and Alejandro Dobles and Matthias Fey and Jan Eric Lenssen and Yiwen Yuan and Zecheng Zhang and Xinwei He and Jure Leskovec},
  title = {{RelBench: A Benchmark for Deep Learning on Relational Databases}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
}
Figure