Parameter-Efficient Tuning Large Language Models for Graph Representation Learning

Qi Zhu, Da Zheng, Xiang Song, Shichang Zhang, Bowen Jin, Yizhou Sun, George KarypisarXiv 2024

Abstract: Text-rich graphs (TAGs), which exhibit rich textual information on nodes and edges, are prevalent across a wide range of real-world business applications. Large Language Models (LLMs) have demonstrated remarkable abilities in understanding text, which also introduced the potential for more expressive modeling in text-rich graphs. Despite these capabilities, efficiently applying LLMs to representation learning on graphs presents significant challenges. Recently, parameter-efficient fine-tuning methods for LLMs have enabled efficient new task generalization with minimal time and memory consumption. Inspired by this, we introduce Graph-aware Parameter-Efficient Fine-Tuning (GPEFT), a novel approach for efficient graph representation learning with LLMs on text-rich graphs. Specifically, we utilize a graph neural network (GNN) to encode structural information from neighboring nodes into a graph prompt. This prompt is then inserted at the beginning of the text sequence. To improve the quality of graph prompts, we pre-trained the GNN to assist the frozen LLM in predicting the next token in the node text. Compared with existing joint GNN and LMs, our method directly generates node embeddings from large language models with an affordable fine-tuning cost. We validate our approach through comprehensive experiments conducted on 8 different text-rich graphs, observing an average improvement of 2% in hit@1 and Mean Reciprocal Rank (MRR) in link prediction evaluations. Our results demonstrate the efficacy and efficiency of our model, showing that it can be smoothly integrated with various large language models, including OPT, LLaMA, and Falcon.

Introduction

Real-world data often exists in the form of text-rich graphs (TAGs), where nodes represent entities (like products or academic papers) and edges represent relationships (like "frequently bought together" or citations). Modeling these graphs requires a dual understanding of complex structural relationships and deep semantic nuances in text.

Historically, researchers have faced a trade-off. GNN-centric models excel at capturing structural topology but often fail to grasp the sophisticated semantics that modern LLMs can. Conversely, LLM-centric models are linguistic powerhouses but are computationally prohibitive to fine-tune on large-scale graphs. Furthermore, simple in-context learning (prompting) does not scale for tasks like link prediction, which involves quadratic complexity relative to the number of nodes. GPEFT addresses these challenges by making LLMs "graph-aware" through a parameter-efficient framework.

The GPEFT Framework

GPEFT bridges the gap between GNNs and LLMs using a three-stage approach designed for efficiency and performance.

1. Graph Prompt Encoding

The framework employs a standard GNN (such as GraphSAGE or GCN) to aggregate structural information from a node's neighborhood. This structural data is compressed into a "graph prompt"—a continuous vector that serves as a "soft prompt" for the LLM. This allows the model to ingest graph topology without needing to describe the graph in natural language, which is often verbose and inefficient.

2. Alignment Pre-training

A critical discovery in this research is that GNN outputs and LLM word embeddings often reside in different feature spaces. To resolve this, GPEFT includes an alignment pre-training phase. The GNN encoder is trained to assist a frozen LLM in a next-token prediction task on node text. This ensures the graph prompt is "aligned" with the LLM's internal representation space before task-specific tuning begins.

3. Parameter-Efficient Fine-Tuning (PEFT)

Instead of updating the billions of parameters in an LLM, GPEFT utilizes Low-Rank Adaptation (LoRA) or Prefix Tuning. A key innovation here is the prepending of the graph prompt to the text sequence. Mathematical analysis (Theorem A.1 in the full paper) demonstrates that in causal, decoder-only LLMs, prepending allows structural information to influence the attention calculation of every subsequent text token. In contrast, appending the prompt at the end only influences the final representation, limiting the model's reasoning capability.

The GPEFT architecture, illustrating the graph prompt encoding and the two-stage training process: (a) pre-training for alignment and (b) fine-tuning for specific tasks.

Datasets and Applications

The model was rigorously evaluated across 8 subdomains within two major datasets:

  • Amazon Review: Focuses on co-purchase prediction in categories like Clothing, Home, Sports, and Video Games.
  • Microsoft Academic Graph (MAG): Focuses on author identification (determining if two papers share an author) in fields like Computer Science, Economics, Geology, and Mathematics.
Overview of the GPEFT model applied to various text-rich graph domains such as social graphs and e-commerce for tasks like recommendation and fraud detection.

Key Results and Insights

  • Superior Performance: GPEFT achieved an average improvement of 2% in Hit@1 and Mean Reciprocal Rank (MRR) over state-of-the-art baselines like GraphFormers and Patton.
  • Extreme Efficiency: The framework requires only ~2% additional parameters per application, making it feasible to deploy across multiple specialized graph tasks simultaneously.
  • Significant Cost Savings: Training GPEFT costs approximately $50 in GPU hours, a 5x reduction compared to traditional GNN-LM fine-tuning (~$250). For inference on 1 million edges, GPEFT costs ~$10, while standard LLM prompting services would exceed $1,000.
  • Model Agnostic: The framework is highly versatile, showing consistent gains when integrated with various LLM backbones, including OPT, LLaMA, and Falcon.

Conclusion

GPEFT demonstrates that LLMs can be effectively and efficiently adapted for graph representation learning. By combining soft-prompt structural encoding with alignment pre-training and parameter-efficient tuning, the framework provides a scalable solution for text-rich graphs. Future work will look to extend this approach to dynamic graphs and more complex graph-level reasoning tasks.

Summary updated

BibTeX
@misc{zhu2024parameter,
  author = {Qi Zhu and Da Zheng and Xiang Song and Shichang Zhang and Bowen Jin and Yizhou Sun and George Karypis},
  title = {{Parameter-Efficient Tuning Large Language Models for Graph Representation Learning}},
  year = {2024},
  eprint = {2404.18271},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.18271},
}
Figure