Rethinking Graph Transformers with Spectral Attention

Devin Kreuzer, Dominique Beaini, William L. Hamilton, Vincent Létourneau, Prudencio Tossou
6/7/2021
cs.LG
transformer-attentiongnn

Official code: DevinKreuzer/SAN (154 stars, Python, MIT, last commit 2021-08-23).

Abstract

In recent years, the Transformer architecture has proven to be very successful in sequence processing, but its application to other data structures, such as graphs, has remained limited due to the difficulty of properly defining positions. Here, we present the $\textit{Spectral Attention Network}$ (SAN), which uses a learned positional encoding (LPE) that can take advantage of the full Laplacian spectrum to learn the position of each node in a given graph.

Show full abstract

This LPE is then added to the node features of the graph and passed to a fully-connected Transformer. By leveraging the full spectrum of the Laplacian, our model is theoretically powerful in distinguishing graphs, and can better detect similar sub-structures from their resonance. Further, by fully connecting the graph, the Transformer does not suffer from over-squashing, an information bottleneck of most GNNs, and enables better modeling of physical phenomenons such as heat transfer and electric interaction. When tested empirically on a set of 4 standard datasets, our model performs on par or better than state-of-the-art GNNs, and outperforms any attention-based model by a wide margin, becoming the first fully-connected architecture to perform well on graph benchmarks.

View on arXivView PDF

Code Implementations(1)

DevinKreuzer/SANOfficial100%
MIT
15433Python, ShellMay 27, 20215 years agoMIT

Similar Papers

Cite this paper

@article{kreuzer2021rethinking,
  title  = {Rethinking Graph Transformers with Spectral Attention},
  author = {Devin Kreuzer and Dominique Beaini and William L. Hamilton and Vincent Létourneau and Prudencio Tossou},
  year   = {2021},
  eprint = {2106.03893},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.03893}
}

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.03893.svg)](https://codeofpaper.com/paper/2106.03893)

Discussion