Do Transformers Really Perform Bad for Graph Representation?

Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke +3 more
6/9/2021
cs.LGcs.AI

Official code: microsoft/Graphormer (2,481 stars, MIT, last commit 2026-09-26).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

MIT

Graphormer is a general-purpose deep learning backbone for molecular modeling.

2,481375Shell, CythonMay 27, 20213 weeks agoMIT
ai4sciencedeep-learninggraphmolecule-simulationtransformer

Similar Papers

Cite this paper

@article{ying2021transformers,
  title  = {Do Transformers Really Perform Bad for Graph Representation?},
  author = {Chengxuan Ying and Tianle Cai and Shengjie Luo and Shuxin Zheng and Guolin Ke and Di He and Yanming Shen and Tie-Yan Liu},
  year   = {2021},
  eprint = {2106.05234},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.05234}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2106.05234.svg)](https://codeofpaper.com/paper/2106.05234)

Discussion