Do Transformers Really Perform Bad for Graph Representation?

9 Jun 2021  ·  Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen, Tie-Yan Liu ·

The Transformer architecture has become a dominant choice in many domains, such as natural language processing and computer vision. Yet, it has not achieved competitive performance on popular leaderboards of graph-level prediction compared to mainstream GNN variants. Therefore, it remains a mystery how Transformers could perform well for graph representation learning. In this paper, we solve this mystery by presenting Graphormer, which is built upon the standard Transformer architecture, and could attain excellent results on a broad range of graph representation learning tasks, especially on the recent OGB Large-Scale Challenge. Our key insight to utilizing Transformer in the graph is the necessity of effectively encoding the structural information of a graph into the model. To this end, we propose several simple yet effective structural encoding methods to help Graphormer better model graph-structured data. Besides, we mathematically characterize the expressive power of Graphormer and exhibit that with our ways of encoding the structural information of graphs, many popular GNN variants could be covered as the special cases of Graphormer.

PDF Abstract

Results from the Paper


Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Graph Property Prediction ogbg-molhiv Graphormer (pre-trained on PCQM4M) Test ROC-AUC 0.8051 ± 0.0053 # 15
Validation ROC-AUC 0.8310 ± 0.0089 # 18
Number of params 47183040 # 1
Ext. data Yes # 1
Graph Property Prediction ogbg-molhiv Graphormer + FPs Test ROC-AUC 0.8225 ± 0.0001 # 7
Validation ROC-AUC 0.8396 ± 0.0001 # 10
Number of params 47085378 # 3
Ext. data No # 1
Graph Property Prediction ogbg-molhiv Graphormer Test ROC-AUC 0.8051 ± 0.0053 # 15
Validation ROC-AUC 0.8310 ± 0.0089 # 18
Number of params 47183040 # 1
Ext. data Yes # 1
Graph Property Prediction ogbg-molpcba Graphormer Test AP 0.3140 ± 0.0032 # 4
Validation AP 0.3227 ± 0.0024 # 4
Number of params 119529664 # 2
Graph Property Prediction ogbg-molpcba Graphormer (pre-trained on PCQM4M) Test AP 0.3140 ± 0.0032 # 4
Validation AP 0.3227 ± 0.0024 # 4
Number of params 119529664 # 2
Ext. data Yes # 1
Graph Regression PCQM4M-LSC Graphormer Validation MAE 0.1234 # 4
Test MAE 13.28 # 1
Graph Regression PCQM4Mv2-LSC Graphormer Validation MAE 0.0864 # 10
Test MAE - # 13
Graph Regression ZINC-500k Graphormer-SLIM MAE 0.122 # 19

Methods