Transformers over Directed Acyclic Graphs

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.

Paper

References (72)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer xj5i4/10 · confidence 4/52023-06-29

Summary

The paper proposes an attention mechanism for directed acyclic graphs. Specifically the reachability to/from nodes is considered for a given node and the unreachable nodes are masked out. The authors use this attention mechanism in existing graph transformers for undirected graphs. Further the paper also proposes a new PE for directed graphs that considers the maximum depth of the node from the root nodes. The method is evaluated over source code and citation datasets and authors show it improves existing transformer performance.

Strengths

1. The method achieves state of the art results when induced in transformer architectures on datasets used 2. Method is claimed to be parallelizable and results in faster training compared to asynchronous methods

Weaknesses

1. Regarding limiting the receptive field of the transformer, the method selects nodes up to path length k. But a principle question arises about “How to select k?”. As of now it seems to be a heuristic or a dataset dependent parameter, which limits the novelty of the work as it is straightforward to apply attention in the top k hop reachable nodes in order to induce some notion of structure in the transformer. 2. Considering that the method only limits the attention to reachable nodes and uses topological depth as PE in existing methods the novelty and contribution seems limited. 3. The proposed attention mechanism that is restricted to reachable nodes, may suffer from learning issues when a node label depends on non-reachable nodes. For example if the label of a child node depends on sibling nodes but those are not reachable and the transformer used is of single layer. The same issue may arise with more layers etc. if there exists label dependence on farther non-reachable nodes. This is where the fundamental strength of the transformer lies over GNN that it doesn't need to wait over many layers for the information to be propagated. But with the proposed modification this property is lost. Missing Citations: 1. https://proceedings.mlr.press/v162/dong22b.html

Questions

1. Regarding limiting the receptive field of the transformer, the method selects nodes up to path length k. But a principle question arises about “How to select k?”. Can the authors comment on a more principled way of selecting k rather than keeping it a heuristic or a dataset dependent parameter? 2. In table 6, the results for the base transformer model and proposed method without DAGRA are the same in ogbg-code2. Is this because no PE is used and the rest of the architecture remains the same? 3. Do the authors see any issues in learning with the proposed attention mechanism that is restricted to reachable nodes? For example if the label of a child node depends on sibling nodes but those are not reachable and the transformer used is of single layer. The same issue may arise with more layers etc. if there exists label dependence on non-reachable nodes. This is where the fundamental strength of the transformer lies over GNN that it doesn't need to wait over many layers for the information to be propagated. But with the proposed modification this property is lost. Can the proposed framework be adapted to handle such cases?

Rating

4: Borderline reject: Technically solid paper where reasons to reject, e.g., limited evaluation, outweigh reasons to accept, e.g., good evaluation. Please use sparingly.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

2 fair

Presentation

2 fair

Contribution

1 poor

Limitations

Limitations of the method have been addressed in the paper.

Authorsrebuttal2023-08-13

Response by Authors

Thank you for getting back to us and for considering our rebuttal in the final review!

Authorsrebuttal2023-08-21

Author Question

Dear Reviewer xj5i, We hope the clarifications in the rebuttal changed your view of our contribution to the positive side. We are sorry for bothering you again! But since the competition is tough and you acknowledged our rebuttal, we wanted to make sure our work doesn't get forgotten.

Reviewer xj5i2023-08-21

I have read the rebuttal and I want to express my appreciation for the response by authors. The response basically address my questions. Therefore, I will keep my rating unchanged so far and make the final decision until the reviewer discussion phase. Many Thanks!

Authorsrebuttal2023-08-21

Final Comment by Authors

Thank you so much for your participation in the discussion and for mentioning it to us!

Reviewer WzDZ6/10 · confidence 4/52023-06-30

Summary

This paper adapts transformers to directed acyclic graphs. It restricts the receptive field of each node to its predecessor and successor nodes so that it faithfully captures the DAG structure. It also incorporates positional encodings based on the node depth. Extensive experiments show that it can improve performance of different kinds of baseline transformers.

Strengths

1. The proposed method is efficient and versatile. It can improve performance of a broad spectrum of transformers. 2. The problem of adapting transformers to DAGs is under-explored. 3. The analysis and experimental results regarding $k$ is surprising and inspiring.

Weaknesses

1. The datasets used in this paper are rather small. As efficiency and versatility are two key advantages claimed by the paper, can the authors include experimental results on larger graphs, like ogbn datasets?

Questions

1. The authors mentioned that they used the same hyperparameters as baseline transformers. Does this include learning rate, weight decay and dropout? If so, one only needs to integrate the proposed module without searching any hyperparameters (as long as $k$ is large enough) and can immediately facilitate an enhancement in performance. 2. See weakness 1.

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

4 excellent

Presentation

3 good

Contribution

3 good

Limitations

Most limitations have been addressed.

Authorsrebuttal2023-08-13

Thank you for initiating further interesting discussion!

**It is a good idea to point out that the focus of SOTA research [2,3] on regular graph transformers is very different from our proposal**, which shows that we can exploit the special structure of DAGs to considerably improve their effectiveness in this very specific - but sometimes important - setting. We can certainly add the indeed proven method [1] as baseline. Please also note that we experimented with the shortest path distance from that paper to address U6X8, Q3. Please note that, since there are many interesting SOTA graph transformers, our submission focused on GraphGPS and NodeFormer, which provided SOTA scores at the time when we were conducting our experiments. We'll run further experiments to include [3] and [3] + DAG into the tables now. **This could indeed nicely underline the fact that our framework's general nature allows for continuous and even subtle SOTA advances** (i.e., here, comparing NodeFormer and DIFFormer [3]). We'll update you here once the results are available!

Reviewer WzDZ2023-08-14

Response to rebuttal

Allow me to clarify my previous point. My intention was simply to recommend incorporating references to these works within the related works section, thereby enhancing the comprehensiveness of the background. I understand that the rebuttal timeframe is limited, and my intention was not to burden you with additional efforts in introducing more baselines or applying the proposed method to new backbones. After all, you have already applied the proposed method to 3 backbones and I think it is enough. Nevertheless, in case circumstances permit, you could consider including the previously mentioned experimental outcomes in the final version. Thank you for the feedback.

Authorsrebuttal2023-08-14

Thank you for clarifying!

We wanted to make sure we address *all* remaining concerns and the experiment is a valid proposal. Preliminary experiments on some datasets show that **our framework likely increases both quality and runtime here as well, sometimes considerably**. | | Cora | | Citeseer | | | :---------------- | :----------------- | :------------- | :----------------- | :------------- | | | Accuracy | Train time (s) | Accuracy | Train time (s) | | NodeFormer | 83.4 $\pm$ 0.2 | - | 73.0 $\pm$ 0.3 | - | | DIFFormer-a | 84.1 $\pm$ 0.6 | 14.215 |75.7 $\pm$ 0.3 | 8.481 | | DAG+DIFFormer-a | **85.1** $\pm$ 0.7 | **10.967** | **76.2** $\pm$ 0.4 | **7.015** | Please note that we report the semi-supervised setting (different from our paper), since this is the one considered in the DIFFormer paper. (edit: we found a bug in the pre-processing with Citeseer and adapted those results)

Reviewer WzDZ2023-08-15

Response to rebuttal

Thanks for the additional results, which contribute to further substantiating the versatility of the proposed method. I have raised my rating to 6. However, I do have a minor question: why does the inclusion of DAG can save the training time?

Authorsrebuttal2023-08-15

This is an important point

Thank you for asking! Since we technically (though not effectively, see the global reply) restrict the attention to only the DAG's relationships, which are are usually sparse, and implement this using message-passing GNNs, **we obtain considerable performance increases generally, also during training**. More precisely, the time complexity is reduced to $O(|V | × n_\infty × d)$; $n_\infty$ denotes the average size of the receptive field and is typically much smaller than |V|. See also Sec. 3.5.

Reviewer Qc5n6/10 · confidence 3/52023-07-06

Summary

The paper proposed a new approach for DAG representation learning using transformer. The representation learning on DGA is significant as DAG can be adapted into many real-world problems, which is also explained in the paper. In addition, the DAG can be formed into a sequence of nodes so that it is naturally to think about using transformers to model. The paper conducted comprehensive experiments to support its claim.

Strengths

The paper utilizes transformer to achieve representation learning on DAG, which is natural. Although transformer has been used on graphs, they are mostly for undirected graphs. The paper tells the story in an easy-to-read way. It also conducts extensive experiments to show the superior performance of the proposed model. The task the paper wants to solve is significant in that DAG can be naturally adapted to many real-world applications. This has also been discussed in the apper.

Weaknesses

(1) It seems that there is one paper that does the same thing [1]. I think this paper should at least be discussed in the paper. (2) I was wondering why some models in Table 2 and Table 2 are not present in Table 4 and Table 5, such as PNA, DGANN. (3) Will the choice of the root node affect the final results? [1] Dong et al., PACE: A Parallelizable Computation Encoder for Directed Acyclic Graphs. 2022

Questions

See weakness.

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

Limitations have been discussed by the paper.

Authorsrebuttal2023-08-14

Response by Authors

a. Please note that we did not intend to ignore the comparison, but rather did not want to give the impression that is reasonable to run DAGNN over larger graphs, especially in case where there are alternatives; observe that it is more than 100 times slower than GCN or our model. Nevertheless, this experiment reveals that our framework, even in combination with the most simple vanilla Transformer, provides a useful alternative and is **likely able to make any transformer competitive to SOTA networks tailored to DAGs**. | | Cora | Citeseer | Pubmed | NA | | | ----- | ---------------- | ---------------- | ---------------- | ----------------- | ----------------- | | | Accuracy | Accuracy | Accuracy | RMSE | Pearson's r | | PNA | 87.03 $\pm$ 0.73 | 73.11 $\pm$ 1.06 | 87.99 $\pm$ 0.26 | 0.691 $\pm$ 0.003 | 0.707 $\pm$ 0.001 | | DAGNN | 84.49 $\pm$ 0.59 | **74.52 $\pm$ 0.67** | OOM | 0.264 $\pm$ 0.004 | 0.964 $\pm$ 0.001 | |Transformer |75.92 $\pm$ 0.86| 72.23 $\pm$ 1.06 |OOM|0.285 $\pm$0.004 |0.957 $\pm$ 0.001 | |**DAG+Transformer**| **87.80** $\pm$ 0.53| **74.42 $\pm$ 0.22** |**89.0** $\pm$ 0.13|**0.253** $\pm$ 0.002 |**0.966** $\pm$0.001 | b. Sorry for not specifying this clearly, there is no randomness here and we use the same setting as the related works. More specifically, every dataset comes with the graphs in terms of nodes and edges and, by definition (and without any randomness), source nodes are the nodes where the indegree is zero. For instance, in python source code graphs, this might be nodes corresponding to a code token in the very beginning (e.g., "def") and, in citation networks, this are nodes corresponding to authors who cite others but who have not been cited yet.

Reviewer Qc5n2023-08-15

Response to author

Thank the response from the author and my concerns are properly addressed.

Reviewer U6X86/10 · confidence 3/52023-07-07

Summary

The paper proposing a new Transformer-based graph neural network for directed graphs (DAGs) that restricts the receptive field size of self-attention and adds depth-based node embeddings to improve learning from DAGs. The resulted model is more efficient than previous Graph Transformer models and at the same time more effective in different DAG tasks as shown in many experiments.

Strengths

1. The problem of learning from DAGs is interesting and important. Improving Transformers for this problem is a reasonable direction. 2. The introduced improvements are simple, but effective. 3. Computational complexity analysis in Section 3.5 is a nice addition. 4. Experiments are overall convincing. 5. The paper is easy to follow and presented well.

Weaknesses

While I enjoyed reading the paper, the paper needs to address the following weaknesses: 1. The paper is missing related works [A, B], which seem to be doing exactly the same as DAGNN by proposing what they call GatedGNN. Therefore, citing DAGNN but not citing A/B can be misleading for readers. 2. Papers [C, D] are also related and it would be nice to discuss them as well. Given their recent appearance it's not necessary to empirically compare to them (although it would make the paper stronger), but they should be discussed. In particular, [C] is solving the same ogbg-code2 task, but achieves much better performance, can the authors discuss why? [D] is proposing a Transformer-based [40] graph model for DAGs and also add node depth-based PE embeddings similar to those in this submission + degree-based embeddings based on [40] (which could further improve the results in this submission). Given these papers, L122: "to the best of our knowledge, transformers have not been studied particularly in the context of DAGs" should be rephrased. 3. The DAGRA component of the method does not seem to leverage two important sources of information: (1) the direction of edges -- node predecessors and successors are treated equally based on L163-164; (2) the shortest path distance between nodes -- the mask is equal to 0 or −∞ in L203. Even though the DAGPE embeddings can help to recover this information, leveraging (1) and (2) seems very natural and could improve results by better distinguishing certain DAG structures. In related papers using Transformers for undirected/directed graphs, (1) and (2) are leveraged. For example, in [C] the forward and backward edges are treated separately, and in [40], [C], the shortest path distance is used in masking. 3. Section 3.3's conclusion is not very clear. Is this section trying to say that all nodes will eventually communicate with each other if enough layers and/or large k are used? Please elaborate/rephrase. 4. Results on ogbg-code2 in Table 6 are a bit confusing, because at first it looks like DAG+TF/SAT are using DAGPE, but from the text it sounds like DAGPE is not used. I think it would be more clear to report both results, with DAGPE and without it, even if the latter is better so that the Table does not have blank entries. **Minor issues:** - "partial order" - wouldn't it be more appropriate to use "topological order" that is often used in DAG context (e.g. https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.dag.topological_sort.html and [A, B])? "partial order" seems to be more relevant to sets. - In Tables, bolding results per pair makes sense, but baseline's top performance should be highlighted too. Also, the overall top performance across all rows can be underlined (or highlighted in some other way). - In Fig. 3, it's hard to conclude that DAG+Nodeformer separate classes better, so I don't think this visualization is helpful in the main text. - All equations should be numbered so that reviewers and readers can refer to them easily. - L130: "in more important fields than" - it's a quite subjective statement - L154: "[a] given node’s predecessors" - L169: "regular transformers (e.g., Eq. 2)" - Eq. 1? - L168: "still very different" - please elaborate how is it different given that k=∞ is the best *References:* - [A] Graph HyperNetworks for Neural Architecture Search. ICLR 2019. - [B] Parameter Prediction for Unseen Deep Architectures. NeurIPS 2021. - [C] Can We Scale Transformers to Predict Parameters of Diverse ImageNet Models? ICML 2023. - [D] Transformers Meet Directed Graphs. ICML 2023.

Questions

See Weaknesses above. I'm looking forward to the author's response and will be willing to update my score.

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

3 good

Presentation

3 good

Contribution

3 good

Limitations

Limitations are discussed, which is appreciated. L344 says that "we found only a limited number of DAG datasets", so one suggestion would be to use a dataset of DAGs introduced in [B].

Authorsrebuttal2023-08-14

Thank you for getting back to us!

We highly appreciate the careful and positive evaluation. In case there is anything we can do to address the remaining concerns, please let us know!

Reviewer xj5i2023-08-13

Response to Rebuttal

Thanks to the authors for the clarifications and it helps my understanding of the proposed method and contributions. I will think through the discussed points in detail and consider my review in light of the responses. Many Thanks

Area Chair vN1V2023-08-13

Please read and respond to rebuttal

Dear reviewers, Please read and respond to the rebuttal as soon as possible. Thanks

Authorsrebuttal2023-08-17

Thank you everyone!

We thank the AC for starting the discussion. We sincerely appreciate that all reviewers fully recognized our contributions, took our rebuttal into account, and provided constructive and positive feedback!

Reviewer WzDZ2023-08-13

Response to rebuttal

Thanks for the rebuttal, most of my concerns have been addressed.

Reviewer WzDZ2023-08-13

One more suggestion

Let me give another suggestion to the related works section: The paper could have benefited from acknowledging [1,2,3] as pertinent references and conducting a comparative analysis with the proposed method. This would have contributed to a more comprehensive examination of the relevant works and underscored the innovative nature of the proposed methodology. [1] Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen, and Tie-Yan Liu. Do transformers really perform bad for graph representation? In Advances in Neural Information Processing Systems, 2021. [2] Md. Shamim Hussain, Mohammed J. Zaki, and Dharmashankar Subramanian. Global self attention as a replacement for graph convolution. In ACM SIGKDD Conference on Knowledge Discovery and Data Mining, 2022. [3] Qitian Wu, Chenxiao Yang, Wentao Zhao, Yixuan He, David Wipf, and Junchi Yan. 2023. DIFFormer: Scalable (Graph) Transformers Induced by Energy Constrained Diffusion. In International Conference on Learning Representations, 2023.

Reviewer Qc5n2023-08-14

Response to author

Thank the author for clarifying my concerns. a. I still think that it's a bit weired if baselines in Table 2, 4 and 5 are different. Although this is a minor issue, I would recommend the author to make it equivalent for fair comparison and statement in the paper. b. For the source node, how is it specified in the dataset, by random? I would also suggest the author to clarify this in their paper.

Reviewer U6X82023-08-14

Thank you for the response. It clarifies some of my concerns, therefore I increased the score from 5 to 6.

Program Chairsdecision2023-09-21

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC