A complex small molecule reverse synthesis path planning method based on tree search and memory driving

CN122991327APending Publication Date: 2026-10-27ZHEJIANG UNIV OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611100769.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-10-27

AI Technical Summary

Benefits of technology

[0024]本发明的创新点在于:一方面,将数据库模板反向执行得到的候选切分动作作为局部可验证的切分锚点,用于引导大语言模型组织多步候选路线,而不是仅将模板本身或大语言模型自由生成的前体集合直接作为搜索动作;另一方面,将严格模板验证设置为候选路线进入 AND/OR 搜索树的准入门,只有连续通过验证的合法路线前缀能够被插入搜索树;再一方面,将验证通过的切分、验证失败的切分、剪枝原因、节点访问状态和搜索瓶颈沉淀为宏观与微观两级结构化经验记忆,并将其反馈至候选切分图排序、提示信息构造和后续搜索扩展。由此,本发明形成了“模板生成切分锚点-大语言模型候选路线生成-严格验证准入-AND/OR 树搜索-结构化经验反馈”的闭环式逆合成规划框架。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122991327A_ABST
    Figure CN122991327A_ABST
Patent Text Reader

Abstract

A complex small molecule reverse synthesis path planning method based on tree search and memory driving, comprising: 1) obtaining the molecular representation of the target molecule, loading the synthesis knowledge base; 2) establishing an AND / OR search tree, generating template-supported root-cutting anchor points and target-level macro strategies; 3) selecting a molecular node to be expanded, constructing a candidate cutting graph generated by a template; 4) constructing a large language model prompt information, generating a candidate reverse synthesis route; 5) strictly verifying the candidate reverse synthesis route; 6) cutting the continuous legal route prefix that passes the verification from the candidate reverse synthesis route, inserting it into the AND / OR search tree, discarding or recording the unverified as failure evidence; 7) calculating the reward value of the AND reaction node and returning it, updating the node value and selecting the subsequent molecular node to be expanded; 8) updating the structured experience memory, repeating steps 1) to 8) until the root node is solved, the search budget is exhausted or there is no expandable legal node, and outputting the complete or best partial reverse synthesis route.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer-aided organic synthesis route design technology, and in particular to a method and apparatus for inverse synthesis path planning that combines large language model task planning capabilities, hierarchical structured self-evolutionary experience memory, and tree search enhanced by similar route retrieval. Background Technology

[0002] Retrosynthetic analysis aims to break down a target product into commercially available or readily available precursor molecules. Traditional template-based retrosynthetic methods typically rely on pre-extracted reaction rules, which offer advantages in terms of strong chemical feasibility. However, in multi-step route planning for complex drug-like molecules, they are easily limited by template coverage, the number of candidate actions, and the depth of heuristic search.

[0003] In recent years, large language models have been able to propose multi-step retrosynthetic schemes based on molecular structure and chemical knowledge, demonstrating good generalization ability. However, the SMILES, reaction SMARTS, or precursor sets directly generated by large language models may contain problems such as valence state errors, aromaticity errors, route connection errors, fictitious reaction templates, duplicate generation of ancestor molecules, and the generation of unstable or unpurchasable intermediates. If such generated results are directly incorporated into the search tree, the search space will be contaminated by erroneous branches, reducing the reliability of route planning.

[0004] Some existing retrieval enhancement generation methods provide similar historical routes as prompts to the model, but similar routes themselves cannot guarantee that every step of the model's output will be executed by the local response template. Other search methods, although employing AND / OR tree or Monte Carlo tree search frameworks, often rely on candidate actions derived from single-step models or template enumeration, making it difficult to leverage the multi-step global planning capabilities of large language models. They also lack mechanisms to structurally feed back verified successes and failures into subsequent generation processes.

[0005] Therefore, a retrosynthetic path planning scheme is needed, which allows a large language model to propose candidate paths rather than directly determine the search results, and to perform rigorous database template execution verification before the candidate paths enter the search tree. At the same time, it is necessary to precipitate the evidence of successful and unsuccessful verification into macroscopic and microscopic experience, and continuously constrain the subsequent candidate generation, so as to improve the executability, search efficiency and stability of retrosynthetic planning for complex molecules. Summary of the Invention

[0006] This invention provides a method and apparatus for retrosynthetic pathway planning for complex small organic molecules, which overcomes the problems of large search space, difficulty in ensuring the chemical feasibility of candidate routes, easy contamination of the search tree by the output of large language models, and difficulty in reusing verification experience in existing retrosynthetic pathway planning methods.

[0007] In a first aspect, the present invention provides a retrosynthetic pathway planning method for complex small organic molecules, executed by a computing device, comprising the following steps: S1, Obtain the molecular representation of the target molecule, normalize the molecular representation, and load the synthesis knowledge base, which includes a reaction template library, a historical route library, and a purchasable molecule library.

[0008] S2, Based on the target molecule, establish an AND / OR search tree, and according to the reaction template library, the historical route library, and the purchasable molecule library, generate template-supported root splitting anchor points and target-level macroscopic strategies for the target molecule.

[0009] S3, select the molecular node to be expanded in the AND / OR search tree, and construct a candidate segmentation map based on the molecular node to be expanded using the template. The candidate segmentation items in the candidate segmentation map are the segmentation actions from product to precursor set obtained by applying a database template that can be matched and reversed on the product side to the molecular to be expanded, rather than the reaction template itself.

[0010] S4. Based on the current search path, search frontier information, the target-level macro strategy, the candidate segmentation map, similar historical routes, and structured experience memory, construct large language model prompt information, and call the large language model to generate one or more candidate inverse synthesis routes.

[0011] S5, perform rigorous verification on the candidate retrosynthetic route, which includes molecular representation validity check, route connectivity check, database template matching, and reverse execution of the matched database template on the product molecule.

[0012] S6. Extract the legal route prefixes that have passed strict verification from the candidate inverse synthesis routes, insert only the legal route prefixes into the AND / OR search tree, and discard or record the route suffixes that have not passed verification as evidence of failure.

[0013] S7. Calculate the reward value of the inserted AND reaction node based on the purchasability and chemical complexity of the precursor, and backpropagate the reward value along the AND / OR search tree to update the node value and select subsequent molecular nodes to be expanded.

[0014] S8, update the structured experience memory based on the legal route prefix, the route suffix that failed verification and the search tree node status, and repeat S3 to S8 until the root node of the target molecule is solved, the search budget is exhausted or there are no scalable legal nodes, and output the complete inverse synthesis route or the best partial inverse synthesis route.

[0015] Further, S2 includes: creating root OR molecular nodes based on the normalized target molecule; retrieving historical routes similar to the target molecule from the historical route library; screening database templates that can match the target molecule on the product side from the reaction template library, and performing reverse execution on the target molecule using the screened database templates to obtain one or more root splitting anchors; inputting the target molecule, the similar historical routes, and the root splitting anchors into at least one large language model to generate the target-level macro-strategy, wherein the target-level macro-strategy includes skeleton-level decomposition direction, route priority, and chemical risk constraints.

[0016] Further, the candidate segmentation graph generated by constructing the template in S3 includes: performing product-side template adaptation on the molecules corresponding to the molecular nodes to be expanded to obtain a set of product-side matchable templates; performing reverse reactions on the templates in the set of product-side matchable templates to generate a set of candidate precursors; normalizing, deduplicating, and filtering the set of candidate precursors; and sorting the set of candidate precursors according to similar historical route matching scores, structured experience scores, proportion of purchasable precursors, complexity of non-purchasable precursors, changes in the number of heavy atoms, lateral movement risk, and unstable intermediate risk to obtain the candidate segmentation graph.

[0017] Further, S4 includes: obtaining the current search path from the root node of the AND / OR search tree to the molecular node to be expanded; calculating the search front information of the branch where the molecular node to be expanded is located, the search front information including the number of terminal molecules, the proportion of purchasable terminal molecules, and the complexity information of non-purchasable terminal molecules; reading the micro-experience and global macro-experience corresponding to the molecular node to be expanded from the structured experience memory; combining the current search path, search front information, target-level macro-strategy, candidate segmentation graph, similar historical routes, micro-experience, and global macro-experience into large language model prompt information, so that the large language model outputs candidate inverse synthesis routes.

[0018] Further, S5 includes: maintaining a set of active molecules composed of the molecules to be disassembled; for each step of the candidate retrosynthetic route, checking whether the product of that step belongs to the set of active molecules, and checking whether the molecular representations of the product and the precursor of that step are valid; constructing a template query based on the product of that step, the candidate precursor, and the candidate reaction template, and sequentially performing exact template matching, substructure template matching, and fingerprint similarity Top-K template matching; performing the reverse execution of the matched database template on the product of that step; when the database template generates a valid precursor set, using the precursor set generated by the template as the normalized precursor set for that step.

[0019] Further, S6 includes: starting from the first step of the candidate retrosynthetic route, accepting one or more steps that have passed rigorous verification consecutively as a valid route prefix; before inserting the valid route prefix into the AND / OR search tree, performing at least one of the following on the valid route prefix: cyclic path pruning, pruning of the product itself as a precursor, pruning of exceeding the maximum search depth, pruning of repeated failed precursor sets, and ancestor molecule regeneration pruning; mapping the pruned valid route prefix to AND reaction nodes and OR molecule nodes, and recording the template source, generation source, verification feedback, and candidate splitting identifier.

[0020] Furthermore, the reward value R of the AND reaction node in S7 satisfies: R = alpha A + (1 - alpha) C; where A represents the proportion of purchasable precursors in the precursor set of the AND reaction node, C represents the chemical accessibility score obtained by normalization based on the synthesis complexity score, and alpha is the purchasability weight; the node value is updated according to the reward value and the number of node visits, and subsequent branches to be expanded are selected by the confidence upper bound score.

[0021] Furthermore, the structured experience memory includes macroscopic experience memory and microscopic experience memory; the macroscopic experience memory is used to record global verification success patterns, global failure types, global taboos, bottleneck molecule categories, and global generation constraints; the microscopic experience memory is used to record preferred segmentation, failed segmentation, avoidance precursor sets, local taboos, node access status, and next generation constraints at the molecule node level; the structured experience memory is updated based on the prefixes of legal routes that have passed rigorous verification and the suffixes of routes that have not passed verification or have been pruned, and is used for candidate segmentation graph sorting, candidate inverse synthesis route generation, and candidate inverse synthesis route pruning.

[0022] Secondly, this invention also provides a retrosynthetic pathway planning device for complex small organic molecules, comprising: a knowledge base module for acquiring the molecular representation of the target molecule and loading a reaction template library, a historical route library, and a purchasable molecule library; an initialization module for establishing an AND / OR search tree and generating template-supported root splitting anchor points and target-level macroscopic strategies; a candidate splitting graph module for constructing template-generated candidate splitting graphs for the molecular nodes to be expanded; a route generation module for generating candidate retrosynthetic routes based on the current search path, search frontier information, target-level macroscopic strategies, candidate splitting graphs, similar historical routes, and structured experience memory by calling a large language model; a rigorous verification module for performing molecular representation legality checks, route connectivity checks, database template matching, and template reverse execution on the candidate retrosynthetic routes; a search tree update module for extracting legal route prefixes, inserting the legal route prefixes into the AND / OR search tree, calculating reward values, and performing node value backpropagation; an experience memory module for updating the structured experience memory based on legal route prefixes, route suffixes that have not passed verification, and the search tree node status; and a result output module for outputting the complete retrosynthetic route or the optimal partial retrosynthetic route.

[0023] Thirdly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the above-mentioned retrosynthetic path planning methods for complex small organic molecules.

[0024] The innovations of this invention are as follows: First, it uses candidate segmentation actions obtained by reverse execution of database templates as locally verifiable segmentation anchors to guide the large language model in organizing multi-step candidate routes, rather than directly using the template itself or the freely generated precursor set of the large language model as search actions. Second, it sets strict template verification as the entry threshold for candidate routes to enter the AND / OR search tree; only valid route prefixes that pass verification consecutively can be inserted into the search tree. Third, it condenses verified segments, failed segments, pruning reasons, node access status, and search bottlenecks into macroscopic and microscopic two-level structured experience memories, and feeds them back to candidate segmentation graph sorting, prompt information construction, and subsequent search expansion. Thus, this invention forms a closed-loop inverse synthesis planning framework of "template generation of segmentation anchors - large language model candidate route generation - strict verification entry - AND / OR tree search - structured experience feedback".

[0025] This invention has at least the following beneficial effects: First, candidate routes output by the large language model must be validated by the database template before they can affect the search tree, reducing the pollution of the search space by fictitious reactions, illegal molecular representations, and disconnected routes; Second, the candidate options in the candidate segmentation graph are the product-to-precursor set segmentation actions after the template is reverse-executed, which can provide locally executable chemical anchors for the large language model; Third, the legal route prefix insertion mechanism retains the effective parts of multi-step candidate routes while discarding illegal suffixes, improving the utilization rate of candidate routes; Fourth, the AND / OR tree search combines precursor availability, chemical complexity, and search exploration, which is beneficial for stable searching in complex retrosynthetic spaces; Fifth, structured experience memory can reduce repeated failed segmentation, cyclic paths, and locally invalid searches, improving the efficiency of subsequent route generation and search expansion. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the following description of the embodiments are briefly explained. The accompanying drawings in the following description are only used to explain the overall process, core data structure, experimental results, and computer implementation of the present invention, and do not constitute a limitation on the scope of protection of the present invention.

[0027] Figure 1 is a schematic diagram of the overall flow of the retrosynthetic path planning method for complex small organic molecules provided in an embodiment of the present invention. Figure 1 shows the overall relationship between root initialization, root splitting anchor point generation, initial macroscopic strategy generation, selection, context construction, candidate route pool, rigorous verification, reward evaluation and backpropagation, and experience memory update.

[0028] Figure 2 is a schematic diagram of the self-learning AND / OR tree data structure and structured experience memory provided in an embodiment of the present invention. Figure 2 shows the OR molecule node, AND reaction node, micro-experience, macro-experience, and the main experience fields contained in both.

[0029] Figure 3 is a schematic diagram of the retrosynthetic path planning device for complex small organic molecules provided in an embodiment of the present invention. Figure 3 illustrates the relationship between the knowledge base module, initialization module, candidate segmentation graph module, route generation module, rigorous verification module, search tree update module, experience memory module, and result output module.

[0030] Figure 4 is a schematic diagram of the physical structure of the electronic device provided in an embodiment of the present invention. Figure 4 shows the connection relationships between the processor, memory, communication interface, input / output interface, bus, and computer-readable storage medium. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the protection scope of this invention.

[0032] This embodiment provides a retrosynthetic route planning method for complex small organic molecules. This method can be executed by a server, personal computer, workstation, cloud computing device, or a computing system composed of multiple computing nodes. The computing device can be configured with a cheminformatics toolkit, a reaction template database, a purchasable molecule database, a historical route database, a large language model calling interface, and a data structure for maintaining the AND / OR search tree. The large language model can be a locally deployed model, a cloud-based model, or a combination of both, as long as it can output candidate retrosynthetic routes conforming to a preset format based on prompts.

[0033] As shown in Figure 1, the method includes: S110, acquiring the target molecule and loading the synthesis knowledge base; S120, performing root initialization, establishing an AND / OR search tree, and generating root segmentation anchor points and initial macroscopic strategies; S130, selecting molecular nodes to be expanded and constructing a candidate segmentation graph; S140, constructing prompt information and generating candidate retrosynthetic routes from a large language model; S150, performing rigorous verification on the candidate retrosynthetic routes; S160, truncating the prefixes of legal routes and inserting them into the AND / OR search tree; S170, calculating the reward value and performing search tree backpropagation; S180, updating the structured experience memory and determining whether to terminate the search. The above steps correspond to S1 to S8 in claim 1, where S110 corresponds to S1, S120 corresponds to S2, S130 corresponds to S3, S140 corresponds to S4, S150 corresponds to S5, S160 corresponds to S6, S170 corresponds to S7, and S180 corresponds to S8.

[0034] S110: Obtain the target molecule and load the synthesis knowledge base.

[0035] In this step, the computing device acquires the molecular representation of the target molecule. This molecular representation can be a SMILES string or any other molecular representation that can be converted into a molecular diagram or a normalized string. The computing device performs normalization processing on the input molecular representation, such as removing atom mapping numbers, checking molecule validity, standardizing aromaticity representation, and generating normalized SMILES. If the input molecular representation cannot be parsed by cheminformatics tools, an input anomaly message can be output, or the target molecule can be marked as an unplanned target.

[0036] The computing device further loads a synthesis knowledge base. This synthesis knowledge base includes a reaction template library, a historical route library, and a library of purchasable molecules. The reaction template library provides executable reverse reaction templates; the historical route library retrieves historical reaction routes similar to the current molecule based on molecular fingerprint similarity; and the library of purchasable molecules determines whether a molecule is an available starting material. In one embodiment, each template record in the reaction template library includes fields such as template identifier, reaction SMARTS, product-side matching substructure, reaction category, template frequency, template source, and template fingerprint.

[0037] S120, perform root initialization, build the AND / OR search tree and generate the root splitting anchor point and initial macro strategy.

[0038] In this step, the computing device creates a root OR molecular node based on the target molecule. An OR molecular node represents a molecule to be synthesized or disassembled; an AND reaction node represents a reverse reaction split from a product molecule to one or more precursor molecules. If the molecule corresponding to an OR molecular node belongs to a purchasable molecule library, that OR molecular node is marked as solved; when all child OR molecular nodes of an AND reaction node are solved, that AND reaction node is marked as solved; when an OR molecular node has at least one solved child AND reaction node, that OR molecular node can be marked as solved. Figure 2 illustrates the data structure relationship between the above OR molecular nodes and AND reaction nodes.

[0039] The computing device retrieves similar historical routes from the historical route database based on the target molecule and filters database templates from the reaction template database that match the target molecule on the product side. The filtered database templates are then applied in reverse to the target molecule to obtain one or more root splitting anchors. It should be noted that the root splitting anchor is not a single reaction template, but rather a candidate splitting action from the product to the precursor set obtained by applying the database template in reverse. Figure 1 (left side) shows the initialization process of the target molecule and the database used to generate root splitting anchors.

[0040] The computing device inputs the target molecule, similar historical routes, and root segmentation anchors into at least one large language model to generate an initial macroscopic strategy. In one implementation, a strategy generation model first generates a target-level disassembly strategy, then a critique model reviews whether the strategy conforms to the target structure, retrieves evidence, and identifies segmentation anchors. Subsequently, a revision model revises the strategy based on the critique, and a final decision model determines the final initial macroscopic strategy. The initial macroscopic strategy describes the skeleton-level disassembly direction, route priority, protecting group order, and chemical risk constraints.

[0041] S130, Select the molecular nodes to be expanded and construct the candidate segmentation graph.

[0042] In this step, the computing device is based on AOT. The search strategy selects the molecular nodes to be expanded from the AND / OR search tree. Selection may consider node value, node access count, whether it is resolved, whether it is a dead end, and whether a scalable front exists. The selection module in Figure 1 illustrates the selection process for this scalable front node.

[0043] For the molecular node to be expanded, the computing device constructs a candidate segmentation graph using template generation. First, the computing device performs product-side template adaptation on the molecule to be expanded, obtaining a set of matching templates on the product side. Then, it reverse-executes the templates in the template set to generate a candidate precursor set. Next, the candidate precursor set is normalized, deduplicated, and filtered. Finally, the candidate precursor set is sorted based on similarity historical route matching scores, structured experience scores, the proportion of purchasable precursors, the complexity of non-purchasable precursors, changes in the number of heavy atoms, lateral movement risk, and unstable intermediate risk, resulting in the candidate segmentation graph.

[0044] In one implementation, each candidate segmentation item in the candidate segmentation graph may include: candidate segmentation identifier, product molecule normalization SMILES, template identifier, template SMARTS, template source, candidate precursor set, template matching type, template execution score, similar historical route matching score, experience-weighted score, proportion of purchasable precursors, complexity of non-purchasable precursors, risk label, and ranking score. These fields enable the large language model to identify locally executable segmentation anchors and provide template query clues for subsequent rigorous validation.

[0045] In this embodiment, the candidate segmentation graph is used to provide locally verifiable segmentation anchors and evidence for the large language model, and is not directly inserted into the AND / OR search tree. Candidate segmentation items in the candidate segmentation graph can only enter the search tree as part of a valid route prefix after the large language model has organized candidate routes and passed rigorous verification. The template-grounded cut anchors in the context construction module of Figure 1 correspond to the candidate segmentation graph or its summary form.

[0046] S140, construct prompt information and generate candidate inverse synthesis routes from the large language model.

[0047] In this step, the computing device obtains the current search path from the root node to the molecular node to be expanded, and calculates the current search front information. The search front information may include the current route step count, the number of terminal molecules, the number of purchasable terminal molecules, the number of non-purchasable terminal molecules, the proportion of purchasable terminal molecules, the number of heavy atoms in non-purchasable terminal molecules, and the synthesis complexity score.

[0048] The computing device reads global macro-level experience and micro-level experience corresponding to the molecular node to be expanded from the structured experience memory. As shown in Figure 2, the global macro-level experience may include global successful verification modes, global taboos, bottleneck categories, and global generation instructions; the micro-level experience may include feasible partitioning, failed partitioning, avoidance of precursor sets, local taboos, and next generation constraints for the molecular node.

[0049] The computing device combines the current search path, search frontier information, initial macro-level strategy, candidate segmentation graph, similar historical routes, global macro-level experience, and micro-level experience into a prompt message, and calls a large language model to generate one or more candidate retrosynthetic routes. In one implementation, the prompt message includes a target molecule summary, current search path, frontier status, target-level macro-level strategy, candidate segmentation anchor list, similar historical route summary, current node micro-level experience, global macro-level experience, output format constraints, and validation rule prompts. A candidate retrosynthetic route may include one or more consecutive steps, each step including a product molecule, a candidate reaction template or reaction prompt, and a set of candidate precursor molecules. The candidate route pool in Figure 1 represents the set of candidate retrosynthetic routes generated by the large language model.

[0050] To avoid diluting important evidence with excessively long prompts, computing devices can compress candidate segmentation maps and empirical memories. For example, only top-ranked candidate segmentations, frequently occurring preferred segmentations, failed segmentations with a high number of recent or cumulative failures, and historical routes with high similarity to current cutting-edge molecular structures can be retained. For sets of precursors that repeatedly fail, the prompt can explicitly include a local taboo to "avoid repeating this set of precursors."

[0051] S150 performs rigorous validation of candidate retrosynthetic routes.

[0052] In this step, the computing device performs rigorous validation on each candidate retrosynthetic route output by the large language model. The computing device first maintains a set of active molecules consisting of the molecules currently to be decomposed. For each step in a candidate route, the computing device checks whether the step contains only one product and whether that product belongs to the set of active molecules; if the product does not belong to the set of active molecules, the candidate route is determined to have a route connectivity error starting from that step.

[0053] The computing device further examines the validity of the molecular representations of the product and precursor of this step. If the molecular representation cannot be resolved by cheminformatics tools, or if there are obvious errors in valence, aromaticity, or ring closure, the verification step fails.

[0054] For steps that pass the molecular validity and connectivity checks, the computing device constructs a template query based on the product of that step, candidate precursors, and candidate reaction templates, and sequentially performs exact template matching, substructure template matching, and fingerprint similarity Top-K template matching. When a database template is matched, the computing device reverses the process on the product of that step using the matched database template.

[0055] If the database template is executed in reverse to generate a valid precursor set, the computing device uses the precursor set generated by the template as the normalized precursor set for this step, instead of directly using the precursor set declared by the large language model. Therefore, even if the candidate precursors output by the large language model are inaccurate, as long as the decomposition direction can be supported and executed by the database template, the system can still obtain a valid step normalized by the template. The verification module in Figure 1 illustrates the above rigorous verification process.

[0056] S160, extract the valid route prefix and insert it into the AND / OR search tree.

[0057] In this step, the computing device starts from the first step of the candidate inverse synthesis route and accepts one or more steps that have passed rigorous verification consecutively as legal route prefixes. If the first few steps of a candidate route are legal but the subsequent steps are illegal, only the first few legal route prefixes are retained, and the illegal suffixes are discarded or recorded as evidence of failure. The "Only legal prefixes enter tree" in Figure 1 represents this admission rule.

[0058] Before inserting the valid route prefix into the AND / OR search tree, the computing device can perform at least one pruning operation, including cyclic path pruning, pruning of the product itself as a precursor, pruning of exceeding the maximum search depth, pruning of repeated failed precursor sets, and ancestor molecule regeneration pruning. The pruned valid route prefix is ​​mapped to one or more AND reaction nodes and corresponding OR molecule nodes, the structure of which can be seen in Figure 2.

[0059] For a newly inserted AND reaction node, the computing device records its corresponding database template, template matching source, generation source, verification feedback, and candidate splitting identifier. If an AND reaction node with the same product, template, and precursor set already exists, the computing device can reuse the existing node to avoid redundant expansion.

[0060] S170, calculate the reward value and perform a search tree backpropagation.

[0061] In this step, the computing device calculates a reward value for the inserted AND reaction node. The reward value can be determined by both precursor availability and precursor chemical complexity. In one implementation, the reward value R satisfies: R = alpha A + (1 - alpha) C; Where A represents the proportion of purchasable precursors in the precursor set of the AND reaction node, C represents the chemical accessibility score obtained by normalization based on the synthesis complexity score, and alpha is the purchasability weight. The evaluation and feedback module in Figure 1 illustrates the relationship between reward calculation and value feedback.

[0062] The computing device propagates the reward value upwards along the AND / OR search tree. For AND reaction nodes, the computing device updates the node value based on the reward value and the number of times the node has been visited; for OR molecule nodes, the computing device updates the value of the OR molecule node based on the value of its legitimate child AND reaction nodes. An OR molecule node is marked as resolved when the molecule corresponding to it is purchasable, or when there are resolved child AND reaction nodes.

[0063] In subsequent selection steps, the computing device can calculate a confidence upper bound score based on node value and access frequency to strike a balance between utilizing high-value branches and exploring low-access branches. In one implementation, the selection of the node to be expanded can also take into account whether the node has available candidate split anchors, whether the node hits a failed split taboo, and the number of non-purchasable terminal molecules on the path to the node.

[0064] S180, update the structured experience memory and determine whether to terminate the search.

[0065] In this step, the computing device updates the structured experience memory based on valid route prefixes, unvalidated route suffixes, pruning results, and the search tree node status. Figure 1 shows the experience memory update module illustrating the positions of macro-updates and micro-updates in the iterative search loop, and Figure 2 shows the main fields of macro-experience and micro-experience.

[0066] For steps that pass rigorous verification, the computing device records the product, precursor set, database template, template matching source, template similarity, reward value, and occurrence frequency, forming a preferred segmentation record. For steps that fail verification or are pruned, the computing device records the reason for failure, the failed precursor set, the corresponding product, and the generation source, forming a failed segmentation record. Microscopic experience memory is organized by molecular node and is used to record the preferred segmentation, failed segmentation, avoided precursor set, local taboos, node access status, and next generation constraints for that molecular node.

[0067] The macro-level experience memory summarizes global successful verification patterns, global failure types, global taboos, bottleneck molecule categories, and global generation constraints. This structured experience memory is used in subsequent steps for candidate segmentation graph ranking, prompt information construction, and candidate route pruning, thereby reducing repeated failed segments, cyclical paths, and locally ineffective searches.

[0068] The computing device repeats steps S130 to S180 until the root OR molecular node of the target molecule is resolved, the search budget is exhausted, or no scalable legal nodes exist. If the root OR molecular node is resolved, the computing device extracts the highest-value resolved branch from the AND / OR search tree and outputs the complete retrosynthetic route. If the search budget is exhausted but the root OR molecular node is not resolved, the computing device outputs the optimal partial retrosynthetic route and the unresolved frontier molecule.

[0069] Experimental example: Inverse synthetic path planning performance on different datasets.

[0070] To verify the effectiveness of this embodiment in retrosynthetic pathway planning for complex small organic molecules, three target molecule datasets—USPTO-190, Pistachio Reachable, and Pistachio Hard—were used for testing, and the results were compared with various retrosynthetic pathway planning methods. The evaluation metric was the success rate, representing the proportion of target molecules successfully solved within a given search budget. Successful solution meant that the root OR molecular node of the target molecule was solved, all reaction steps in the output route passed rigorous template validation, and the terminal molecules of the route were either from a purchasable molecule library or identified as available starting materials.

[0071] Table 1

[0072] Table 1 shows the experimental results under three search budgets: N=100, N=300, and N=500. In the experiments, Graph2Edits, RootAligned, and LocalRetro performed well in MCTS and Retro searches, respectively. In search frameworks, it serves as a single-step inverse synthesis model or heuristic model; DESP and Tango For existing inverse synthetic programming methods; LLM-Syn-Planner and AOT Different large language model configurations were used respectively. The above comparison objects are only used to illustrate the effect of this embodiment and do not constitute a limitation on the scope of protection of this invention.

[0073] According to Table 1, on the USPTO-190 dataset, the Ours (HSE-Retro) method in this embodiment achieved a success rate of 98.4% for three budgets: N=100, N=300, and N=500, which is higher than that of AOT. The success rates of (DS) (86.3%, 93.1%, and 93.6%) are also higher than those of LLM-Syn-Planner (DS) (62.1%, 92.1%, and 92.6%). This indicates that on this dataset, generating splitting anchors through templates, rigorously validating admissions, and structured empirical feedback can achieve a high success rate with a lower budget.

[0074] On the Pistachio Reachable dataset, the method in this embodiment achieves a success rate of 98.7% for three budgets: N=100, N=300, and N=500. This result is comparable to that of the strong template search method RootAligned (Retro). ) of 98.7% and AOT (DS) achieves 98.7% similarity at N=100 and maintains stable solution capability under lower budgets. The target molecules in this dataset have high overall reachability, so many strong baseline methods approach saturation under higher budgets; the method in this embodiment still maintains stable performance, indicating that its rigorous verification mechanism does not weaken the solution capability on reachable targets.

[0075] On the Pistachio Hard dataset, the method in this embodiment achieved success rates of 92.0%, 95.0%, and 95.0% for budgets of N=100, N=300, and N=500, respectively, which are higher than those of AOT. The success rates of (DS) are 86.0%, 89.0%, and 93.0%, which are also higher than those of LLM-Syn-Planner (DS) (74.0%, 84.0%, and 86.0%). The target molecules in the Pistachio Hard dataset have higher search difficulty. This result shows that the structured experience memory in this embodiment can feed back verified local evidence of success and failure to subsequent candidate generation and search expansion, thereby reducing repeated failed branches and improving the planning success rate on more difficult targets.

[0076] In summary, the experimental results shown in Table 1 demonstrate that this embodiment achieves a high success rate on all three datasets. Particularly on the USPTO-190 and Pistachio Hard datasets, this embodiment exhibits good solution capabilities under both low and medium-to-high budgets; on the Pistachio Reachable dataset, this embodiment maintains a high success rate close to the strong template search baseline. These results experimentally support the effectiveness of the closed-loop mechanism in this invention: "template generation for segmentation anchor points - large language model candidate route generation - rigorous verification of admission - AND / OR tree search - structured experience feedback."

[0077] This embodiment also provides a retrosynthetic pathway planning device for complex small organic molecules. As shown in Figure 3, the device includes a knowledge base module, an initialization module, a candidate segmentation graph module, a route generation module, a rigorous verification module, a search tree update module, an experience memory module, and a result output module.

[0078] The knowledge base module performs S110, which involves acquiring the molecular representation of the target molecule, normalizing the molecular representation, and loading the reaction template library, historical route library, and purchasable molecule library. The initialization module performs S120, which involves building an AND / OR search tree and generating template-supported root segmentation anchors and target-level macroscopic strategies. The candidate segmentation graph module performs S130, which involves constructing a candidate segmentation graph generated from templates for the molecular nodes to be expanded. The route generation module performs S140, which involves generating candidate retrosynthetic routes based on the current search path, search frontier information, target-level macroscopic strategies, candidate segmentation graphs, similar historical routes, and structured experience memory, invoking a large language model.

[0079] The rigorous verification module performs S150, which involves checking the molecular representation validity, route connectivity, database template matching, and template inversion on the candidate inverse synthesis routes. The search tree update module performs S160 and S170, which involve extracting valid route prefixes, inserting these prefixes into the AND / OR search tree, calculating reward values, and performing node value backpropagation. The experience memory module performs the structured experience update in S180. The result output module outputs the complete inverse synthesis route or the optimal partial inverse synthesis route when the search terminates. These modules can be implemented by software programs, hardware circuits, or a combination of both; they can be deployed on the same computing device or distributed across multiple computing nodes.

[0080] This embodiment also provides an electronic device. As shown in FIG4, the electronic device may include a processor, a memory, a communication interface, an input / output interface, and a bus. The memory stores a computer program, and the processor calls the computer program via the bus to execute the steps in S110 to S180 described above. The communication interface can be used to access large language model services, reaction template databases, historical route databases, and purchasable molecule databases; the input / output interface can be used to receive molecular representations of target molecules and output complete retrosynthetic routes, optimal partial retrosynthetic routes, unresolved frontier molecules, reasons for verification failures, or structured experience records.

[0081] This embodiment also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the aforementioned retrosynthetic path planning method for complex small organic molecules. The computer-readable storage medium can be a read-only memory, random access memory, disk, optical disk, flash memory, solid-state drive, or other media capable of storing computer programs.

[0082] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for planning complex small molecule retrosynthetic pathways based on tree search and memory-driven computation, executed by a computing device, characterized in that, include: S1, Obtain the molecular representation of the target molecule, normalize the molecular representation, and load the synthesis knowledge base, which includes a reaction template library, a historical route library, and a purchasable molecule library; S2, Based on the target molecule, establish an AND / OR search tree, and according to the reaction template library, the historical route library and the purchasable molecule library, generate template-supported root splitting anchor points and target-level macroscopic strategies for the target molecule; S3, select the molecular node to be expanded in the AND / OR search tree, and construct a candidate segmentation map based on the molecular node to be expanded using a template. The candidate segmentation items in the candidate segmentation map are the segmentation actions from product to precursor set obtained by applying a database template that can be matched and reversed on the product side to the molecular node to be expanded. S4. Based on the current search path, search frontier information, the target-level macro strategy, the candidate segmentation map, similar historical routes, and structured experience memory, construct large language model prompt information, and call the large language model to generate one or more candidate inverse synthesis routes; S5, perform rigorous verification on the candidate retrosynthetic route, which includes molecular representation validity check, route connectivity check, database template matching, and reverse execution of the matched database template on the product molecule; S6, extract the legal route prefixes that have passed strict verification from the candidate inverse synthesis routes, insert only the legal route prefixes into the AND / OR search tree, and discard or record the route suffixes that have not passed verification as evidence of failure; S7. Calculate the reward value of the inserted AND reaction node based on the purchasability and chemical complexity of the precursor, and backpropagate the reward value along the AND / OR search tree to update the node value and select subsequent molecular nodes to be expanded. S8, update the structured experience memory based on the legal route prefix, the route suffix that failed verification and the search tree node status, and repeat S3 to S8 until the root node of the target molecule is solved, the search budget is exhausted or there are no scalable legal nodes, and output the complete inverse synthesis route or the best partial inverse synthesis route.

2. The method according to claim 1, characterized in that, S2 includes: Root OR molecule nodes are created based on the normalized target molecule; Retrieve historical routes similar to the target molecule from the historical route database; The database templates that can match the product side of the reaction template library are screened from the reaction template library, and the screened database templates are reverse-executed on the target molecule to obtain one or more root splitting anchors; The target molecule, the similar historical routes, and the root segmentation anchor point are input into at least one large language model to generate the target-level macro strategy, which includes skeleton-level decomposition direction, route priority, and chemical risk constraints.

3. The method according to claim 1, characterized in that, The candidate segmentation map generated by the template in S3 includes: Perform product-side template adaptation on the molecules corresponding to the molecular nodes to be expanded to obtain a set of matching templates on the product side. Perform a reverse reaction on the templates in the set of matchable templates on the product side to generate a set of candidate precursors; The candidate precursor set is normalized, deduplicated, and filtered. The candidate precursor set is sorted based on similar historical route matching score, structured experience score, proportion of purchasable precursors, complexity of non-purchasable precursors, variation of heavy atom number, lateral movement risk, and unstable intermediate risk to obtain the candidate segmentation graph.

4. The method according to claim 1, characterized in that, The S4 includes: Obtain the current search path from the root node of the AND / OR search tree to the molecule node to be expanded; Calculate the search front information of the branch where the molecular node to be expanded is located. The search front information includes the number of terminal molecules, the proportion of purchasable terminal molecules, and the complexity information of non-purchasable terminal molecules. Read the microscopic experience and global macroscopic experience corresponding to the molecular node to be expanded from the structured experience memory; The current search path, search frontier information, target-level macro strategy, candidate segmentation map, similar historical routes, micro experience, and global macro experience are combined into large language model prompt information, so that the large language model outputs candidate inverse synthesis routes.

5. The method according to claim 1, characterized in that, The S5 includes: Maintain the set of active molecules consisting of the molecules currently to be disassembled; For each step of the candidate retrosynthetic route, check whether the product of that step belongs to the set of active molecules, and check whether the molecular representation of the product and the precursor of that step is valid; Based on the product, candidate precursor, and candidate reaction templates from this step, a template query is constructed, and precise template matching, substructure template matching, and fingerprint similarity Top-K template matching are performed sequentially. The matched database template is then executed in reverse on the output of this step; When the database template generates a valid precursor set, the precursor set generated by the template is used as the normalized precursor set for this step.

6. The method according to claim 1, characterized in that, S6 includes: Starting from the first step of the candidate inverse synthesis route, accept one or more steps that have passed rigorous verification consecutively as a valid route prefix; Before inserting the legal route prefix into the AND / OR search tree, perform at least one of the following on the legal route prefix: cyclic path pruning, pruning with the product itself as a precursor, pruning exceeding the maximum search depth, pruning of repeated failed precursor sets, and ancestor molecule regeneration pruning. The valid route prefixes obtained through pruning are mapped to AND reaction nodes and OR molecular nodes, and the template source, generation source, verification feedback, and candidate split identifier are recorded.

7. The method according to claim 1, characterized in that, The reward value R of the AND reaction node in S7 satisfies: R = alpha A + (1 - alpha) C; Where A represents the proportion of purchasable precursors in the precursor set of the AND reaction node, C represents the chemical accessibility score obtained by normalization based on the synthesis complexity score, and alpha is the purchasability weight; the node value is updated according to the reward value and the number of node visits, and subsequent branches to be expanded are selected by the confidence upper bound score.

8. The method according to claim 1, characterized in that, The structured experience memory includes macroscopic experience memory and microscopic experience memory; The macro-experience memory is used to record global verification success patterns, global failure types, global taboos, bottleneck molecule categories, and global generation constraints; The microscopic experience memory is used to record optimal segmentation, failed segmentation, avoidance of precursor sets, local taboos, node access status and next generation constraints at molecular nodes; The structured experience memory is updated based on the valid route prefixes that have passed rigorous verification and the route suffixes that have not passed verification or have been pruned, and is used for candidate segmentation graph sorting, candidate inverse synthesis route generation, and candidate inverse synthesis route pruning.

9. A retrosynthetic pathway planning device for complex small organic molecules, characterized in that, include: The knowledge base module is used to obtain the molecular representation of the target molecule and load the reaction template library, historical route library, and purchasable molecule library; The initialization module is used to build the AND / OR search tree and generate the root splitting anchor point supported by the template and the target-level macro strategy; The candidate segmentation graph module is used to construct candidate segmentation graphs generated from templates for molecular nodes to be expanded. The route generation module is used to generate candidate inverse synthesis routes by calling a large language model based on the current search path, search frontier information, target-level macro strategy, candidate segmentation map, similar historical routes, and structured experience memory; The rigorous verification module is used to perform molecular representation validity checks, route connectivity checks, database template matching, and template inversion on the candidate retrosynthetic routes. The search tree update module is used to extract the legal route prefix, insert the legal route prefix into the AND / OR search tree, calculate the reward value, and perform node value back transmission. The experience memory module is used to update the structured experience memory based on the valid route prefix, the route suffix that failed verification, and the search tree node status. The results output module is used to output the complete inverse synthesis route or the optimal partial inverse synthesis route.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method according to any one of claims 1 to 8.