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 Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
15 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- From Theory to Practice: Rethinking Green and Martin Kernels for Unleashing Graph Transformers cites Recipe for a General, Powerful, Scalable Graph Transformer
- From Theory to Practice: Rethinking Green and Martin Kernels for Unleashing Graph Transformers cites Do Transformers Really Perform Badly for Graph Representation?
- From Theory to Practice: Rethinking Green and Martin Kernels for Unleashing Graph Transformers cites Principal Neighbourhood Aggregation for Graph Nets
- Recipe for a General, Powerful, Scalable Graph Transformer cites Do Transformers Really Perform Badly for Graph Representation?
- Recipe for a General, Powerful, Scalable Graph Transformer cites Principal Neighbourhood Aggregation for Graph Nets
- Can Classic GNNs Be Strong Baselines for Graph-level Tasks? Simple Architectures Meet Excellence cites Recipe for a General, Powerful, Scalable Graph Transformer
- Can Classic GNNs Be Strong Baselines for Graph-level Tasks? Simple Architectures Meet Excellence cites Open Graph Benchmark: Datasets for Machine Learning on Graphs
- Can Classic GNNs Be Strong Baselines for Graph-level Tasks? Simple Architectures Meet Excellence cites Enhancing Graph Transformers with Hierarchical Distance Structural Encoding
- Can Classic GNNs Be Strong Baselines for Graph-level Tasks? Simple Architectures Meet Excellence cites Do Transformers Really Perform Badly for Graph Representation?
- Toward Effective Digraph Representation Learning: A Magnetic Adaptive Propagation based Approach cites Open Graph Benchmark: Datasets for Machine Learning on Graphs
- Enhancing Graph Transformers with Hierarchical Distance Structural Encoding cites Recipe for a General, Powerful, Scalable Graph Transformer
- Enhancing Graph Transformers with Hierarchical Distance Structural Encoding cites Open Graph Benchmark: Datasets for Machine Learning on Graphs
- Enhancing Graph Transformers with Hierarchical Distance Structural Encoding cites Do Transformers Really Perform Badly for Graph Representation?
- Enhancing Graph Transformers with Hierarchical Distance Structural Encoding cites Principal Neighbourhood Aggregation for Graph Nets
- DualEqui: A Dual-Space Hierarchical Equivariant Network for Large Biomolecules cites Recipe for a General, Powerful, Scalable Graph Transformer
- DualEqui: A Dual-Space Hierarchical Equivariant Network for Large Biomolecules cites Enhancing Graph Transformers with Hierarchical Distance Structural Encoding
- DualEqui: A Dual-Space Hierarchical Equivariant Network for Large Biomolecules cites Do Transformers Really Perform Badly for Graph Representation?
- Do Transformers Really Perform Badly for Graph Representation? cites Open Graph Benchmark: Datasets for Machine Learning on Graphs
- Do Transformers Really Perform Badly for Graph Representation? cites Principal Neighbourhood Aggregation for Graph Nets
- Principal Neighbourhood Aggregation for Graph Nets cites Open Graph Benchmark: Datasets for Machine Learning on Graphs
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
