Towards Foundation Models on Graphs: An Analysis on Cross-Dataset Transfer of Pretrained GNNs

Fabrizio Frasca, Fabian Jogl, Moshe Eliasof, Matan Ostrovsky, Carola-Bibiane Schönlieb, Thomas Gärtner, Haggai Maron

TL;DR

Can we build universal Graph Foundation Models that seamlessly transfer across entirely different graph datasets? This paper benchmarks pretrained Graph Neural Networks (GNNs) across distinct molecular domains and introduces Feature-Structuralization—a method to turn categorical node features into graph topology so models can learn feature interactions without losing cross-dataset generality. The authors show that while pretrained structural representations can boost downstream generalization, their utility strongly depends on downstream data volume and structural/feature alignment.

What Problem Does This Paper Address?

Foundation models excel in vision and NLP because tokenized text and image patches provide universally compatible input representations. In graph machine learning, building generalist models remains an open challenge: graphs from different domains not only exhibit vastly divergent topological structures (e.g., small cyclic molecules vs. long amino acid chains) but also feature entirely incompatible node and edge feature spaces.

Recent efforts like GPSE (Graph Positional and Structural Encoder) sidestep this by training expressive GNNs purely on graph topology to predict mathematical positional and structural encodings (P/SEs). However, ignoring node attributes throws away critical information. The authors investigate:

  1. Can pretrained structural embeddings actually help in downstream, data-scarce regimes?
  2. How does the composition of the pretraining corpus affect transfer?
  3. Can we incorporate node features during pretraining without breaking dataset-agnostic transferability?

Methods

  • Base Framework (GPSE): The backbone is a 20-layer Residual Gated GCN (~2M parameters) pretrained to predict mathematical graph invariants: Laplacian eigenvectors/eigenvalues, random walk structural encodings, electrostatic potentials, and heat kernel diagonals.
  • Feature-Structuralization: To process categorical features without tying the model to specific feature tables or dimensions, the authors convert feature values into graph connectivity. For every categorical channel $i$ and value $j$, an auxiliary "feature-node" $u_{i,j}$ is instantiated and connected to every original graph node exhibiting that attribute. All explicit raw features are discarded; nodes retain only a single binary mark indicating whether they are an original node or an auxiliary feature node.
  • Downstream Adaptation: Pretrained representations are linearly mapped and summed with downstream task-specific feature embeddings, then fed into a lightweight 3-layer Graph Isomorphism Network (GIN). Only the downstream adapter and GIN are fine-tuned.
Original Graph (features as colors)  -->  Structuralized Graph (features as nodes)
     (A)---(B)                                (A)-------(B)
      |     |                                  \  \     /  /
     (C)---(D)                                  \  (F1)(F2)
                                                (Original nodes connect to
                                                 shared feature nodes)

Datasets

The authors evaluate three standard molecular benchmarks exhibiting varying degrees of structural and feature similarity (no new benchmarks are introduced):

  • ZINC-12k: ~12,000 small molecules with a single categorical feature channel (atom type).
  • ogbg-molpcba: ~438k small molecules (downsampled to ~12k–15k for pretraining balance) with 9 SMILES-derived categorical node features.
  • peptides-func: ~15,535 long-range peptide chains. These share the identical 9 categorical feature types with molpcba, but possess vastly different macromolecular chain topologies compared to small molecules.

Key Insights and Ideas

  • Pretraining embeddings can hurt in ultra-low-data regimes: Counter to the typical foundation model narrative, frozen pretrained representations do not automatically save extreme data-scarcity settings. On peptides at a 10% downstream training split, adding pretrained embeddings degraded performance compared to the scratch baseline, likely because downstream adapters overfit to spurious patterns before learning proper task alignment.
  • Corpus composition matters more than sheer size: Pretraining on molpcba transfers reasonably well to peptides (which share identical feature schemas), but transferring peptides or molpcba representations to ZINC is significantly less effective due to conflicting feature encodings and divergent graph diameter/cyclicity.
  • Structuralization is effective—when feature spaces align: Feature-structuralization consistently beats vanilla GPSE when pretraining in-distribution (e.g., ZINC $\to$ ZINC, peptides $\to$ peptides). It also succeeds under structural shifts if the feature definitions align (e.g., pretraining on zinc + molpcba transferring to peptides). However, when applied across conflicting feature spaces (e.g., molpcba to ZINC), structuralization degrades transfer.

Key Results

  • P/SE Prediction: Models trained purely on small molecules (zinc or molpcba) achieve near-chance $R^2$ (-0.16 to -0.35) when predicting Laplacian eigenvectors on peptides. Multi-dataset mixtures (molpcba + peptides) restore generalization ($R^2 \approx 0.64$).
  • Downstream Transfer on ZINC: At 25% downstream training data, pretrained GPSE representations reduce Test MAE from ~0.50 (baseline from scratch) to ~0.27.
  • Downstream Transfer on Peptides: At 50% training fraction, the baseline achieves ~0.47 Average Precision (AP). Models pretrained on multi-dataset mixtures with structuralization boost performance past 0.50 AP. Scaling the molpcba pretraining corpus from 10k graphs to the full ~438k dataset increases peptides downstream AP to $0.513 \pm 0.002$.

Limitations and Future Work

  • Categorical Feature Boundary: Structuralization currently applies naturally only to discrete categorical attributes; continuous attributes (e.g., 3D coordinates, physical constants) cannot be directly mapped without discretization.
  • Target Difficulty: Structuralized graphs have larger diameters and bipartite-like connections, making certain targets (like heat kernel diagonals and eigenvalues) noticeably harder for message-passing networks to fit ($R^2 \approx 0$).
  • Domain Scope: The study is restricted to molecular graphs. Evaluating whether these conclusions hold across web graphs, citation networks, or social collaboration networks remains unexplored.

Summary updated

BibTeX
@inproceedings{frasca2024towards,
  author = {Fabrizio Frasca and Fabian Jogl and Moshe Eliasof and Matan Ostrovsky and Carola-Bibiane Schönlieb and Thomas Gärtner and Haggai Maron},
  title = {{Towards Foundation Models on Graphs: An Analysis on Cross-Dataset Transfer of Pretrained GNNs}},
  booktitle = {NeurReps @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=URMPK7Yp9Y},
}
Figure