Generative-Contrastive Heterogeneous Graph Neural Network

Yu Wang, Lei Sang, Yi Zhang, Xindong Wu

TL;DR

GC-HGNN introduces a novel self-supervised framework for Heterogeneous Graphs (HGs) that elegantly fuses generative and contrastive learning. By utilizing a feature-reconstructing masked autoencoder alongside hierarchical contrastive learning, the model captures both local and global graph semantics without disrupting the underlying graph topology.

What Problem Does This Paper Address?

Many real-world systems—like citation networks, social networks, and recommendation engines—are best modeled as Heterogeneous Graphs (HGs), which contain multiple types of nodes and edges. To learn from these graphs without relying on expensive manual labels, researchers frequently turn to self-supervised Contrastive Learning (CL).

However, standard CL paradigms face a major bottleneck when applied to graphs: data augmentation. Typical augmentation strategies rely on randomly dropping nodes or edges to create different "views" of the graph. On an HG, this structural disruption can destroy vital topological integrity and create highly unbalanced training signals. Furthermore, existing contrastive discriminators suffer from sampling bias (frequently selecting false negatives) and tend to overemphasize high-order relationships (meta-paths) while completely ignoring crucial local, one-hop neighborhood information.

The contrastive learning paradigm vs. the proposed generative-contrastive paradigm.

Methods

The authors propose GC-HGNN (Generative-Contrastive Heterogeneous Graph Neural Network) to solve these limitations through a multi-view architecture:

  1. Network Schema View (Local Structure): This component focuses on the immediate, one-hop neighbors of a target node. It projects different node types into a shared space and uses an attention mechanism to aggregate local neighborhood features.
  2. Meta-path View with Generative Learning (Global Structure): Instead of altering the graph's structure, GC-HGNN uses a Masked Autoencoder (MAE). It applies uniform random sampling to mask the features of a subset of nodes, leaving the graph topology intact. A GNN encoder-decoder structure then attempts to reconstruct these missing features using Mean Squared Error (MSE) loss.
  3. Hierarchical Contrastive Learning (HCL): To align these views, the model introduces a two-tier contrastive discriminator:
  4. Intra-contrast: Aligns and regulates consistency across different meta-path views using Scaled Cosine Error (SCE) to focus on hard samples.
  5. Inter-contrast: Contrasts the local network schema view against the global meta-path view, forcing the model to reconcile local and higher-order structures.
  6. Hard Sampling Strategy: To mitigate sampling bias, the model uses a dual strategy to find high-quality positive samples: Location-aware sampling (using pre-trained metapath2vec embeddings to find structurally close nodes) and Semantic-aware sampling (identifying nodes connected via multiple meta-paths).

Datasets

The model was comprehensively evaluated across eight real-world datasets split by downstream tasks:

  • Node Classification: ACM (papers, authors, subjects), DBLP (authors, papers), Aminer (papers, authors, references), and Freebase (movies, actors, directors, writers).
  • Link Prediction (Recommendation): Last.fm (user-artist), Yelp (user-business), Douban Movie (user-movie), and Douban Book (user-book).

Key Insights and Ideas

  • Feature Masking > Edge Dropping: Masking node features rather than dropping edges preserves the structural integrity of the graph. The game between generation and contrastive learning forces the model to learn the true underlying data distribution rather than memorizing individual samples.
  • The Clustering-Uniformity Balance: Visualization via t-SNE reveals that generative learning excels at creating tight, distinct clusters, while contrastive learning ensures an even, uniform distribution in the embedding space. Combining them yields highly discriminative yet well-generalized representations.
  • Local-Global Alignment is Key: Ablation studies highlighted that the INTER loss (contrasting local one-hop schema with global meta-paths) serves as the principal driver for performance, proving that cross-scale semantic alignment is vital for HGs.

Key Results

GC-HGNN was pitted against 17 baseline models (including strong self-supervised methods like HeCo and HGMAE) and demonstrated superior performance across the board:

  • Node Classification: Achieved the highest Macro-F1 and Micro-F1 scores across all four datasets. For instance, on the ACM dataset, GC-HGNN achieved a 90.54% Macro-F1, outperforming the generative baseline HGMAE (89.29%).
  • Link Prediction: Achieved significant boosts in Recall@20 and NDCG@20, showing an overall improvement of over 3% compared to the strongest baselines. Notably, on the Douban-Book dataset, it achieved an 11.11% relative improvement in Recall@20 over the next best model.
  • Efficiency: Due to optimized modules and direct edge encoding, GC-HGNN boasts a significantly lower time complexity per epoch compared to its closest competitors, making it highly scalable.

Limitations and Future Work

The authors note that the generative learning loss ($\lambda_{Gen}$) must be carefully balanced; setting its weight too high causes a decline in downstream performance metrics. This indicates that within this specific architecture, generative learning functions best in an auxiliary role to support the contrastive discriminator, rather than as the primary objective.

Specific avenues for future work are not extensively detailed in the paper, though the framework lays a solid foundation for exploring generative-contrastive paradigms on more complex, dynamic, or large-scale heterogeneous networks.

Summary updated

BibTeX
@article{wang2024generative,
  author = {Yu Wang and Lei Sang and Yi Zhang and Yiwen Zhang and Xindong Wu},
  title = {{Generative-Contrastive Heterogeneous Graph Neural Network}},
  journal = {IEEE Trans. big Data},
  year = {2024},
}
Figure