Lune

NeurIPS2023Top-tier venue

Can Language Models Solve Graph Problems in Natural Language?

Heng Wang, Shangbin Feng, Tianxing He, Zhaoxuan Tan, Xiaochuang Han, Yulia Tsvetkov

Abstract

Large language models (LLMs) are increasingly adopted for a variety of tasks with implicit graphical structures, such as planning in robotics, multi-hop question answering or knowledge probing, structured commonsense reasoning, and more. While LLMs have advanced the state-of-the-art on these tasks with structure implications, whether LLMs could explicitly process textual descriptions of graphs and structures, map them to grounded conceptual spaces, and perform structured operations remains underexplored. To this end, we propose NLGraph (Natural Language Graph), a comprehensive benchmark of graph-based problem solving designed in natural language. NLGraph contains 29,370 problems, covering eight graph reasoning tasks with varying complexity from simple tasks such as connectivity and shortest path up to complex problems such as maximum flow and simulating graph neural networks. We evaluate LLMs (GPT-3/4) with various prompting approaches on the NLGraph benchmark and find that 1) language models do demonstrate preliminary graph reasoning abilities, 2) the benefit of advanced prompting and in-context learning diminishes on more complex graph problems, while 3) LLMs are also (un)surprisingly brittle in the face of spurious correlations in graph and problem settings. We then propose Build-a-Graph Prompting and Algorithmic Prompting, two instruction-based approaches to enhance LLMs in solving natural language graph problems. Build-a-Graph and Algorithmic prompting improve the performance of LLMs on NLGraph by 3.07% to 16.85% across multiple tasks and settings, while how to solve the most complicated graph reasoning tasks in our setup with language models remains an open research question. The NLGraph benchmark and evaluation code are available at https://github.com/Arthur-Heng/NLGraph .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

122 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • One For All: Towards Training One Graph Model For All Classification Tasks cites Language Models are Few-Shot Learners
  • Language Models as Zero-Shot Planners: Extracting Actionable Knowledge for Embodied Agents cites Language Models are Few-Shot Learners
  • Large Language Models are Zero-Shot Reasoners cites Language Models are Few-Shot Learners
  • Large Language Models are Zero-Shot Reasoners cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Large Language Models are Zero-Shot Reasoners cites Training language models to follow instructions with human feedback
  • G-Retriever: Retrieval-Augmented Generation for Textual Graph Understanding and Question Answering cites One For All: Towards Training One Graph Model For All Classification Tasks
  • G-Retriever: Retrieval-Augmented Generation for Textual Graph Understanding and Question Answering cites Large Language Models are Zero-Shot Reasoners
  • G-Retriever: Retrieval-Augmented Generation for Textual Graph Understanding and Question Answering cites Harnessing Explanations: LLM-to-LM Interpreter for Enhanced Text-Attributed Graph Representation Learning
  • G-Retriever: Retrieval-Augmented Generation for Textual Graph Understanding and Question Answering cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • G-Retriever: Retrieval-Augmented Generation for Textual Graph Understanding and Question Answering cites Talk like a Graph: Encoding Graphs for Large Language Models
  • Harnessing Explanations: LLM-to-LM Interpreter for Enhanced Text-Attributed Graph Representation Learning cites Language Models are Few-Shot Learners
  • Chain-of-Thought Prompting Elicits Reasoning in Large Language Models cites Training language models to follow instructions with human feedback
  • Training language models to follow instructions with human feedback cites Language Models are Few-Shot Learners
  • GFT: Graph Foundation Model with Transferable Tree Vocabulary cites One For All: Towards Training One Graph Model For All Classification Tasks
  • GFT: Graph Foundation Model with Transferable Tree Vocabulary cites Talk like a Graph: Encoding Graphs for Large Language Models
  • Talk like a Graph: Encoding Graphs for Large Language Models cites Large Language Models are Zero-Shot Reasoners
  • Talk like a Graph: Encoding Graphs for Large Language Models cites Language Models are Few-Shot Learners
  • Talk like a Graph: Encoding Graphs for Large Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Talk like a Graph: Encoding Graphs for Large Language Models cites Training language models to follow instructions with human feedback
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers122

  1. G-Retriever: Retrieval-Augmented Generation for Textual Graph Understanding and Question AnsweringXiaoxin He, Yijun Tian, Yifei Sun, Nitesh V. Chawla et al.NeurIPS 2024 · 384 citations
  2. One For All: Towards Training One Graph Model For All Classification TasksHao Liu, Jiarui Feng, Lecheng Kong, Ningyue Liang et al.ICLR 2024 · 253 citations
  3. Talk like a Graph: Encoding Graphs for Large Language ModelsBahare Fatemi, Jonathan Halcrow, Bryan PerozziICLR 2024 · 194 citations
  4. Harnessing Explanations: LLM-to-LM Interpreter for Enhanced Text-Attributed Graph Representation LearningXiaoxin He, Xavier Bresson, Thomas Laurent, Adam Perold et al.ICLR 2024 · 151 citations
  5. GFT: Graph Foundation Model with Transferable Tree VocabularyZehong Wang, Zheyuan Zhang, Nitesh V. Chawla, Chuxu Zhang et al.NeurIPS 2024 · 108 citations

Builds on23

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  3. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  4. Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo et al.NeurIPS 2022 · 8,168 citations
  5. Language Models as Zero-Shot Planners: Extracting Actionable Knowledge for Embodied AgentsWenlong Huang, Pieter Abbeel, Deepak Pathak, Igor MordatchICML 2022 · 1,539 citations

Related papers

  1. Evaluating LLMs on Large-Scale Graph Property Estimation via Random WalksSunil Kumar Maurya, Xin LiuACL 2026
  2. Can Graph Descriptive Order Affect Solving Graph Problems with LLMs?Yuyao Ge, Shenghua Liu, Baolong Bi, Yiwei Wang et al.ACL 2025
  3. Beyond Graphs: Can Large Language Models Comprehend Hypergraphs?Yifan Feng, Chengwu Yang, Xingliang Hou, Shaoyi Du et al.ICLR 2025
  4. Structure Guided Prompt: Instructing Large Language Model in Multi-Step Reasoning by Exploring Graph Structure of the TextKewei Cheng, Nesreen K. Ahmed, Theodore L. Willke, Yizhou SunEMNLP 2024 · 6 citations
  5. Graph Neural Prompting with Large Language ModelsYijun Tian, Huan Song, Zichen Wang, Haozhu Wang et al.AAAI 2024 · 90 citations
Dusk over the sea between two cliffs drawn in fine vertical lines