Are Large-Language Models Graph Algorithmic Reasoners?

Alexander K Taylor, Anthony Cuturrufo, Vishal Yathish, Mingyu Derek Ma, Wei Wang
10/29/2024
cs.LGcs.AI

No official code found. Best implementation: ataylor24/MAGMA (8 stars, last commit 2025-03-26).

Abstract

We seek to address a core challenge facing current Large Language Models (LLMs). LLMs have demonstrated superior performance in many tasks, yet continue to struggle with reasoning problems on explicit graphs that require multiple steps. To address this gap, we introduce a novel benchmark designed to evaluate LLM performance on classical algorithmic reasoning tasks on explicit graphs. Our benchmark encompasses five fundamental algorithms: Breadth-First Search (BFS) and Depth-First Search (DFS) for connectivity, Dijkstra's algorithm and Floyd-Warshall algorithm for all nodes shortest path, and Prim's Minimum Spanning Tree (MST-Prim's) algorithm. Through extensive experimentation, we assess the capabilities of state-of-the-art LLMs in executing these algorithms step-by-step and systematically evaluate their performance at each stage. Our findings highlight the persistent challenges LLMs face in this domain and underscore the necessity for advanced prompting techniques and algorithmic instruction to enhance their graph reasoning abilities. This work presents MAGMA, the first comprehensive benchmark focused on LLMs completing classical graph algorithms, and provides a critical step toward understanding and improving their structured problem-solving skills.

View on arXivView PDF

Code Implementations(1)

ataylor24/MAGMACommunity100%

The MAGMA Benchmark is designed to evaluate the performance of large language models (LLMs) on classical graph algorithms using intermediate steps.

83Python, Jupyter NotebookNov 9, 20231 years ago
clrs-algorithmsgraph-algorithmsllmsreasoning

Similar Papers

Cite this paper

@article{taylor2024largelanguage,
  title  = {Are Large-Language Models Graph Algorithmic Reasoners?},
  author = {Alexander K Taylor and Anthony Cuturrufo and Vishal Yathish and Mingyu Derek Ma and Wei Wang},
  year   = {2024},
  eprint = {2410.22597},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.22597v1}
}

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

Discussion