Share your thoughts, 1 month free Claude Pro on usSee more
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
Graph ReasoningGraphQA (test)
Avg Accuracy14.7
9
Cycle CheckGraphQA
Accuracy76
6
Edge CountGraphQA
Accuracy12.4
6
Edge ExistenceGraphQA
Accuracy44.5
6
Node CountGraphQA
Accuracy21.7
6
Node DegreeGraphQA
Accuracy14
6
ReachabilityGraphQA
Accuracy84.9
6
Shortest PathGraphQA
Accuracy11.5
6
Triangle CountingGraphQA
Accuracy1.5
6
Maximum FlowBA and ER averaged (test)
Accuracy36.59
5
Showing 10 of 17 rows

Other info

Follow for update