{"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/metro-memory-enhanced-transformer-for","title":"FusionRetro: Molecule Representation Fusion via In-Context Learning for Retrosynthetic Planning","arxiv_id":"2209.15315","date":"2022-09-30","proceeding":null,"authors":["Songtao Liu","Zhengkai Tu","Minkai Xu","Zuobai Zhang","Lu Lin","Rex Ying","Jian Tang","Peilin Zhao","Dinghao Wu"],"abstract":"Retrosynthetic planning aims to devise a complete multi-step synthetic route from starting materials to a target molecule. Current strategies use a decoupled approach of single-step retrosynthesis models and search algorithms, taking only the product as the input to predict the reactants for each planning step and ignoring valuable context information along the synthetic route. In this work, we propose a novel framework that utilizes context information for improved retrosynthetic planning. We view synthetic routes as reaction graphs and propose to incorporate context through three principled steps: encode molecules into embeddings, aggregate information over routes, and readout to predict reactants. Our approach is the first attempt to utilize in-context learning for retrosynthesis prediction in retrosynthetic planning. The entire framework can be efficiently optimized in an end-to-end fashion and produce more practical and accurate predictions. Comprehensive experiments demonstrate that by fusing in the context information over routes, our model significantly improves the performance of retrosynthetic planning over baselines that are not context-aware, especially for long synthetic routes. Code is available at https://github.com/SongtaoLiu0823/FusionRetro.","url_abs":"https://arxiv.org/abs/2209.15315v4","url_pdf":"https://arxiv.org/pdf/2209.15315v4.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":"metro-memory-enhanced-transformer-for","repo_url":"https://github.com/songtaoliu0823/fusionretro","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"drug-discovery","task_name":"Drug Discovery"},{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"multi-step-retrosynthesis","task_name":"Multi-step retrosynthesis"},{"task_slug":"retrosynthesis","task_name":"Retrosynthesis"},{"task_slug":"single-step-retrosynthesis","task_name":"Single-step retrosynthesis"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2209.15315","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2209.15315"}},"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/songtaoliu0823/fusionretro","reach":null}],"summary":{"ran":3,"ran_fixture":1,"ran_draft_wrong":1,"unverified":11},"by_repo_kind":{"official":{"samples":16,"ran":5,"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":16,"samples":[{"code_sha256_prefix":"2db11c865eb4def6","entry":"Embeddings","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2db11c865eb4def6"}},{"code_sha256_prefix":"49bbbcad6b3ba9e2","entry":"MemoryMechanismMultiHeadAttention","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"49bbbcad6b3ba9e2"}},{"code_sha256_prefix":"ce740963c248e166","entry":"MutualMultiHeadAttention","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ce740963c248e166"}},{"code_sha256_prefix":"aab6b0ababd814f1","entry":"get_attention_mask","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"aab6b0ababd814f1"}},{"code_sha256_prefix":"63f5e5133356e1ce","entry":"get_mem_attention_mask","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"63f5e5133356e1ce"}},{"code_sha256_prefix":"7ccea8dbabb872e4","entry":"Decoder","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7ccea8dbabb872e4"}},{"code_sha256_prefix":"f1b165a65087e010","entry":"DecoderLayer","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f1b165a65087e010"}},{"code_sha256_prefix":"d14f4d8502957748","entry":"Encoder","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d14f4d8502957748"}},{"code_sha256_prefix":"e9ff2eccea780216","entry":"EncoderLayer","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e9ff2eccea780216"}},{"code_sha256_prefix":"d39a5451ad73ca2a","entry":"LayerNorm","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d39a5451ad73ca2a"}},{"code_sha256_prefix":"206006247acc1466","entry":"MemoryMechanism","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"206006247acc1466"}},{"code_sha256_prefix":"6edfab863d4594ff","entry":"MemoryMechanismLayer","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6edfab863d4594ff"}},{"code_sha256_prefix":"bbc83c6266642359","entry":"SelfMultiHeadAttention","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bbc83c6266642359"}},{"code_sha256_prefix":"0d9bc0ad0e3b7f14","entry":"Transformer","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0d9bc0ad0e3b7f14"}},{"code_sha256_prefix":"11f013c9f6798201","entry":"convert_symbols_to_inputs","repo":"SongtaoLiu0823/FusionRetro","repo_kind":"official","path":"FusionRetro/retro_star.py","file_url":"https://github.com/SongtaoLiu0823/FusionRetro/blob/HEAD/FusionRetro/retro_star.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"11f013c9f6798201"}},{"code_sha256_prefix":"30837b65f41ab124","entry":"get_position_embedding","repo":"songtaoliu0823/fusionretro","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/songtaoliu0823/fusionretro/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"30837b65f41ab124"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}