Probabilistic Graph Rewiring via Virtual Nodes

Chendi Qian, Andrei Manolache, Christopher Morris, Mathias Niepert

TL;DR

IPR-MPNNs introduce a small set of "virtual nodes" to act as global communication hubs, allowing graph neural networks to capture long-range interactions without the quadratic computational cost of Graph Transformers. By learning these connections through a differentiable sampling process, the model achieves state-of-the-art performance on molecular benchmarks while remaining significantly faster and more memory-efficient than existing global attention methods.

What Problem Does This Paper Address?

Standard Message-Passing Graph Neural Networks (MPNNs) are inherently local: a node only "sees" its immediate neighbors. To capture distant relationships, you have to stack many layers, which leads to two notorious problems:

  1. Under-reaching: Distant nodes simply fail to communicate because the network isn't deep enough.
  2. Over-squashing: As the receptive field grows, an exponential amount of information is forced through a fixed-size vector bottleneck, causing critical signals to wash out.

Graph Transformers solve this by allowing every node to attend to every other node, but this comes with a $O(n^2)$ complexity. For large graphs, this quadratic memory and time requirement makes Transformers impractical. The authors seek a "middle ground": a way to enable global communication with the efficiency of local message passing.

Methods

The authors propose Implicitly Probabilistically Rewired MPNNs (IPR-MPNNs). The core idea is to add a small number $m$ of virtual nodes (where $m \ll n$) that serve as "shortcuts" for information flow.

The process works in three main stages, as illustrated in the overview below:

Figure 1: Overview of how IPR-MPNNs implicitly rewire a graph through adding virtual nodes. IPR-MPNNs use an upstream MPNN to learn priors θ for connecting original nodes with virtual nodes via edges, parameterizing a probability mass function conditioned on exactly-k constraints. Subsequently, we sample exactly k edges from this distribution for each original node, connecting it to k virtual nodes. We input the resulting graph to a downstream model, typically an MPNN, for the final predictions task, propagating information from (1) original nodes to virtual nodes, (2) among virtual nodes, and (3) among original nodes. On the backward pass, the gradients of the loss ℓ regarding the parameters θ are approximated through the derivative of the exactly-k marginals.
  1. Upstream Learning: An "upstream" MPNN looks at the original graph and learns a set of scores (priors) $\theta$ representing how likely each real node is to connect to each virtual node.
  2. Differentiable Sampling: For each real node, the model samples exactly $k$ virtual nodes to connect to. To make this discrete choice trainable via backpropagation, they use a recent technique called SIMPLE for differentiable $k$-subset sampling.
  3. Hierarchical Message Passing: Information flows from real nodes to virtual nodes, then among the virtual nodes (which are fully connected to each other), and finally back down to the real nodes.

Because $m$ is small, the complexity is roughly $O(|E| + nm)$, which is linear with respect to the number of nodes $n$, rather than quadratic.

Datasets

The authors evaluated IPR-MPNNs on a wide variety of benchmarks:

  • Synthetic: TREES-LEAFCOUNT and TREES-NEIGHBOURSMATCH to specifically test for under-reaching and over-squashing.
  • Molecular Regression/Classification: QM9 (13 chemical properties), ZINC (12K), and OGBG-MOLHIV.
  • Long-Range Graph Benchmark (LRGB): Peptides-func, Peptides-struct, and PCQM-Contact, which are designed to require global reasoning.
  • Heterophilic Graphs: Cornell, Texas, Wisconsin, and others where node labels don't necessarily match neighbor labels.

Key Insights and Ideas

  • Hub-and-Spoke Communication: Instead of trying to learn all $n^2$ possible edges between real nodes, IPR-MPNNs learn to route information through a few optimized "hubs." This effectively turns a large-diameter graph into a small-diameter one.
  • Theoretical Expressivity: The paper proves that IPR-MPNNs are more expressive than the standard 1-Weisfeiler-Leman (1-WL) isomorphism test. By rewiring the graph, they can distinguish certain non-isomorphic graphs that standard MPNNs find identical.
  • Maintaining Sensitivity: In standard MPNNs, the sensitivity of a node's output to a distant input decays to zero very quickly. IPR-MPNNs maintain high sensitivity even across many layers, as shown in the comparison below.
Figure 2: Comparing model sensitivity across different layers for the two most distant nodes from graphs from the ZINC dataset. On the left, we compare the sensitivity for models with a varying number of layers. We can observe that IPR-MPNNs maintain a high sensitivity even for the last layer, while the base models have the sensitivity decaying to 0. On the right, we compare models with a different number of virtual nodes, observing that the results are similar for all of the variants.

Key Results

  • State-of-the-Art Performance: IPR-MPNNs achieved the best results on 12 out of 13 targets in the QM9 dataset (see Table 1) and outperformed all competitors on the LRGB datasets (see Table 2).
  • Massive Efficiency Gains: On the Peptides-struct dataset, IPR-MPNN used only 1.9GB of memory compared to 22.2GB for the GPS Graph Transformer, while also being nearly 3x faster per training epoch.
  • Connectivity Improvement: The authors measured "total effective resistance"—a proxy for how well information flows. Their rewiring consistently and significantly lowered this value across all tested molecular datasets.
Table 1: Comparison on QM9 properties. IPR-MPNN (green) dominates most targets.
Table 2: Results on LRGB and PCQM-Contact. IPR-MPNN achieves SOTA performance.

Limitations and Future Work

  • Scalability of Virtual Nodes: The linear complexity assumes the number of virtual nodes $m$ is a small constant. If a task requires $m$ to scale with $n$, the benefit disappears.
  • Node-Level Tasks: The current work focuses heavily on graph-level predictions (like molecular properties). The authors note that applying this to node-level tasks (like social network classification) remains an open area for exploration.
  • Hyperparameter Tuning: The optimal number of virtual nodes ($m$) and the number of connections per node ($k$) are still hyperparameters that need to be tuned for each dataset.

Summary updated

BibTeX
@inproceedings{qian2024probabilistic,
  author = {Chendi Qian and Andrei Manolache and Christopher Morris and Mathias Niepert},
  title = {{Probabilistic Graph Rewiring via Virtual Nodes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=LpvSHL9lcK},
}
Figure