Abstract
In this paper, we address the problem of learning low dimension representation of entities on relational databases consisting of multiple tables. Embeddings help to capture semantics encoded in the database and can be used in a variety of settings like auto-completion of tables, fully-neural query processing of relational joins queries, seamlessly handling missing values, and more. Current work is restricted to working with just single table, or using pretrained embeddings over an external corpus making them unsuitable for use in real-world databases. In this work, we look into ways of using these attention-based model to learn embeddings for entities in the relational database. We are inspired by BERT style pretraining methods and are interested in observing how they can be extended for representation learning on structured databases. We evaluate our approach of the autocompletion of relational databases and achieve improvement over standard baselines.
Introduction
Relational databases (RDBMS) are the foundational storage systems for industrial data, yet they present significant challenges for modern deep learning architectures. Unlike natural language, database information is typically normalized, meaning data about a single entity is distributed across multiple tables linked by primary and foreign keys.
Existing representation learning approaches often fail in two ways: they either ignore the schema entirely, treating rows as isolated sentences, or they attempt to denormalize the entire database into a single massive table. The former loses rich semantic connections, while the latter is computationally prohibitive and introduces noise. Furthermore, the same string (e.g., a person's name) can have different semantic meanings depending on whether it appears in an "Actor" or "Director" column. Standard NLP models like BERT are not designed to handle this column-specific heterogeneity.
Methodology: The RELBERT Framework
The authors propose RELBERT, an attention-based model that treats a relational database as a structured corpus. RELBERT introduces several key innovations to adapt transformer architectures to tabular data.
Relational Context and Joins
To capture inter-table relationships, RELBERT employs a Relational Next Sentence Prediction (NSP) task. Instead of sequential sentences, the "next sentence" is defined as a row from a different table that joins with the current row via a foreign key. This allows the model to learn cross-table semantics without the need for physical denormalization.
Architecture and Training
RELBERT's architecture is designed to respect the unique properties of relational data:
- Column-Specific Embedding Spaces: The model uses distinct embedding functions ($\Phi^k$) for each column, ensuring that the semantic role of an entity is preserved.
- Masked Language Modeling (MLM): Similar to BERT, the model is trained to predict masked cells within a row, forcing it to learn intra-table dependencies.
- Permutation Invariance: Unlike natural language, column order is arbitrary. RELBERT omits positional embeddings to maintain this invariance.
The framework includes two specialized variants: RELBERT-A for autocompletion and data imputation, and RELBERT-J for predicting relational joins.
Evaluation and Results
The model was evaluated on two large-scale datasets: the IMDB movie database (7 tables, ~5.7M tuples) and the MIMIC-III clinical database (6 tables, 3.5M rows).
- Superior Accuracy: RELBERT-A significantly outperformed the state-of-the-art EmbDI model, showing an 11.3% improvement on IMDB and a 41.6% improvement on the MIMIC-III dataset for autocompletion tasks.
- Neural Joins: RELBERT-J demonstrated high capability for relational prediction, achieving approximately 80% accuracy (Hits@10) in predicting joins between actors and directors.
- Efficiency: RELBERT proved more scalable than graph-based baselines, training nearly 50% faster than EmbDI on the IMDB dataset while achieving superior results.
Conclusion
RELBERT demonstrates that the normalization inherent in relational databases is a powerful signal rather than a hurdle. By leveraging join structures and column-specific contexts, it provides a robust method for learning entity representations. Future work includes exploring "vertical attention" across rows and making the model "query-aware" to optimize embeddings for specific SQL patterns.
Summary updated