Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Transformers Meet Directed Graphs

About

Transformers were originally proposed as a sequence-to-sequence model for text but have become vital for a wide range of modalities, including images, audio, video, and undirected graphs. However, transformers for directed graphs are a surprisingly underexplored topic, despite their applicability to ubiquitous domains, including source code and logic circuits. In this work, we propose two direction- and structure-aware positional encodings for directed graphs: (1) the eigenvectors of the Magnetic Laplacian - a direction-aware generalization of the combinatorial Laplacian; (2) directional random walk encodings. Empirically, we show that the extra directionality information is useful in various downstream tasks, including correctness testing of sorting networks and source code understanding. Together with a data-flow-centric graph construction, our model outperforms the prior state of the art on the Open Graph Benchmark Code2 relatively by 14.7%.

Simon Geisler, Yujia Li, Daniel Mankowitz, Ali Taylan Cemgil, Stephan G\"unnemann, Cosmin Paduraru• 2023

Related benchmarks

TaskDatasetResultRank
Graph property predictionOGBG-CODE2 (test)
F122.22
57
Circuit property regressionOpen Circuit Benchmark (test)
Gain (RMSE)0.364
32
Circuit property regressionHigh-level Synthesis (test)
DSP MSE2.304
32
Node-pair distance predictionDirected Acyclic Graph (test)
Shortest Path Distance (RMSE)0.124
13
Node-pair distance predictionRegular Directed Graph (test)
RMSE (spd)1.533
13
Function name predictionOGB Code2 (val)
F1 Score20.44
9
Showing 6 of 6 rows

Other info

Follow for update