Transformers Generalize DeepSets and Can be Extended to Graphs and Hypergraphs

Jinwoo Kim, Saeyoon Oh, Seunghoon Hong
10/27/2021
49 citations
cs.LG
transformer-attention

Official code: jw9730/hot (67 stars, PyTorch, last commit 2022-11-28).

Abstract

We present a generalization of Transformers to any-order permutation invariant data (sets, graphs, and hypergraphs). We begin by observing that Transformers generalize DeepSets, or first-order (set-input) permutation invariant MLPs.

Show full abstract

Then, based on recently characterized higher-order invariant MLPs, we extend the concept of self-attention to higher orders and propose higher-order Transformers for order-$k$ data ($k=2$ for graphs and $k>2$ for hypergraphs). Unfortunately, higher-order Transformers turn out to have prohibitive complexity $\mathcal{O}(n^{2k})$ to the number of input nodes $n$. To address this problem, we present sparse higher-order Transformers that have quadratic complexity to the number of input hyperedges, and further adopt the kernel attention approach to reduce the complexity to linear. In particular, we show that the sparse second-order Transformers with kernel attention are theoretically more expressive than message passing operations while having an asymptotically identical complexity. Our models achieve significant performance improvement over invariant MLPs and message-passing graph neural networks in large-scale graph regression and set-to-(hyper)graph prediction tasks. Our implementation is available at https://github.com/jw9730/hot.

View on arXivView PDF

Code Implementations(1)

jw9730/hotOfficial100%
PyTorch

[NeurIPS'21] Higher-order Transformers for sets, graphs, and hypergraphs, in PyTorch

679Oct 27, 20214 years ago
equivariancegnngraphhypergraphpytorch+2 more

Similar Papers

Cite this paper

@article{kim2021transformers,
  title  = {Transformers Generalize DeepSets and Can be Extended to Graphs and Hypergraphs},
  author = {Jinwoo Kim and Saeyoon Oh and Seunghoon Hong},
  year   = {2021},
  eprint = {2110.14416},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2110.14416}
}

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

Discussion