Beyond Message Passing: Neural Graph Pattern Machine
Zehong Wang, Zheyuan Zhang, Tianyi Ma, Nitesh V Chawla, Chuxu Zhang, Yanfang Ye
TL;DR
GPM introduces a paradigm shift from message passing to pattern-based learning by sampling graph substructures with a random-walk tokenizer, encoding semantic and anonymous path information, and aggregating dominant patterns via a transformer. By design, it improves expressivity beyond 1-WL and mitigates over-squashing, supported by empirical gains across node, link, and graph tasks and robust out-of-distribution generalization. The framework also offers interpretability through a class token that highlights influential patterns such as stars and rings in graphs. Its scalability is demonstrated on large graphs with efficient training and potential for future integration with adaptive pattern vocabularies or unsupervised learning. This approach broadens the toolbox for graph representation learning, emphasizing direct pattern-centric reasoning over neighborhood aggregation.
Abstract
Graph learning tasks often hinge on identifying key substructure patterns -- such as triadic closures in social networks or benzene rings in molecular graphs -- that underpin downstream performance. However, most existing graph neural networks (GNNs) rely on message passing, which aggregates local neighborhood information iteratively and struggles to explicitly capture such fundamental motifs, like triangles, k-cliques, and rings. This limitation hinders both expressiveness and long-range dependency modeling. In this paper, we introduce the Neural Graph Pattern Machine (GPM), a novel framework that bypasses message passing by learning directly from graph substructures. GPM efficiently extracts, encodes, and prioritizes task-relevant graph patterns, offering greater expressivity and improved ability to capture long-range dependencies. Empirical evaluations across four standard tasks -- node classification, link prediction, graph classification, and graph regression -- demonstrate that GPM outperforms state-of-the-art baselines. Further analysis reveals that GPM exhibits strong out-of-distribution generalization, desirable scalability, and enhanced interpretability. Code and datasets are available at: https://github.com/Zehong-Wang/GPM.
