Towards Foundation Models for Relational Databases with Language Models and Graph Neural Networks

Jingcheng Wu, Ratan Bahadur Thapa, Mojtaba Nayyeri, Lucas Etteldorf, Max Finkenbeiner, Fabian Leeske, Steffen StaabarXiv 2026

TL;DR

This paper introduces a lightweight, hybrid foundation model for relational databases by combining a language model (BART) with a graph neural network (GraphSAGE). By capturing both textual row-level semantics and structural table relationships, the architecture achieves competitive performance on downstream tasks with a fraction of the computational overhead required by massive commercial models.

What Problem Does This Paper Address?

Relational databases are the backbone of modern enterprise data, yet deep learning has historically struggled to handle them effectively. The standard industry practice relies on manual feature engineering—flattening multiple interconnected tables into a single table using joins and aggregations before feeding them into traditional machine learning models like LightGBM. This process is slow, error-prone, and discards rich relational context.

While Relational Deep Learning (RDL) introduced the use of Graph Neural Networks (GNNs) to model databases as graphs, these models remain strictly task- and database-specific; they cannot transfer knowledge to a new database schema. On the other end of the spectrum, recent "relational foundation models" are highly complex, computationally heavy, and often closed-source. The authors tackle this gap by proposing an accessible, lightweight, and transferable hybrid architecture.

Methods

The authors propose a two-stage pipeline that integrates a Pre-trained Language Model (PLM) with a Heterogeneous GNN:

  1. Stage 1: Row-Level Semantics (BART)
    Database rows are linearized into schema-aware text strings using special tokens (e.g., <table>, <attr>, <value>). A BART encoder is fine-tuned using a novel schema-aware masking strategy (masking table names, attributes, and cell values at different probabilities) to learn deep intra-row dependencies.

  2. Stage 2: Relational Context (HeteroGraphSAGE)
    The database is modeled as a Relational Entity Graph (REG), where rows are nodes and primary-foreign key links are edges. The row embeddings from BART serve as initial node features. The GNN is pre-trained using a masked feature reconstruction objective, forcing nodes to reconstruct their missing dimensions by aggregating information from their neighbors.

For downstream tasks, the pre-trained GNN weights can either be kept frozen for rapid adaptation or fine-tuned alongside a lightweight prediction head.

Figure 1: Overview of the hybrid architecture. A fine-tuned BART encoder generates row-level embeddings from linearized database rows, which serve as initial node features in the relational entity graph (REG). Node- type-specific linear layers project the 1024-dimensional BART embeddings to the 256-dimensional hidden space. Two shared SAGEConv layers then perform message passing across all edge types, and a linear decoder maps the enriched embeddings back to 1024 dimensions for reconstruction loss computation.

Datasets

The framework is developed and evaluated using the RelBench benchmark:

  • Pre-training: Six distinct databases (rel-amazon, rel-avito, rel-event, rel-hm, rel-trial, rel-stack) were used, totaling roughly 28.7 million nodes and 40 million edges.
  • Downstream Evaluation: The model was evaluated on the completely held-out rel-f1 dataset (Formula 1 data) to strictly test its generalization capabilities. Specifically, they focused on the driver-dnf node classification task, which predicts whether a given driver will fail to finish a race within a one-month window.

Key Insights and Ideas

  • The "Domain Shift" Trap: Interestingly, using BART embeddings without the GNN performed worse than using completely random embeddings (ROC-AUC of 43.90 vs 55.40). Because BART was pre-trained on different databases, its embeddings suffered from a domain shift.
  • GNN as a Semantic Amplifier: Once the GNN was introduced, the performance flipped dramatically in favor of BART. This reveals that while the language model preserves relative semantic structures, it takes the GNN's message-passing mechanism to amplify and translate these latent structures into a linearly separable signal that a classifier can use.
  • Relational Pre-training is Crucial: In a frozen-backbone transfer setting, this lightweight model outperformed Griffin (a larger foundation model pre-trained exclusively on single-table data). This highlights that exposure to relational graph structures during pre-training is absolutely essential for cross-database generalization.

Key Results

Evaluated on the driver-dnf task from the held-out rel-f1 dataset, the main quantitative findings include:

  • Competitive Performance: The fine-tuned hybrid model achieved a ROC-AUC of 67.40, approaching established supervised baselines like LightGBM (68.86) and manual feature engineering by data scientists (69.80).
  • Bridging the RDL Gap: It narrowed the performance gap to within 5.22 points of a fully supervised, database-specific RDL model (72.62), which represents the gold standard but requires training from scratch for every database.
  • Room for Growth: It still trails significantly behind state-of-the-art commercial foundation models like KumoRFM (82.63), which benefit from vastly larger training scales and advanced graph transformers.

Limitations and Future Work

The authors openly acknowledge several constraints that pave the way for future research:

  • Scale Limitations: The pre-training data was restricted to 100,000 rows for BART and 6 RelBench databases, which is tiny compared to standard foundation model corpora.
  • Sequential Disconnect: The current two-stage training pipeline prevents joint end-to-end backpropagation, disrupting the gradient flow between the language model and the GNN.
  • Evaluation Breadth: The model was only tested on a single downstream classification task. Future work must validate the architecture across regression, link prediction, and more complex database schemas.

Summary updated

BibTeX
@misc{wu2026towards,
  author = {Jingcheng Wu and Ratan Bahadur Thapa and Mojtaba Nayyeri and Lucas Etteldorf and Max Finkenbeiner and Fabian Leeske and Steffen Staab},
  title = {{Towards Foundation Models for Relational Databases with Language Models and Graph Neural Networks}},
  year = {2026},
  eprint = {2605.16085},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.16085},
}
Figure