Zero-shot Graph Reasoning via Retrieval Augmented Framework with LLMs

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Li, Hanqing, Jyothi, Kiran Sheena, Liang, Henry, Mahadevan, Sharika, Klabjan, Diego
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866916952037916672
author Li, Hanqing
Jyothi, Kiran Sheena
Liang, Henry
Mahadevan, Sharika
Klabjan, Diego
author_facet Li, Hanqing
Jyothi, Kiran Sheena
Liang, Henry
Mahadevan, Sharika
Klabjan, Diego
contents We propose a new, training-free method, Graph Reasoning via Retrieval Augmented Framework (GRRAF), that harnesses retrieval-augmented generation (RAG) alongside the code-generation capabilities of large language models (LLMs) to address a wide range of graph reasoning tasks. In GRRAF, the target graph is stored in a graph database, and the LLM is prompted to generate executable code queries that retrieve the necessary information. This approach circumvents the limitations of existing methods that require extensive finetuning or depend on predefined algorithms, and it incorporates an error feedback loop with a time-out mechanism to ensure both correctness and efficiency. Experimental evaluations on the GraphInstruct dataset reveal that GRRAF achieves 100% accuracy on most graph reasoning tasks, including cycle detection, bipartite graph checks, shortest path computation, and maximum flow, while maintaining consistent token costs regardless of graph sizes. Imperfect but still very high performance is observed on subgraph matching. Notably, GRRAF scales effectively to large graphs with up to 10,000 nodes.
format Preprint
id arxiv_https___arxiv_org_abs_2509_12743
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Zero-shot Graph Reasoning via Retrieval Augmented Framework with LLMs
Li, Hanqing
Jyothi, Kiran Sheena
Liang, Henry
Mahadevan, Sharika
Klabjan, Diego
Artificial Intelligence
Computation and Language
We propose a new, training-free method, Graph Reasoning via Retrieval Augmented Framework (GRRAF), that harnesses retrieval-augmented generation (RAG) alongside the code-generation capabilities of large language models (LLMs) to address a wide range of graph reasoning tasks. In GRRAF, the target graph is stored in a graph database, and the LLM is prompted to generate executable code queries that retrieve the necessary information. This approach circumvents the limitations of existing methods that require extensive finetuning or depend on predefined algorithms, and it incorporates an error feedback loop with a time-out mechanism to ensure both correctness and efficiency. Experimental evaluations on the GraphInstruct dataset reveal that GRRAF achieves 100% accuracy on most graph reasoning tasks, including cycle detection, bipartite graph checks, shortest path computation, and maximum flow, while maintaining consistent token costs regardless of graph sizes. Imperfect but still very high performance is observed on subgraph matching. Notably, GRRAF scales effectively to large graphs with up to 10,000 nodes.
title Zero-shot Graph Reasoning via Retrieval Augmented Framework with LLMs
topic Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2509.12743