Aligning Transformers with Weisfeiler-Leman

Luis Müller, Christopher Morris
2/12/2026

No official code found. Best implementation: luis-mueller/wl-transformers (11 stars, MIT, last commit 2024-06-09).

Abstract

Graph neural network architectures aligned with the $k$-dimensional Weisfeiler--Leman ($k$-WL) hierarchy offer theoretically well-understood expressive power. However, these architectures often fail to deliver state-of-the-art predictive performance on real-world graphs, limiting their practical utility. While recent works aligning graph transformer architectures with the $k$-WL hierarchy have shown promising empirical results, employing transformers for higher orders of $k$ remains challenging due to a prohibitive runtime and memory complexity of self-attention as well as impractical architectural assumptions, such as an infeasible number of attention heads. Here, we advance the alignment of transformers with the $k$-WL hierarchy, showing stronger expressivity results for each $k$, making them more feasible in practice. In addition, we develop a theoretical framework that allows the study of established positional encodings such as Laplacian PEs and SPE. We evaluate our transformers on the large-scale PCQM4Mv2 dataset, showing competitive predictive performance with the state-of-the-art and demonstrating strong downstream performance when fine-tuning them on small-scale molecular datasets. Our code is available at https://github.com/luis-mueller/wl-transformers.

View on arXivView PDF

Code Implementations(1)

MIT

Code for our ICML 2024 paper "Aligning Transformers with Weisfeiler-Leman"

110PythonJun 3, 20242 years agoMIT

Similar Papers

Cite this paper

@article{mller2026aligning,
  title  = {Aligning Transformers with Weisfeiler-Leman},
  author = {Luis Müller and Christopher Morris},
  year   = {2026},
  eprint = {2406.03148},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2406.03148},
  journal = {ICML 2024 2024}
}

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

Discussion