{"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/preference-optimization-for-molecule","title":"Preference Optimization for Molecule Synthesis with Conditional Residual Energy-based Models","arxiv_id":"2406.02066","date":"2024-06-04","proceeding":null,"authors":["Songtao Liu","Hanjun Dai","Yue Zhao","Peng Liu"],"abstract":"Molecule synthesis through machine learning is one of the fundamental problems in drug discovery. Current data-driven strategies employ one-step retrosynthesis models and search algorithms to predict synthetic routes in a top-bottom manner. Despite their effective performance, these strategies face limitations in the molecule synthetic route generation due to a greedy selection of the next molecule set without any lookahead. Furthermore, existing strategies cannot control the generation of synthetic routes based on possible criteria such as material costs, yields, and step count. In this work, we propose a general and principled framework via conditional residual energy-based models (EBMs), that focus on the quality of the entire synthetic route based on the specific criteria. By incorporating an additional energy-based function into our probabilistic model, our proposed algorithm can enhance the quality of the most probable synthetic routes (with higher probabilities) generated by various strategies in a plug-and-play fashion. Extensive experiments demonstrate that our framework can consistently boost performance across various strategies and outperforms previous state-of-the-art top-1 accuracy by a margin of 2.5%. Code is available at https://github.com/SongtaoLiu0823/CREBM.","url_abs":"https://arxiv.org/abs/2406.02066v1","url_pdf":"https://arxiv.org/pdf/2406.02066v1.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":"preference-optimization-for-molecule","repo_url":"https://github.com/songtaoliu0823/crebm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"drug-discovery","task_name":"Drug Discovery"},{"task_slug":"retrosynthesis","task_name":"Retrosynthesis"}],"methods":[{"method_slug":"focus","method_name":"Focus"},{"method_slug":"set","method_name":"SET"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2406.02066","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.02066"}},"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/SongtaoLiu0823/CREBM","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/songtaoliu0823/crebm","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_fixture":1,"ran_draft_wrong":3,"ran":6,"unverified":10},"by_repo_kind":{"official":{"samples":20,"ran":10,"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":"aab6b0ababd814f1","entry":"get_attention_mask","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/FusionRetro/modeling.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"aab6b0ababd814f1"}},{"code_sha256_prefix":"eec7bf6cd0c9ce7d","entry":"get_attention_mask","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"eec7bf6cd0c9ce7d"}},{"code_sha256_prefix":"d9192da44e7497f4","entry":"get_attention_mask_reward","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"FusionRetro/reward_model.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/FusionRetro/reward_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d9192da44e7497f4"}},{"code_sha256_prefix":"eff77b1103611612","entry":"get_dataset","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"Forward_model/forward_preprocess.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/Forward_model/forward_preprocess.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"eff77b1103611612"}},{"code_sha256_prefix":"bda04ebfeae378ad","entry":"get_input_mask_reward","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"FusionRetro/reward_model.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/FusionRetro/reward_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bda04ebfeae378ad"}},{"code_sha256_prefix":"63f5e5133356e1ce","entry":"get_mem_attention_mask","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/FusionRetro/modeling.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"63f5e5133356e1ce"}},{"code_sha256_prefix":"6ffa7d3b10e36bff","entry":"get_model_dir","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"GraphRetro/scripts/benchmarks/run_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/GraphRetro/scripts/benchmarks/run_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6ffa7d3b10e36bff"}},{"code_sha256_prefix":"8a2fd49d7c7f70d1","entry":"get_position_embedding","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/Energy_function/reward_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8a2fd49d7c7f70d1"}},{"code_sha256_prefix":"30d746b2a597c06c","entry":"get_position_embedding","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"FusionRetro/modeling.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/FusionRetro/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"30d746b2a597c06c"}},{"code_sha256_prefix":"bc7b5841f4ac0765","entry":"get_position_embedding_reward","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"FusionRetro/reward_model.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/FusionRetro/reward_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bc7b5841f4ac0765"}},{"code_sha256_prefix":"504a163b8cca9e67","entry":"Decoder","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"504a163b8cca9e67"}},{"code_sha256_prefix":"d291fa98cd3fd2ba","entry":"DecoderLayer","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"d291fa98cd3fd2ba"}},{"code_sha256_prefix":"ae58f0fed04a3eba","entry":"Embeddings","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"ae58f0fed04a3eba"}},{"code_sha256_prefix":"54fe6546395e90b0","entry":"Encoder","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"54fe6546395e90b0"}},{"code_sha256_prefix":"b4ba32298cce6023","entry":"EncoderLayer","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"b4ba32298cce6023"}},{"code_sha256_prefix":"35b3f91bfff1f5ce","entry":"MultiHeadAttention","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"35b3f91bfff1f5ce"}},{"code_sha256_prefix":"c02f128f73e14a42","entry":"RewardTransformer","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"c02f128f73e14a42"}},{"code_sha256_prefix":"84f89ccafcd7f616","entry":"convert_symbols_to_inputs","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"Forward_model/forward_preprocess.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/Forward_model/forward_preprocess.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":"84f89ccafcd7f616"}},{"code_sha256_prefix":"a241aff115771ddd","entry":"get_input_mask","repo":"SongtaoLiu0823/CREBM","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/SongtaoLiu0823/CREBM/blob/HEAD/Energy_function/reward_model.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":"a241aff115771ddd"}},{"code_sha256_prefix":"492feba8c4b1b9ff","entry":"get_position_embedding","repo":"songtaoliu0823/crebm","repo_kind":"official","path":"Energy_function/reward_model.py","file_url":"https://github.com/songtaoliu0823/crebm/blob/HEAD/Energy_function/reward_model.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":"492feba8c4b1b9ff"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}