The official implementation for NeurIPS23 paper "SGFormer: Simplifying and Empowering Transformers for Large-Graph Representations".
Related material: [Paper], [Blog], [Video]
SGFormer is a graph encoder backbone that efficiently computes all-pair interactions with one-layer attentive propagation.
SGFormer is built upon our previous works on scalable graph Transformers with linear complexity NodeFormer (NeurIPS22, spotlight) and DIFFormer (ICLR23, spotlight).
[2023.10.28] We release the code for the model on large graph benchmarks. More detailed info will be updated soon.
[2023.12.20] We supplement more details for how to run the code.
[2024.05.05] We supplement the code for testing time and memory in ./medium/time_test.py
The model adopts a simple architecture and is comprised of a one-layer global attention and a shallow GNN.
![image](https://private-user-images.githubusercontent.com/22075007/292065764-3b46ec4c-1532-4d8e-b2d7-3bc1368c7ef8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIzNDMzOTEsIm5iZiI6MTcyMjM0MzA5MSwicGF0aCI6Ii8yMjA3NTAwNy8yOTIwNjU3NjQtM2I0NmVjNGMtMTUzMi00ZDhlLWIyZDctM2JjMTM2OGM3ZWY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzMwVDEyMzgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRmYzIyMmNiZjgwY2UxZDBjMWM2NmU2NDM1YTM5YmUzZmI5NDkzZjhiNmRmM2JmMGZjMmVhODcwNWYyODllMTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nWZl3VcDjZkMiyJzCDuzNk3zwrbgilQrUeFHaceczHU)
The following tables present the results for standard node classification tasks on medium-sized and large-sized graphs.
![image](https://private-user-images.githubusercontent.com/22075007/292065867-a017202b-14c5-490f-9ca5-dd21c755add4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIzNDMzOTEsIm5iZiI6MTcyMjM0MzA5MSwicGF0aCI6Ii8yMjA3NTAwNy8yOTIwNjU4NjctYTAxNzIwMmItMTRjNS00OTBmLTljYTUtZGQyMWM3NTVhZGQ0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzMwVDEyMzgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY0MTg0NWRhNjU4ZmUzMGRiNTJjMjgwMzc0MzVjNDUzOGNkNmU3MTBhMTIxNDAwYzkyOWY4OTliNTk2YTZjOTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.u4-NOwCuhizKizLu2OeQYIlP8tF5EmUdmnaWrnGux3M)
![image](https://private-user-images.githubusercontent.com/22075007/292065904-aeb29fb7-8ac2-407d-9599-23f681b34672.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIzNDMzOTEsIm5iZiI6MTcyMjM0MzA5MSwicGF0aCI6Ii8yMjA3NTAwNy8yOTIwNjU5MDQtYWViMjlmYjctOGFjMi00MDdkLTk1OTktMjNmNjgxYjM0NjcyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzMwVDEyMzgxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUyNDEzMDFjNmJhMWYxNWZmYjU4MWZkZjY3YzIyMzRhNmZhMmU3OGU3NzBhNWRkNmQ5YzdiYTYyNzNkMjZmZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.prQ9euteN8Aw1Kg1R3NQSpvD6ZAnNy3-9wAUKbraA-s)
For datasets except ogbn-papers100M, we used the environment with package versions indicated in ./large/requirement.txt
. For ogbn-papers100M, one needs PyG version >=2.0 for running the code.
One can download the datasets (Planetoid, Deezer, Pokec, Actor/Film) from the google drive link below:
https://drive.google.com/drive/folders/1rr3kewCBUvIuVxA6MJ90wzQuF-NnCRtf?usp=drive_link
For Chameleon and Squirrel, we use the new splits that filter out the overlapped nodes.
For the OGB datasets, they will be downloaded automatically when running the code.
Please refer to the bash script run.sh
in each folder for running the training and evaluation pipeline.
If you find our code and model useful, please cite our work. Thank you!
@inproceedings{
wu2023sgformer,
title={SGFormer: Simplifying and Empowering Transformers for Large-Graph Representations},
author={Qitian Wu and Wentao Zhao and Chenxiao Yang and Hengrui Zhang and Fan Nie and Haitian Jiang and Yatao Bian and Junchi Yan},
booktitle={Advances in Neural Information Processing Systems (NeurIPS)},
year={2023}
}