| Quick Start | Website | Paper | Video | Media Coverage | Call For Contribution |
ProG (Prompt Graph) is a library built upon PyTorch to easily conduct single or multi-task prompting for pre-trained Graph Neural Networks (GNNs). The idea is derived from the paper: Xiangguo Sun, Hong Cheng, Jia Li, etc. All in One: Multi-task Prompting for Graph Neural Networks. KDD2023 (🔥 Best Research Paper Award, which is the first time for Hong Kong and Mainland China), in which they released their raw codes. This repository is a redesigned and enhanced version of the raw codes with extremely huge changes and updates
ProG++ is an extended library with ProG, which supports more graph prompt models. Currently, ProG++ is now in its beta version (a little baby: ProG Plus), and we will merge ProG Plus
to ProG
in the near future. Some implemented models are as follows (We are now implementing more related models and we will keep integrating more models to ProG++):
- [All in One] X. Sun, H. Cheng, J. Li, B. Liu, and J. Guan, “All in One: Multi-Task Prompting for Graph Neural Networks,” KDD, 2023
- [GPF Plus] T. Fang, Y. Zhang, Y. Yang, C. Wang, and L. Chen, “Universal Prompt Tuning for Graph Neural Networks,” NeurIPS, 2023.
- [GraphPrompt] Liu Z, Yu X, Fang Y, et al. Graphprompt: Unifying pre-training and downstream tasks for graph neural networks. The Web Conference, 2023.
- [GPPT] M. Sun, K. Zhou, X. He, Y. Wang, and X. Wang, “GPPT: Graph Pre-Training and Prompt Tuning to Generalize Graph Neural Networks,” KDD, 2022
- [GPF] T. Fang, Y. Zhang, Y. Yang, and C. Wang, “Prompt tuning for graph neural networks,” arXiv preprint, 2022.
Xiangguo Sun, Jiawen Zhang, Xixi Wu, Hong Cheng, Yun Xiong, Jia Li.
Graph Prompt Learning: A Comprehensive Survey and Beyond
in arXiv https://arxiv.org/abs/2311.16534
(under review in TKDE)
In this survey, we present more details of ProG++ and also release a repository🦀 for a comprehensive collection of research papers, benchmark datasets, and readily accessible code implementations.
The Architecture of ProG++
🌹Please cite our work if you find help for you:
@inproceedings{sun2023all,
title={All in One: Multi-Task Prompting for Graph Neural Networks},
author={Sun, Xiangguo and Cheng, Hong and Li, Jia and Liu, Bo and Guan, Jihong},
booktitle={Proceedings of the 26th ACM SIGKDD international conference on knowledge discovery \& data mining (KDD'23)},
year={2023},
pages = {2120–2131},
location = {Long Beach, CA, USA},
isbn = {9798400701030},
url = {https://doi.org/10.1145/3580305.3599256},
doi = {10.1145/3580305.3599256}
}
@article{sun2023graph,
title = {Graph Prompt Learning: A Comprehensive Survey and Beyond},
author = {Sun, Xiangguo and Zhang, Jiawen and Wu, Xixi and Cheng, Hong and Xiong, Yun and Li, Jia},
year = {2023},
journal = {arXiv:2311.16534},
eprint = {2311.16534},
archiveprefix = {arxiv}
}
@article{zhao2024all,
title={All in One and One for All: A Simple yet Effective Method towards Cross-domain Graph Pretraining},
author={Haihong Zhao and Aochuan Chen and Xiangguo Sun and Hong Cheng and Jia Li},
year={2024},
eprint={2402.09834},
archivePrefix={arXiv}
}
@inproceedings{gao2024protein,
title={Protein Multimer Structure Prediction via {PPI}-guided Prompt Learning},
author={Ziqi Gao and Xiangguo Sun and Zijing Liu and Yu Li and Hong Cheng and Jia Li},
booktitle={The Twelfth International Conference on Learning Representations (ICLR)},
year={2024},
url={https://openreview.net/forum?id=OHpvivXrQr}
}
@article{chen2024prompt,
title={Prompt Learning on Temporal Interaction Graphs},
author={Xi Chen and Siwei Zhang and Yun Xiong and Xixi Wu and Jiawei Zhang and Xiangguo Sun and Yao Zhang and Yinglong Zhao and Yulin Kang},
year={2024},
eprint={2402.06326},
archivePrefix={arXiv},
journal = {arXiv:2402.06326}
}
@article{li2024survey,
title={A Survey of Graph Meets Large Language Model: Progress and Future Directions},
author={Yuhan Li and Zhixun Li and Peisong Wang and Jia Li and Xiangguo Sun and Hong Cheng and Jeffrey Xu Yu},
year={2024},
eprint={2311.12399},
archivePrefix={arXiv},
journal = {arXiv:2311.12399}
}
- PyTorch 1.13.1
- torchmetrics 0.11.4
- torch_geometric 2.2.0
The following codes present a simple example on how to pre-train a GNN model via GraphCL. You can also find a integrated
function pretrain()
in no_meta_demo.py
.
from ProG.utils import mkdir, load_data4pretrain
from ProG import PreTrain
mkdir('./pre_trained_gnn/')
pretext = 'GraphCL' # 'GraphCL', 'SimGRACE'
gnn_type = 'TransformerConv' # 'GAT', 'GCN'
dataname, num_parts, batch_size = 'CiteSeer', 200, 10
print("load data...")
graph_list, input_dim, hid_dim = load_data4pretrain(dataname, num_parts)
print("create PreTrain instance...")
pt = PreTrain(pretext, gnn_type, input_dim, hid_dim, gln=2)
print("pre-training...")
pt.train(dataname, graph_list, batch_size=batch_size,
aug1='dropN', aug2="permE", aug_ratio=None,
lr=0.01, decay=0.0001, epochs=100)
from ProG.prompt import GNN, LightPrompt
from torch import nn, optim
import torch
# load pre-trained GNN
gnn = GNN(100, hid_dim=100, out_dim=100, gcn_layer_num=2, gnn_type="TransformerConv")
pre_train_path = './pre_trained_gnn/{}.GraphCL.{}.pth'.format("CiteSeer", "TransformerConv")
gnn.load_state_dict(torch.load(pre_train_path))
print("successfully load pre-trained weights for gnn! @ {}".format(pre_train_path))
for p in gnn.parameters():
p.requires_grad = False
# prompt with hand-crafted answering template (no answering head tuning)
PG = LightPrompt(token_dim=100, token_num_per_group=100, group_num=6, inner_prune=0.01)
opi = optim.Adam(filter(lambda p: p.requires_grad, PG.parameters()),
lr=0.001, weight_decay=0.00001)
lossfn = nn.CrossEntropyLoss(reduction='mean')
The above codes are also integrated as a function model_create(dataname, gnn_type, num_class, task_type)
in this
project.
from ProG.data import multi_class_NIG
import torch
train, test, _, _ = multi_class_NIG(dataname, num_class)
gnn, PG, opi, lossfn, _, _ = model_create(dataname, gnn_type, num_class, task_type)
prompt_epoch = 200 # 200
# training stage
PG.train()
emb0 = gnn(train.x, train.edge_index, train.batch)
for j in range(prompt_epoch):
pg_batch = PG.inner_structure_update()
pg_emb = gnn(pg_batch.x, pg_batch.edge_index, pg_batch.batch)
dot = torch.mm(emb0, torch.transpose(pg_emb, 0, 1))
sim = torch.softmax(dot, dim=1)
train_loss = lossfn(sim, train.y)
print('{}/{} training loss: {:.8f}'.format(j, prompt_epoch, train_loss.item()))
opi.zero_grad()
train_loss.backward()
opi.step()
For more detailed usage examples w.r.t prompt with answer tuning
, prompt with meta-learning
etc. Please check
the demo in:
no_meta_demo.py
meta_demo.py
Multi-class node classification (100-shots)
| CiteSeer |
| ACC | Macro-F1 |
==========================================|
reported in the paper | 80.50 | 80.05 |
(Prompt) | |
------------------------------------------|
this version code | 81.00 | 81.23 |
(Prompt) | (run one time) |
==========================================|
reported in the paper | 80.00 | 80.05 |
(Prompt w/o h) | |
------------------------------------------|
this version code | 79.78 | 80.01 |
(Prompt w/o h) | (run one time) |
==========================================|
Kindly note that the comparison takes the same pre-trained pth.The absolute value of performance won't mean much because the final results may vary depending on different pre-training states.It would be more interesting to see the relative performance with other training paradigms.
Note:
- The above table is copied from this blog: https://github.com/sheldonresearch/ProG/blob/main/History.md#13-jul-2023
bibtex
@inproceedings{sun2023all,
title={All in One: Multi-Task Prompting for Graph Neural Networks},
author={Sun, Xiangguo and Cheng, Hong and Li, Jia and Liu, Bo and Guan, Jihong},
booktitle={Proceedings of the 26th ACM SIGKDD international conference on knowledge discovery \& data mining (KDD'23)},
year={2023},
pages = {2120–2131},
location = {Long Beach, CA, USA},
isbn = {9798400701030},
url = {https://doi.org/10.1145/3580305.3599256},
doi = {10.1145/3580305.3599256}
}
@article{sun2023graph,
title = {Graph Prompt Learning: {{A}} Comprehensive Survey and Beyond},
author = {Sun, Xiangguo and Zhang, Jiawen and Wu, Xixi and Cheng, Hong and Xiong, Yun and Li, Jia},
year = {2023},
journal = {arXiv:2311.16534},
eprint = {2311.16534},
archiveprefix = {arxiv}
}
- For More Information, Further discussion, Contact: Website
- Email: xiangguosun at cuhk dot edu dot hk
Media Reports
- 香港首位學者獲ACM頒最佳研究論文獎, 香港新聞網, 2023-09-20 15:21
- 内地及香港首次!港中大的他们获得这项国际大奖!,香港中文大学官方公众号, 2023-09-11 21:30
- Two CUHK scholars receive Best Paper Award from ACM SIGKDD Conference 2023, CUHK Focus
- Prof. Cheng Hong and her postdoc fellow Dr. Sun Xiangguo won the best paper award at KDD2023, CUHK SEEM
- 港科夜闻|香港科大(广州)熊辉教授、李佳教授分别荣获 ACM SIGKDD2023 服务奖与最佳论文奖(研究)
- 数据科学与分析学域李佳教授荣获SIGKDD2023最佳论文奖(研究)!
- 实时追踪科研动态丨姚期智、Quoc Viet Le等人8.9精选新论文,附ChatPaper综述
- KDD 2023奖项出炉:港中文、港科大等获最佳论文奖,GNN大牛Leskovec获创新奖
- 多篇GNN论文获KDD 2023大奖, 图神经网络与推荐系统 2023-08-09 16:03
- 港科广数据科学与分析学域李佳教授荣获SIGKDD2023最佳论文奖(研究)!
Online Discussion
- LOGS第2023/08/12期||KDD 2023 Best Paper Winner 孙相国 :提示学习在图神经网络中的探索
- Talk预告 | KDD'23 Best Paper 港中文孙相国:All in One - 提示学习在图神经网络中的探索
- All in One Multi-Task Prompting for Graph Neural Networks 论文解读
- kdd2023最佳论文
- All in One: Multi-task Prompting for Graph Neural Networks(KDD 2023 Best Paper
- 怎么评价KDD23的best paper? - 知乎
Other research papers released by us
- 最新图大模型综述:由港科广、港中文、清华联合发布,详述使用大模型处理图任务的进展与挑战
- 大模型和图如何结合?最新《图遇见大型语言模型》综述,详述最新进展
- 香港中文领衔港科广、复旦重磅发布:迈向通用图智能的新方法,图提示学习进展与挑战
- 香港中文领衔港科广、复旦重磅发布:迈向通用图智能的新方法,图提示学习进展与挑战
- 图上如何提示?港中文等最新《图提示学习》全面综述,详述图提示分类体系
Once you are invited as a contributor, you would be asked to follow the following steps:
- step 1. create a temp branch (e.g.
xgTemp
) from themain
branch (latest branch). - step 2. fetch
origin/xgTemp
to your localxgTemp
, and make your own changes via PyCharm etc. - step 3. push your changes from local
xgTemp
to your github cloud branch:origin/xgTemp
. - step 4. open a pull request to merge from your branch to
main
.
When you finish all these jobs. I will get a notification and approve merging your branch to main
.
Once I finish, I will delete your branch, and next time you will repeat the above jobs.
A widely tested main
branch will then be merged to the stable
branch and a new version will be released based on stable
branch.