A method and apparatus for molecule generation and optimization based on autonomous chemical space design
By employing a molecular generation and optimization method based on autonomous chemical space design, combined with a generation flow network and a molecular editing reaction template library, the problems of narrow chemical space and synthetic feasibility in existing technologies have been solved, achieving efficient synergy between molecular generation and optimization and active expansion of chemical space.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2026-01-15
- Publication Date
- 2026-06-09
AI Technical Summary
Existing generative artificial intelligence (GenAI) faces challenges in drug development, including narrow chemical spaces and synthetic feasibility, lacks proactive design of chemical spaces, and molecular editing technology lacks systematic generative exploration capabilities.
By constructing a molecular generation and optimization method with autonomous chemical space design, combined with a generation flow network and a molecular editing reaction template library, the system enables active construction and molecular optimization from a given space. It supports user-defined building block libraries and reaction template libraries, and uses a fingerprint embedded strategy for action probability modeling to construct a molecular editing reaction template library for cascaded structure editing.
It significantly expands the novelty of explorable chemical spaces, achieves efficient synergy between molecular generation and optimization, supports plug-and-play and rapid iterative updates, and enhances the structural novelty and property potential of molecular optimization.
Smart Images

Figure CN122177277A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of molecular generation technology, specifically relating to a method and apparatus for molecular generation and optimization based on autonomous chemical space design. Background Technology
[0002] In recent years, the introduction of generative artificial intelligence (GenAI) has shifted drug development from passive screening to active generation, enabling researchers to systematically explore a vast chemical space, particularly in areas previously unexplored, thereby significantly improving efficiency in the crucial stages of hit discovery and lead optimization—key factors in determining drug fate. However, current methods have not yet achieved deep integration of GenAI, chemical synthesis, and drug development, and two major problems remain: First, GenAI primarily focuses on improving sampling efficiency and molecular generation quality within a given chemical space, with insufficient active design of the chemical space itself; second, drug development still heavily relies on classical reactions, resulting in new drug molecules being structurally too similar and covering an overly narrow chemical space.
[0003] The core logic of existing GenAI algorithms for de novo drug design can be broadly divided into two categories: one is to construct an implicit chemical space, attempting to indirectly simulate a larger theoretical space by learning the distribution of known molecules. Representative classical algorithms include the JT-VAE algorithm based on variational autoencoders (VAEs) and the MCMG algorithm based on conditional transformers. The other is to explicitly assemble an explorable chemical space based on commercial synthetic building blocks and classical reactions. This type of approach is also one of the most cutting-edge directions in related fields. Representative works include the SyntheMol algorithm based on Monte Carlo Tree Search (MCTS), the SynFlowNet algorithm based on generative flow networks (GflowNets), and the SynGFN algorithm. Although a series of algorithms have emerged, the above algorithms still face limitations: the former suffers from black-box problems and insufficient interpretability, while the latter relies excessively on commercial building block libraries and traditional reactions, essentially still hovering within the boundaries of commercial chemical space.
[0004] Drug molecule optimization is another important area where GenAI is applied to drug development. Traditional molecule optimization relies on the experience of medicinal chemists, exploring only a limited number of optimization schemes while considering synthetic feasibility. Existing GenAI-based molecule optimization methods can be divided into two approaches: goal-oriented and structure-oriented. The former relies on constructing an implicit chemical space that meets predetermined constraints (such as activity and safety) and performing an efficient search, while the latter first generates molecules with specific structures based on structural constraints and then further screens them based on target attributes (such as activity and safety). However, existing methods rarely consider the synthetic accessibility of molecule optimization (for example, a small atom modification may require dozens of reaction steps, and the synthetic complexity problem remains severe), and there is a "limited chemical space paradox," that is, although GenAI aims to explore molecules in unknown chemical spaces, current methods are limited by reference datasets (existing compound libraries / protein-small molecule complex structure datasets with constraint-related tags), and have not truly achieved this goal.
[0005] In the field of synthetic chemistry, which is closely related to drug development, researchers have proposed the concept of molecular editing. This involves the efficient and selective insertion, deletion, or exchange of atoms in highly functionalized complex molecules to directly edit drug molecules and expand the chemical space for exploration. Although molecular editing technology has made significant progress, most research focuses on the methodology itself, with few application examples, often limited to modifying specific molecules targeting specific targets. In fact, related research indicates that pharmaceutical companies are quite conservative in their choice of synthetic reactions. Over the past thirty years, commonly used drug synthesis reactions have remained largely unchanged, with over-reliance on a very small number of robust synthetic reactions (such as amide bond formation reactions and aromatic nucleophilic substitution reactions) resulting in a relatively narrow chemical space for current drugs. This explains the aforementioned paradox. Therefore, the potential novelty of molecular editing technology has not yet been fully realized in current drug development. Combining molecular editing with generative AI for molecular optimization is undoubtedly a research direction with enormous potential and appeal.
[0006] In summary, while current GenAI-based drug design has shifted towards active generation, its chemical space remains limited by historical data and classical reactions, resulting in a narrow scope of exploration and challenges to synthetic feasibility. Emerging molecular editing technologies, while capable of directly and precisely modifying molecules, lack systematic generative exploration capabilities. Therefore, breaking away from the passive generation model reliant on predetermined spaces and actively designing and constructing novel, accessible, and autonomous chemical spaces by integrating generative AI with synthetic molecular editing operations has become a key breakthrough direction for driving original drug innovation. Summary of the Invention
[0007] In view of the above, the purpose of this invention is to provide a method and apparatus for molecular generation and optimization based on autonomous chemical space design. Within a unified generation flow network framework, it innovatively integrates exploration and editing modes, completing the transition from passive sampling of a predetermined space to active construction of an autonomous chemical space, thus unifying the tasks from molecular generation to molecular optimization. Furthermore, by systematically introducing molecular editing into generative AI and constructing a dedicated molecular editing reaction template library, the network can utilize novel and efficient editing reactions to perform synthetically-oriented deep optimization and generation of molecules. This not only achieves a novel molecular optimization method that is editable, supports plug-and-play functionality, and allows for rapid iterative updates, but also significantly expands the novelty of the explorable chemical space while ensuring synthetic feasibility.
[0008] To achieve the above-mentioned objectives, the present invention provides the following technical solution: In a first aspect, the present invention provides a molecular generation and optimization method based on autonomous chemical spatial design, comprising the following steps: Based on user-defined molecular building block libraries and chemical reaction template libraries, an autonomous chemical space is formed after standardization, which includes reaction template selection action space and reactant selection action space. A chemical space autonomous design molecular generation flow network is constructed, in which molecular structure is defined as a state, the selection of reaction templates and reactants based on strategy network is defined as an action, and the molecular generation process is modeled as a trajectory from the initial state to the final state through a series of state-action transitions. In exploration mode, starting with empty molecules or specific substrates, trajectory sampling is performed in a molecular generation flow network designed autonomously in the chemical space. Molecular building blocks and chemical reaction templates in the autonomous chemical space are combined to generate complete new molecules and their synthetic routes. In edit mode, starting with the molecule to be optimized as the initial state, trajectory sampling is performed in a self-designed molecular generation flow network in chemical space. The self-constructed molecular editing reaction template library is used to perform cascaded structural editing of the molecule to be optimized, generating the optimized molecule and its edited synthetic route.
[0009] Preferably, the user-defined molecular building block library and chemical reaction template library, after standardization, form an autonomous chemical space containing a reaction template selection action space and a reactant selection action space, including: It can receive user-defined molecular building block libraries and chemical reaction template libraries. The molecular building block library includes at least one of the following: synthetic building block library, natural product derived building block library, or any set of custom structures. The chemical reaction template library includes at least one of the following: classical synthetic reaction template, enzyme-catalyzed reaction template, or a set of user-defined reaction rules. A standardized chemical space construction pipeline is implemented for molecular building block libraries and chemical reaction template libraries, including at least element type constraints, ring structure size restrictions, and reaction matching effectiveness screening. The standardized building blocks and reaction templates are transformed into a standardized trajectory input format that can be directly executed by the autonomous molecular generation flow network designed by the chemical space, thereby explicitly constructing user-defined chemical primitives into an autonomous chemical space that supports systematic exploration.
[0010] Preferably, in the chemical space autonomously designed molecular generation flow network, a fingerprint embedding strategy is used for probabilistic modeling and sampling of actions, including: Pre-calculate the chemical reaction fingerprint vectors of all reactions / reactants to form a fingerprint matrix; The fixed-dimensional embedding vector output by the policy model is multiplied by the transpose of the fingerprint matrix, and the score and sampling probability for each reaction / reactant are obtained through vector similarity measurement.
[0011] Preferably, the cascade structural editing of the molecule to be optimized using a self-constructed molecular editing reaction template library includes: In a single optimization trajectory, multiple editing steps driven by a molecular editing reaction template library are executed sequentially. The intermediate molecules generated in the previous editing step are automatically used as input substrates for the next editing step. In this way, structural modifications of different editing types and sites are continuously combined to achieve complex molecular optimization from local functional group adjustment to core skeleton reshaping.
[0012] Preferably, the types of molecular editing reaction template libraries include single-atom editing, multi-atom editing, functional group-functional group exchange, and CH functionalization.
[0013] Preferably, the template compilation process for the molecular editing reaction template library includes: Summarize the substrate-product examples of molecular editing reactions, identify the invariant backbone structure in the reaction, as well as the variable reaction center and editable groups, to form a description of the core structure of the reaction; Based on the reaction substrate range and reaction mechanism, SMARTS wildcards are used to generalize the variable structural sites in the core structure description of the reaction to generate SMARTS reaction mode descriptions. Based on the SMARTS reaction pattern description, by comparing and analyzing the molecular structures before and after the reaction, a complete reaction transformation rule containing matching and transformation relationships is formed as a reaction SMARTS template, namely a molecular editing reaction template library; During the construction of the reaction SMARTS template, the atomic mapping relationship before and after the reaction is explicitly defined to ensure that bond breaking and formation processes correspond accurately and to avoid atomic mismatches. Multiple rounds of verification and testing of SMARTS reaction templates were conducted using cheminformatics tools to verify the reliability and chemical rationality of the templates, thereby completing the construction and optimization of a molecular editing reaction template library.
[0014] Preferably, a reward function is used to train the policy network to guide it to generate molecular trajectories with higher target property scores, and the quality of the generated molecules is evaluated and screened during the sampling process; in exploration mode, the biological activity of the generated molecules is used as the value of the reward function; in editing mode, a molecular activity prediction tool with higher accuracy than that in exploration mode is used for scoring, and the score is used as the value of the reward function.
[0015] Secondly, embodiments of the present invention also provide a molecular generation and optimization device based on autonomous chemical space design, used to implement the above-mentioned molecular generation and optimization method based on autonomous chemical space design, including: an autonomous chemical space construction module, a network unified trajectory modeling module, a molecular exploration and generation module, and a molecular editing and optimization module; The autonomous chemical space construction module is used to form an autonomous chemical space, which includes reaction template selection action space and reactant selection action space, based on user-defined molecular building block library and chemical reaction template library after standardization. The unified trajectory modeling module is used to construct a chemical space autonomously designed molecular generation flow network, in which molecular structure is defined as a state, the selection of reaction templates and reactants according to the strategy network is defined as an action, and the molecular generation process is modeled as a trajectory from the initial state through a series of state-action transitions to the final state. The molecular exploration and generation module is used in exploration mode to take an empty molecule or a specific substrate as the initial state, and to perform trajectory sampling in a molecular generation flow network designed autonomously in the chemical space. It uses molecular building blocks and chemical reaction templates in the autonomous chemical space to generate complete new molecules and their synthetic routes. The molecular editing optimization module is used in editing mode to take the molecule to be optimized as the initial state, perform trajectory sampling in a chemically designed molecular generation flow network, and use a self-constructed molecular editing reaction template library to perform cascade structural editing of the molecule to be optimized, generating the optimized molecule and its edited synthetic route.
[0016] Thirdly, embodiments of the present invention also provide an electronic device, including a memory and one or more processors, wherein the memory is used to store a computer program, and the processor is used to implement the above-described molecular generation and optimization method based on autonomous chemical space design when the computer program is executed.
[0017] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a computer, implements the aforementioned molecular generation and optimization method based on autonomous chemical spatial design.
[0018] Compared with the prior art, the beneficial effects of the present invention include at least the following: (1) Based on the generative flow network, this invention models molecular design as a state transition trajectory. Combined with the strategy network and sampling mechanism, it can not only generate molecular innovations from scratch, but also perform targeted structural optimization on specific molecules. This significantly improves the algorithm's versatility, integration, and actual deployment efficiency, and achieves efficient collaboration between molecular generation and optimization under a unified algorithm framework.
[0019] (2) This invention supports user-defined building block libraries and reaction template libraries, and constructs a programmable and scalable autonomous chemical space through a standardized pipeline. This enables generative AI to break through the inherent boundaries of traditional commercial chemical spaces and actively explore unknown chemical regions with more structural novelty and functional diversity. It realizes the transformation from passive mining of predetermined chemical spaces to active design of chemical spaces, thus revolutionizing the molecular design paradigm.
[0020] (3) This invention systematically introduces and encodes cutting-edge molecular editing reactions to construct a molecular editing reaction template library, enabling the optimization process to use efficient cascade editing strategies to perform precise and in-depth structural modifications on molecules. While ensuring that the synthetic route is clear and feasible, it greatly enhances the structural novelty and property enhancement potential of the optimized molecule, realizing a novel molecular optimization method that is editable, supports plug-and-play, and can be rapidly iterated and updated. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic flowchart of a molecular generation and optimization method based on autonomous chemical space design provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the SpaceGFN algorithm provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the exploration mode of SpaceGFN provided in an embodiment of the present invention; Figure 4This is a schematic diagram of the editing mode of SpaceGFN provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of a molecular generation and optimization device based on autonomous chemical space design provided in an embodiment of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the scope of protection of this invention.
[0024] The inventive concept of this invention is as follows: Addressing the shortcomings of existing generative AI methods, which primarily focus on improving sampling efficiency and molecular generation quality within a given chemical space, lacking proactive design of the chemical space itself, and neglecting synthetic feasibility in molecular optimization, this invention provides a molecular generation and optimization method and apparatus based on autonomous chemical space design. It integrates exploration and editing modes by constructing a new generation molecular generation framework system centered on autonomous chemical space design—the SpaceGFN (Chemical Space Autonomous Design Molecular Generation Flow Network). In exploration mode, SpaceGFN supports DIY chemical space construction and demonstrates the feasibility of explicitly constructing natural product-like spaces through a pseudo-natural product (PNP) case. In editing mode, molecular editing is systematically introduced into generative AI for the first time, establishing a molecular editing reaction template library, and validating its effectiveness and universality in molecular optimization through testing on 96 drug targets. Overall, SpaceGFN establishes a new balance between imagination and feasibility, providing a new paradigm for the deep integration of generative AI, chemical synthesis, and drug development, and is expected to systematically expand explorable chemical spaces and accelerate the discovery of next-generation innovative drugs.
[0025] like Figure 1 As shown in the example, this embodiment provides a molecular generation and optimization method based on autonomous chemical space design, including the following steps: S1, based on user-defined molecular building block libraries and chemical reaction template libraries, forms an autonomous chemical space after standardization, which includes reaction template selection action space and reactant selection action space.
[0026] In this embodiment, unlike traditional molecular generation methods that rely on immobilized synthetic spaces, the autonomous chemical space of this invention is composed of user-defined chemical space primitives, including: Building block library: You can choose from a synthetic building block library, a natural product-derived building block library, or any custom structure collection; Reaction template library: You can choose from classic synthetic reactions, enzyme-catalyzed reactions, or user-defined reaction rule sets.
[0027] Before entering SpaceGFN, all the above inputs undergo standardized chemical space construction pipeline processing, including operations such as element type constraints, ring structure size restrictions, and reaction matching effectiveness screening, and are finally transformed into a standardized trajectory input format that SpaceGFN can directly execute.
[0028] S2, construct a chemical space autonomous design molecular generation flow network, in which molecular structure is defined as a state, the selection of reaction templates and reactants according to the strategy network is defined as an action, and the molecular generation process is modeled as a trajectory from the initial state to the final state through a series of state-action transitions.
[0029] In the embodiments, such as Figure 2 As shown, SpaceGFN is built on the framework of Generative Flow Network (GFlowNet), which models the molecular generation process as a step-by-step reaction trajectory, with each molecular generation trajectory consisting of a series of states and actions.
[0030] (1) State: Represents the current partial molecular structure. The initial state is an empty molecule or a specific substrate, and the final state is the generated complete molecule. (2) Action: In each step, the model must first select a reaction template and then select a reactant that matches it.
[0031] The synthesis route is modeled as a sequence of trajectories in SpaceGFN, with each state represented as a sequence. Taking a maximum reaction step count of 2 as an example, each trajectory is set as [reactant1, reactant2, reactant3, rxn1, product_index1, rxn2, product_index2], where reactant1, reactant2, and reactant3 represent reactant 1, reactant 2, and reactant 3, respectively; rxn1 and rxn2 represent reaction 1 and reaction 2, respectively; and product_index1 and product_index2 represent product index 1 and product index 2, respectively.
[0032] In the algorithm flow, this invention models the molecular design process using a trajectory model, abstracting the complete synthetic route into a sequential trajectory composed of discrete states and actions. To achieve this representation, each intermediate molecular structure (state) is encoded as a sequence vector with fixed dimensions, and the three key elements involved in the molecular generation process—reactants, reaction templates, and product indices—are uniformly incorporated into the trajectory definition system. Through the above definition, each molecular design object is abstracted into a high-dimensional synthetic trajectory containing multiple categories of discrete elements. This trajectory not only depicts the path dependence of structural evolution but also fully preserves the sequence structure and combinatorial logic of chemical reactions, enabling SpaceGFN to model molecular generation and optimization using a unified trajectory optimization framework. Based on this mechanism, SpaceGFN can achieve the construction of molecules from scratch and the optimization from existing to optimal forms through the same trajectory generation logic without relying on independent training tasks, significantly improving the model's versatility and algorithm integration.
[0033] The specific process is as follows: For the initial state S0, the corresponding starting sequence is [PAD, PAD, PAD, PAD, PAD, PAD, PAD]. PAD represents a padding symbol, used to place space in time steps where no effective editing operation has occurred in the initial state, ensuring the consistency of the state sequence length. PAD itself does not correspond to any actual molecular editing action or state transition; it is only used for sequence alignment and model calculation. Each time step (S... t-1 To S t State transition Includes action 1 ( ) and Action 2 ( The selection process involves two parts executed sequentially. Action 1 corresponds to the selection of the reaction template, and Action 2 corresponds to the selection of the reactants (building blocks). The action space corresponding to Action 1 includes all reaction templates and the special action EOS (representing the termination action). The action space corresponding to Action 2 includes all reactants and two special actions: EOS (representing the termination action) and UNI (representing that the reaction template selected in Action 1 is a single-component reaction). The actual synthetic route is a process of progressively filling Action 1 and Action 2 into the starting sequence corresponding to S0. Specifically, for S0-S1, only the selection of Action 2 is considered a valid action, and the selectable action is any reactant in Action 2. At this time, the sequence of S1 corresponds to [reactant1, PAD, PAD, PAD, PAD, PAD, PAD]. In the subsequent S1-S2 process, Action 1 is selected first. During the selection, a masking operation is performed to ensure that the currently selected reaction template is compatible with the molecule corresponding to the current state. Specifically, the validity of the reaction template is confirmed by checking the substructure matching between the molecule corresponding to the current state and the reactants in all reaction templates. After the mask operation ends, action 1 is selected. If the special action EOS is selected, the trajectory ends, and the generated molecule is the first reactant selected. If a valid reaction template is selected, action 2 is selected. Action 2 selection is similar to action 1, except that in addition to the current state, the already selected action 1 is known. There are three cases: 1. If action 1 selects EOS, then action 2 can only select EOS (the mask operation treats other actions 2 as invalid); 2. If action 1 selects a single-component reaction, then action 2 can only select UNI or EOS (the mask operation treats other actions 2 as invalid); 3. If action 1 selects a two-component reaction, then action 2 selects a suitable reactant from the reactant library based on the selected reaction template and the molecule corresponding to the current state (the mask operation treats incompatible reactants as invalid). The transitions between other states are consistent with the logic of S1-S2. It should be noted that when action 2 selects UNI or a valid reactant, the RunReactants function in the cheminformatics toolkit RDKit is used to generate intermediate / final products. Considering that each state corresponds to a specific molecule, while the RunReactants function may generate multiple different molecules, the generated molecules are deduplicated to obtain a list of generated molecules, and then randomly selected from it. The index of the randomly selected list is recorded to facilitate accurate reproduction when converting the state into actual molecules later.
[0034] During model training, a multilayer perceptron (MLP) is used as the policy model for selecting action 1 and action 2, respectively. The input to policy model 1 is the Morgan fingerprint (4096 bits) of the molecule corresponding to the current state, while policy model 2 is the Morgan fingerprint of the molecule corresponding to the current state and the encoding representing the selected reaction template. For the input representation of the reaction template, SpaceGFN employs a chemical reaction fingerprint generation model RXNFP based on the BERT (Bidirectional Encoder Representations from Transformers) architecture to generate reaction fingerprints and replace the traditional one-hot encoding method. Compared with the latter, RXNFP can capture the similarity between different reactions, improving the rationality of chemical semantics. In the design of the reaction or reactant selection policy network, SpaceGFN designs two optional strategies.
[0035] (1) Discrete indexing strategy: Its output dimension corresponds one-to-one with the size of the reaction library / reactant library, directly giving the sampling probability of each reaction or reactant. This scheme is suitable for scenarios with a small action space, but when the number of selectable reaction templates or reactants is extremely large, the output dimension expands linearly, resulting in an excessively large model parameter size and reduced training efficiency, making it difficult to meet the computational needs of a large-scale chemical space.
[0036] (2) Fingerprint Embedded Strategy (also one of the key innovations of this invention): To solve the problem of the non-scalability of the large-scale action space (≥100,000 levels), this invention proposes a probabilistic modeling method decoupled from the scale of the action space. The output dimension of this strategy model is fixed and does not increase with the expansion of the reaction library or reactant library. The specific implementation is as follows: First, the fingerprint matrix of all reactions / reactants is pre-calculated; then, the fixed-dimensional embedding vector output by the strategy model is multiplied by the transpose of the fingerprint matrix, and the score and sampling probability of each reaction / reactant are indirectly obtained through vector similarity.
[0037] The core advantages of this fingerprint-embedded strategy are: 1. It completely eliminates the output dimension limitations of discrete indexing strategies, decoupling the number of parameters in the strategy model from the scale of the action space, maintaining a stable model structure even when the reaction template library reaches tens of thousands or even larger; 2. It significantly reduces the number of parameters in the strategy model (no longer expanding linearly with the action space); 3. It supports the construction of more complex and larger-scale optional chemical spaces, enabling SpaceGFN to be extended to the corresponding large building block libraries of commercial synthesis spaces, significantly enhancing the model's adaptability to multiple types of chemical spaces; 4. It achieves similarity-driven action probability inference through the reaction / reactant fingerprint matrix, effectively improving the chemical semantic capabilities of the strategy network; 5. It outperforms discrete indexing strategies in both training and sampling efficiency, especially in large-scale tasks.
[0038] S3, in exploration mode, uses empty molecules or specific substrates as the initial state, autonomously designs molecular generation flow networks in chemical space for trajectory sampling, and uses molecular building blocks in autonomous chemical space to combine with chemical reaction templates to generate complete new molecules and their synthetic routes.
[0039] In the embodiments, such as Figure 3 As shown, in SpaceGFN's exploration mode, user-defined building blocks and reaction templates are treated as composable construction operators. Through progressive sampling of the action space, a systematic exploration of the user-defined chemical space is achieved, and a set of molecular candidate molecules that meet target attributes (such as activity prediction) is automatically generated. Therefore, the exploration mode of this invention not only provides configurable and scalable chemical spaces, but also enables molecular generation tasks to directly benefit from the aforementioned unified algorithm framework based on reaction-driven trajectory modeling, realizing an integrated process from chemical space construction → trajectory generation → molecular sampling.
[0040] S4, in edit mode, takes the molecule to be optimized as the initial state, performs trajectory sampling in a self-designed molecular generation flow network in chemical space, and uses a self-constructed molecular editing reaction template library to perform cascade structural editing of the molecule to be optimized, generating the optimized molecule and its edited synthetic route.
[0041] In the embodiments, if molecular optimization directly borrows from the design approach of de novo molecular design, which can guarantee syntheticity through combinatorial chemistry, there are two limitations: 1. Reactions used for de novo design are mostly two-component reactions with simple substrates and tend to generate new skeletons rather than modify existing ones, making them unsuitable for fine-tuning complex molecules; 2. If classical synthetic reactions are still relied upon, the "limited chemical space paradox" remains, and the constraints of commercial chemical space cannot be escaped. Therefore, this invention introduces the concept of molecular editing into the editing mode of SpaceGFN and constructs the first molecular editing-style reaction dataset EditRule V1 as a molecular editing reaction template library, such as... Figure 4 As shown.
[0042] Specifically, the research literature was first collected and organized according to several types of molecular editing, such as single-atom editing, multi-atom editing, and functional group-functional group exchange, using keyword searches and other methods. Based on background knowledge in synthetic chemistry, research literature with mild reaction conditions, a broad substrate range, single-step reactions, and high reaction selectivity was selected. Since novel molecular modification methods were preferred, the existence of specific drug molecule optimization cases was not used as a screening criterion. The impact of substrate differences and combinations in editing modes was considered, and the selected molecular editing schemes were not required to have clear pharmacodynamic effects. Regarding reaction conditions, research based on novel synthetic methods such as photocatalysis and electrocatalysis was not specifically searched; the focus was more on whether these methods could achieve molecular editing effects. Among the molecular editing literature collected, CH functionalization, a peripheral editing form, is particularly noteworthy. CH functionalization is a classic drug modification technique. Such methods require strong regioselectivity, especially when modifying substituents in ring systems. If a method can introduce functional groups with equal yields at multiple different sites, the substrate is unsuitable for introducing protecting groups. Therefore, non-regioselective CH functionalization is unsuitable as a template; only CH functionalization reactions with clearly defined modification sites are appropriate. Furthermore, many early CH functionalization strategies required a directing group on the substrate. However, directing groups are generally complex and unsuitable as substrate structures for templates. Therefore, they were treated as special protecting groups, and the substrate before the addition of the directing group was used as the CH functionalization substrate. For simple directing groups, they were directly used as part of the substrate. In addition to the four types of molecular editing currently collected (skeleton editing, including the aforementioned single-atom and multi-atom editing; peripheral editing: including the aforementioned functional group-functional group exchange and CH functionalization), there are also molecular editing concepts such as functional group transposition and skeleton remodeling. However, during the literature collection process, it was found that there are still very few relevant documents on these methods. In the future, as more research on these new types increases, more new molecular editing methods will be added to the dataset. It should be noted that stereochemical editing and isotopic atom-atom exchange also fall within the scope of molecular editing. However, considering that in molecular optimization tasks, accurate prediction of the properties (mainly activity) of molecules before and after modification is required, and that both chiral transformations and the introduction of isotopic atoms are difficult to predict accurately using existing prediction tools, these two types were not considered.
[0043] After collecting relevant literature on molecular editing, this invention employs a set of manual reaction template compilation techniques based on manual rule derivation and structural induction to transform the molecular editing methods in the literature into executable SMARTS reaction templates. Although several automated template extraction tools exist, in practical use, it has been found that these tools lack sufficient accuracy in atomic mapping for complex editing reactions and often fail to correctly identify editable sites in different substrate structures, thus failing to meet the requirements of this invention for "substrate universality and scalability." Therefore, this invention uses a manual method to perform structural induction, rule abstraction, and line-by-line verification of the reaction templates, giving them higher chemical accuracy and generalization ability.
[0044] Specifically, the template compilation process of this invention includes: (1) Summarize the set of substrate-product examples of molecular editing reactions, analyze the common structure-activity elements among different examples, identify the backbone structure that remains unchanged in the reaction, as well as the reaction center and editable groups that change, and form a description of the core structure of the reaction. (2) Combining the substrate scope of the reaction and the organic reaction mechanism, the variable structure sites in the core structure description of the reaction are generalized, and all atoms, bonds and substituents expected to participate in molecular editing are summarized in the form of SMARTS wildcards and attribute constraints to generate SMARTS reaction mode description with structure generalization ability. (3) By comparing and analyzing the molecular structure before and after the reaction, the changes in bond type, heteroatom type and aromatic state that need to be matched and replaced in the SMARTS reaction mode description are clarified, so as to determine the correspondence between the matching part and the transformation part in the reaction template and form a complete reaction transformation rule as the reaction SMARTS template. (4) During the construction of the reaction SMARTS template, the corresponding atom mapping relationship before and after the reaction is explicitly specified to ensure that the mapping numbers in the reaction SMARTS template correspond one-to-one, so as to accurately describe the bond breaking and generation process and avoid the atom mismatch problem that the automatic mapping algorithm may produce under complex structures. (5) Based on cheminformatics tools, multiple rounds of verification and testing of reaction SMARTS templates were conducted. By inputting substrate molecules of different structural types, the templates were tested to see if they could stably generate product structures that conform to the reaction mechanism and chemical rationality, thereby completing the construction and optimization of the molecular editing reaction template library.
[0045] For example, for a certain type of heterocyclic editing reaction, the local reaction pattern in the literature is abstracted into the following SMARTS form (partial truncation example): [*:1]-[#6]1:[#6](-[*:2]):[#6](-[*:3]):[#6]2:[#7]:[#6](-[*:4]):[#6](-[*:5]):[#6](-[*:6]):[#6]:2:[#6]:1-[*:7]>>[*:1]-[#6]1:[#6](-[*:2]):[#6](-[*:3]):[#6]2:[#7].
[0046] The SMARTS template describes the carbon and heteroatoms involved in the reaction using atom type numbers (e.g., [#6], [#7]), characterizes the heterocyclic skeleton structure using aromatic bonds and ring numbers, indicates variable substituent positions using wildcard markers (e.g., [*:n]), and clarifies the mapping relationship between corresponding atoms before and after the reaction using atom mapping numbers (map labels, such as the number n in [*:n]). This allows for a precise description of the structural matching range and bond transformation rules for this type of heterocyclic editing reaction. Ultimately, this invention constructs the Edit Rule V1 dataset as a molecular editing reaction template library through the aforementioned manual compilation and verification process, providing broader coverage and higher template accuracy.
[0047] It should also be noted that the difference between the edit mode and the exploration mode lies in the fact that the user needs to input the set of molecules to be optimized. Specifically, the initial state of the molecular generation trajectory in SpaceGFN's edit mode is a specific substrate (based on the set of molecules to be optimized) rather than an empty state. The reaction library corresponds to Edit Rule V1 rather than classical synthetic reactions. Considering that some molecular editing is in the form of two-component reactions, the building block library published by Enamine is used as the source of additional substrates for two-component reactions.
[0048] It is worth emphasizing that the SpaceGFN editing mode does not break down the optimization task into single objectives such as skeletal transitions and side-chain modifications. Instead, it achieves multi-step, combinatorial structural evolution through a trajectory modeling approach based on "cascade reactions." In this cascade reaction model, each modification to the molecule is represented as a state-to-state chemical reaction transfer, and multiple editing actions (such as atom substitution, skeletal editing, and exchange of peripheral functional groups) can be sequentially superimposed on a continuous trajectory. This allows molecular optimization to move beyond relying on single editing operations, enabling the natural combination of multiple structural modification strategies along a single optimization path, flexibly switching from local fine-tuning to global structural reshaping. More importantly, this cascade mechanism is constrained by the matching rules between reaction templates and reactants, ensuring that each intermediate molecule generated corresponds to a practically feasible synthetic path, thereby guaranteeing the synthetic accessibility and chemical rationality of the optimized molecule.
[0049] In exploration mode, the biological activity of the generated molecule is used as the reward function value, such as the binding affinity score of the generated molecule as a ligand to the target protein calculated by quantitative structure-activity relationship models or molecular docking tools. Editing mode also requires a reward objective, which is also set to the activity of the molecule. However, unlike exploration mode, the molecular activity prediction tool in editing mode requires higher accuracy. This is because exploration mode corresponds to the hit-discovery stage of drug development, which aims to find diverse potentially highly active molecules, while editing mode corresponds to the lead optimization stage of drug development, which involves structural modification based on molecules that already possess a certain level of activity. Considering that the structural changes in molecular modification may be relatively small, the activity prediction tool needs high-precision identification of activity differences resulting from small structural modifications. In this example, Uni-Dock is used as the scoring tool. Uni-Dock is a GPU-accelerated docking program that significantly improves speed compared to the traditional AutoDock Vina while maintaining accuracy.
[0050] Furthermore, based on the exploration mode of SpaceGFN, this invention demonstrates the feasibility of explicitly constructing a space similar to natural products through the case of pseudo-natural products (PNP).
[0051] Natural products (NPs) have long provided important inspiration for drug development due to their unique molecular properties and structural features. However, due to evolutionary limitations, their skeletal diversity is limited, making it difficult to cover a broader chemical space. Previous attempts have mainly focused on small-scale fragment assembly, usually involving only a few hundred molecules, making systematic exploration difficult. In this invention, the SpaceGFN exploration mode is used to explicitly construct a PNP chemical space within a DIY chemical space framework, and the exploration is guided by drug activity. A set of structurally diverse fragments extracted from a natural product database by Waldmann et al. was selected. These fragments are not only closer to natural products in physicochemical properties (e.g., higher oxygen content, lower nitrogen content), but most also have easy-to-assemble chemical "handles," ensuring synthetic accessibility. As a control, a synthetic chemical space based on commercially available building blocks was also constructed. The two types of spaces showed significant differences in reaction preferences, molecular spatial distribution, and physicochemical properties. To verify the potential of PNP space in drug discovery, four important targets—EGFR, FGFR1, SRC, and VEGFR2—were selected, and the sampling results of SpaceGFN in PNP space and synthetic space were compared. UMAP analysis showed that the molecules generated in the two spaces were significantly different in distribution, and this difference was also evident at the physicochemical level. Molecules in the pseudo-NP space were more consistent with the characteristics of natural products in terms of physicochemical properties. Further comparison of their structural similarity with known active molecules in ChEMBL showed that molecules in the PNP space generally exhibited higher novelty. Finally, the sampled molecules were evaluated using NP similarity as an indicator, and the results showed that molecules generated in the PNP space were significantly closer to the characteristics of natural products. This proves that the PNP chemical space constructed in this invention not only expands the natural product space but also breaks through the constraints of commercial chemical spaces. Through the exploration mode of SpaceGFN, and through large-scale, systematic explicit construction and exploration of the PNP chemical space, a completely new path is provided for discovering molecules with high novelty and natural product similarity.
[0052] Furthermore, based on the SpaceGFN editing mode, this invention has verified its effectiveness and universality in molecular optimization in tests on 96 drug targets.
[0053] Historically and in practice, any promising molecule must undergo further structural modification to exhibit ideal performance in wet experiments. As mentioned earlier, both empirical optimization by medicinal chemists and generative optimization using existing GenAI tools are inevitably limited by synthetic complexity: the former often restricts imagination due to synthetic difficulty, while the latter frequently generates molecules lacking feasibility. To overcome this bottleneck, this invention introduces the concept of molecular editing from the field of synthetic chemistry into SpaceGFN, proposing a novel editing paradigm. From the perspective of structural modification, molecular editing can be broadly categorized into two types: skeletal editing and peripheral editing. Skeletal editing primarily targets the core skeleton of the molecule, including ring expansion, ring contraction, and atom substitution on rings, further evolving into single-atom editing, multi-atom editing, and macrocyclication. Peripheral editing focuses more on introducing or exchanging functional groups on the skeleton, including C–H functionalization, functional group-functional group exchange, and skeleton remodeling. These strategies have demonstrated strong potential in synthetic chemistry, but this is the first time they have been systematically introduced into GenAI-driven molecular design.
[0054] To demonstrate the effectiveness of the editing mode, two drug molecule optimization case studies were selected. The results show that the editing mode can provide a clear synthetic route for molecule optimization while ensuring synthetic feasibility, with each reaction step corresponding to a specific molecule editing method. It is worth emphasizing that, unlike previous GenAI optimizations which typically decompose the optimization task into single objectives such as skeletal transitions and side-chain modifications, the SpaceGFN editing mode, based on a cascade reaction structure, can naturally achieve multiple modification strategies within the same optimization path, ensuring that the final molecule can still be obtained through a realistically feasible synthetic route.
[0055] Furthermore, the "plug-and-play" capability of the editing mode was tested. Two molecular editing methods were selected and quickly incorporated into the Edit Rule V1 dataset using the same processing workflow. Results showed that these methods can be immediately applied to molecular optimization tasks. Given that molecular editing is still a rapidly developing research area, it is expected that more and more novel editing strategies will emerge in the future. With its modular and open architecture, the SpaceGFN editing mode can continuously absorb the latest editing tools, achieving iterative updates that keep pace with the times. This makes it not only an algorithmic framework but also a sustainably evolving platform, capable of continuously expanding the possibilities of molecular optimization as chemical methodologies develop.
[0056] The above tests demonstrate the unique advantages of the editing mode: it not only provides feasible synthetic routes while optimizing molecules, but also enables parallel implementation of multiple structural modifications within the same optimization path, and possesses plug-and-play scalability. To further verify the feasibility and universality of combining molecular editing with GenAI in molecular optimization tasks, this study conducted a large-scale validation experiment. Specifically, based on the approved drug target map constructed by Santos et al., after rigorous data processing, 96 protein targets were finally selected, covering multiple important human protein families such as kinases, GPCRs, ligand-gated ion channels, and nuclear receptors. This test set can well simulate the complexity and diversity of real-world drug optimization tasks in terms of the number and type distribution of targets, as well as the size and activity fraction distribution of the initial molecules to be optimized, providing an ideal scenario for verifying the generalization ability and robustness of molecular optimization algorithms. First, the molecular optimization effect of the editing mode on 96 targets was examined, and the Uni-Dock docking score was used as the activity evaluation index. Statistical results on optimization success rates show that SpaceGFN exhibits robust performance across different thresholds: molecular optimization was achieved at 92.89% of target sites, with significant activity enhancements at 71.44% and substantial enhancements at 33.51%. This demonstrates that the editing mode not only has broad applicability but also exhibits strong stability in multi-target tasks. Further analysis shows that the optimized molecules increased the number of backbones and circles (an important indicator of topological diversity) by 76% and 98%, respectively, while significantly improving the activity fraction distribution, with an average increase of 0.39 kcal / mol. These results indicate that the editing mode can significantly increase structural diversity while enhancing molecular activity.
[0057] After validating the effectiveness of the editing mode, the novelty of the optimized molecules was further evaluated. A comparison of the top 10 most active molecules for all targets showed that approximately 65% of the molecules had a structural similarity of less than 0.4 before and after optimization. This indicates that the candidate molecules generated by the editing mode not only exhibited significantly enhanced activity but also possessed structural novelty. In fact, the primary motivation for introducing molecular editing is to integrate cutting-edge chemical methodologies, thereby breaking free from the dependence of traditional molecular optimization on classical synthetic methods and injecting new chemical creativity into molecular optimization.
[0058] Based on the same inventive concept, such as Figure 5 As shown, this embodiment of the invention also provides a molecular generation and optimization device 500 based on autonomous chemical space design, including: an autonomous chemical space construction module 510, a network unified trajectory modeling module 520, a molecular exploration and generation module 530, and a molecular editing and optimization module 540.
[0059] The autonomous chemical space construction module 510 is used to form an autonomous chemical space, which includes a reaction template selection action space and a reactant selection action space, based on a user-defined molecular building block library and a chemical reaction template library after standardization.
[0060] The Network Unified Trajectory Modeling Module 520 is used to construct a chemical space autonomously designed molecular generation flow network, in which molecular structure is defined as a state, the selection of reaction templates and reactants based on the strategy network is defined as an action, and the molecular generation process is modeled as a trajectory from the initial state through a series of state-action transitions to the final state.
[0061] The molecular exploration and generation module 530 is used in exploration mode to take an empty molecule or a specific substrate as the initial state, and to perform trajectory sampling in a molecular generation flow network designed autonomously in the chemical space. It uses molecular building blocks in the autonomous chemical space and chemical reaction templates to combine and generate complete new molecules and their synthetic routes.
[0062] The molecular editing optimization module 540 is used in editing mode to take the molecule to be optimized as the initial state, perform trajectory sampling in a chemical space autonomously designed molecular generation flow network, and use a self-constructed molecular editing reaction template library to perform cascade structural editing of the molecule to be optimized, generating the optimized molecule and its edited synthetic route.
[0063] Based on the same inventive concept, embodiments of the present invention also provide an electronic device, including a memory and one or more processors, wherein the memory is used to store a computer program, and the processor is used to implement the above-described molecular generation and optimization method based on autonomous chemical space design when executing the computer program.
[0064] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a computer, implements the above-described molecular generation and optimization method based on autonomous chemical spatial design.
[0065] It should be noted that the molecular generation and optimization device, electronic device, and computer-readable storage medium based on autonomous chemical space design provided in the above embodiments all belong to the same inventive concept as the molecular generation and optimization method based on autonomous chemical space design. For details of their specific implementation process, please refer to the embodiments of the molecular generation and optimization method based on autonomous chemical space design, which will not be repeated here.
[0066] The specific embodiments described above illustrate the technical solution and beneficial effects of the present invention in detail. It should be understood that the above description is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, additions, and equivalent substitutions made within the scope of the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A molecular generation and optimization method based on autonomous chemical spatial design, characterized in that, Includes the following steps: Based on user-defined molecular building block libraries and chemical reaction template libraries, an autonomous chemical space is formed after standardization, which includes reaction template selection action space and reactant selection action space. A chemical space autonomous design molecular generation flow network is constructed, in which molecular structure is defined as a state, the selection of reaction templates and reactants based on strategy network is defined as an action, and the molecular generation process is modeled as a trajectory from the initial state to the final state through a series of state-action transitions. In exploration mode, starting with empty molecules or specific substrates, trajectory sampling is performed in a molecular generation flow network designed autonomously in the chemical space. Molecular building blocks and chemical reaction templates in the autonomous chemical space are combined to generate complete new molecules and their synthetic routes. In edit mode, starting with the molecule to be optimized as the initial state, trajectory sampling is performed in a self-designed molecular generation flow network in chemical space. The self-constructed molecular editing reaction template library is used to perform cascaded structural editing of the molecule to be optimized, generating the optimized molecule and its edited synthetic route.
2. The molecular generation and optimization method based on autonomous chemical space design according to claim 1, characterized in that, The user-defined molecular building block library and chemical reaction template library, after standardization, form an autonomous chemical space containing a reaction template selection action space and a reactant selection action space, including: It can receive user-defined molecular building block libraries and chemical reaction template libraries. The molecular building block library includes at least one of the following: synthetic building block library, natural product derived building block library, or any set of custom structures. The chemical reaction template library includes at least one of the following: classical synthetic reaction template, enzyme-catalyzed reaction template, or a set of user-defined reaction rules. A standardized chemical space construction pipeline is implemented for molecular building block libraries and chemical reaction template libraries, including at least element type constraints, ring structure size restrictions, and reaction matching effectiveness screening. The standardized building blocks and reaction templates are transformed into a standardized trajectory input format that can be directly executed by the autonomous molecular generation flow network designed by the chemical space, thereby explicitly constructing user-defined chemical primitives into an autonomous chemical space that supports systematic exploration.
3. The molecular generation and optimization method based on autonomous chemical space design according to claim 1, characterized in that, In the self-designed molecular generation flow network in chemical space, a fingerprint embedding strategy is used for probabilistic modeling and sampling of actions, including: Pre-calculate the chemical reaction fingerprint vectors of all reactions / reactants to form a fingerprint matrix; The fixed-dimensional embedding vector output by the policy model is multiplied by the transpose of the fingerprint matrix, and the score and sampling probability for each reaction / reactant are obtained through vector similarity measurement.
4. The molecular generation and optimization method based on autonomous chemical space design according to claim 1, characterized in that, The method of using a self-constructed molecular editing reaction template library to perform cascaded structural editing of the molecule to be optimized includes: In a single optimization trajectory, multiple editing steps driven by a molecular editing reaction template library are executed sequentially. The intermediate molecules generated in the previous editing step are automatically used as input substrates for the next editing step. In this way, structural modifications of different editing types and sites are continuously combined to achieve complex molecular optimization from local functional group adjustment to core skeleton reshaping.
5. The molecular generation and optimization method based on autonomous chemical space design according to claim 1, characterized in that, The types of molecular editing reaction template libraries include single-atom editing, multi-atom editing, functional group-functional group exchange, and CH functionalization.
6. The molecular generation and optimization method based on autonomous chemical space design according to claim 1, characterized in that, The template compilation process for the molecular editing reaction template library includes: Summarize the substrate-product examples of molecular editing reactions, identify the invariant backbone structure in the reaction, as well as the variable reaction center and editable groups, to form a description of the core structure of the reaction; Based on the reaction substrate range and reaction mechanism, SMARTS wildcards are used to generalize the variable structural sites in the core structure description of the reaction to generate SMARTS reaction mode descriptions. Based on the SMARTS reaction pattern description, by comparing and analyzing the molecular structures before and after the reaction, a complete reaction transformation rule containing matching and transformation relationships is formed as a reaction SMARTS template, namely a molecular editing reaction template library; During the construction of the reaction SMARTS template, the atomic mapping relationship before and after the reaction is explicitly defined to ensure that bond breaking and formation processes correspond accurately and to avoid atomic mismatches. Multiple rounds of verification and testing of SMARTS reaction templates were conducted using cheminformatics tools to verify the reliability and chemical rationality of the templates, thereby completing the construction and optimization of a molecular editing reaction template library.
7. The molecular generation and optimization method based on autonomous chemical space design according to claim 1, characterized in that, The policy network is trained using a reward function to guide it to generate molecular trajectories with higher target property scores, and the quality of the generated molecules is evaluated and screened during the sampling process. In exploration mode, the biological activity of the generated molecules is used as the reward function value; in edit mode, a molecular activity prediction tool with higher accuracy than that in exploration mode is used for scoring, and the score is used as the reward function value.
8. A molecular generation and optimization device based on autonomous chemical spatial design, used to implement the molecular generation and optimization method based on autonomous chemical spatial design as described in any one of claims 1 to 7, characterized in that, include: The module includes an autonomous chemical space construction module, a unified network trajectory modeling module, a molecular exploration and generation module, and a molecular editing and optimization module. The autonomous chemical space construction module is used to form an autonomous chemical space, which includes reaction template selection action space and reactant selection action space, based on user-defined molecular building block library and chemical reaction template library after standardization. The unified trajectory modeling module is used to construct a chemical space autonomously designed molecular generation flow network, in which molecular structure is defined as a state, the selection of reaction templates and reactants according to the strategy network is defined as an action, and the molecular generation process is modeled as a trajectory from the initial state through a series of state-action transitions to the final state. The molecular exploration and generation module is used in exploration mode to take an empty molecule or a specific substrate as the initial state, and to perform trajectory sampling in a molecular generation flow network designed autonomously in the chemical space. It uses molecular building blocks and chemical reaction templates in the autonomous chemical space to generate complete new molecules and their synthetic routes. The molecular editing optimization module is used in editing mode to take the molecule to be optimized as the initial state, perform trajectory sampling in a chemically designed molecular generation flow network, and use a self-constructed molecular editing reaction template library to perform cascade structural editing of the molecule to be optimized, generating the optimized molecule and its edited synthetic route.
9. An electronic device comprising a memory and one or more processors, the memory for storing a computer program, characterized in that, The processor is used to implement the molecular generation and optimization method based on autonomous chemical space design as described in any one of claims 1 to 7 when executing a computer program.
10. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by a computer, it implements the molecular generation and optimization method based on autonomous chemical space design as described in any one of claims 1 to 7.