HarmonyGNNs: Harmonizing Heterophily and Homophily in GNNs via Self-Supervised Node Encoding

Rui Xue, Tianfu WuICLR 2026

TL;DR

HarmonyGNNs is a new self-supervised learning (SSL) framework that solves a long-standing "identity crisis" in Graph Neural Networks: the struggle to handle both homophily (where neighbors are similar) and heterophily (where neighbors are different). By combining a teacher-student predictive architecture with a novel weighted encoding scheme, it achieves state-of-the-art performance on heterophilic graphs (up to +9.6% improvement) while remaining highly efficient.

What Problem Does This Paper Address?

Most Graph Neural Networks (GNNs) are built on the "homophily assumption"—the idea that connected nodes likely share the same label (like friends sharing interests). Consequently, standard GNNs act as low-pass filters, smoothing features across neighbors.

Performance of standard models on homophilic vs. heterophilic graphs.

However, many real-world graphs are heterophilic, meaning "opposites attract" (e.g., in a dating network or a chemical bond). In these cases, standard smoothing actually destroys the information needed to distinguish nodes. While some supervised models handle this, doing so in a self-supervised (unlabeled) setting is incredibly difficult. Without labels, how does a model know whether to smooth features (homophily) or sharpen them (heterophily)? Existing SSL methods often collapse into one mode or the other, or they rely on complex, computationally expensive data augmentations.

Methods

The authors introduce two core innovations to achieve "harmony":

The HarmonyGNNs architecture featuring a teacher-student setup and Joint Structural Node Encoding.

1. Representation Harmonization (Joint Structural Node Encoding)

Instead of a single encoding, the model generates four distinct "tokens" for every node: a linear projection, an MLP projection (capturing node-specific features), and two outputs from a new Weighted GCN (WGCN).

  • The WGCN adaptively learns edge weights, allowing the model to decide on-the-fly whether to aggregate or differentiate neighbor information.
  • These tokens are fused using a Transformer block with feature-level attention. Crucially, the attention happens within the node's feature set, not across all nodes, keeping the complexity linear $O(N)$ rather than quadratic $O(N^2)$.

2. Objective Harmonization (Predictive Architecture with Dynamic Masking)

The framework uses a Teacher-Student setup (similar to I-JEPA). The student sees a masked version of the graph and tries to predict the latent embeddings generated by the teacher (which sees the full graph).

  • Node-Difficulty-Aware Masking: Instead of masking nodes at random, the authors propose two dynamic strategies (+Diffi and +Prob) that prioritize masking "hard" nodes—those where the student's current prediction differs most from the teacher's. This forces the model to learn more robust structural patterns.

Datasets

The model was evaluated on a comprehensive suite of 11 benchmarks:

  • Homophilic Graphs: Cora, CiteSeer, PubMed, and ogbn-Arxiv.
  • Heterophilic Graphs: Cornell, Texas, Wisconsin, Actor, Chameleon (filtered), Squirrel (filtered), and Roman-Empire.
  • Note: The authors specifically used "filtered" versions of Chameleon and Squirrel to avoid the data leakage issues (duplicate nodes) that have plagued previous GNN research.

Key Insights and Ideas

  • Latent Prediction > Raw Reconstruction: Most generative SSL models try to reconstruct raw input features. The authors argue this is counterproductive in heterophilic graphs because raw features are often noisy and contradictory. Predicting a stable, EMA-updated (Exponential Moving Average) teacher's latent space provides a much cleaner training signal.
  • Feature-Token Attention: By treating different encoding perspectives (linear, MLP, WGCN) as tokens for a Transformer, the model gains the adaptive power of attention without the massive memory overhead of standard Graph Transformers.
  • The "Harmony" Proof: The paper includes a theoretical analysis proving that their teacher-student objective converges faster and more stably than traditional encoder-decoder architectures because it avoids the "coupling effects" that lead to training instability.

Key Results

  • State-of-the-Art Performance: HarmonyGNNs outperformed previous SSL methods on all heterophilic datasets, with massive jumps like +7.1% on Texas and +9.6% on Roman-Empire.
  • No Trade-offs: Unlike many specialized models that excel at heterophily but fail at homophily, HarmonyGNNs matched or slightly exceeded SOTA performance on standard homophilic benchmarks like Cora and Arxiv.
  • Efficiency: Despite the sophisticated architecture, HarmonyGNNs is significantly faster to train than contrastive baselines. For example, on the Arxiv dataset, it reached convergence in 476 seconds, compared to 627s for MUSE and 738s for GREET, while using less GPU memory.

Limitations and Future Work

  • Hyperparameter Sensitivity: The "exploitation ratio" ($r$) in the dynamic masking strategy requires tuning per dataset to balance exploration (random masking) and exploitation (hard-node masking).
  • Architecture Overhead: While computationally efficient, the teacher-student setup effectively doubles the model's parameter count in memory (though only the student is updated via backpropagation).
  • Future Directions: The authors suggest exploring how this "harmonization" approach could be applied to other graph tasks like link prediction or graph-level classification, and testing its scalability on even larger industrial-scale graphs.

Summary updated

BibTeX
@inproceedings{xue2026harmonygnns,
  author = {Rui Xue and Tianfu Wu},
  title = {{HarmonyGNNs: Harmonizing Heterophily and Homophily in GNNs via Self-Supervised Node Encoding}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=mGxtoQY3GA},
}
Figure