Diagnosing Graph Neural Networks: Do They Operate in the Feature Learning Regime and How?
Abstract
The generalization of Graph Neural Networks (GNNs) to other datasets is critical for the development of Graph Foundation Models (GFMs). Yet, unlike many foundation models in vision and language, GNNs can frequently achieve high test accuracy on the same dataset yet generalize poorly to other datasets, with performance brittle to data splits, distribution shifts, and evaluation protocols. These behaviors are consistent with kernel-like dynamics, where training is well-approximated by a linearization around initialization and internal representations change only weakly. By contrast, strong generalization is typically associated with feature learning, where internal representations change substantially to learn generalizable patterns from data. Despite broad recognition of the GNN generalization issues, it remains unclear to what extent GNNs exhibit feature learning and which architectural choices most effectively promote it. To address these gaps, we propose a theoretically grounded and practical diagnostic framework that evaluates GNN generalization across datasets via feature learning and provides actionable guidance for future GNN and GFM design. Using this framework, we study over ten models and datasets and show that data format and model architecture influence how easily GNNs operate in the feature learning regime. In particular, we find that most classic GNNs struggle to work in this regime. On the data side, representing regular data as graphs makes it harder to operate in this regime. On the model side, most message-passing architectures rarely succeed. In contrast, graph transformers work in this regime more effectively.