NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Generative Graph Pattern Machine

Zehong Wang, Zheyuan Zhang, Tianyi Ma, Chuxu Zhang, Yanfang Ye

Abstract

Graph neural networks (GNNs) have been predominantly driven by message-passing, where node representations are iteratively updated via local neighborhood aggregation. Despite their success, message-passing suffers from fundamental limitations—including constrained expressiveness, over-smoothing, over-squashing, and limited capacity to model long-range dependencies. These issues hinder scalability: increasing data size or model size often fails to yield improved performance. To this end, we explore pathways beyond message-passing and introduce Generative Graph Pattern Machine ($G^2PM$), a generative Transformer pre-training framework for graphs. $G^2PM$ represents graph instances (nodes, edges, or entire graphs) as sequences of substructures, and employs generative pre-training over the sequences to learn generalizable and transferable representations. Empirically, $G^2PM$ demonstrates strong scalability: on the ogbn-arxiv benchmark, it continues to improve with model sizes up to 60M parameters, outperforming prior generative approaches that plateau at significantly smaller scales (e.g., 3M). In addition, we systematically analyze the model design space, highlighting key architectural choices that contribute to its scalability and generalization. Across diverse tasks—including node/link/graph classification, transfer learning, and cross-graph pretraining—$G^2PM$ consistently outperforms strong baselines, establishing a compelling foundation for scalable graph learning.

Introduction: The Scalability Wall in Graph Learning

In the realms of Natural Language Processing (NLP) and Computer Vision, Transformer-based foundation models (like LLMs and ViTs) have proven that generative pre-training scales brilliantly with more data and larger models. However, the graph machine learning domain has struggled to replicate this success.

Most graph models rely on Message-Passing Neural Networks (MPNNs), which suffer from fundamental flaws: over-smoothing (where node representations become indistinguishable), over-squashing (bottlenecks in information flow), and an inability to capture long-range dependencies. Consequently, throwing more parameters or data at an MPNN often yields diminishing returns. Furthermore, applying standard Transformers directly to graphs is computationally expensive, as treating every node as a token results in quadratic complexity. The authors of $G^2PM$ tackle this gap by defining sequences of high-level semantic tokens for graphs to enable scalable, pure-Transformer generative pre-training.

Methodology: From Message-Passing to Pattern Sequences

To bypass the limitations of message-passing, the proposed $G^2PM$ framework treats graphs similarly to text or images by tokenizing them into structural patterns.

Comparison of generative modeling paradigms across text, vision, and the proposed graph substructure sequence approach.

The Tokenization Pipeline

Instead of using individual nodes or running expensive subgraph isomorphism algorithms, $G^2PM$ uses a Random Walk Tokenizer to sample "substructures" on the fly. Each walk becomes a token, capturing local structural inductive biases much better than individual nodes. These random walks are then processed by a Substructure Encoder, where each walk (a sequence of nodes) is encoded into a single embedding using a small Transformer. Interestingly, the authors found that positional embeddings were unnecessary for this specific encoding step.

Generative Pre-training

The core of the learning process is Masked Substructure Modeling (MSM). Inspired by Masked Autoencoders (MAE) in vision, $G^2PM$ randomly masks a large portion of these substructure tokens (often 70-80%). A Transformer encoder processes the visible tokens, and a shallow decoder attempts to reconstruct the masked ones.

Crucially, rather than forcing the model to reconstruct raw, low-level node features, $G^2PM$ uses Semantic Targets. It employs an Exponential Moving Average (EMA) version of the encoder to generate high-level semantic targets for the masked tokens. Because graphs lack a natural, discrete vocabulary, using a slow-moving teacher model to provide semantic targets forces the network to learn meaningful abstractions rather than memorizing local noise.

Experimental Evaluation and Scalability

The authors evaluated $G^2PM$ across a massive suite of benchmarks, including node classification (homophily and heterophily), link prediction, and graph classification for molecular and social networks.

Breaking the Scaling Bottleneck

Unlike previous generative graph models that plateau or degrade around 3M parameters, $G^2PM$ exhibits clear scaling laws. On the ogbn-arxiv benchmark, $G^2PM$ achieved 72.31% accuracy with a 60M parameter model, easily surpassing current state-of-the-art generative pre-training methods that fail to scale past a few million parameters.

Downstream Performance

  • Node Classification: $G^2PM$ ranked 1st among all self-supervised methods across 7 homophily node classification datasets. It showed particularly strong gains on the massive ogbn-products dataset (80.56% accuracy).
  • Link & Graph Classification: The model set a new SOTA for link prediction on ogbl-collab (47.1% Hit@50) and consistently beat contrastive and generative baselines on 7 different graph classification benchmarks.
  • Cross-Domain Transfer: $G^2PM$ successfully transferred learned representations across wildly different domains—such as pre-training on an academic network (Arxiv) and fine-tuning on a molecular graph (HIV)—a feat where message-passing models usually fail due to their over-sensitivity to local structural shifts.

Discussion and Future Directions

While $G^2PM$ represents a significant step forward, several avenues for future work remain. Currently, the random walk tokens are treated as an unordered set, which restricts the model to masked-token prediction (similar to BERT). Extending this to ordered sequences could enable autoregressive next-token prediction (similar to GPT), potentially unlocking even greater scalability. Additionally, while random walks are efficient, they are a heuristic; future research could explore learnable, adaptive substructure tokenizers that intelligently parse a graph into its most meaningful semantic components.

Summary updated

BibTeX
@inproceedings{wang2025generative,
  author = {Zehong Wang and Zheyuan Zhang and Tianyi Ma and Chuxu Zhang and Yanfang Ye},
  title = {{Generative Graph Pattern Machine}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=tdMWo3jB21},
}
Figure