Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Talk like a Graph: Encoding Graphs for Large Language Models

About

Graphs are a powerful tool for representing and analyzing complex relationships in real-world applications such as social networks, recommender systems, and computational finance. Reasoning on graphs is essential for drawing inferences about the relationships between entities in a complex system, and to identify hidden patterns and trends. Despite the remarkable progress in automated reasoning with natural text, reasoning on graphs with large language models (LLMs) remains an understudied problem. In this work, we perform the first comprehensive study of encoding graph-structured data as text for consumption by LLMs. We show that LLM performance on graph reasoning tasks varies on three fundamental levels: (1) the graph encoding method, (2) the nature of the graph task itself, and (3) interestingly, the very structure of the graph considered. These novel results provide valuable insight on strategies for encoding graphs as text. Using these insights we illustrate how the correct choice of encoders can boost performance on graph reasoning tasks inside LLMs by 4.8% to 61.8%, depending on the task.

Bahare Fatemi, Jonathan Halcrow, Bryan Perozzi• 2023

Related benchmarks

TaskDatasetResultRank
Maximum FlowBA and ER averaged (test)
Accuracy36.59
5
Triangle CountingBA and ER averaged (test)
Accuracy16
5
Shortest PathBA and ER averaged (test)
Accuracy87.8
5
Cycle CheckBA and ER averaged (test)
Accuracy91.5
5
Node ClassificationOGBN-ArXiv 150 subgraphs total (30 sampled)
F1-Macro22.76
4
Node ClassificationCora 150 subgraphs total (30 sampled)
Macro F10.1135
4
Node ClassificationCiteseer 150 subgraphs total (30 sampled)
F1-Macro9.01
4
Node ClassificationPubMed 150 subgraphs total (30 sampled)
F1-Macro5.7
4
Showing 8 of 8 rows

Other info

Follow for update