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

Beyond Message Passing: Neural Graph Pattern Machine

Zehong Wang, Zheyuan Zhang, Tianyi Ma, Nitesh V Chawla, Chuxu Zhang, Yanfang Ye

TL;DR

The Neural Graph Pattern Machine (GPM) is a novel framework that moves beyond the standard message-passing paradigm by learning directly from graph substructures. By combining random-walk-based tokenization with a Transformer-based importance identifier, GPM achieves state-of-the-art performance across diverse graph tasks while offering superior scalability, out-of-distribution generalization, and interpretability.

What Problem Does This Paper Address?

Most modern Graph Neural Networks (GNNs) rely on message passing (MP), where nodes iteratively aggregate information from their immediate neighbors. While successful, this paradigm has three fundamental flaws:

  1. Expressiveness Bottleneck: Message passing is theoretically limited by the 1-dimensional Weisfeiler-Leman (1-WL) test. This means standard GNNs struggle to distinguish or count basic motifs like triangles, rings, or cliques—structures that are chemically or socially vital.
  2. Over-squashing: As information travels across many "hops" in a large graph, it often gets compressed or lost, making it difficult for GNNs to model long-range dependencies.
  3. Scalability and Interpretability: The iterative nature of MP makes it difficult to distribute across multiple GPUs and often results in "black box" representations where it is unclear which specific substructures drove a prediction.

Methods: A Substructure-First Approach

GPM bypasses message passing entirely, treating a graph more like a collection of "tokens" (substructures) rather than a web of messages. The workflow consists of three main stages:

  1. Pattern Sampler (Tokenization): Instead of aggregating neighbors, GPM uses random walks to sample graph patterns. This allows the model to capture both local motifs and long-range connections efficiently.
  2. Pattern Encoder: This is the core innovation. Each sampled walk is split into two components:
  3. Semantic Path: Captures the actual features of the nodes and edges in the walk.
  4. Anonymous Path: Captures the topology (the "shape") of the walk by using relative positions rather than node IDs. Combining these two paths uniquely identifies a graph pattern, allowing the model to recognize structural motifs regardless of where they appear.

  5. Important Pattern Identifier: Not all sampled patterns are useful. GPM feeds the encoded patterns into a Transformer Encoder. Using a specialized [class] token and self-attention, the model learns to prioritize task-relevant patterns (like a benzene ring in a molecule) while ignoring noisy or redundant ones.

Detailed overview of the GPM architecture, including tokenization via random walks and dual pattern encoding.

Key Insights and Ideas

  • Patterns > Messages: By directly modeling substructures, GPM naturally captures higher-order information that message-passing GNNs miss. It successfully distinguishes non-isomorphic graphs that are indistinguishable to 3-WL tests.
  • The Power of Anonymity: Using "anonymous paths" allows the model to learn structural motifs (like stars or cycles) that generalize across different parts of a graph or even different graphs entirely.
  • Transformer Scalability: Because GPM uses a Transformer backbone over sampled patterns rather than iterative neighborhood aggregation, it is much easier to scale. It avoids the communication bottlenecks that typically plague message-passing GNNs.

Key Results

The authors evaluated GPM across a massive suite of benchmarks, including large-scale node classification (ogbn-products, Arxiv), link prediction, and graph classification (ZINC, IMDB-B).

  • State-of-the-Art Performance: GPM consistently outperformed both traditional GNNs (GCN, GAT) and modern Graph Transformers (GraphGPS, SAN) across almost all datasets.
  • Solving Over-squashing: On the TREENEIGHBORSMATCHING benchmark—a task specifically designed to test long-range dependencies—GPM achieved perfect accuracy up to a radius of 7, while message-passing methods failed as early as radius 4.
  • Robustness: In out-of-distribution (OOD) tests, GPM showed significantly higher accuracy than standard GNNs, suggesting that the patterns it learns are more "universal" than local neighborhood aggregations.
  • Interpretability: By analyzing attention scores, the authors could visualize the most important patterns for specific nodes. For example, in molecular graphs, GPM correctly identified rings and star-shaped structures as the most critical features for prediction.
Scalability analysis showing GPM's performance compared to standard GNNs as model parameters increase.

Limitations and Future Work

The authors identify a few areas for improvement:

  • Sampling Dependency: GPM’s performance is tied to the quality of the random walk sampling. If a critical motif isn't sampled, the model can't "see" it. Future work could involve adaptive sampling strategies.
  • Supervised Constraint: The current implementation is primarily supervised. Extending GPM to self-supervised or unsupervised pre-training (similar to BERT or GPT for graphs) is a promising next step.
  • Complexity: While scalable, the quadratic complexity of the self-attention mechanism relative to the number of sampled patterns could be a hurdle for extremely dense pattern sets.

Summary updated

BibTeX
@inproceedings{wang2025beyond,
  author = {Zehong Wang and Zheyuan Zhang and Tianyi Ma and Nitesh V Chawla and Chuxu Zhang and Yanfang Ye},
  title = {{Beyond Message Passing: Neural Graph Pattern Machine}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=bKkCyPzD5P},
}
Figure