Skip to main content
QUICK REVIEW

[Paper Review] Graph-ToolFormer: To Empower LLMs with Graph Reasoning Ability via Prompt Augmented by ChatGPT

Jiawei Zhang|arXiv (Cornell University)|Apr 10, 2023
Advanced Graph Neural NetworksComputer Science12 citations
TL;DR

The paper proposes Graph-ToolFormer, a framework that teaches pre-trained LLMs to perform graph reasoning by augmenting prompts with ChatGPT-generated API calls to external graph tools, enabling reasoning over basic to advanced graph tasks. It fine-tunes models like GPT-J and LLaMA using a specialized graph reasoning prompt dataset.

ABSTRACT

In this paper, we aim to develop a large language model (LLM) with the reasoning ability on complex graph data. Currently, LLMs have achieved very impressive performance on various natural language learning tasks, extensions of which have also been applied to study the vision tasks with multi-modal data. However, when it comes to the graph learning tasks, existing LLMs present very serious flaws due to their several inherited weaknesses in performing {multi-step logic reasoning}, {precise mathematical calculation} and {perception about the spatial and temporal factors}. To address such challenges, in this paper, we will investigate the principles, methodologies and algorithms to empower existing LLMs with graph reasoning ability, which will have tremendous impacts on the current research of both LLMs and graph learning. Inspired by the latest ChatGPT and Toolformer models, we propose the Graph-ToolFormer (Graph Reasoning oriented Toolformer) framework to teach LLMs themselves with prompts augmented by ChatGPT to use external graph reasoning API tools. Specifically, we will investigate to teach Graph-ToolFormer to handle various graph data reasoning tasks in this paper, including both (1) very basic graph data loading and graph property reasoning tasks, ranging from simple graph order and size to the graph diameter and periphery, and (2) more advanced reasoning tasks on real-world graph data, such as bibliographic networks, protein molecules, sequential recommender systems, social networks and knowledge graphs.

Motivation & Objective

  • Motivate and enable LLMs to perform precise graph reasoning across various domains.
  • Bridge graph learning with modern LLMs and AIGC by leveraging external graph reasoning tools.
  • Create a prompt dataset and fine-tune LLMs to decide when and which graph tools to use.
  • Demonstrate effectiveness on both basic graph properties and real-world graph datasets.

Proposed method

  • Hand-craft instruction and prompt templates for graph reasoning tasks.
  • Use ChatGPT to annotate and augment a large graph reasoning prompt dataset with API calls.
  • Fine-tune pre-trained causal LLMs (e.g., GPT-J, LLaMA) using the augmented prompts via LoRA and quantization techniques.
  • Represent API calls with specialized tokens to allow nested and sequential tool usage within output statements.
  • Implement parsing, execution, and post-processing of API calls to produce final answers.
  • Provide a public GitHub repository with data, prompts, and code.
Figure 1. An Illustration of LLMs based Graph Reasoning Tasks. Based on the input graph data from various domains and a handful number of prompt examples with brief instructions, we propose to use ChatGPT to annotate and augment a large prompt dataset that contains graph reasoning API calls of exter
Figure 1. An Illustration of LLMs based Graph Reasoning Tasks. Based on the input graph data from various domains and a handful number of prompt examples with brief instructions, we propose to use ChatGPT to annotate and augment a large prompt dataset that contains graph reasoning API calls of exter

Experimental results

Research questions

  • RQ1How can an LLM be guided to use external graph reasoning tools via augmented prompts?
  • RQ2What graph reasoning tasks can be effectively supported by this framework (from basic properties to domain-specific tasks)?
  • RQ3How does fine-tuning with ChatGPT-augmented prompts affect LLMs' graph reasoning accuracy and tool usage decisions?
  • RQ4Can the framework scale to real-world graph data such as bibliographic networks, molecular graphs, and knowledge graphs?

Key findings

  • Graph-ToolFormer enables LLMs to incorporate graph reasoning API calls into generated statements.
  • The approach supports basic graph loading and property computation as well as advanced tasks across multiple domains.
  • Experimental studies are conducted on real-world graph datasets and tasks, illustrating effectiveness of the framework.
  • An LLM demo with graph reasoning capabilities is released alongside the code and datasets.
Figure 2. The Outline of the Graph-ToolFormer Framework. The framework has three main parts: (1) prompt data annotation and augmentation with ChatGPT, (2) existing pre-trained causal LLMs fine-tuning with the generated prompt dataset, and (3) inference of the fine-tuned model for adding graph reason
Figure 2. The Outline of the Graph-ToolFormer Framework. The framework has three main parts: (1) prompt data annotation and augmentation with ChatGPT, (2) existing pre-trained causal LLMs fine-tuning with the generated prompt dataset, and (3) inference of the fine-tuned model for adding graph reason

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.