Abstract
Graph Neural Networks (GNNs) struggle to balance heterophily and homophily in representation learning, a challenge further amplified in self-supervised settings. We propose H$^3$GNNs, an end-to-end self-supervised learning framework that harmonizes both structural properties through two key innovations: (i) Joint Structural Node Encoding. We embed nodes into a unified space combining linear and non-linear feature projections with K-hop structural representations via a Weighted Graph Convolution Network(WGCN). A cross-attention mechanism enhances awareness and adaptability to heterophily and homophily. (ii) Self-Supervised Learning Using Teacher-Student Predictive Architectures with Node-Difficulty Driven Dynamic Masking Strategies. We use a teacher-student model, the student sees the masked input graph and predicts node features inferred by the teacher that sees the full input graph in the joint encoding space. To enhance learning difficulty, we introduce two novel node-predictive-difficulty-based masking strategies. Experiments on seven benchmarks (four heterophily datasets and three homophily datasets) confirm the effectiveness and efficiency of H$^3$GNNs across diverse graph types. Our H$^3$GNNs achieves overall state-of-the-art performance on the four heterophily datasets, while retaining on-par performance to previous state-of-the-art methods on the three homophily datasets.
Introduction
Most Graph Neural Networks (GNNs) are built on the fundamental assumption of homophily, where connected nodes are expected to share similar features and labels. However, many real-world graphs exhibit heterophily, where "opposites attract" (e.g., fraud networks or chemical molecules). Traditional GNNs often fail in heterophilic settings because their message-passing mechanisms effectively blur distinct features of different neighbors. Furthermore, existing self-supervised learning (SSL) methods for graphs often struggle with representation collapse or rely on complex negative sampling that is difficult to tune.
Methodology: The $H^3$GNN Framework
$H^3$GNNs (Harmonizing Heterophily and Homophily GNNs) introduces a novel architecture to address these challenges through two primary innovations.
Joint Structural Node Encoding
Instead of a single view of a node, the model creates four: a linear projection, a non-linear MLP projection, and two "Weighted Graph Convolution" (WGCN) views (1-hop and 2-hop). These WGCNs utilize learnable edge weights, allowing the model to adaptively decide per-edge whether to smooth features (low-pass filter for homophily) or preserve differences (high-pass filter for heterophily). These views are fused using a Transformer-style cross-attention mechanism to create a unified, context-aware representation.
Teacher-Student Predictive Architecture with Dynamic Masking
The framework employs a teacher-student setup where a "Student" network predicts the latent representations of a "Teacher" network (an exponential moving average of the student). While the teacher sees the full graph, the student only sees a version where some node features are masked.
A key innovation is Node-Difficulty Driven Dynamic Masking. Instead of random masking, $H^3$GNNs identifies "difficult" nodes—those where the student's prediction error is highest—and masks them more frequently. This "exploitation-exploration" strategy forces the model to work harder on the parts of the graph it understands the least, leading to more robust features.
Experimental Results
The model was evaluated on seven benchmarks, including citation networks (homophilic) and webpage/actor networks (heterophilic).
Performance and Visualization
$H^3$GNNs achieved state-of-the-art (SOTA) results on all four heterophily datasets. Notably, it outperformed the previous best model (MUSE) by over 8.4% on the Texas dataset. On homophilic datasets, it remained competitive with SOTA models specifically designed for those types of graphs, proving it truly "harmonizes" the two properties.
Efficiency
Beyond accuracy, $H^3$GNNs is highly efficient. It requires approximately half the total training time of other SOTA SSL methods like GREET and MUSE, largely because it avoids expensive alternating training strategies and utilizes a streamlined predictive task.
Conclusion
$H^3$GNNs demonstrates that by combining adaptive structural encoding with a difficulty-driven predictive task, models can effectively bridge the gap between homophilic and heterophilic graph structures. Future work will explore Graph Transformer architectures to handle even more complex, mixed structural patterns found in highly irregular datasets.
Summary updated