InstructGraph: Boosting Large Language Models via Graph-centric Instruction Tuning and Preference Alignment

Jianing Wang, Junda Wu, Yupeng Hou, Yao Liu, Ming Gao, Julian J. McAuley

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities in processing linear text, yet they frequently struggle with structured graph data, such as social networks or knowledge graphs. Traditional approaches to bridge this gap—using natural language descriptions or specialized graph encoders—often fall short. Natural language templates can be overly rigid or verbose, while graph embeddings may be "lossy," making it difficult for models to translate information back into usable graphs. Furthermore, LLMs are susceptible to "graph hallucinations," where they generate responses based on non-existent nodes or ignore the actual connectivity of the provided data.

InstructGraph is a unified framework designed to enable LLMs to "speak graph" fluently while remaining grounded in the provided data. By representing graphs in a universal, code-like format and employing a combination of instruction tuning and preference alignment, InstructGraph significantly enhances the ability of LLMs to reason about and generate graph data.

Methodology

The InstructGraph framework is built upon three primary pillars:

  1. Structured Format Verbalizer: To avoid the pitfalls of complex natural language descriptions, InstructGraph converts graphs into a code-like format (e.g., using node_list and edge_list). Given that modern LLMs are extensively pre-trained on programming code, they are inherently better at parsing and generating this structured syntax.
  2. Graph Instruction Tuning: The model is trained on a massive corpus of 1.6 million examples categorized into four task groups: Graph Structure Modeling, Graph Language Modeling, Graph Generation Modeling, and Graph Thought Modeling.
  3. Graph Preference Alignment: To mitigate hallucinations, the authors utilize Direct Preference Optimization (DPO). By training the model on pairs of correct and "negative" examples (e.g., graphs with missing information or conflicting edges), the model learns to prefer grounded responses over hallucinated ones.
The InstructGraph framework overview, illustrating the pipeline from graph-centric corpus to instruction tuning and preference alignment.

A key insight of this work is that LLMs treat structured graph data more effectively when it mimics code, bypassing the need for specialized graph neural network (GNN) encoders. Additionally, the "Graph Thought Modeling" approach suggests that graphs can serve as a structured reasoning tool for non-graph problems, improving overall accuracy.

Datasets

The researchers aggregated and reformatted data from 29 different graph tasks to create a comprehensive training set. Key data sources include NLGraph for structural tasks, Wikipedia and WebNLG for graph-to-text captioning, and PathQSP for complex knowledge graph question answering. The corpus also incorporates data from citation networks (Cora, Pubmed) and recommendation systems (Amazon).

Results and Discussion

InstructGraph demonstrates superior performance across a wide range of benchmarks. It achieved an average score of 79.84% across all tasks, notably outperforming GPT-4 (66.76%) and LLaMA2 (41.65%).

Comparison of InstructGraph against GPT-3.5 and GPT-4 in zero-shot settings across Wikidata, UIE, and NLGraph datasets.

Key findings include:

  • Hallucination Reduction: The DPO stage improved performance on hallucination-prone tasks by approximately 10% compared to instruction tuning alone.
  • Zero-Shot Prowess: The model showed a remarkable ability to solve graph tasks it had not encountered during training, outperforming significantly larger models in zero-shot settings.
  • Knowledge Retention: Despite heavy tuning for graph tasks, the model maintained competitive performance on general benchmarks like MMLU and Big-Bench Hard.

Conclusion and Future Work

While InstructGraph represents a significant leap forward, some limitations remain. Hardware constraints limited most experiments to the 7B parameter scale. Additionally, extremely large or complex graphs can result in long code sequences that challenge the context windows of current LLMs. Future work will focus on scaling the framework to larger architectures and exploring even more complex graph types to further push the boundaries of graph-centric LLM reasoning.

Summary updated

BibTeX
@inproceedings{wang2024instructgraph,
  author = {Jianing Wang and Junda Wu and Yupeng Hou and Yao Liu and Ming Gao and Julian J. McAuley},
  title = {{InstructGraph: Boosting Large Language Models via Graph-centric Instruction Tuning and Preference Alignment}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.801},
}
Figure