Saved in:
Bibliographic Details
Main Authors: Lv, Rui, Zhang, Zaixi, Zhang, Kai, Liu, Qi, Gao, Weibo, Liu, Jiawei, Yan, Jiaxia, Yue, Linan, Yao, Fangzhou
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2505.02027
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909600877379584
author Lv, Rui
Zhang, Zaixi
Zhang, Kai
Liu, Qi
Gao, Weibo
Liu, Jiawei
Yan, Jiaxia
Yue, Linan
Yao, Fangzhou
author_facet Lv, Rui
Zhang, Zaixi
Zhang, Kai
Liu, Qi
Gao, Weibo
Liu, Jiawei
Yan, Jiaxia
Yue, Linan
Yao, Fangzhou
contents Graph In-Context Learning, with the ability to adapt pre-trained graph models to novel and diverse downstream graphs without updating any parameters, has gained much attention in the community. The key to graph in-context learning is to perform downstream graphs conditioned on chosen prompt examples. Existing methods randomly select subgraphs or edges as prompts, leading to noisy graph prompts and inferior model performance. Additionally, due to the gap between pre-training and testing graphs, when the number of classes in the testing graphs is much greater than that in the training, the in-context learning ability will also significantly deteriorate. To tackle the aforementioned challenges, we develop a multi-stage adaptive prompt optimization method GraphPrompter, which optimizes the entire process of generating, selecting, and using graph prompts for better in-context learning capabilities. Firstly, Prompt Generator introduces a reconstruction layer to highlight the most informative edges and reduce irrelevant noise for graph prompt construction. Furthermore, in the selection stage, Prompt Selector employs the $k$-nearest neighbors algorithm and pre-trained selection layers to dynamically choose appropriate samples and minimize the influence of irrelevant prompts. Finally, we leverage a Prompt Augmenter with a cache replacement strategy to enhance the generalization capability of the pre-trained model on new datasets. Extensive experiments show that GraphPrompter effectively enhances the in-context learning ability of graph models. On average across all the settings, our approach surpasses the state-of-the-art baselines by over 8%. Our code is released at https://github.com/karin0018/GraphPrompter.
format Preprint
id arxiv_https___arxiv_org_abs_2505_02027
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle GraphPrompter: Multi-stage Adaptive Prompt Optimization for Graph In-Context Learning
Lv, Rui
Zhang, Zaixi
Zhang, Kai
Liu, Qi
Gao, Weibo
Liu, Jiawei
Yan, Jiaxia
Yue, Linan
Yao, Fangzhou
Machine Learning
Artificial Intelligence
Social and Information Networks
Graph In-Context Learning, with the ability to adapt pre-trained graph models to novel and diverse downstream graphs without updating any parameters, has gained much attention in the community. The key to graph in-context learning is to perform downstream graphs conditioned on chosen prompt examples. Existing methods randomly select subgraphs or edges as prompts, leading to noisy graph prompts and inferior model performance. Additionally, due to the gap between pre-training and testing graphs, when the number of classes in the testing graphs is much greater than that in the training, the in-context learning ability will also significantly deteriorate. To tackle the aforementioned challenges, we develop a multi-stage adaptive prompt optimization method GraphPrompter, which optimizes the entire process of generating, selecting, and using graph prompts for better in-context learning capabilities. Firstly, Prompt Generator introduces a reconstruction layer to highlight the most informative edges and reduce irrelevant noise for graph prompt construction. Furthermore, in the selection stage, Prompt Selector employs the $k$-nearest neighbors algorithm and pre-trained selection layers to dynamically choose appropriate samples and minimize the influence of irrelevant prompts. Finally, we leverage a Prompt Augmenter with a cache replacement strategy to enhance the generalization capability of the pre-trained model on new datasets. Extensive experiments show that GraphPrompter effectively enhances the in-context learning ability of graph models. On average across all the settings, our approach surpasses the state-of-the-art baselines by over 8%. Our code is released at https://github.com/karin0018/GraphPrompter.
title GraphPrompter: Multi-stage Adaptive Prompt Optimization for Graph In-Context Learning
topic Machine Learning
Artificial Intelligence
Social and Information Networks
url https://arxiv.org/abs/2505.02027