Transformers over Directed Acyclic Graphs
Yuankai Luo, Veronika Thost, Lei Shi
Abstract
Transformer models have recently gained popularity in graph representation learning as they have the potential to learn complex relationships beyond the ones captured by regular graph neural networks. The main research question is how to inject the structural bias of graphs into the transformer architecture, and several proposals have been made for undirected molecular graphs and, recently, also for larger network graphs. In this paper, we study transformers over directed acyclic graphs (DAGs) and propose architecture adaptations tailored to DAGs: (1) An attention mechanism that is considerably more efficient than the regular quadratic complexity of transformers and at the same time faithfully captures the DAG structure, and (2) a positional encoding of the DAG's partial order, complementing the former. We rigorously evaluate our approach over various types of tasks, ranging from classifying source code graphs to nodes in citation networks, and show that it is effective in two important aspects: in making graph transformers generally outperform graph neural networks tailored to DAGs and in improving SOTA graph transformer performance in terms of both quality and efficiency.
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.
Cited by top-tier papers15
- Enhancing Graph Transformers with Hierarchical Distance Structural EncodingYuankai Luo, Hongkang Li, Lei Shi, Xiao-Ming WuNeurIPS 2024 · 26 citations
- Toward Effective Digraph Representation Learning: A Magnetic Adaptive Propagation based ApproachXunkai Li, Daohan Su, Zhengyu Wu, Guang Zeng et al.WWW 2025 · 4 citations
- DualEqui: A Dual-Space Hierarchical Equivariant Network for Large BiomoleculesJunjie Xu, Jiahao Zhang, Mangal Prakash, Xiang Zhang et al.NeurIPS 2025 · 2 citations
- 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
- Can Classic GNNs Be Strong Baselines for Graph-level Tasks? Simple Architectures Meet ExcellenceYuankai Luo, Lei Shi, Xiao-Ming WuICML 2025
Builds on26
- Open Graph Benchmark: Datasets for Machine Learning on GraphsWeihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong et al.NeurIPS 2020 · 3,935 citations
- Do Transformers Really Perform Badly for Graph Representation?Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng et al.NeurIPS 2021 · 1,632 citations
- Learning to Simulate Complex Physics with Graph NetworksAlvaro Sanchez-Gonzalez, Jonathan Godwin, Tobias Pfaff, Rex Ying et al.ICML 2020 · 1,439 citations
- Recipe for a General, Powerful, Scalable Graph TransformerLadislav Rampásek, Michael Galkin, Vijay Prakash Dwivedi, Anh Tuan Luu et al.NeurIPS 2022 · 1,216 citations
- Principal Neighbourhood Aggregation for Graph NetsGabriele Corso, Luca Cavalleri, Dominique Beaini, Pietro Liò et al.NeurIPS 2020 · 914 citations
Related papers
- Structure-Aware Transformer for Graph Representation LearningDexiong Chen, Leslie O'Bray, Karsten M. BorgwardtICML 2022 · 349 citations
- Directed Acyclic Graph Neural NetworksVeronika Thost, Jie ChenICLR 2021 · 134 citations
- Transformers Meet Directed GraphsSimon Geisler, Yujia Li, Daniel J. Mankowitz, Ali Taylan Cemgil et al.ICML 2023 · 51 citations
- Homomorphism Counts as Structural Encodings for Graph LearningLinus Bao, Emily Jin, Michael M. Bronstein, Ismail Ilkan Ceylan et al.ICLR 2025
- Subgraphormer: Unifying Subgraph GNNs and Graph Transformers via Graph ProductsGuy Bar-Shalom, Beatrice Bevilacqua, Haggai MaronICML 2024 · 13 citations
