HGPROMPT: Bridging Homogeneous and Heterogeneous Graphs for Few-shot Prompt Learning

Xingtong Yu, Yuan Fang, Zemin Liu, Xinming Zhang · DOI

Introduction

Graph Neural Networks (GNNs) have demonstrated remarkable success in various domains, yet their performance remains heavily dependent on the availability of large-scale labeled datasets. To mitigate this dependency, the "pre-train, fine-tune" paradigm has emerged as a popular strategy. In this approach, models are first pre-trained on self-supervised tasks using unlabeled data and subsequently fine-tuned for specific downstream applications. However, two significant gaps limit the effectiveness of this paradigm: the Objective Gap, where pre-training objectives (e.g., link prediction) differ from downstream tasks (e.g., classification), and the Heterogeneity Gap, where models pre-trained on homogeneous graphs struggle to adapt to the multi-typed nature of heterogeneous graphs.

Methodology: The HGPROMPT Framework

To address these challenges, we present HGPROMPT, a novel prompt-learning framework designed to unify homogeneous and heterogeneous graph tasks. HGPROMPT employs a "dual-dual" architecture consisting of dual-templates for unification and dual-prompts for task-specific adaptation.

Dual-Template Unification

The framework first bridges the structural gap through a Graph Template, which decomposes complex heterogeneous graphs into multiple homogeneous subgraphs based on node types and overall topology. Simultaneously, a Task Template reformulates downstream tasks—such as node and graph classification—into a unified "subgraph similarity" problem. This alignment ensures that the downstream objectives are consistent with the link prediction tasks used during pre-training.

Overview of the HGPROMPT framework showing the transition from pre-training to downstream tasks via dual-templates and dual-prompts.

Dual-Prompt Design

Once the templates are established, the pre-trained model's parameters are frozen to prevent overfitting in low-data regimes. HGPROMPT then learns two lightweight prompts:

  1. Feature Prompt: A learnable vector that adjusts node features via element-wise multiplication, allowing the model to focus on task-relevant information.
  2. Heterogeneity Prompt: This prompt learns optimal weights for aggregating the various homogeneous subgraphs generated by the graph template. It acts as a dynamic mechanism to prioritize different relational "facets" (e.g., author vs. paper relationships) depending on the specific task.

Experimental Evaluation

The effectiveness of HGPROMPT was evaluated on three benchmark datasets: ACM (citation network), DBLP (bibliographic database), and Freebase (knowledge graph). The study compared two variants: HGPROMPT (pre-trained on homogeneous graphs) and HGPROMPT+ (pre-trained on heterogeneous graphs using the graph template).

Results and Discussion

Experimental results demonstrate that HGPROMPT significantly outperforms state-of-the-art baselines, including GCN, HAN, and GraphPrompt, particularly in few-shot scenarios.

Performance comparison (Micro-F1) of HGPROMPT against baselines across different shot counts (k) for node and graph classification.

Key Findings

  • Superior Few-Shot Performance: In 1-shot node classification on the ACM dataset, HGPROMPT+ achieved a Micro-F1 score of approximately 74%, a substantial improvement over the heterogeneous baseline HeCo (~63%).
  • Robustness and Efficiency: By tuning only a small fraction of parameters (the prompts) while keeping the backbone frozen, HGPROMPT avoids the overfitting common in traditional fine-tuning. The framework also proved to be backbone-agnostic, showing consistent gains whether using GCN or GAT architectures.
  • Task-Specific Adaptation: The heterogeneity prompt effectively serves as a "soft switch," enabling the model to dynamically weight different node and edge types based on the requirements of the downstream task.

Conclusion

HGPROMPT offers a robust solution for few-shot learning on graphs by bridging the structural and objective gaps between pre-training and downstream tasks. By leveraging dual-templates and dual-prompts, the framework enables a single pre-trained model to excel across diverse heterogeneous graph applications with minimal labeled data. Future work will explore more complex task templates and the application of this framework to dynamic graph environments.

Summary updated

BibTeX
@inproceedings{yu2024hgprompt,
  author = {Xingtong Yu and Yuan Fang and Zemin Liu and Xinming Zhang},
  title = {{HGPROMPT: Bridging Homogeneous and Heterogeneous Graphs for Few-shot Prompt Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i15.29596},
}
Figure