Rotary Position Encodings for Graphs
About
We study the extent to which rotary position encodings (RoPE), a recent transformer position encoding algorithm broadly adopted in large language models (LLMs) and vision transformers (ViTs), can be applied to graph-structured data. We find that rotating tokens depending on the spectrum of the graph Laplacian efficiently injects structural information into the attention mechanism, boosting performance in synthetic and real-world graph learning tasks. This approach, coined _Wave-Induced Rotary Encodings_ (WIRE), enjoys intriguing theoretical properties: it recovers regular RoPE on grids, and depends asymptotically on the graph effective resistance. Unlike bias-based relative position encodings, WIRE is compatible with linear attention.
Isaac Reid, Arijit Sehanobish, Cederik H\"ofs, Bruno Mlodozeniec, Leonhard Vulpius, Federico Barbero, Adrian Weller, Krzysztof Choromanski, Richard E. Turner, Petar Veli\v{c}kovi\'c• 2025
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Image Classification | MNIST (test) | Accuracy98.1 | 654 | |
| Point Cloud Classification | ModelNet40 (test) | -- | 229 | |
| Graph Classification | ogbg-molpcba (test) | AP26.4 | 215 | |
| Node Classification | CLUSTER (test) | Test Accuracy77.53 | 132 | |
| Node Classification | PATTERN (test) | Test Accuracy86.63 | 109 | |
| Graph Regression | Peptides struct (test) | MAE0.2566 | 100 | |
| Graph Classification | Peptides-func (test) | AP64.9 | 98 | |
| Graph-level classification | OGBG-MOLHIV (test) | AUROC78.5 | 44 | |
| Graph Classification | ogbg-ppa (test) | Accuracy80.4 | 22 | |
| Graph Classification | MalNet-Tiny (test) | Accuracy93.46 | 12 |
Showing 10 of 13 rows