{"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/molecule-edit-graph-attention-network","title":"Molecule Edit Graph Attention Network: Modeling Chemical Reactions as Sequences of Graph Edits","arxiv_id":"2006.15426","date":"2020-06-27","proceeding":null,"authors":["Mikołaj Sacha","Mikołaj Błaż","Piotr Byrski","Paweł Dąbrowski-Tumański","Mikołaj Chromiński","Rafał Loska","Paweł Włodarczyk-Pruszyński","Stanisław Jastrzębski"],"abstract":"The central challenge in automated synthesis planning is to be able to generate and predict outcomes of a diverse set of chemical reactions. In particular, in many cases, the most likely synthesis pathway cannot be applied due to additional constraints, which requires proposing alternative chemical reactions. With this in mind, we present Molecule Edit Graph Attention Network (MEGAN), an end-to-end encoder-decoder neural model. MEGAN is inspired by models that express a chemical reaction as a sequence of graph edits, akin to the arrow pushing formalism. We extend this model to retrosynthesis prediction (predicting substrates given the product of a chemical reaction) and scale it up to large datasets. We argue that representing the reaction as a sequence of edits enables MEGAN to efficiently explore the space of plausible chemical reactions, maintaining the flexibility of modeling the reaction in an end-to-end fashion, and achieving state-of-the-art accuracy in standard benchmarks. Code and trained models are made available online at https://github.com/molecule-one/megan.","url_abs":"https://arxiv.org/abs/2006.15426v2","url_pdf":"https://arxiv.org/pdf/2006.15426v2.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":"molecule-edit-graph-attention-network","repo_url":"https://github.com/molecule-one/megan","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"graph-attention","task_name":"Graph Attention"},{"task_slug":"retrosynthesis","task_name":"Retrosynthesis"},{"task_slug":"single-step-retrosynthesis","task_name":"Single-step retrosynthesis"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/single-step-retrosynthesis-on-uspto-50k","task":"Single-step retrosynthesis","dataset":"USPTO-50k","model":"MEGAN (reaction class as prior)","rank_in_archive_order":10,"of":35,"metrics":{"Top-1 accuracy":"60.7","Top-10 accuracy":"91.6","Top-3 accuracy":"82","Top-5 accuracy":"87.5"},"uses_additional_data":false},{"leaderboard":"/sota/single-step-retrosynthesis-on-uspto-50k","task":"Single-step retrosynthesis","dataset":"USPTO-50k","model":"MEGAN (reaction class unknown)","rank_in_archive_order":32,"of":35,"metrics":{"Top-1 accuracy":"48.1","Top-10 accuracy":"86.1","Top-20 accuracy":"90.3","Top-3 accuracy":"70.7","Top-5 accuracy":"78.4","Top-50 accuracy":"93.2"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2006.15426","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2006.15426"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/molecule-one/megan","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":6},"by_repo_kind":{"official":{"samples":6,"ran":0,"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":"35a1bc504611c90d","entry":"get_adj_path","repo":"molecule-one/megan","repo_kind":"official","path":"src/feat/megan_graph.py","file_url":"https://github.com/molecule-one/megan/blob/HEAD/src/feat/megan_graph.py","link_basis":"first_harvest_node","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":"35a1bc504611c90d"}},{"code_sha256_prefix":"042085ae57c430df","entry":"get_base_action_masks","repo":"molecule-one/megan","repo_kind":"official","path":"src/model/megan_utils.py","file_url":"https://github.com/molecule-one/megan/blob/HEAD/src/model/megan_utils.py","link_basis":"first_harvest_node","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":"042085ae57c430df"}},{"code_sha256_prefix":"87e4cd29e722b0b6","entry":"get_nodes_path","repo":"molecule-one/megan","repo_kind":"official","path":"src/feat/megan_graph.py","file_url":"https://github.com/molecule-one/megan/blob/HEAD/src/feat/megan_graph.py","link_basis":"first_harvest_node","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":"87e4cd29e722b0b6"}},{"code_sha256_prefix":"e3709e88b0e80e8d","entry":"get_sample_data_path","repo":"molecule-one/megan","repo_kind":"official","path":"src/feat/megan_graph.py","file_url":"https://github.com/molecule-one/megan/blob/HEAD/src/feat/megan_graph.py","link_basis":"first_harvest_node","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":"e3709e88b0e80e8d"}},{"code_sha256_prefix":"ecfb638373066abe","entry":"softmax","repo":"molecule-one/megan","repo_kind":"official","path":"src/model/megan_modules/decoder.py","file_url":"https://github.com/molecule-one/megan/blob/HEAD/src/model/megan_modules/decoder.py","link_basis":"first_harvest_node","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":"ecfb638373066abe"}},{"code_sha256_prefix":"e5bfe5eefc935780","entry":"to_one_hot","repo":"molecule-one/megan","repo_kind":"official","path":"src/model/megan.py","file_url":"https://github.com/molecule-one/megan/blob/HEAD/src/model/megan.py","link_basis":"first_harvest_node","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":"e5bfe5eefc935780"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}