Skip to main content
QUICK REVIEW

[Paper Review] Pure Transformers are Powerful Graph Learners

Jinwoo Kim, Tien Dat Nguyen|arXiv (Cornell University)|Jul 6, 2022
Advanced Graph Neural NetworksComputer Science57 citations
TL;DR

The paper shows standard Transformers, with simple node/edge token embeddings, can learn graphs as well as or better than GNNs and even match graph-specific Transformers, with strong theoretical expressiveness and competitive results on PCQM4Mv2.

ABSTRACT

We show that standard Transformers without graph-specific modifications can lead to promising results in graph learning both in theory and practice. Given a graph, we simply treat all nodes and edges as independent tokens, augment them with token embeddings, and feed them to a Transformer. With an appropriate choice of token embeddings, we prove that this approach is theoretically at least as expressive as an invariant graph network (2-IGN) composed of equivariant linear layers, which is already more expressive than all message-passing Graph Neural Networks (GNN). When trained on a large-scale graph dataset (PCQM4Mv2), our method coined Tokenized Graph Transformer (TokenGT) achieves significantly better results compared to GNN baselines and competitive results compared to Transformer variants with sophisticated graph-specific inductive bias. Our implementation is available at https://github.com/jw9730/tokengt.

Motivation & Objective

  • Motivate using pure Transformer architectures for graph learning without hand-crafted graph inductive biases.
  • Provide theoretical guarantees showing TokenGT is at least as expressive as 2-IGN and WL-2, and extend to k-IGN/k-WL on hypergraphs.
  • Develop TokenGT by treating nodes and edges as tokens augmented with node identifiers and type identifiers.
  • Empirically validate TokenGT on large-scale graphs (PCQM4Mv2) and compare to GNN baselines and graph-aware Transformers.

Proposed method

  • Treat all graph nodes and edges as independent tokens and augment with token-wise embeddings (node identifiers and trainable type identifiers).
  • Use a standard Transformer encoder on the augmented token set, with an extra [graph] token for graph-level prediction.
  • Prove that with appropriate token embeddings, self-attention can approximate any permutation-equivariant linear operator, yielding at least 2-IGN expressiveness for graphs (and k-IGN for hypergraphs).
  • Provide two practical node identifier schemes: orthonormal node identifiers (ORFs) and Laplacian eigenvectors, with Laplacian-based embeddings offering graph positional information.
  • Demonstrate that TokenGT can leverage efficient Transformer variants (e.g., kernel attention) without sacrificing performance.

Experimental results

Research questions

  • RQ1Can a standard Transformer, fed with node and edge tokens augmented by simple identifiers, match or surpass graph-specific inductive biases used in GNNs?
  • RQ2What is the theoretical expressiveness of TokenGT compared to invariant/equivariant graph networks (IGNs) and WL tests?
  • RQ3How does TokenGT perform on large-scale graph benchmarks (e.g., PCQM4Mv2) relative to GNN baselines and graph-enhanced Transformers?
  • RQ4Do order-k token embeddings extend TokenGT to higher-order graphs/hypergraphs with corresponding expressiveness (k-IGN, k-WL)?

Key findings

  • A standard Transformer with node and type identifiers is provably at least as expressive as the 2-IGN, hence at least as powerful as the 2-WL test and more expressive than all message-passing GNNs.
  • TokenGT achieves significantly better results than GNN baselines on PCQM4Mv2 and is competitive with Transformer variants that use graph-specific inductive biases.
  • Theoretical results extend to hypergraphs, showing order-k TokenGT is at least as expressive as k-IGN and k-WL.
  • Empirical studies show self-attention can approximate the equivariant bases required for graph operators when supplied with appropriate auxiliary node/type information.
  • Transformers with kernel attention variants can be used to reduce computational cost without substantial performance loss.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.