Leveraging Invariant Principle for Heterophilic Graph Structure Distribution Shifts

Jinluan Yang, Zhengyu Chen, Teng Xiao, Wenqiao Zhang, Yong Lin, Kun Kuang

TL;DR

Graph Neural Networks (GNNs) often suffer severe performance drops when the structural patterns—specifically the mix of similar (homophilic) and dissimilar (heterophilic) neighbor connections—change between training and testing data. This paper introduces HEI, a framework that tackles this "Heterophilic Graph Structure distribution Shift" (HGSS) by directly inferring latent structural environments from a node's local neighbor patterns without relying on flawed graph augmentation techniques. By enforcing an invariance penalty across these inferred environments, HEI learns robust node representations that generalize significantly better to unseen graph structures.

What Problem Does This Paper Address?

Traditional Graph Neural Networks assume homophily, meaning connected nodes tend to share the same labels or features. While recent Heterophilic GNNs (HGNNs) are designed to handle graphs where connected nodes are different, they still operate under a critical assumption: that the training and testing nodes share the exact same distribution of structural patterns.

The authors identify a major unaddressed challenge called Heterophilic Graph Structure distribution Shift (HGSS). Real-world graphs are a messy mixture of locally homophilic and heterophilic pockets. If a model is trained on nodes that happen to reside in mostly homophilic neighborhoods but is evaluated on nodes in highly heterophilic neighborhoods, its performance plummets.

Prior attempts to solve graph distribution shifts rely on data augmentation (like randomly dropping or adding edges). However, the authors demonstrate that these random modifications fail to alter the underlying local neighbor pattern distribution—a heterophilic neighborhood remains fundamentally heterophilic even with a few missing edges.

Figure 1: (a) illustrates the heterophilic graph structure distribution shifts (HGSS), where the figure and histogram show the HGSS and neighbor pattern (measured by node homophily) difference between train and test nodes on the Squirrel dataset; (b) displays the comparison of different environment construction strategies between previous invariant learning works and ours from augmentation; (c) shows that the environment construction of previous methods may be ineffective in addressing the HGSS due to the unchanged neighbor pattern distribution. The experimental results between traditional and graph-based invariant learning methods can support our analysis and verify the superiority of our proposed HEI.

Methods

To overcome the limitations of data augmentation, the authors propose HEI (Heterophily-Guided Environment Inference). Instead of generating artificial graphs, HEI infers latent environments directly from a single input graph using a three-step process:

  1. Neighbor Pattern Estimation: Because neighbor labels are unavailable during training, HEI uses unsupervised node feature similarity metrics (such as SimRank or Local Similarity) to estimate each node's local structural pattern ($z_v$).
  2. Adaptive Environment Construction: An environment classifier (a two-layer MLP) takes these estimated neighbor patterns and assigns nodes into $K$ distinct latent environments. The optimization objective maximizes the variance of risks across these environments to deliberately expose unstable, spurious correlations.
  3. Invariance Penalty Learning: HEI utilizes a shared GNN feature encoder alongside a set of environment-dependent classifiers. It introduces an invariance penalty that minimizes the performance gap between the base classifier and the environment-specific classifiers. This forces the encoder to discard fragile structural features and retain only invariant, generalizable representations.
Figure 2: Illustrations of our framework HEI. (a) The neighbor pattern for each train node can be estimated by similarity first and then used for inferring environments without augmentation; (b) Based on the train nodes belonging to different inferred environments, we can train a set of environment-independent GNN classifiers with the shared encoder compared with the base GNN. The shared encoder outputs the representations of nodes in each environment and then forwards them to the base GNN classifier and the environment-independent classifier respectively. By calculating the loss gap between these two different classifiers, an invariance penalty is introduced to improve model generalization.

Datasets

The framework was evaluated using two state-of-the-art backbones (LINKX and GloGNN++) across six heterophilic graph benchmarks:

  • Chameleon-filter
  • Squirrel-filter
  • Actor
  • Penn94
  • arxiv-year
  • twitch-gamer

To explicitly test for HGSS, the authors sorted and split the test sets into "High Hom Test" and "Low Hom Test" groups based on node-level homophily. They also introduced a severe Simulation Setting, where models were trained exclusively on low-homophily nodes and tested on high-homophily nodes (and vice versa).

Key Insights and Ideas

  • Augmentation is Blind to Structure Shifts: Random edge masking does not change a node's structural neighborhood profile. Explicit graph augmentation is an ineffective proxy for creating diverse structural environments.
  • A Single Graph Contains Multiple Environments: Instead of treating an entire graph as a single environment, HEI recognizes that a single heterophilic graph naturally contains a mixture of distinct local structural environments.
  • Similarity as a Structural Proxy: The authors provide theoretical proof that unsupervised node feature similarity (particularly SimRank) can effectively approximate structural homophily without requiring ground-truth labels during training.

Key Results

  • The Reality of HGSS: Under standard settings, baseline models showed massive performance gaps (up to 30% accuracy differences) between high-homophily and low-homophily test nodes, validating the authors' claim that structure shifts heavily impact GNNs.
  • Superior Generalization: HEI consistently outperformed strong invariant learning and reweighting baselines (such as EERM, FLOOD, and GDN).
  • Robustness Under Severe Shifts: In the simulation settings featuring extreme distribution shifts, HEI outperformed competing methods by a striking 5 to 10 accuracy points on average.
  • Low Overhead: Efficiency testing revealed that HEI adds negligible computational overhead, requiring only a few extra seconds to converge compared to standard empirical risk minimization (ERM) training.

Limitations and Future Work

The success of HEI depends heavily on the initial similarity metric used to estimate neighbor patterns. If a dataset features highly noisy or uninformative node features, the unsupervised similarity metrics might fail to accurately capture the underlying structural heterophily.

The authors suggest that future research could focus on developing more dynamic, learnable neighbor pattern estimators rather than relying on fixed, predefined similarity metrics. Additionally, extending this invariant learning principle to graph-level classification and dynamic, time-evolving graphs remains an open and promising direction.

Summary updated

Abstract

Heterophilic Graph Neural Networks (HGNNs) have shown promising results for semi-supervised learning tasks on graphs. Notably, most real-world heterophilic graphs are composed of a mixture of nodes with different neighbor patterns, exhibiting local node-level homophilic and heterophilic structures. However, existing works are only devoted to designing better HGNN backbones or architectures for node classification tasks on heterophilic and homophilic graph benchmarks simultaneously, and their analyses of HGNN performance with respect to nodes are only based on the determined data distribution without exploring the effect caused by this structural difference between training and testing nodes. How to learn invariant node representations on heterophilic graphs to handle this structure difference or distribution shifts remains unexplored. In this paper, we first discuss the limitations of previous graph-based invariant learning methods from the perspective of data augmentation. Then, we propose \textbf{HEI}, a framework capable of generating invariant node representations through incorporating heterophily information to infer latent environments without augmentation, which are then used for invariant prediction, under heterophilic graph structure distribution shifts. We theoretically show that our proposed method can achieve guaranteed performance under heterophilic graph structure distribution shifts. Extensive experiments on various benchmarks and backbones can also demonstrate the effectiveness of our method compared with existing state-of-the-art baselines. The code is available at https://github.com/Yangjinluan/HEI
BibTeX
@inproceedings{yang2024leveraging,
  author = {Jinluan Yang and Zhengyu Chen and Teng Xiao and Wenqiao Zhang and Yong Lin and Kun Kuang},
  title = {{Leveraging Invariant Principle for Heterophilic Graph Structure Distribution Shifts}},
  booktitle = {The Web Conference},
  year = {2024},
}
Figure