Skip to Main content Skip to Navigation
Preprints, Working Papers, ...

GraphiT: Encoding Graph Structure in Transformers

Grégoire Mialon 1, 2 Dexiong Chen 2 Margot Selosse 2 Julien Mairal 2
1 SIERRA - Statistical Machine Learning and Parsimony
DI-ENS - Département d'informatique de l'École normale supérieure, CNRS - Centre National de la Recherche Scientifique, Inria de Paris
2 Thoth - Apprentissage de modèles à partir de données massives
Inria Grenoble - Rhône-Alpes, LJK - Laboratoire Jean Kuntzmann
Abstract : We show that viewing graphs as sets of node features and incorporating structural and positional information into a transformer architecture is able to outperform representations learned with classical graph neural networks (GNNs). Our model, GraphiT, encodes such information by (i) leveraging relative positional encoding strategies in self-attention scores based on positive definite kernels on graphs, and (ii) enumerating and encoding local sub-structures such as paths of short length. We thoroughly evaluate these two ideas on many classification and regression tasks, demonstrating the effectiveness of each of them independently, as well as their combination. In addition to performing well on standard benchmarks, our model also admits natural visualization mechanisms for interpreting graph motifs explaining the predictions, making it a potentially strong candidate for scientific applications where interpretation is important.
Document type :
Preprints, Working Papers, ...
Complete list of metadata
Contributor : Grégoire Mialon <>
Submitted on : Thursday, June 10, 2021 - 2:04:36 PM
Last modification on : Tuesday, June 15, 2021 - 10:56:04 PM


Files produced by the author(s)


  • HAL Id : hal-03256708, version 1



Grégoire Mialon, Dexiong Chen, Margot Selosse, Julien Mairal. GraphiT: Encoding Graph Structure in Transformers. 2021. ⟨hal-03256708⟩



Record views


Files downloads