Abstract
Heterogeneous graph neural networks (HGNNs) have been widely applied in heterogeneous information network tasks, while most HGNNs suffer from poor scalability or weak representation when they are applied to large-scale heterogeneous graphs. To address these problems, we propose a novel Relation-aware Heterogeneous Graph Neural Network with Contrastive Learning (RHCO) for large-scale heterogeneous graph representation learning. Unlike traditional heterogeneous graph neural networks, we adopt the contrastive learning mechanism to deal with the complex heterogeneity of large-scale heterogeneous graphs. We first learn relation-aware node embeddings under the network schema view. Then we propose a novel positive sample selection strategy to choose meaningful positive samples. After learning node embeddings under the positive sample graph view, we perform a cross-view contrastive learning to obtain the final node representations. Moreover, we adopt the label smoothing technique to boost the performance of RHCO. Extensive experiments on three large-scale academic heterogeneous graph datasets show that RHCO achieves best performance over the state-of-the-art models.
The Challenge of Heterogeneity and Scale
Heterogeneous Graphs (HGs) are characterized by multiple types of nodes and edges, such as bibliographic networks containing authors, papers, and fields of study. While rich in semantic information, modeling these graphs at scale presents significant challenges.
Current Heterogeneous Graph Neural Networks (HGNNs) typically face two primary hurdles:
- Poor Scalability: Many models rely on "metapaths"—pre-defined sequences of node types—to capture high-order semantics. In large-scale graphs, the number of neighbors reachable via these paths grows exponentially, leading to prohibitive computational costs.
- Weak Representation: Most existing models operate within a single "view" (either local structure or specific metapaths), often failing to capture the full spectrum of local and high-order semantic information simultaneously.
To overcome these, RHCO introduces a relation-aware approach that decomposes the complex heterogeneous graph into simpler relation-specific bipartite structures, allowing for more efficient and expressive representation learning.
The RHCO Framework
The RHCO framework utilizes a dual-view architecture designed to capture both local structural details and broader semantic context through contrastive learning.
1. Network Schema Encoder (Local View)
This encoder captures the immediate neighborhood structure. It is "relation-aware," utilizing specific relation vectors within its attention mechanism to weigh the importance of different types of connections. Unlike standard GNNs that treat all edges of a certain type identically, RHCO’s use of relation-specific transformation matrices allows it to distinguish between the subtle roles different connections play (e.g., an author "writing" a paper vs. a paper "having" a field).
2. Positive Sample Graph Encoder (Semantic View)
To capture high-order relationships without the exponential cost of metapaths, RHCO introduces a novel Positive Sample Selection Strategy. Instead of exhaustive path-finding, the model uses attention weights from a lightweight pre-trained model to identify the most "essential" neighbors for a target node. This allows the construction of a simplified "positive sample graph" in linear time, turning a combinatorial problem into a scalable one.
3. Cross-View Contrastive Learning
The core of RHCO is its cross-view contrastive learning mechanism. The model is trained to maximize the similarity between representations of the same node across the Network Schema View and the Positive Sample Graph View. This forces the network to reconcile local structural details with broader semantic context, acting as a bridge that allows these two signals to supervise each other.
4. Label Smoothing and Refinement
Finally, the model employs a label propagation technique (C&S) and label smoothing to refine node classifications. This ensures that neighboring nodes in the graph maintain consistent labels, further boosting performance.
Experimental Evaluation
RHCO was evaluated on three massive, real-world academic datasets:
- ogbn-mag: A Microsoft Academic Graph subset (~1.9 million nodes).
- oag-venue: A Computer Science domain network (~4.2 million nodes).
- oag-field: A network labeled by 41 distinct fields of study.
Key Results
RHCO consistently outperformed state-of-the-art models like HGT, R-HGNN, and HGConv:
- Accuracy Boost: On the
ogbn-magdataset, RHCO achieved an accuracy of 0.5662, a significant improvement over the previous best baseline, R-HGNN (0.5201). - Macro-F1 Gains: The model demonstrated superior performance in handling class imbalances across all datasets.
- Visualization: t-SNE plots revealed that RHCO produces tighter, more distinct clusters with clearer boundaries between classes compared to traditional methods like R-GCN or HGT.
Conclusion and Future Work
RHCO demonstrates that using attention as a scalability tool—specifically for pruning the search space for positive samples—is highly effective for large-scale HGs. By combining relation-aware local encoding with semantic-aware contrastive learning, it achieves a new state-of-the-art in heterogeneous graph representation.
Future work may address the dependency on pre-training quality for positive sample selection and explore the model's sensitivity to the balance between supervised and unsupervised loss components. Additionally, extending this contrastive strategy to link prediction and graph-level tasks remains an open area for exploration.
Summary updated