Heterformer: Transformer-based Deep Node Representation Learning on Heterogeneous Text-Rich Networks

Bowen Jin, Yu Zhang, Qi Zhu, Jiawei Han

Introduction

Most real-world networks are Heterogeneous Text-Rich Networks (HTRNs), characterized by diverse node types (e.g., papers, authors, venues) and varying amounts of textual information. While some nodes are text-rich, others are "textless," carrying only structural significance. Traditional approaches to representation learning on these graphs typically employ a "cascaded" architecture: a Pretrained Language Model (PLM) like BERT encodes text into vectors, which are then processed by a Graph Neural Network (GNN). However, this separation leads to information isolation, where the text encoder lacks awareness of the network context, and the GNN struggles to integrate heterogeneous node types effectively.

Examples of Heterogeneous Text-Rich Networks (HTRNs) and the high-level Heterformer architecture.

The Heterformer Architecture

Heterformer addresses these challenges by injecting heterogeneous network structure directly into every layer of a Transformer. This "deep coupling" allows textual semantics and network topology to inform each other throughout the encoding process.

Deep Coupling via Virtual Tokens

The core innovation of Heterformer is the use of virtual neighbor tokens. For a given center node, the model introduces two special tokens into the Transformer's input sequence: one for text-rich neighbors and another for textless neighbors. These tokens are updated at every layer, enabling the self-attention mechanism to allow the center node's text to attend to its neighborhood context dynamically.

Detailed view of the Heterformer Layer and the Neighbor Aggregation Module.

Heterogeneous Aggregation

To handle diverse edge types, Heterformer utilizes a Multi-Head Attention (MHA)-based aggregation module. It projects neighbors into a shared latent space using edge-specific transformation matrices, ensuring that different relationship types (e.g., "citation" vs. "authorship") are weighted appropriately. Furthermore, to integrate textless nodes, a "warm-up" stage aligns their initial embeddings with the PLM's semantic space using a link-prediction objective.

Experimental Evaluation

The authors evaluated Heterformer across three large-scale datasets: DBLP (academic), Twitter (social media), and Goodreads (book-related).

Key Results

  • Link Prediction: Heterformer significantly outperformed state-of-the-art baselines like GraphFormers and BERT+HGT. On the DBLP dataset, it achieved a Precision@1 of 0.8474.
  • Node Classification: The model excelled in both transductive and inductive settings. Notably, it showed a massive improvement (over 15% in Micro-F1 on DBLP) in classifying textless nodes, demonstrating the power of structural information in inferring semantics.
  • Efficiency: Despite the deep integration of graph structure, Heterformer maintains computational costs comparable to existing nested Transformer models, making it viable for large-scale applications.

Conclusion

Heterformer demonstrates that network structure is a vital disambiguator for text. By unifying text and structure encoding in a single, multi-layer framework, it achieves superior node representations in complex HTRNs. This approach paves the way for more context-aware models in domains ranging from recommendation systems to academic search.

Summary updated

BibTeX
@inproceedings{jin2023heterformer,
  author = {Bowen Jin and Yu Zhang and Qi Zhu and Jiawei Han},
  title = {{Heterformer: Transformer-based Deep Node Representation Learning on Heterogeneous Text-Rich Networks}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2023},
  doi = {10.1145/3580305.3599376},
}
Figure