Harnessing Explanations: LLM-to-LM Interpreter for Enhanced Text-Attributed Graph Representation Learning

Xiaoxin He, Xavier Bresson, Thomas Laurent, Adam Perold, Yann LeCun, Bryan Hooi

In the world of machine learning, Text-Attributed Graphs (TAGs)—think citation networks or social media webs—are everywhere. Traditionally, we’ve tackled these by combining Graph Neural Networks (GNNs) with shallow text features like Bag-of-Words. More recently, researchers have plugged in smaller Language Models (LMs) like BERT. But there’s a new giant in the room: Large Language Models (LLMs) like GPT-4 and Llama.

The problem? LLMs are too massive to train alongside a graph, and their best "reasoning" is often locked behind a text-based API. A new paper from ICLR 2024, "Harnessing Explanations: LLM-to-LM Interpreter for Enhanced Text-Attributed Graph Representation Learning," introduces a clever workaround called TAPE. The secret sauce? Don't just ask the LLM for a label; ask it for an explanation.

TL;DR

TAPE (Title, Abstract, Prediction, Explanation) is a framework that prompts LLMs to generate textual explanations for node classifications, which are then "interpreted" by a smaller LM into enriched features for GNNs. This approach achieves state-of-the-art results across major benchmarks while training nearly 3x faster than previous top-tier methods.

What Problem Does This Paper Address?

Learning on TAGs requires balancing two different worlds: the structural connectivity of the graph and the semantic richness of the text.

Existing pipelines have a "reasoning gap." Shallow features (like skip-grams) miss deep context. Small LMs (like DeBERTa) are great at encoding text into vectors but lack the vast general knowledge and reasoning capabilities of LLMs. However, you can't easily fine-tune a 175B-parameter GPT model on a graph task due to the sheer computational cost and the fact that many LLMs are only accessible as a service (LMaaS). The authors set out to find a way to inject LLM-level "wisdom" into GNNs without breaking the bank or the hardware.

Methods

The authors propose a three-step pipeline illustrated in the framework overview:

Figure 1: Our framework leverages large language models (LLMs) to enhance representation learn- ing on TAGs. First, textual attributes of each node, i.e., title and abstract, are wrapped in a custom prompt (green box) to query the LLM, here GPT-3.5 (Brown et al., 2020), which generates a ranked prediction list and explanation (yellow box). Next, the original text, predictions, and explanation are used to fine-tune a language model (LM), here DeBERTa (He et al., 2021), and then transformed into vectorial node features. Finally, these enriched node features, i.e., horig, hexpl and hpred, are used in any downstream GNN, e.g., RevGAT (Li et al., 2021) to predict unknown node classes.
  1. LLM Querying: For each node (e.g., a research paper), they wrap the title and abstract in a prompt. They ask the LLM (GPT-3.5 or Llama2) to provide a ranked list of likely categories and, crucially, a textual explanation for its choice.
  2. The LM Interpreter: Since GNNs need vectorial inputs, not paragraphs of text, they use a smaller LM (DeBERTa) as an "interpreter." They fine-tune this smaller model to encode the original text, the LLM's predictions, and the LLM's explanations into fixed-length vectors ($h_{orig}$, $h_{pred}$, and $h_{expl}$).
  3. GNN Training: These enriched features are fed into a standard GNN (like RevGAT or GraphSAGE). Because the features are pre-computed and frozen, the GNN training remains lightweight and fast.

Datasets

The researchers evaluated TAPE on several high-profile TAG benchmarks:

  • Cora & PubMed: Classic citation networks (the authors notably released raw text versions of these, which were previously hard to find).
  • ogbn-arxiv & ogbn-products: Large-scale benchmarks from the Open Graph Benchmark.
  • tape-arxiv23: A brand-new dataset introduced by the authors containing papers published in 2023. This was specifically designed to test if the method works on data published after the LLM's training cutoff, ensuring the model isn't just "remembering" labels from its training set.

Key Insights and Ideas

  • Explanations as Distilled Knowledge: The "aha moment" is that an LLM's explanation acts as a bridge. An abstract might be dense, but an LLM explanation can explicitly link concepts (e.g., identifying that "db/db mice" implies a study on Type 2 diabetes). This makes the job much easier for the smaller "interpreter" LM.
  • Decoupling for Speed: Unlike previous state-of-the-art methods like GLEM, which iterate back and forth between the LM and GNN, TAPE pre-computes features. This modularity allows for massive parallelization.
  • LLMs as Feature Generators: The paper shifts the role of the LLM from a "final classifier" to a "feature engineer," leveraging its reasoning to create better inputs for structural models.

Key Results

TAPE consistently outperformed both pure LM approaches and existing LM+GNN hybrids.

Table 1: Node classification accuracy for the Cora, PubMed, ogbn-arxiv, ogbn-products and tape-arxiv23 datasets. G ↑denotes the improvements of our approach over the same GNN trained on shallow features hshallow; L ↑denotes the improvements of our approach over LMfinetune. The results are averaged over four runs with different seeds, and the best results are in bold.
  • Accuracy: On ogbn-arxiv, TAPE reached 77.50% accuracy, surpassing the previous SOTA (GLEM) and significantly beating standard GNNs (~70.8%).
  • Efficiency: As shown in Figure 2, TAPE achieved this superior accuracy while being 2.88x faster to train than GLEM.
  • Generalization: On the tape-arxiv23 dataset, TAPE achieved 84.23% accuracy, proving that the LLM's reasoning ability generalizes well even to "future" data it hasn't seen during pre-training.
Figure 2: The performance trade-off between node classification accuracy and total training time on ogbn-arxiv (Hu et al., 2020a) for various training approaches that combine language models (LMs) and graph neural networks (GNNs). The experiment employs DeBERTa-base (He et al., 2021) as the LM backbone and RevGAT (Li et al., 2021) as the GNN backbone, with the size of the marker indicating the number of parameters.

Limitations and Future Work

While powerful, TAPE has a few hurdles:

  • Prompt Sensitivity: The method relies on manually crafted prompts. The authors noted that the efficacy of the "explanation" can fluctuate based on how the question is phrased.
  • API Costs: Using closed-source LLMs like GPT-3.5 incurs costs per token, though the authors showed that open-source alternatives like Llama2 are viable, cost-effective substitutes.
  • Static Nature: The current work focuses on node classification. Future work could explore how LLM explanations might help with link prediction or dynamic graphs where the topology changes over time.

For those interested in implementing this, the authors have open-sourced their code and the new tape-arxiv23 dataset at https://github.com/XiaoxinHe/TAPE.

Summary updated

Abstract

Representation learning on text-attributed graphs (TAGs) has become a critical research problem in recent years. A typical example of a TAG is a paper citation graph, where the text of each paper serves as node attributes. Initial graph neural network (GNN) pipelines handled these text attributes by transforming them into shallow or hand-crafted features, such as skip-gram or bag-of-words features. Recent efforts have focused on enhancing these pipelines with language models (LMs), which typically demand intricate designs and substantial computational resources. With the advent of powerful large language models (LLMs) such as GPT or Llama2, which demonstrate an ability to reason and to utilize general knowledge, there is a growing need for techniques which combine the textual modelling abilities of LLMs with the structural learning capabilities of GNNs. Hence, in this work, we focus on leveraging LLMs to capture textual information as features, which can be used to boost GNN performance on downstream tasks. A key innovation is our use of explanations as features: we prompt an LLM to perform zero-shot classification, request textual explanations for its decision-making process, and design an LLM-to-LM interpreter to translate these explanations into informative features for downstream GNNs. Our experiments demonstrate that our method achieves state-of-the-art results on well-established TAG datasets, including Cora, PubMed, ogbn-arxiv, as well as our newly introduced dataset, tape-arxiv23. Furthermore, our method significantly speeds up training, achieving a 2.88 times improvement over the closest baseline on ogbn-arxiv. Lastly, we believe the versatility of the proposed method extends beyond TAGs and holds the potential to enhance other tasks involving graph-text data. Our codes and datasets are available at: https://github.com/XiaoxinHe/TAPE.
BibTeX
@inproceedings{he2024harnessing,
  author = {Xiaoxin He and Xavier Bresson and Thomas Laurent and Adam Perold and Yann LeCun and Bryan Hooi},
  title = {{Harnessing Explanations: LLM-to-LM Interpreter for Enhanced Text-Attributed Graph Representation Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=RXFVcynVe1},
}
Figure