Authors: Yaqi Chen, Shixun Huang, Ryan Twemlow, Lei Wang, John Le, Sheng Wang, Willy Susilo, Jun Yan, +1 more
Organizations: University of Wollongong, Northfields Avenue, Gwynneville, 2500, NSW, Australia · Wuhan University, No. 299, Luojia Hill, Wuhan, 430072, Hubei, China
GNN prompting aims to adapt models across tasks and graphs without requiring extensive retraining. However, most existing graph prompt methods still require task-specific parameter updates and face the issue of generalizing across graphs, limiting their performance and undermining the core promise of prompting. In this work, we introduce a Cross-graph Tuning-free Prompting Framework (CTP), which supports both homogeneous and heterogeneous graphs, can be directly deployed to unseen graphs without further parameter tuning, and thus enables a plug-and-play GNN inference engine. Extensive experiments on few-shot prediction tasks show that, compared to SOTAs, CTP achieves an average accuracy gain of 30.8% and a maximum gain of 54%, confirming its effectiveness and offering a new perspective on graph prompt learning.
Figures & tables
Figure 1: An analogy between GNN and NLP prompts
Figure 2: The Prompting Framework. The overall workflow includes three stages, illustrated with node classification. During example and query collection, example and query nodes are sampled for each class. Then each sampled node’s context is constructed and augmented from its neighborhood. Finally a prompt graph is built, with context nodes initialized using their contextual embeddings. A learning process refines all node embeddings and all learned parameters will be directly used on unseen test graphs without any further update.
Figure 3: Neighborhood Centroid Collection. This figure illustrates the preprocessing step for clustering node embeddings and selecting centroids. (A) Initially, node embeddings are generated by a self-supervised GNN, enabling them to capture neighborhood similarity in the graph. (B) The embeddings are then clustered, and the cluster center nodes together with some randomly sampled nodes are collected to form the neighborhood centroid candidate set. (C) Each centroid represents a class, and example and query nodes are subsequently sampled from the local neighborhood of each centroid for context construction. Unless otherwise specified, all centroids in the following sections refer to neighborhood centroids.
Figure 4: Augmentation Strategy Comparison . When sampling context near a shared centroid, subgraphs often overlap. The Overly Independent Approach augments all nodes, including overlapping ones, which disrupts structural consistency and integrity. The Overly Conservative Approach blocks augmentation in these regions, reducing structural diversity. Our Balanced Approach selectively limits augmentation in overlapping areas, preserving consistency while ensuring sufficient diversity and integrity.
Figure 5: Average Initialization and Orthogonal Loss. (A) Compared to random initialization, average embedding provides more context-related label representations. (B) Cross-entropy aligns labels with nodes but neglects inter-label relations, often leading to unclear boundaries. Orthogonal loss mitigates this by encouraging label separation.
Dataset
# Nodes
# Edges
# Classes
MAG240M
122M
1.3B
153
Wiki
4.8M
5.9M
639
arXiv
169K
1.2M
40
ConceptNet
791K
2.5M
14
FB15K-237
15K
268K
200
NELL
69K
181K
291
Table 1: Dataset statistics
Way
CTP
PG-NM
Contrastive
Graph Prompter
All In One
GPPT
GraphPrompt
3
66.09 (±0.08)
56.82 (±0.08)
56.01 (±0.09)
48.40 (±0.17)
25.16 (±0.27)
30.53 (±0.28)
42.31 (±0.24)
5
52.61 (±0.06)
42.50 (±0.06)
41.18 (±0.07)
32.61 (±0.12)
27.06 (±0.11)
22.62 (±0.13)
19.93 (±0.08)
10
36.94 (±0.04)
28.62 (±0.04)
27.35 (±0.04)
19.17 (±0.07)
9.75 (±0.05)
11.28 (±0.04)
10.92 (±0.07)
20
24.03 (±0.02)
18.34 (±0.02)
17.39 (±0.02)
11.89 (±0.04)
7.91 (±0.10)
4.97 (±0.10)
4.55 (±0.03)
40
16.37 (±0.01)
10.63 (±0.01)
10.79 (±0.01)
5.97 (±0.02)
2.22 (±0.03)
1.57 (±0.01)
3.17 (±0.03)
Table 2: Node Classification Accuracy (±std) on Arxiv. This table shows the accuracy and standard deviation in arXiv, in 5 settings of {3,5,10,20,40} ways (number of classes). All trained on the same 20M-node subgraph, and evaluated on Arxiv.
Dataset
Way
CTP
PG-NM
Contrastive
Graph Prompter
ConceptNet
4
46.3(±0.14)
46.94(±0.61)
44.01(±0.61)
44.06(±0.15)
FB15K-237
5
83.66(±0.11)
80.35(±0.57)
81.35(±0.58)
82.34(±0.07)
10
73.23(±0.10)
71.68(±0.45)
70.88(±0.48)
50.71(±0.06)
20
62.91(±0.07)
59.90(±0.35)
59.80(±0.35)
35.74(±0.04)
40
47.96(±0.05)
46.82(±0.21)
49.39(±0.23)
27.63(±0.03)
NELL
5
84.32(±0.12)
82.39(±0.53)
83.38(±0.50)
89.8(±0.06)
Table 3: Link Prediction Accuracy (±std) on ConceptNet, FB15K-237, and NELL. The table reports test accuracy(%) and standard deviation of CTP and 2 baselines, all trained on Wiki and evaluated on these 3 graphs.
Figure 6: Parameter study: λ and p . The heatmaps present the accuracy improvements of CTP over PG-NM across different combinations of λ (between [0.1,0.5] ) and p (under 3-, 5-, 10-, 20-, and 40-way). In each cell, the top value reports the accuracy of CTP for the corresponding parameter setting, while the value in parentheses shows the difference (i.e., CTP accuracy minus PG-NM accuracy). Darker red shades indicate larger accuracy gains.
Figure 7: Parameter study: Number of Downstream Examples. Figures (a) - (e) show the results of varying the number of downstream examples {0,3,5,7,10,15,20} across different way settings, with the blue line representing CTP and the orange line representing PG-NM. As the number of ways increases and the task becomes more challenging, CTP consistently achieves larger improvements over the baseline across all shot settings, demonstrating both superior and more stable performance.
School of Computer Science and Cyber Engineering, Guangzhou University, Guang Zhou, 510006, Guangdong, China · Hunan University of Technology and Business, Changsha, 410205, Hunan, China
School of Computer Science and Technology, Anhui University, Hefei 230601, China. · State Key Laboratory of Opto-Electronic Information Acquisition and Protection Technology, School of Computer Science and Technology, Anhui University, Hefei 230601, China.