Talk like a Graph: Encoding Graphs for Large Language Models

Bahare Fatemi, Jonathan J. Halcrow, Bryan Perozzi
2/12/2026

Official code: google-research/google-research (38,246 stars, Apache-2.0, last commit 2026-04-30). 2 more implementations below.

Abstract

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.

View on arXivView PDF

Code Implementations(3)

Apache-2.0

Google Research

38,2468,446C, ROct 4, 20185 months agoApache-2.0
aimachine-learningresearch
Apache-2.0
17420Python, Jupyter NotebookJul 10, 20242 years agoApache-2.0

experiment with "TALK LIKE A GRAPH: ENCODING GRAPHS FOR LARGE LANGUAGE MODELS" open source code

60Shell, PythonApr 14, 20242 years ago

Similar Papers

Cite this paper

@article{fatemi2026talk,
  title  = {Talk like a Graph: Encoding Graphs for Large Language Models},
  author = {Bahare Fatemi and Jonathan J. Halcrow and Bryan Perozzi},
  year   = {2026},
  eprint = {2310.04560},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2310.04560},
  journal = {ICLR 2023 2023}
}

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/2310.04560.svg)](https://codeofpaper.com/paper/2310.04560)

Discussion