Abstract
Graph Neural Networks (GNNs) are widely used for node classification tasks but often fail to generalize when training and test nodes come from different distributions, limiting their practicality. To overcome this, recent approaches adopt invariant learning techniques from the out-of-distribution (OOD) generalization field, which seek to establish stable prediction methods across environments. However, the applicability of these invariant assumptions to graph data remains unverified, and such methods often lack solid theoretical support. In this work, we introduce the Topology-Aware Dynamic Reweighting (TAR) framework, which dynamically adjusts sample weights through gradient flow in the geometric Wasserstein space during training. Instead of relying on strict invariance assumptions, we prove that our method is able to provide distributional robustness, thereby enhancing the out-of-distribution generalization performance on graph data. By leveraging the inherent graph structure, TAR effectively addresses distribution shifts. Our framework's superiority is demonstrated through standard testing on four graph OOD datasets and three class-imbalanced node classification datasets, exhibiting marked improvements over existing methods.
Introduction
Most Graph Neural Networks (GNNs) are trained under the "i.i.d. assumption"—the belief that training data and future test data come from the exact same distribution. In real-world applications, this assumption is frequently violated. For instance, a model trained on web page classification at one university may struggle when applied to another due to differences in link structures and content styles, a phenomenon known as "distribution shift."
Existing solutions often adapt "invariant learning" techniques from computer vision or natural language processing. However, these methods typically treat nodes as independent data points, neglecting the graph topology. This oversight fails to account for how connections between nodes influence information propagation and the nature of the shifts themselves. To address this, we propose Topology-Aware Dynamic Reweighting (TAR), a framework that dynamically identifies and prioritizes difficult nodes while ensuring adjustments respect the graph's underlying structure.
Methodology: Topology-Aware Dynamic Reweighting
TAR frames the training process as a "minimax" game, consisting of an inner maximization step and an outer minimization step.
The Inner Maximization (The Adversary)
During training, the model seeks a new set of weights for training samples that maximizes the classification difficulty. Unlike standard reweighting schemes, TAR utilizes Wasserstein gradient flow on the graph. This approach forces the weighting to move smoothly across edges; if a node is difficult to classify, the weights of its neighbors are also likely to be adjusted.
The Outer Minimization (The Learner)
The GNN updates its parameters to minimize loss under this "worst-case" reweighted distribution. The core of this process is the Discrete Geometric Wasserstein Distance, which measures the effort required to move "probability mass" (importance) between nodes specifically along the graph's existing edges. This ensures the reweighting is inherently "topology-aware."
Theoretical Foundation and Insights
The TAR framework is built on two key theoretical pillars:
- Distributional Robustness: As shown in Theorem 1 (visualized in the figure above), the gradient flow approach is equivalent to finding the "worst-case" distribution within a local neighborhood in the Wasserstein space. This provides a rigorous foundation for the method's ability to handle OOD data.
- Topology as a Regularizer: By constraining sample weights to "flow" through edges, the model avoids over-focusing on isolated noisy nodes. The graph structure acts as a natural filter, promoting local smoothness in how the model perceives node importance.
Furthermore, despite the mathematical complexity, the gradient flow is implemented via message passing. This ensures the method scales linearly with the number of nodes and is compatible with GPU acceleration.
Experimental Evaluation
The authors evaluated TAR across two primary challenges: OOD node classification and class-imbalanced (long-tailed) datasets.
OOD Node Classification
Using the GOOD benchmark, TAR was tested on:
- WebKB: Web pages from different universities.
- CBAS: A synthetic dataset with shifts induced by node colors.
- Twitch: A social network where shifts occur across different languages.
- Cora: A citation network with shifts based on word counts.
TAR outperformed all baselines (including IRM, Group DRO, and DANN) in 6 out of 8 experimental settings. Notably, TAR works in an unsupervised manner regarding the shift, requiring no manual "domain" or "environment" labels.
Class-Imbalanced Datasets
On modified citation datasets (Cora-LT, CiteSeer-LT, and PubMed-LT) with a 100:1 imbalance ratio, TAR showed significant improvements. For example, on PubMed-LT, TAR improved balanced accuracy (bAcc) by approximately 10% over standard Empirical Risk Minimization (ERM).
Conclusion and Future Work
TAR demonstrates that leveraging graph geometry through Wasserstein gradient flow significantly enhances GNN generalization. While effective, a current limitation is the "Connectivity Gap"—the distance between labeled nodes in sparse graphs can hinder the effectiveness of the weight "flow." Future research will explore methods to bridge these gaps without distorting the graph's natural geometry.
Summary updated