{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/transformers-over-directed-acyclic-graphs-1","title":"Transformers over Directed Acyclic Graphs","arxiv_id":"2210.13148","date":"2022-10-24","proceeding":"NeurIPS 2023 11","authors":["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.","url_abs":"https://arxiv.org/abs/2210.13148v6","url_pdf":"https://arxiv.org/pdf/2210.13148v6.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"transformers-over-directed-acyclic-graphs-1","repo_url":"https://github.com/LUOyk1999/DAGformer","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"graph-property-prediction","task_name":"Graph Property Prediction"},{"task_slug":"graph-representation-learning","task_name":"Graph Representation Learning"},{"task_slug":"representation-learning","task_name":"Representation Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/graph-property-prediction-on-ogbg-code2","task":"Graph Property Prediction","dataset":"ogbg-code2","model":"DAGformer","rank_in_archive_order":3,"of":21,"metrics":{"Ext. data":"No","Number of params":"14952882","Test F1 score":"0.2018 ± 0.0021","Validation F1 score":"0.1846 ± 0.0010"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2210.13148","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2210.13148"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/LUOyk1999/DAGformer","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_honours":2,"unverified":7},"by_repo_kind":{"listed":{"samples":9,"ran":2,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"214d66f90baa5770","entry":"create_products_of_givens_rotations","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"Node_classification_citation/dag_nodeformer.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/Node_classification_citation/dag_nodeformer.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"214d66f90baa5770"}},{"code_sha256_prefix":"44fbc869db4685a6","entry":"create_projection_matrix","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"Node_classification_citation/dag_nodeformer.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/Node_classification_citation/dag_nodeformer.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"44fbc869db4685a6"}},{"code_sha256_prefix":"0ca4bfed1ccd10c3","entry":"eigvec_normalizer","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"NA/src/utils_dag.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/NA/src/utils_dag.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0ca4bfed1ccd10c3"}},{"code_sha256_prefix":"19afc55973cf4ff3","entry":"get_conv","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"self-citation/models.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/self-citation/models.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"19afc55973cf4ff3"}},{"code_sha256_prefix":"3f612bede595ee34","entry":"get_lap_decomp_stats","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"NA/src/utils_dag.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/NA/src/utils_dag.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3f612bede595ee34"}},{"code_sha256_prefix":"a99c1bcf4a331aae","entry":"get_simple_gnn_layer","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"Node_classification_citation/gnn_layers.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/Node_classification_citation/gnn_layers.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a99c1bcf4a331aae"}},{"code_sha256_prefix":"8b08a2aa35ad4509","entry":"get_simple_gnn_layer","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"NA/dvae/gnn_layers.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/NA/dvae/gnn_layers.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8b08a2aa35ad4509"}},{"code_sha256_prefix":"9ec77c43b56275a8","entry":"relu_kernel_transformation","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"Node_classification_citation/dag_nodeformer.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/Node_classification_citation/dag_nodeformer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9ec77c43b56275a8"}},{"code_sha256_prefix":"9dd505688b70e6d7","entry":"top_sort","repo":"LUOyk1999/DAGformer","repo_kind":"listed","path":"NA/src/utils_dag.py","file_url":"https://github.com/LUOyk1999/DAGformer/blob/HEAD/NA/src/utils_dag.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9dd505688b70e6d7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}