Augmenting Message Passing by Retrieving Similar Graphs

Dingmin Wang, Shengchao Liu, Hanchen Wang, Linfeng Song, Jian Tang, Song Le, Bernardo Cuenca Grau, Qi Liu · OpenReview

Abstract

Graph Neural Networks (GNNs) are effective tools for graph representation learning. Most GNNs rely on a recursive neighborhood aggregation scheme, named message passing, thereby their theoretical expressive power is limited to the first order Weisfeiler-Lehman test (1-WL). Motivated by the success of retrieval-based models and off-the-shelf high-performance retrieval systems, we propose a non-parametric and model-agnostic scheme called GraphRetrieval to boost existing GNN models. In GraphRetrieval, similar training graphs associated with their ground-truth labels are retrieved as an enhancement to be jointly utilized with the input graph representation to complete various graph property predictive tasks. In particular, to effectively "absorb" useful information from retrieved graphs and "ignore" possible noise, we introduce an adapter based on self-attention to explicitly learn the interaction between an input graph and its retrieved similar graphs. By experimenting with three classic GNN models on 12 different datasets, we have demonstrated GraphRetrieval is able to bring substantial improvements to existing GNN models without comprising the model size and the prediction efficiency. Our work also firstly validates the feasibility and effectiveness of retrieved-enhanced graph neural networks.

Introduction

Standard Graph Neural Networks (GNNs) primarily utilize message passing, where node representations are updated by aggregating information from immediate neighbors. Despite their success, this paradigm faces two critical challenges. First, the expressive power of message passing is theoretically bounded by the first-order Weisfeiler-Lehman (1-WL) test, limiting the ability to distinguish complex graph topologies. Second, GNNs often suffer from "catastrophic forgetting" of training data; once trained, the specific nuances of individual training examples are lost, and the model relies entirely on static learned weights.

To address these limitations, we introduce GRAPHRETRIEVAL, a model-agnostic framework that augments GNNs by retrieving similar graphs and their labels from the training set during inference. This approach allows the model to "look up" relevant historical data to refine its predictions, particularly for rare or complex cases.

The GRAPHRETRIEVAL Framework

The GRAPHRETRIEVAL pipeline consists of three main stages:

  1. Base Model Training and Indexing: A standard GNN (e.g., GCN, GIN, or PNA) is trained. Once trained, it is used to generate embeddings for all graphs in the training set. These embeddings are stored in a high-performance FAISS index as keys, with their corresponding ground-truth labels as values.
  2. Retrieval: For a given test graph, the base GNN generates an initial embedding and prediction. The system then retrieves the $k$ most similar graphs from the index based on embedding similarity.
  3. Self-Attention Based Adapter: To integrate the retrieved information, we employ a self-attention adapter. This component learns to weigh the initial prediction against the retrieved labels, effectively filtering out noise from less relevant retrievals.
The self-attention adapter learns to weigh the input graph representation against retrieved similar graphs.

To ensure robust learning, we implement Retrieval Dropout during training. This prevents the model from over-relying on the most similar graph (which, during training, would be the graph itself) and encourages it to generalize across the retrieved set.

Experimental Results and Analysis

We evaluated GRAPHRETRIEVAL across 13 diverse benchmarks, including molecular property prediction (e.g., BBBP, Tox21), computer vision (MNIST, CIFAR10), and large-scale quantum chemistry (PCQM4Mv2).

Consistent Performance Gains

The framework demonstrated consistent improvements across all tasks. For instance, on the BBBP dataset, GRAPHRETRIEVAL provided a 2% ROC_AUC boost for the GIN model. In regression tasks like PCQM4Mv2, the retrieval-enhanced GIN achieved an MAE of 0.115, significantly outperforming the base model's 0.123.

Addressing the Long Tail

The most significant impact of retrieval was observed in "long-tailed" scenarios—data ranges or classes that are underrepresented in the training set. In the PCQM4M regression task, while common value ranges saw a modest 2.6% improvement, the long-tailed numerical ranges experienced a massive improvement of over 17%. Similarly, in multi-class classification (USPTO), the adapter effectively utilized retrieved labels to correct predictions for rare catalyst types.

Performance improvements across binary classification (a), multi-class classification (b), and regression (c), highlighting gains in long-tail distributions.

Conclusion and Future Work

GRAPHRETRIEVAL proves that non-parametric retrieval is a powerful, efficient, and model-agnostic way to enhance GNNs. By allowing models to access a "memory" of training examples, we can overcome theoretical expressive bounds and improve performance on rare data. Future research will explore extending this framework to node-level tasks and incorporating 3D geometric modeling for more precise structural retrieval in scientific domains.

Summary updated

BibTeX
@inproceedings{wang2023augmenting,
  author = {Dingmin Wang and Shengchao Liu and Hanchen Wang and Linfeng Song and Jian Tang and Song Le and Bernardo Cuenca Grau and Qi Liu},
  title = {{Augmenting Message Passing by Retrieving Similar Graphs}},
  booktitle = {ECAI},
  year = {2023},
  doi = {10.3233/faia230547},
}
Figure