Graph Positional and Structural Encoder

Semih Cantürk, Renming Liu, Olivier Lapointe-Gagné, Vincent Létourneau, Guy Wolf, Dominique Beaini, Ladislav Rampášek

Modern Graph Neural Networks (GNNs), and particularly Graph Transformers, face a fundamental limitation: they often lack the inherent "inductive bias" required to understand a node's position within a graph or the specific topology of its local neighborhood. To overcome this, researchers typically rely on Positional and Structural Encodings (PSEs)—mathematical descriptors such as Laplacian eigenvectors or random walk statistics.

However, the current landscape of PSEs is fragmented and computationally burdensome. There is no "one-size-fits-all" encoding; random walks might excel for molecular graphs, while Laplacian features are better suited for capturing long-range dependencies. Consequently, practitioners must manually select and tune PSEs through trial and error. Furthermore, calculating these features—especially spectral ones—scales poorly ($O(n^3)$), making them prohibitively slow for massive graphs. Finally, simply stacking multiple explicitly computed PSEs often introduces noise and redundancy, leading to diminishing returns.

To address these challenges, researchers introduce the Graph Positional and Structural Encoder (GPSE), a pre-trained, "foundation-style" graph encoder. GPSE learns a unified, highly transferable latent representation of multiple PSEs, offering a computationally efficient and highly effective way to augment any GNN or Graph Transformer.

The GPSE Framework

Instead of manually calculating and concatenating various PSEs, GPSE trains a single model to learn them simultaneously.

Overview of the GPSE framework

Architecture and Self-Supervised Training

GPSE employs a deep, 20-layer GatedGCN architecture equipped with residual connections and a virtual node to facilitate global communication. To break the symmetry limitations inherent in standard GNNs (the 1-WL test limit), the model is fed random node features as input. This stochastic input allows the model to distinguish between nodes that are structurally identical but positionally distinct.

The model undergoes self-supervised training to reconstruct six diverse, hand-crafted PSEs simultaneously:

  • Positional Encodings: Laplacian eigenvectors, Laplacian eigenvalues, and electrostatic potentials.
  • Structural Encodings: Random walk diagonals, heat kernel diagonals, and cycle counts.

The training objective utilizes a combined loss function incorporating $\ell_1$ loss (to capture the magnitude of the features) and cosine similarity (to capture the directional signal of the graph).

Downstream Usage

Once pre-training is complete, the GPSE weights are frozen. For any new, unseen graph, practitioners simply pass it through the GPSE model to extract a latent representation for each node. These learned "GPSE features" are then concatenated with the original node features and fed into the target downstream model (e.g., a Graph Transformer or a standard GCN).

Key Insights and Results

The GPSE model was pre-trained primarily on the MolPCBA dataset (comprising over 320,000 unique molecular graphs) and evaluated across a wide array of benchmarks, revealing several compelling advantages:

  • Universal Transferability: Perhaps the most striking finding is GPSE's zero-shot transferability. Despite being trained on small molecules, the encoder works remarkably well on vastly different domains, including citation networks (ogbn-arxiv), image superpixels (CIFAR10, MNIST), and long-range graphs (Peptides). This suggests that the underlying "language" of graph structure—such as cycles, connectivity, and spectral properties—is largely universal.
  • Latent Synergy: GPSE-augmented models frequently outperform models that use raw, explicitly computed PSEs. This indicates that the joint latent space learned by GPSE is "cleaner" and more synergistic than simply concatenating raw features, effectively filtering out noise and redundancy.
  • Significant Performance Boosts: On the ZINC benchmark, models enhanced with GPSE saw an average 56.24% reduction in Mean Absolute Error (MAE) compared to baselines lacking PSEs. Furthermore, GPSE-augmented Graph Transformers achieved state-of-the-art results on the Peptides-struct benchmark, besting models explicitly designed for long-range dependencies.
  • Computational Efficiency: While computing exact eigenvectors scales at $O(n^3)$, GPSE inference scales linearly at $O(Lm)$ (where $L$ is the number of layers and $m$ is the number of edges). On the MolPCBA dataset, GPSE inference was roughly 2x faster than computing Laplacian and Random Walk encodings separately, making it a highly scalable alternative for extracting spectral-like information.

Limitations and Future Directions

While GPSE represents a major leap forward, the authors note that training the current 20-layer model from scratch on billion-scale datasets remains computationally prohibitive, even though downstream inference is fast. Additionally, while zero-shot transfer is remarkably strong, fine-tuning GPSE on a target domain still yields a slight performance edge, implying that some domain-specific structural nuances are not perfectly captured by the universal weights.

Ultimately, GPSE paves the way for the development of true foundational graph encoders. Future iterations could incorporate an even broader array of self-supervision tasks, further solidifying learned graph representations as a powerful, efficient alternative to manual feature engineering.

Summary updated

BibTeX
@inproceedings{canturk2024graph,
  author = {Semih Cantürk and Renming Liu and Olivier Lapointe-Gagné and Vincent Létourneau and Guy Wolf and Dominique Beaini and Ladislav Rampášek},
  title = {{Graph Positional and Structural Encoder}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=UTSCK582Yo},
}
Figure