Comparing Graph Transformers via Positional Encodings
Mitchell Black, Zhengchao Wan, Gal Mishne, Amir Nayyeri, Yusu Wang
Abstract
The distinguishing power of graph transformers is tied to the choice of positional encoding: features used to augment the base transformer with information about the graph. There are two primary types of positional encoding: absolute positional encodings (APEs) and relative positional encodings (RPEs). APEs assign features to each node and are given as input to the transformer. RPEs instead assign a feature to each pair of nodes, e.g., shortest-path distance, and are used to augment the attention block. A priori, it is unclear which method is better for maximizing the power of the resulting graph transformer. In this paper, we aim to understand the relationship between these different types of positional encodings. Interestingly, we show that graph transformers using APEs and RPEs are equivalent in their ability to distinguish non-isomorphic graphs. In particular, we demonstrate how to interchange APEs and RPEs while maintaining their distinguishing power in terms of graph transformers. However, in the case of graphs with node features, we show that RPEs may have an advantage over APEs. Based on our theoretical results, we provide a study of different APEs and RPEs-including the shortest-path and resistance distance and the recently introduced stable and expressive positional encoding (SPE)and compare their distinguishing power in terms of transformers. We believe our work will help navigate the vast number of positional encoding choices and provide guidance on the future design of positional encodings for graph transformers.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 35487cd1-ee86-4885-8fd7-c9f3fdacb7b4Cited by top-tier papers11
- Relational Transformer: Toward Zero-Shot Foundation Models for Relational DataRishabh Ranjan, Valter Hudovernik, Mark Znidar, Charilaos I. Kanatsoulis et al.ICLR 2026 · 35 citations
- CKGConv: General Graph Convolution with Continuous KernelsLiheng Ma, Soumyasundar Pal, Yitian Zhang, Jiaming Zhou et al.ICML 2024 · 10 citations
- Generalizable Insights for Graph Transformers in Theory and PracticeTimo Stoll, Luis Müller, Christopher MorrisNeurIPS 2025 · 2 citations
- Few-shot Learning on AMS Circuits and Its Application to Parasitic Capacitance PredictionShan Shen, Yibin Zhang, Hector Rodriguez Rodriguez, Wenjian YuDAC 2025 · 1 citation
- From Theory to Practice: Rethinking Green and Martin Kernels for Unleashing Graph TransformersYoon Hyeok Lee, Jaemin Park, Taejin Paik, Doyun Kim et al.ICML 2025
Builds on13
- Do Transformers Really Perform Badly for Graph Representation?Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng et al.NeurIPS 2021 · 1,632 citations
- Rethinking Graph Transformers with Spectral AttentionDevin Kreuzer, Dominique Beaini, William L. Hamilton, Vincent Létourneau et al.NeurIPS 2021 · 854 citations
- Transformers Meet Directed GraphsSimon Geisler, Yujia Li, Daniel J. Mankowitz, Ali Taylan Cemgil et al.ICML 2023 · 51 citations
- From block-Toeplitz matrices to differential equations on graphs: towards a general theory for scalable masked TransformersKrzysztof Choromanski, Han Lin, Haoxian Chen, Tianyi Zhang et al.ICML 2022 · 47 citations
- Fine-grained Expressivity of Graph Neural NetworksJan Böker, Ron Levie, Ningyuan Huang, Soledad Villar et al.NeurIPS 2023 · 34 citations
Related papers
- On the Stability of Expressive Positional Encodings for GraphsYinan Huang, William Lu, Joshua Robinson, Yu Yang et al.ICLR 2024 · 32 citations
- On Structural Expressive Power of Graph TransformersWenhao Zhu, Tianyu Wen, Guojie Song, Liang Wang et al.KDD 2023 · 9 citations
- Understanding Truncated Positional Encodings for Graph Neural NetworksJames Flora, Mitchell Black, Weng-Keen Wong, Amir NayyeriICML 2026
- CAPE: Encoding Relative Positions with Continuous Augmented Positional EmbeddingsTatiana Likhomanenko, Qiantong Xu, Gabriel Synnaeve, Ronan Collobert et al.NeurIPS 2021 · 74 citations
- Graph Positional and Structural EncoderSemih Cantürk, Renming Liu, Olivier Lapointe-Gagné, Vincent Létourneau et al.ICML 2024 · 33 citations
