CHAT: Beyond Contrastive Graph Transformer for Link Prediction in Heterogeneous Networks

Shengming Zhang, Le Zhang, Jingbo Zhou, Hui XiongarXiv 2025 · DOI

Abstract

Link prediction in heterogeneous networks is challenging due to over-smoothing in Graph Neural Networks (GNNs) and the heavy reliance on manually defined meta-paths. We present CHAT (Contrastive Heterogeneous grAph Transformer), a framework that utilizes concentrated graph sampling and a connection-aware transformer to capture long-distance relationships without domain-specific templates. By treating edge sequences as primary features and employing a dual-faceted loss function, CHAT achieves state-of-the-art performance on drug-target interaction (DTI) and general heterogeneous benchmarks.

Introduction

Heterogeneous networks, which contain diverse node and edge types (e.g., drugs, proteins, and diseases), are vital for modeling complex real-world systems. However, predicting missing links in these networks faces two primary hurdles. First, traditional GNNs suffer from over-smoothing: as they aggregate information from distant neighbors, node features become indistinguishable, losing critical structural details. Second, most models depend on meta-paths—human-defined sequences of node types—which require extensive domain expertise and may overlook non-obvious patterns.

Comparison of GNN-based approaches vs. Transformers in exploring network neighborhoods.

As illustrated in Figure 1, while GNNs are often restricted to local "reachable" regions, Transformers can effectively explore long-distance neighbors without feature degradation. CHAT addresses these limitations by automating path discovery and maintaining structural context through a transformer-based architecture.

Methodology

The CHAT framework introduces several key innovations to streamline link prediction in heterogeneous environments.

The CHAT framework architecture, illustrating concentrated graph sampling and the connection-aware transformer.

Concentrated Graph Sampling and Connection Encoding

Instead of standard random walks, CHAT employs concentrated graph sampling. This technique retains only "nodes of interest" and compresses intermediate nodes into connection encodings (tuples of edge types). This transformation effectively turns long paths into rich edge features, allowing the model to learn from complex connectivity patterns without explicit meta-path definitions.

Connection-Aware Transformer

The model utilizes a transformer architecture that is explicitly aware of node interconnections. By using shortest-path distances as position encodings, CHAT preserves the network's structural topology. This ensures that the transformer treats the sequence of nodes not just as independent tokens, but as a coherent part of the graph structure.

Training and Prediction

CHAT is trained using a dual-faceted loss function:

  1. Supervised Contrastive Loss: Enhances the model's ability to distinguish between linked (positive) and unlinked (negative) node pairs.
  2. Observation Probability Loss: An attentive loss mechanism that reinforces the likelihood of observing specific network neighborhoods.

Finally, an Ensemble Link Predictor synthesizes results from multiple random-walk samplings to ensure robust predictions and reduce variance.

Experimental Evaluation

The authors evaluated CHAT across several Drug-Target Interaction (DTI) datasets: DTI-315 (small/imbalanced), DTI-708 (medium/balanced), and DTI-258K (large-scale). The model was also tested on general benchmarks like ACM, DBLP, and IMDB.

Key Results

CHAT consistently outperformed both general graph models (e.g., HAN, Metapath2vec) and specialized DTI models (e.g., EEG-DTI).

  • High Performance: On the DTI-258K dataset, CHAT achieved an AUC of 96.92% and an AUPR of 91.32%.
  • Robustness: The model maintained high precision even on the heavily imbalanced DTI-315 dataset (1:29 ratio).
  • Interpretability: Analysis of transformer attention weights revealed that the model could identify influential connection types (e.g., Target-Drug-Target), providing insights into its decision-making process.

Conclusion and Future Work

CHAT demonstrates that automating meta-path discovery through concentrated sampling and transformer architectures significantly improves link prediction. While the model is scalable, future work could address the sensitivity to sampling size and explore more sophisticated projection networks for the link predictor. Additionally, optimizing the quadratic complexity of self-attention for extremely dense sequences remains an area for further development.

Summary updated

Abstract

Link prediction in heterogeneous networks is crucial for understanding the intricacies of network structures and forecasting their future developments. Traditional methodologies often face significant obstacles, including over-smoothing-wherein the excessive aggregation of node features leads to the loss of critical structural details-and a dependency on human-defined meta-paths, which necessitate extensive domain knowledge and can be inherently restrictive. These limitations hinder the effective prediction and analysis of complex heterogeneous networks. In response to these challenges, we propose the Contrastive Heterogeneous grAph Transformer (CHAT). CHAT introduces a novel sampling-based graph transformer technique that selectively retains nodes of interest, thereby obviating the need for predefined meta-paths. The method employs an innovative connection-aware transformer to encode node sequences and their interconnections with high fidelity, guided by a dual-faceted loss function specifically designed for heterogeneous network link prediction. Additionally, CHAT incorporates an ensemble link predictor that synthesizes multiple samplings to achieve enhanced prediction accuracy. We conducted comprehensive evaluations of CHAT using three distinct drug-target interaction (DTI) datasets. The empirical results underscore CHAT's superior performance, outperforming both general-task approaches and models specialized in DTI prediction. These findings substantiate the efficacy of CHAT in addressing the complex problem of link prediction in heterogeneous networks.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
ACMCHATAUC91.31%evaluation=cross-domain
Source quote
L301: CHAT │ 91.31% │ 92.26% │ 94.27% │ 95.22% │ 79.41% │ 76.75%
ACMCHATAUPR92.26%evaluation=cross-domain
Source quote
L301: CHAT │ 91.31% │ 92.26% │ 94.27% │ 95.22% │ 79.41% │ 76.75%
DBLPCHATAUC94.27%evaluation=cross-domain
Source quote
L301: CHAT │ 91.31% │ 92.26% │ 94.27% │ 95.22% │ 79.41% │ 76.75%
DBLPCHATAUPR95.22%evaluation=cross-domain
Source quote
L301: CHAT │ 91.31% │ 92.26% │ 94.27% │ 95.22% │ 79.41% │ 76.75%
IMDBCHATAUC79.41%evaluation=cross-domain
Source quote
L301: CHAT │ 91.31% │ 92.26% │ 94.27% │ 95.22% │ 79.41% │ 76.75%
IMDBCHATAUPR76.75%evaluation=cross-domain
Source quote
L301: CHAT │ 91.31% │ 92.26% │ 94.27% │ 95.22% │ 79.41% │ 76.75%
BibTeX
@misc{zhang2025chat,
  author = {Shengming Zhang and Le Zhang and Jingbo Zhou and Hui Xiong},
  title = {{CHAT: Beyond Contrastive Graph Transformer for Link Prediction in Heterogeneous Networks}},
  year = {2025},
  eprint = {2501.02760},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.02760},
}
Figure