Large Language Models are Good Relational Learners

Fang Wu, Vijay Prakash Dwivedi, Jure Leskovec
6/6/2025
cs.CLcs.AIcs.LG

Official code: smiles724/Rel-LLM (32 stars, last commit 2025-09-23).

Abstract

Large language models (LLMs) have demonstrated remarkable capabilities across various domains, yet their application to relational deep learning (RDL) remains underexplored. Existing approaches adapt LLMs by traversing relational links between entities in a database and converting the structured data into flat text documents. Still, this text-based serialization disregards critical relational structures, introduces redundancy, and often exceeds standard LLM context lengths. We introduce Rel-LLM, a novel architecture that utilizes a graph neural network (GNN)- based encoder to generate structured relational prompts for LLMs within a retrieval-augmented generation (RAG) framework. Unlike traditional text-based serialization approaches, our method preserves the inherent relational structure of databases while enabling LLMs to effectively process and reason over complex entity relationships. Specifically, the GNN encoder extracts a local subgraph around an entity to build feature representations that contain relevant entity relationships and temporal dependencies. These representations are transformed into structured prompts using a denormalization process, effectively allowing the LLM to reason over relational structures. Through extensive experiments, we demonstrate that Rel-LLM outperforms existing methods on key RDL tasks, offering a scalable and efficient approach to integrating LLMs with structured data sources. Code is available at https://github.com/smiles724/Rel-LLM.

View on arXivView PDF

Code Implementations(1)

smiles724/Rel-LLMOfficial100%
326Shell, PythonMay 22, 20251 years ago

Similar Papers

Cite this paper

@article{wu2025large,
  title  = {Large Language Models are Good Relational Learners},
  author = {Fang Wu and Vijay Prakash Dwivedi and Jure Leskovec},
  year   = {2025},
  eprint = {2506.05725},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.05725v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.05725.svg)](https://codeofpaper.com/paper/2506.05725)

Discussion