Molecular generation method and apparatus, device, and storage medium

The generation and denoising of hierarchical embeddings are carried out through machine learning models, which solves the problem of limited generation of molecular generation tasks in the prior art, and achieves more efficient and diversified molecular generation.

WO2025180314A1PCT designated stage Publication Date: 2025-09-04TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/078686
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-02-26
Filing Date
2025-02-24
Publication Date
2025-09-04

AI Technical Summary

Technical Problem

In the prior art, the molecular generation task is limited by the size of the search space and the computational complexity, resulting in a limited number of molecules generated.

Method used

The machine learning model is used to generate and denoise the hierarchical embedding. By randomly generating the initial hierarchical embedding, the relationship between molecular graphs, subgraphs and atoms is used to predict and remove noise, decode it into the structural information of the generated molecules, and the mutually restrictive relationship of the hierarchical structure is used to improve the diversity and efficiency of the generated molecules.

Benefits of technology

This improves the number and diversity of potentially generated molecules, reduces computational storage requirements and time-consuming, and achieves large-scale molecular generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025078686_04092025_PF_FP_ABST
    Figure CN2025078686_04092025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed are a molecular generation method and apparatus, a device, and a storage medium. The method comprises: generating random initial hierarchical embeddings, wherein the initial hierarchical embeddings comprise an initial graph embedding representing a molecular graph, an initial subgraph embedding representing a subgraph and an initial atom embedding representing atoms, the molecular graph consists of nodes and edges, the nodes represent the atoms, the edges represent chemical bonds for connecting the atoms, and the subgraph represents a regional molecular structure of the molecular graph; by using a trained machine learning model, predicting and removing noise in the initial molecular graph embedding, the initial subgraph embedding and the initial atom embedding by means of the learned relationship among the molecular graph, the subgraph and the atoms to obtain a generated molecular graph embedding, a generated subgraph embedding and a generated atom embedding of generated hierarchical embeddings; and decoding the generated hierarchical embeddings into molecular structure information of a generated molecule, wherein the molecular structure information comprises the atomic types of atoms in the generated molecule and the chemical bond types of chemical bonds between the atoms.
Need to check novelty before this filing date? Find Prior Art

Description

Molecular generation method, device, equipment and storage medium

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 26, 2024, with application number 202410210835.3 and invention name “Molecular Generation Method, Device, Equipment and Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and storage medium for generating molecules.

[0003] The task of molecular generation is to generate molecules with desired properties by designing a synthesis path based on given molecular properties or structures. With the development of chemical synthesis and materials science, the task of molecular generation has become increasingly important. In related technologies, heuristic search algorithms or rule-based methods are used to generate new molecules. Based on known molecules, search strategies are adopted to modify known molecules according to the transformation rules of molecules to generate new molecules. However, the solutions provided by related technologies are often limited by the size of the search space and the computational complexity, resulting in a limited number of molecules that can be generated. Summary of the Invention

[0004] The embodiments of the present application provide a molecule generation method, apparatus, device, and storage medium.

[0005] The molecule generation method of the embodiment of the present application may include:

[0006] Generate random initial hierarchical embeddings, including initial graph embeddings representing molecular graphs, initial subgraph embeddings representing subgraphs, and initial atom embeddings representing atoms, where a molecular graph is composed of nodes and edges, the nodes representing atoms, the edges representing chemical bonds connecting atoms, and the subgraphs representing the regional molecular structure of the molecular graph;

[0007] Using a trained machine learning model and the learned relationships among the molecular graph, subgraph, and atoms, the trained machine learning model is used to predict and remove noise from the initial molecular graph embedding, the initial subgraph embedding, and the initial atom embedding, thereby obtaining a generated molecular graph embedding, a generated subgraph embedding, and a generated atom embedding that generate a hierarchical embedding.

[0008] The generated hierarchical embedding is decoded into molecular structure information of the generated molecule, where the molecular structure information includes atomic types of atoms in the generated molecule and chemical bond types of chemical bonds between atoms.

[0009] The molecule generation device implemented in this application may include:

[0010] An initial sampling module for generating random initial hierarchical embeddings, wherein the initial hierarchical embeddings include an initial graph embedding representing molecules, an initial subgraph embedding representing subgraphs, and an initial atom embedding representing atoms, wherein a molecular graph is composed of nodes and edges, wherein the nodes represent atoms, the edges represent chemical bonds connecting atoms, and the subgraphs represent the local molecular structure of the molecular graph;

[0011] a denoising module for predicting and removing noise from the initial molecular graph embedding, the initial subgraph embedding, and the initial atom embedding by using a trained machine learning model and the learned relationships among the molecular graph, subgraph, and atoms, to obtain a generated molecular graph embedding, a generated subgraph embedding, and a generated atom embedding for generating a hierarchical embedding;

[0012] A decoding module is used to decode the generated hierarchical embedding into molecular structure information of the generated molecule, where the molecular structure information includes the atomic types of atoms in the generated molecule and the chemical bond types of chemical bonds between atoms.

[0013] The computer device of the embodiment of the present application includes a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the molecule generation method as described in each embodiment.

[0014] The computer-readable storage medium of the embodiments of the present application stores at least one program, and the at least one program can be loaded and executed by a processor to implement the molecule generation method of each embodiment.

[0015] The computer program product or computer program of the embodiments of the present application includes at least one program segment stored in a computer-readable storage medium. A processor of a computer device reads the at least one program segment from the computer-readable storage medium and executes the at least one program segment, causing the computer device to perform the molecule generation method of each embodiment.

[0016] In the embodiment of the present application, a machine learning model is used to perform denoising processing at different levels of the molecular structure based on the learned relationships between molecular graphs, subgraphs, and atomic graphs, making full use of the mutual constraints between the hierarchical structures within the molecule, which is beneficial to increasing the number of potential molecules that can be generated and improving the diversity of molecules that can be generated. In addition, by using subgraph embedding, the machine learning model can determine the local structural information of the molecule through the subgraph. Compared with always using the structural information of the entire molecular graph for various calculations, it is beneficial to reduce the storage requirements of the processing process of the machine learning model and reduce the time consumption, thereby facilitating the large-scale generation of molecules. Brief description of the accompanying drawings

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0018] FIG1A shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;

[0019] FIG1B shows a flow chart of a molecule generation method according to an embodiment of the present application.

[0020] FIG1C shows a schematic structural diagram of a hierarchical denoising network provided by an exemplary embodiment of the present application.

[0021] FIG2 shows a flow chart of a method for generating molecules according to an exemplary embodiment of the present application;

[0022] FIG3 shows a schematic diagram of a molecular structure hierarchy provided by an exemplary embodiment of the present application;

[0023] FIG4 shows a schematic diagram of an N-step denoising process provided by an exemplary embodiment of the present application;

[0024] FIG5 shows a flowchart of a denoising process provided by an exemplary embodiment of the present application;

[0025] FIG6 shows a flowchart of a denoising process performed by a hierarchical denoising network according to an exemplary embodiment of the present application;

[0026] FIG7 shows a schematic diagram of the structure of a hierarchical block provided by an exemplary embodiment of the present application;

[0027] FIG8 shows a schematic structural diagram of a hierarchical denoising network provided by an exemplary embodiment of the present application;

[0028] FIG9 shows a flowchart of a process for generating molecular structure information provided by an exemplary embodiment of the present application;

[0029] FIG10 shows a schematic structural diagram of a hierarchical denoising network provided by another exemplary embodiment of the present application;

[0030] FIG11 shows a schematic structural diagram of a molecular generation model provided by an exemplary embodiment of the present application;

[0031] FIG12 is a schematic diagram showing the structure of a molecule generation model during training provided by an exemplary embodiment of the present application;

[0032] FIG13 shows a block diagram of a molecule generation device provided by an exemplary embodiment of the present application;

[0033] FIG14 shows a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application.

[0034] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0035] Molecular generation refers to the design of synthetic pathways to generate molecules with desired properties or structures, and has wide applications in drug discovery, material design, and catalyst development.

[0036] The molecular generation scheme provided in the embodiments of the present application involves artificial intelligence machine learning technology, which is specifically illustrated by the following embodiments.

[0037] FIG1A is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application. The implementation environment may include: a terminal 110 and a server 120. Data communication between the terminal 110 and the server 120 is performed via a communication network. In some embodiments, the communication network may be a wired network or a wireless network, and the communication network may be at least one of a local area network, a metropolitan area network, and a wide area network.

[0038] The terminal 110 may be an electronic device, such as a mobile terminal such as a smart phone, a tablet computer, a laptop computer, or a desktop computer, and the number may be one or more, which is not limited in the embodiments of the present application. The server 120 is at least one electronic device, such as an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0039] The solution provided in this application can be completed by the terminal 110 or the server 120 alone, or can be completed by the terminal 110 and the server 120 in collaboration.

[0040] In a possible embodiment, the solution provided in the embodiment of the present application is performed by a molecular generation model. The molecular generation model is a machine learning model that has been trained to perform molecular generation tasks. In some embodiments, the molecular generation model is deployed in the terminal 110. When a molecular generation instruction is received, the terminal 110 generates an initial hierarchical embedding, uses the molecular generation model to denoise the initial hierarchical embedding to obtain a generated hierarchical embedding (also referred to as a target hierarchical embedding), decodes the generated hierarchical embedding, and obtains molecular structure information of a generated molecule (also referred to as a target molecule). The terminal 110 can display the generated molecule 130 corresponding to the molecular structure information to the user through a display screen component.

[0041] In some embodiments, the molecular generation model is deployed on server 120. Upon receiving the molecular generation instruction, terminal 110 sends the molecular generation instruction to server 120. Upon receiving the molecular generation instruction, the server generates an initial hierarchical embedding and uses the molecular generation model to denoise the initial hierarchical embedding based on the hierarchical relationships between the molecular graph, subgraphs, and atoms to obtain a generated hierarchical embedding. Based on the generated hierarchical embedding, the server then obtains molecular structure information for the generated molecule. After obtaining the molecular structure information for the generated molecule, server 120 returns it to terminal 110.

[0042] In some embodiments, upon receiving a molecule generation instruction, the terminal 110 generates an initial hierarchical embedding and sends the initial hierarchical embedding to the server 120 . The server 120 performs denoising on the initial hierarchical embedding and decodes the generated hierarchical embedding to obtain molecular structure information and return it to the terminal 110 .

[0043] For ease of description, the following embodiments are described using the example of a molecule generation method executed by a computer device. It is understood that the computer device in each embodiment can be the terminal 110, or the server 120, or both the terminal 110 and the server 120.

[0044] Figure 1B shows a flow chart of a method for generating molecules according to an embodiment of the present application. As shown in Figure 1B , the exemplary method may include the following steps.

[0045] Step 101: Generate random initial hierarchical embeddings.

[0046] Among them, the initial hierarchical embedding is the initial data for the molecule generation task. The machine learning model makes a series of modifications to the initial hierarchical embedding of the input, and finally obtains the hierarchical embedding (also referred to as the generated hierarchical embedding or target hierarchical embedding) of the generated new molecule (hereinafter referred to as the generated molecule or target molecule). The generated hierarchical embedding can be decoded into the structural information of the generated molecule. The initial hierarchical embedding of each embodiment includes an initial molecular graph embedding representing a molecular graph, an initial subgraph embedding representing a subgraph, and an initial atomic embedding representing an atom. The molecular graph (also referred to as a graph) represents the complete structure of the molecule, and the subgraph represents the local molecular structure of the molecular graph. Both the molecular graph and the subgraph can be composed of nodes and edges, the nodes representing atoms, and the edges representing chemical bonds connecting atoms.

[0047] The initial hierarchical embedding can be generated in any random manner, and the generated initial hierarchical embedding obeys a preset distribution mode, such as a Gaussian distribution. In some embodiments, the initial graph embedding, initial subgraph embedding, and initial atom embedding can be sampled from a preset set of candidate molecular graph embeddings, a preset set of candidate subgraph embeddings, and a preset set of candidate atom embeddings, respectively, and the initial graph embedding, initial subgraph embedding, and initial atom embedding obey Gaussian distribution. In some embodiments, the sampling values ​​of at least two preset parameters can be obtained by sampling from a preset parameter value set corresponding to each of the at least two parameters, and the initial molecular structure information is generated based on the sampling values ​​of the at least two parameters, and the initial molecular structure information is converted into the initial graph embedding, initial subgraph embedding, and initial atom embedding, and the at least two parameters obey Gaussian distribution.

[0048] In step 102, a trained machine learning model is used to predict and remove noise from the initial molecular graph embedding, initial subgraph embedding, and initial atom embedding using the learned relationships between molecular graphs, subgraphs, and atoms, thereby obtaining generated molecular graph embeddings, generated subgraph embeddings, and generated atom embeddings of generated hierarchical embeddings (also called target hierarchical embeddings).

[0049] As used herein, "noise" refers to the excess information in the initial hierarchical embedding compared to the generated hierarchical embedding output by the machine learning model. This excess information is not predetermined and added to the initial hierarchical embedding, but is determined by the machine learning model using a built-in algorithm based on the learned relationships between the molecular graph, subgraphs, and atoms. For example, the noise in the initial molecular graph embedding, initial subgraph embedding, or initial atom embedding can be predicted using at least two embeddings among the initial molecular graph embedding, initial subgraph embedding, and initial atom embedding. That is, the noise in each of the initial molecular graph embedding, initial subgraph embedding, or initial atom embedding is determined using at least two embeddings among the initial molecular graph embedding, initial subgraph embedding, and initial atom embedding. In various embodiments, the noise in different embeddings can be determined using different combinations of at least two embeddings. For example, the noise in the initial atom embedding can be predicted using the initial subgraph embedding and the initial atom embedding; the noise in the initial subgraph embedding can be predicted using the initial subgraph embedding and the initial atom embedding; and the noise in the initial molecular graph embedding can be predicted using the initial molecular graph embedding, the initial subgraph embedding, and the initial atom embedding.

[0050] Step 103: Decode the generated hierarchical embedding into molecular structure information of the generated molecule.

[0051] The molecular structure information includes the atomic types of atoms in the generated molecule and the chemical bond types of the chemical bonds between atoms.

[0052] It can be seen that each embodiment performs denoising processing at different levels of the molecular structure, making full use of the mutual constraints between the hierarchical structures within the molecule, which is conducive to increasing the number of potential molecules that can be generated and improving the diversity of molecules that can be generated. In addition, by using subgraph embedding, the machine learning model can determine the local structural information of the molecule through the subgraph. Compared with always using the structural information of the entire molecular graph for various calculations, it is conducive to reducing the storage requirements of the machine learning model processing process and reducing the time consumption, thereby facilitating the large-scale generation of molecules.

[0053] In each embodiment, in order to improve the quality of the generated molecules, the generated hierarchical embedding can be obtained by performing multiple iterative denoising processes. For example, for the initial hierarchical embedding, the first intermediate hierarchical embedding can be obtained by first predicting and removing the noise in the embedding of the initial molecular graph, the embedding of the initial subgraph, and the embedding of the initial atom. In the subsequent n+1th denoising process, the n+1th intermediate hierarchical embedding can be obtained by predicting and removing the n+1th noise in the nth intermediate hierarchical embedding. The nth intermediate hierarchical embedding includes the nth intermediate molecular graph embedding, the nth intermediate subgraph embedding, and the nth intermediate atom embedding. When it is preset that a total of N denoising processes are to be performed, in the Nth denoising process, the generated hierarchical embedding can be obtained by predicting and removing the Nth noise in the N-1th intermediate hierarchical embedding. N is the total number of preset denoising processes, and n is a positive integer greater than 0 and less than N.

[0054] For example, the above-mentioned multiple-iteration denoising process can be implemented in a machine learning model having a structure similar to that shown in FIG11. FIG11 shows a schematic diagram of the structure of a molecular generation model provided by an exemplary embodiment of the present application. The molecular generation model may include at least two hierarchical denoising networks 1101. As shown in FIG11, the number of hierarchical denoising networks 1101 is represented as T. The first hierarchical denoising network 1101 obtains the initial atomic embedding Initial subgraph embedding and the initial graph embedding Predict and remove initial atom embeddings Initial subgraph embedding and the initial graph embedding The noise in the first intermediate atom is obtained by embedding 1st intermediate subgraph embedding and the first intermediate embedding And input it into the second level denoising network 1101. In this way, after T level denoising networks 1101 perform denoising processing in sequence, the final generated atom embedding generated by the last (i.e., Tth) level denoising network 1101 Generating subgraph embeddings and generate graph embeddings It is input to the decoding network 1102 and converted into molecular structure information of the generated molecule.

[0055] In this way, after multiple iterations of denoising, the noise in the initial level embedding can be gradually removed, which reduces the requirements for algorithm accuracy and the complexity of the algorithm, while also improving the denoising effect and the quality of the generated molecules.

[0056] In various embodiments, a hierarchical denoising network may include a first multi-layer perceptual network, a second multi-layer perceptual network, and a hierarchical block located between the first multi-layer perceptual network and the second multi-layer perceptual network. Taking the n+1 hierarchical denoising network as an example, the first multi-layer perceptual network may convert the nth intermediate level embedding into the nth intermediate level latent variables, where the nth intermediate level latent variables include the nth intermediate molecular graph latent variables, the nth intermediate subgraph latent variables, and the nth intermediate atomic latent variables; the hierarchical block updates the nth intermediate level latent variables based on the relationship between the nth intermediate molecular graph latent variables, the nth intermediate subgraph latent variables, and the nth intermediate atomic latent variables to obtain updated nth intermediate level latent variables; and the second multi-layer perceptual network predicts the n+1th noise based on the updated nth intermediate level latent variables.

[0057] By using a multi-layer perceptron network to convert hierarchical embeddings into latent variables at each level in each iterative denoising process, updating each latent variable through the relationship between the latent variables, and converting the updated latent variables into updated hierarchical embeddings using a multi-layer perceptron network, the learned relationships between the levels can be used to better understand the hierarchical embeddings, extract and reorganize features, improve the denoising effect, and ultimately generate higher quality molecules.

[0058] To improve the accuracy of noise prediction, various embodiments propose a multi-updated hierarchical denoising network structure. Figure 1C shows a schematic diagram of the structure of a hierarchical denoising network provided by an exemplary embodiment of the present application. As shown in Figure 1C, the hierarchical denoising network includes a first multi-layer perception network 801, at least two hierarchical blocks 802 connected in series, a second multi-layer perception network 803, and a denoising module 804.

[0059] Taking the n+1th level denoising network as an example, the first multi-layer perception network 801 can embed the nth intermediate level, including the nth intermediate atom embedding nth intermediate subgraph embedding and the nth intermediate molecular graph embedding Converted to the nth intermediate level latent variable.

[0060] The first hierarchical block 802 updates the nth intermediate atomic latent variable based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable output by the first multi-layer perception network; updates the nth intermediate subgraph latent variable based on the nth intermediate subgraph latent variable and the nth intermediate atomic latent variable; and updates the nth intermediate molecular graph latent variable based on the nth intermediate subgraph latent variable, the nth intermediate atomic latent variable, and the nth intermediate molecular graph latent variable.

[0061] The (m+1)th level block 802 updates the nth intermediate atomic latent variables updated by the (m)th level block based on the nth intermediate atomic latent variables and the nth intermediate subgraph latent variables updated by the (m)th level block; updates the nth intermediate subgraph latent variables updated by the (m)th level block based on the nth intermediate subgraph latent variables and the nth intermediate atomic latent variables updated by the (m)th level block; updates the nth intermediate molecular graph latent variables updated by the (m)th level block based on the nth intermediate subgraph latent variables, the nth intermediate atomic latent variables, and the nth intermediate molecular graph latent variables updated by the (m)th level block;

[0062] After the Mth hierarchical block 802 updates the nth intermediate atomic latent variable, the nth intermediate subgraph latent variable, and the nth intermediate molecular graph latent variable, it outputs the updated nth intermediate atomic latent variable, the nth intermediate subgraph latent variable, and the nth intermediate molecular graph latent variable to the second multi-layer perceptron. M is the total number of hierarchical blocks 820, and m is an integer greater than 0 and less than M.

[0063] The second multi-layer perception network 803 predicts the n+1th noise based on the updated nth intermediate atomic latent variable, the nth intermediate subgraph latent variable, and the nth intermediate molecular graph latent variable.

[0064] The denoising module 804 embeds the nth intermediate atom nth intermediate subgraph embedding and the nth intermediate molecular graph embedding Remove the n+1th noise and get the updated nth intermediate atom embedding nth intermediate subgraph embedding and the nth intermediate molecular graph embedding

[0065] In this way, by using at least two hierarchical blocks to perform multiple updates on the intermediate-level latent variables in each iterative denoising process, each update takes into account the mutual constraints between the various levels of the molecular structure. Such a more detailed multi-level update process is conducive to more accurate determination of noise and improved denoising effect.

[0066] In various embodiments, the hierarchical blocks in the hierarchical denoising network can be designed to embed processing logic for each level based on the relationships between the levels of the molecular structure. Figure 7 shows a schematic diagram of the hierarchical block structure provided by an exemplary embodiment of the present application. This description uses the m+1th hierarchical block in the nth hierarchical denoising network as an example.

[0067] The hierarchical block may include at least two third multilayer perceptrons 701 and a fusion module 706. The first perceptrons in the at least two third multilayer perceptrons 701 transform the nth intermediate atomic latent variable updated by the mth hierarchical block to obtain a first transformed latent variable, and the second perceptrons in the at least two third multilayer perceptrons 701 transform the nth intermediate subgraph latent variable updated by the mth hierarchical block to obtain a second transformed latent variable; the fusion module 706 fuses the first transformed latent variable with the second transformed latent variable to obtain a first fused variable; and the third perceptrons in the at least two third multilayer perceptrons 701 transform the first fused variable to obtain the nth intermediate atomic latent variable updated by the m+1th hierarchical block.

[0068] The hierarchical block may further include at least two fourth multilayer perceptrons 702, an attention network 703, and a fusion module 706. The attention network 703 determines a first attention score based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable updated by the mth hierarchical block, and weights the nth intermediate atomic latent variable updated by the mth hierarchical block by the first attention score to obtain the weighted nth intermediate atomic latent variable; the first perceptrons in the at least two fourth multilayer perceptrons 702 transform the nth intermediate subgraph latent variable updated by the mth hierarchical block to obtain a third transformed latent variable; the fusion module 706 fuses the third transformed latent variable with the weighted nth intermediate atomic latent variable to obtain a second fused variable; the second perceptrons in the at least two fourth multilayer perceptrons 702 transform the second fused variable to obtain the nth intermediate subgraph latent variable updated by the m+1th hierarchical block.

[0069] The hierarchical block may further include at least two fifth multilayer perceptrons 704, a neighborhood aggregator 705, and a fusion module 706. The first perceptrons in the at least two fifth multilayer perceptrons 704 transform the nth intermediate molecular graph latent variable updated by the mth hierarchical block to obtain a fourth transformed variable; the neighborhood aggregator 705 performs neighborhood aggregation processing on the nth intermediate atomic latent variable updated by the mth hierarchical block to obtain a first aggregated variable; the neighborhood aggregator 705 performs neighborhood aggregation processing on the nth intermediate subgraph latent variable updated by the mth hierarchical block to obtain a second aggregated variable; the fusion module 706 fuses the fourth transformed variable, the first aggregated variable, and the second aggregated variable to obtain a third fused variable; the second perceptrons in the at least two fifth multilayer perceptrons 704 transform the third fused variable to obtain the nth intermediate molecular graph latent variable updated by the m+1th hierarchical block.

[0070] The processing logic of the aforementioned hierarchical blocks enables a more detailed analysis and understanding of the relationships between the various levels of a molecular structure (atoms, subgraphs, and molecular graphs). For example, a multilayer perceptron can be used to deeply explore the features in atomic and subgraph latent variables, improving the quality of updated atomic latent variables. An attention network can be used to capture the key connections between atoms and molecular structure, improving the quality of updated subgraph latent variables. A domain aggregator can be used to extract information related to the molecular structure from atomic and subgraph latent variables to update the molecular graph latent variables, improving the quality of the updated molecular graph latent variables.

[0071] When there is a preset requirement for the molecular properties of the generated molecule (also called the target molecular properties), the embedding of the target molecular properties can be input into the machine learning model to generate the generated molecule with the target molecular properties. The target molecular properties may include, for example, at least one of the water solubility of the molecule, the ease of synthesis, and the like. The target molecular properties can be obtained from other devices, such as an input device associated with the electronic device, a storage device that can be read by the electronic device, and the like. In some embodiments, the target molecular property embedding can be represented by a vector s = {s1, s2, ...}, where each dimension represents a specific molecular property.

[0072] In one possible embodiment, a sixth multilayer perceptron and an attribute attention network can be added to the hierarchical denoising network. Taking the nth-level denoising network as an example, in the process of predicting and removing the n+1th noise in the nth intermediate level embedding to obtain the n+1th intermediate level embedding, the n+1th noise can be removed from the nth intermediate level embedding to obtain the denoised nth intermediate level embedding; the embedding of the set target molecular attribute is converted into the target attribute latent space variable through the sixth multilayer perceptron; and the denoised nth intermediate level embedding is updated based on the target attribute latent space variable through the attribute attention network to obtain the n+1th intermediate level embedding.

[0073] For example, the second attention score of the target attribute latent space variable and each element in the denoised nth intermediate level embedding can be determined by the attribute attention network. The second attention score is used to characterize the correlation between each element and the target attribute latent space variable. Each element includes at least one of the following: the embedding of an atom in the nth intermediate atom embedding, a subgraph embedding element in the nth intermediate subgraph embedding (for example, an element of a certain dimension in the subgraph embedding vector, which represents a subgraph in at least two subgraphs or an element in a subgraph), the embedding of a node or an edge in the nth intermediate molecular graph embedding, etc. The n+1th intermediate level embedding is generated by weighting at least one element in the denoised nth intermediate level embedding based on the second attention score.

[0074] Thus, during each iterative denoising process, the hierarchical embeddings (including atom embeddings, subgraph embeddings, and molecular graph embeddings) at each level are updated based on the set target molecular properties and the relationship between the learned molecular properties and each level of the molecular structure. For example, at least one element in at least one hierarchical embedding is strengthened through weighted processing using an attention network. In this way, over multiple iterative denoising processes, the molecular structure will gradually evolve toward a structure with the target molecular properties, so that the final generated molecule has the target molecular properties.

[0075] In order to help understand the technical solution of the present application, some exemplary embodiments of various aspects of the present application are listed below. The details therein are only examples, and the technical solution of the present application is not limited to these details.

[0076] Please refer to FIG2 , which shows a flow chart of a molecule generation method provided by an exemplary embodiment of the present application. The method includes the following steps.

[0077] Step 201: Sample initial level embedding.

[0078] The initial level embedding includes the initial graph embedding at the molecular graph level, the initial subgraph embedding at the subgraph level, and the initial atom embedding at the atom level.

[0079] A molecular graph consists of nodes and edges. Nodes represent atoms, edges represent chemical bonds connecting atoms, and subgraphs include the local molecular structure of the molecular graph.

[0080] A molecular graph can be represented by a tuple G = (V, E), where V represents the set of atoms constituting the molecule, E represents the set of chemical bond types between atoms, and the set of atoms V = {v1,…,v n}, which contains a total of n atoms, a set of chemical bond types in Represents the atom v i and atomic v j After determining the set of atoms constituting the molecule, the set of atom types X included in the molecule can be determined as follows: n}.

[0081] Please refer to Figure 3, which shows a schematic diagram of the molecular structure hierarchy provided by an exemplary embodiment of the present application. Among them, the molecular graph 310 is composed of individual atoms 312 and edges 313. The atoms 312 are connected by edges 313. The molecular graph 310 includes at least one subgraph 311, and the subgraph 311 contains the local molecular structure of the molecular graph 310. As shown in Figure 3, each part framed by a dotted line represents a subgraph 311. The subgraph division method shown in Figure 3 is not the only method. Different subgraphs can be obtained by dividing a molecular graph in other ways.

[0082] In some embodiments, to generate new molecules, the computer device obtains an initial graph embedding by sampling according to a standard Gaussian distribution. Initial subgraph embedding As well as the initial atomic embedding, the obtained initial hierarchical embedding obeys a Gaussian distribution.

[0083] In step 202, based on the hierarchical relationships among the molecular graph, subgraphs, and atoms, the initial hierarchical embedding is denoised to obtain a target hierarchical embedding.

[0084] Among them, target-level embedding includes target graph embedding at the molecular graph level, target subgraph embedding at the subgraph level, and target atom embedding at the atomic level.

[0085] In the process of denoising the initial hierarchical embedding, the computer device needs to consider the relationship between atomic embedding, subgraph embedding and molecular graph embedding. By updating the atomic embedding, subgraph embedding and molecular graph embedding, the noise to be removed is predicted, and the predicted noise is removed from the initial hierarchical embedding to obtain the target hierarchical embedding.

[0086] Step 203: Decode the target hierarchical embedding to obtain molecular structure information of the target molecule.

[0087] The molecular structure information includes the atomic types of atoms in the target molecule and the chemical bond types of the chemical bonds between atoms.

[0088] Optionally, during decoding of the target hierarchical embedding, the computer device converts the graph embedding into a series of sub-graph segments using an autoregressive model implemented by a single-layer recurrent neural network, and then predicts connections between these sub-graph segments to construct the target molecule.

[0089] In some embodiments, a computer device decodes the target hierarchical embedding to obtain an n×n×1 target molecular structure matrix to represent the molecular structure information. In the target molecular structure matrix, n represents the number of atoms present, and the data in dimension 1 represents the type of chemical bond between atoms. For example, the possible values ​​of this dimension are 0, 1, and 2. When the value of the chemical bond type between the first atom and the second atom is 0, it indicates that there is no chemical bond between the first atom and the second atom; when the value is 1, it indicates that there is a single bond between the first atom and the second atom; and when the value is 2, it may indicate that there is a double bond between the first atom and the second atom.

[0090] In summary, in the embodiment of the present application, according to the structure of the molecule, the initial graph embedding corresponding to the molecular graph level, the initial subgraph embedding corresponding to the subgraph level and the initial atom embedding corresponding to the atomic level are generated, and according to the hierarchical relationship between the molecular graph, the subgraph and the atomic graph, the initial level embedding is denoised, and finally, the target level embedding is decoded to obtain the target molecular structure information. Among them, according to the hierarchical relationship between the molecular graph, the subgraph and the atomic graph, denoising is performed at different levels of the molecular structure, making full use of the internal hierarchical structure of the molecule, which is conducive to improving the diversity of generated molecules. And making full use of the molecular hierarchical structure for denoising is conducive to increasing the upper limit of the number of molecules that can be generated and generating higher quality molecules. In addition, using subgraph embedding as the processing data of the machine learning model, the local structural information of the molecule can be determined through the subgraph, which is conducive to reducing the storage requirements of the processing process of the machine learning model and reducing the time consuming, thereby facilitating the large-scale generation of molecules.

[0091] In the embodiments of this application, denoising the initial hierarchical embeddings is performed based on the concept of a diffusion model. A diffusion model is a generative model that includes two Markov chains: a forward diffusion process and a reverse denoising process. Denoising the initial hierarchical embeddings is the reverse denoising process.

[0092] In the process of forward diffusion, for data samples z0~q(z0), the process of forward diffusion can be Indicates that, T represents the total time step, t represents the current time step, z represents the data sample, and q(z) represents the function that the data sample obeys.

[0093] In the process of forward diffusion, a series of noise latent variables with gradually increasing noise are generated by gradually adding Gaussian noise to the data samples. 1:T =z1,z2,…,z T The forward diffusion process at time step t can be Indicates. Where N represents Gaussian noise, β t is a hyperparameter used to control the direction of the z t-1 The amount of Gaussian noise added, β t ∈(0,1). Among them, β t Determined by the noise schedule, thus ensuring that the final latent variable z T Close to standard Gaussian noise, that is

[0094] The inverse denoising process at the time step can be achieved by q(z t-1 |z t ) indicates that, since q(z t-1|z t ) is difficult to handle, so it can be transformed by parameterizing the Gaussian θ (z t-1 |z t ) replaces q(z) at each time step t-1 |z t ). Parameterized Gaussian transformation p θ (z t-1 |z t ) and q(z t-1 |z t ) approximate, where Among them, μ θ represents a neural network with learnable parameters θ, σ 2 In the process of reverse denoising, the noise variable z is iterated T:1 Denoising can be performed by Indicates that, p(z T ) is a standard Gaussian distribution.

[0095] In the embodiment of the present application, the process of denoising the initial hierarchical embedding includes N steps of denoising. First, the computer device performs a first step of denoising on the initial hierarchical embedding based on the hierarchical relationship to obtain a first intermediate hierarchical embedding.

[0096] The process of performing the first step of denoising is the denoising process performed by the computer device in the first time step during the reverse diffusion process. The initial subgraph embedding, initial graph embedding and initial atom embedding contained in the initial hierarchical embedding all obey the standard Gaussian distribution.

[0097] The first step of denoising the initial level embedding is that the computer device performs the first step of denoising on the initial graph embedding, the initial subgraph embedding and the initial atom embedding respectively, and the obtained first intermediate level embedding includes the first intermediate graph embedding, the first intermediate subgraph embedding and the first intermediate atom embedding.

[0098] After n steps of denoising processing, the computer device performs the n+1th step of denoising processing on the nth intermediate level embedding based on the hierarchical relationship to obtain the n+1th intermediate level embedding.

[0099] The nth intermediate level embedding is obtained by denoising the n-1th intermediate level embedding. The nth intermediate level embedding includes the nth intermediate graph embedding at the molecular graph level, the nth intermediate subgraph embedding at the subgraph level, and the nth intermediate atom embedding at the atomic level.

[0100] For example, when n is 1, the denoising process has been performed once, and the latent variable obtained is the first intermediate level embedding. The computer device performs the second denoising process on the first intermediate level embedding to obtain the third intermediate level embedding. For another example, when n is 5, the denoising process has been performed five times, and the latent variable obtained is the fifth intermediate level embedding. The computer device performs the sixth level denoising process on the fifth intermediate level embedding to obtain the sixth intermediate level embedding.

[0101] After N-1 denoising processes are performed in sequence, the computer device performs the N-th denoising process on the N-1th intermediate level embedding based on the hierarchical relationship to obtain the target level embedding.

[0102] In the embodiment of the present application, it is assumed that the denoising process includes N steps of denoising. Then, after completing the Nth denoising process, the target hierarchical embedding can be obtained. For example, if N is 5, the target hierarchical embedding can be obtained after performing the denoising process on the initial hierarchical embedding five times.

[0103] In each denoising process, the computer device predicts the noise based on the hierarchical relationship and the intermediate level embedding after denoising in the previous time step, thereby obtaining the predicted noise of different levels in the current time step, and denoises the intermediate level embedding after denoising in the previous time step based on the predicted noise to obtain the intermediate level embedding after denoising in the current time step.

[0104] For example, during the first denoising step, the computer performs noise prediction based on the hierarchical relationship and the initial hierarchical embedding, obtaining first predicted noise at different levels. These first predicted noises include the first molecular graph prediction noise, the first subgraph prediction noise, and the first atom prediction noise. Subsequently, the initial hierarchical embedding is denoised based on the first predicted noises at different levels, obtaining a first intermediate hierarchical embedding.

[0105] For example, during the Nth step of denoising, the computing device performs noise prediction based on the hierarchical relationship and the N-1th intermediate level embedding, obtaining N-th prediction noises at different levels. The N-th prediction noises at different levels include the first molecule graph prediction noise, the first subgraph prediction noise, and the first atom prediction noise. Subsequently, the N-1th intermediate level embedding is denoised based on the N-1th prediction noises at different levels to obtain the N-1th intermediate level embedding.

[0106] For another example, FIG4 shows a schematic diagram of an N-step denoising process provided by an exemplary embodiment of the present application. In this case, the computer device performs noise prediction based on the initial level embedding to obtain first predicted noises at different levels. Subsequently, the initial level embedding is denoised based on the first predicted noise to obtain a first intermediate level embedding. The computer device then performs noise prediction based on the hierarchical relationship and the first intermediate level embedding to obtain second predicted noises at different levels, and denoises the first intermediate level embedding based on the second predicted noise to obtain a second intermediate level embedding. After n steps of denoising, an nth intermediate level embedding is obtained. The computer device performs noise prediction based on the nth intermediate level embedding and the hierarchical relationship to obtain n+1th predicted noises at different levels, and denoises the nth intermediate level embedding based on the n+1th predicted noises at different levels to obtain an n+1th intermediate level embedding. After N-1 steps of denoising, the computer device performs noise prediction based on the N-1th intermediate level embedding and the hierarchical relationship to obtain Nth predicted noises at different levels, and denoises the nth intermediate level embedding based on the Nth predicted noises at different levels to obtain a generated level embedding.

[0107] In one possible embodiment, if the initial level embedding sampled in two molecular generation processes is the same, then the generated level embedding obtained by N-step denoising in the two molecular generation processes is also the same, and the same molecular structure information will be obtained in the end. Therefore, in order to increase the diversity of the generated molecular structure information, the computer device can add additional information to the intermediate level embedding after each denoising step to increase uncertainty. For example, a randomly generated (for example, by sampling) Gaussian noise can be added to the intermediate level embedding, and then the next denoising process is continued according to the intermediate level embedding after adding noise. In this way, even if the same initial level embedding is used, different denoising processes will produce different generated molecular structures.

[0108] For example, the nth intermediate noise corresponding to different levels can be obtained through sampling.

[0109] The computer equipment collects the nth intermediate noise at the atomic level, sub-graph level and molecular graph level respectively, and the nth intermediate noise corresponding to different levels may be the same or different.

[0110] The nth intermediate level embedding is denoised based on the nth intermediate noise to obtain the noisy nth intermediate level embedding. Finally, noise prediction is performed based on the noisy nth intermediate level embedding to obtain the n+1th predicted noise at different levels.

[0111] The computer device performs noise processing on the nth intermediate atom embedding based on the nth intermediate noise at the atomic level to obtain the noisy nth intermediate atom embedding, performs noise processing on the nth intermediate subgraph embedding based on the nth intermediate noise at the subgraph level to obtain the noisy nth intermediate subgraph embedding, and performs noise processing on the nth intermediate graph embedding based on the nth intermediate noise at the molecular graph level to obtain the noisy nth intermediate graph embedding.

[0112] Since the intermediate level embeddings obtained after each denoising step are subjected to noise processing, when the same initial embedding vector is sampled in multiple molecule generation processes, the corresponding generated level embeddings are also different, making the generated molecules diverse.

[0113] The following will use an exemplary embodiment to take the denoising process of step (n+1) as an example to illustrate the specific process of each denoising step.

[0114] Please refer to FIG5 , which shows a flow chart of a denoising process provided by an exemplary embodiment of the present application. The process includes the following steps.

[0115] Step 501 : noise prediction is performed based on the hierarchical relationship and the nth intermediate level embedding to obtain the n+1th predicted noise at different levels.

[0116] The n+1th prediction noise at different levels includes the n+1th molecular graph prediction noise, the n+1th subgraph prediction noise and the n+1th atom prediction noise.

[0117] During each denoising step, because it's difficult to directly predict the denoised hierarchical embedding, the computer first predicts the noise and then removes the prediction noise from the nth intermediate hierarchical embedding. This gradual denoising process improves the denoising effect, resulting in higher-quality generated molecules and increased diversity.

[0118] In one possible implementation, the denoising process is performed by a hierarchical denoising network, which includes a first multi-layer perceptual network, a second multi-layer perceptual network, and at least two hierarchical blocks located between the first multi-layer perceptual network and the second multi-layer perceptual network.

[0119] Please refer to FIG6 , which shows a flowchart of a denoising process performed by a hierarchical denoising network according to an exemplary embodiment of the present application. The process includes the following steps:

[0120] Step 501a: convert the nth intermediate level embedding into the nth intermediate level latent variable through the first multi-layer perception network.

[0121] The nth intermediate level latent variables include the nth intermediate graph latent variables at the molecular graph level, the nth intermediate subgraph latent variables at the subgraph level, and the nth intermediate atomic latent variables at the atomic level.

[0122] In the hierarchical denoising network, the computer device first converts the hierarchical embeddings into their respective corresponding latent space variables through the first multi-layer perception network in the denoising network.

[0123] In some embodiments, there are three multilayer perceptrons (MLPs) in the first multilayer perceptron network, and the three multilayer perceptrons are used to transform the intermediate layer embeddings of different levels respectively, wherein the nth intermediate atom embedding is transformed by the MLP to obtain the nth intermediate atom latent variable The nth intermediate subgraph embedding is transformed through MLP to obtain the nth intermediate subgraph latent variable Transform the nth intermediate graph embedding through MLP to obtain the nth intermediate graph latent variable

[0124] Step 501b: Based on the hierarchical relationship, the nth intermediate level latent variable is updated through the hierarchical block to obtain an updated nth intermediate level latent variable.

[0125] In the process of updating the nth intermediate level latent variable through the hierarchical block, the computer device updates the nth intermediate atomic latent variable, the nth intermediate subgraph latent variable and the nth intermediate graph latent variable based on the hierarchical relationship through the hierarchical block to obtain the updated nth intermediate level latent variable.

[0126] Please refer to Figure 7, which shows a schematic diagram of the structure of a hierarchical block provided by an exemplary embodiment of the present application. The hierarchical block includes a third multilayer perceptron 701, a fourth multilayer perceptron 702, a first attention network 703, a fifth multilayer perceptron 704, and a neighborhood aggregator 705. The third multilayer perceptron 701 is used to update the nth intermediate atomic latent variable, the fourth multilayer perceptron 702 and the first attention network 703 are used to update the nth intermediate subgraph latent variable, and the fifth multilayer perceptron 704 and the neighborhood aggregator 705 are used to update the nth intermediate graph latent variable. Here, X represents the nth intermediate atomic latent variable, M represents the nth intermediate subgraph latent variable, G represents the nth intermediate graph latent variable, X' represents the updated nth intermediate atomic latent variable, M' represents the updated nth intermediate subgraph latent variable, and G' represents the updated nth intermediate graph latent variable.

[0127] The update processes of the nth intermediate atomic latent variable, the nth intermediate subgraph latent variable, and the nth intermediate graph latent variable are described below.

[0128] 1. Based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable, the nth intermediate atomic latent variable is updated to obtain an updated nth intermediate atomic latent variable.

[0129] When updating the nth intermediate atomic latent variable, the relationship between the atomic embedding and the subgraph embedding needs to be considered.

[0130] First, the nth intermediate atomic latent variable is transformed through the third multilayer perceptron to obtain a first transformed latent variable, and the nth intermediate subgraph latent variable is transformed through the third multilayer perceptron to obtain a second transformed latent variable.

[0131] The nth intermediate atomic dependent variable is transformed by the third multilayer perceptron to obtain the first transformed variable: Similarly, the second conversion variable is

[0132] Subsequently, the first transformed latent variable and the second transformed latent variable are fused to obtain the first fused variable. Finally, the first fused variable is transformed by the third multilayer perceptron to obtain the updated nth intermediate atomic latent variable. The final updated nth intermediate atomic dependent variable is

[0133] In some embodiments, different third multilayer perceptrons are used to transform the nth intermediate atomic dependent variable and the nth intermediate subgraph latent variable respectively. During the transformation process, different third multilayer perceptrons have separate parameters, and the parameters between different third multilayer perceptrons are not shared.

[0134] 2. Based on the nth intermediate subgraph latent variable and the nth intermediate atomic latent variable, the nth intermediate subgraph latent variable is updated to obtain the updated nth intermediate subgraph latent variable.

[0135] First, the computer device determines a first attention score based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable through a first attention network. Furthermore, the nth intermediate atomic latent variable is weighted by the first attention score to obtain a weighted nth intermediate atomic latent variable.

[0136] In some embodiments, the computer device calculates a first attention score between the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable using a dot product, and multiplies the first attention score by the nth intermediate atomic latent variable, thereby weighting the nth intermediate atomic latent variable.

[0137] In some embodiments, there are multiple n-th intermediate atomic latent variables and multiple n-th intermediate subgraph latent variables. For the ith intermediate subgraph latent variable, its corresponding first attention score should be the sum of the dot products of the ith intermediate subgraph latent variable and each n-th intermediate atomic latent variable. The first attention score is The weighted nth intermediate atomic latent variable should be Where j represents the number of items of the nth intermediate atomic latent variable.

[0138] Secondly, the computer device transforms the nth intermediate subgraph latent variable through the fourth multilayer perceptron to obtain a third transformed latent variable. The third transformed latent variable obtained by transforming the nth intermediate subgraph latent variable through the fourth multilayer perceptron is

[0139] Subsequently, the computer device fuses the third transformed latent variable with the weighted nth intermediate atomic latent variable to obtain a second fused variable. Finally, the computer device transforms the second fused variable through the fourth multilayer perceptron to obtain an updated nth intermediate subgraph latent variable. The updated nth intermediate subgraph latent variable is

[0140] In some embodiments, different fourth multilayer perceptrons are used to transform the second fusion variable and the nth intermediate subgraph latent variable, with independent parameters in different transformation processes, and the parameters are not shared among different transformations.

[0141] 3. Based on the nth intermediate subgraph latent variable, the nth intermediate atomic latent variable and the nth intermediate graph latent variable, the nth intermediate graph latent variable is updated to obtain an updated nth intermediate graph latent variable.

[0142] First, the computer device transforms the nth intermediate graph latent variable through the fifth multilayer perceptron to obtain the fourth transformed variable. The fourth transformed variable obtained is

[0143] Secondly, the neighborhood aggregator performs neighborhood aggregation on the nth intermediate atomic latent variable to obtain a first aggregated variable. And the neighborhood aggregator performs neighborhood aggregation on the nth intermediate subgraph latent variable to obtain a second aggregated variable.

[0144] In some embodiments, the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable are processed by domain aggregation technology, and the intermediate graph embedding is updated based on neighborhood aggregation. The representation of the atomic level and the subgraph level is obtained by pooling through the neighborhood aggregation technology (Principal Neighborhood Aggregation) to update the intermediate latent variables at the molecular graph level. The first aggregated variable obtained after neighborhood aggregation is The second aggregate variable is

[0145] Subsequently, the computer device fuses the fourth transformed variable, the first aggregated variable, and the second aggregated variable to obtain a third fused variable. Finally, the computer device transforms the third fused variable through the fifth multilayer perceptron to obtain an updated nth intermediate graph latent variable. The final updated nth intermediate graph latent variable is

[0146] In some embodiments, different fifth multilayer perceptrons are used to transform the third fusion variable and the nth intermediate graph latent variable, with independent parameters in different transformation processes, and the parameters are not shared among different transformations.

[0147] Step 501c: Based on the updated latent variables of the nth intermediate layer, the n+1th prediction noise of different layers is predicted through the second multi-layer perception network.

[0148] After obtaining the updated nth intermediate level latent variable, the computer device predicts the molecular graph level noise from the nth intermediate level latent variable through the second multi-layer perception network. Sub-image level noise and atomic-level noise Furthermore, the predicted molecular graph level noise, subgraph level noise, and atom level noise are added as noise residuals to the nth intermediate level embedding, and the predicted molecular graph noise of the molecular graph level (n+1) is obtained as The prediction noise of the n+1th sub-image at the sub-image level is And the prediction noise of the n+1th atom at the atomic level is

[0149] Please refer to Figure 8, which shows a schematic diagram of the structure of a hierarchical denoising network provided by an exemplary embodiment of the present application. It includes a first multi-layer perception network 801, in which there are three different multi-layer perceptrons for converting initial embeddings at different levels. represents atomic embedding, represents subgraph embedding and Represents graph embedding. The output of the nth intermediate first multilayer network is connected to the input of hierarchical block 802. In the hierarchical denoising network, multiple hierarchical blocks are serially connected, which are used to update the intermediate latent variables M times. The output of the Mth hierarchical block is connected to the input of a second multilayer perceptual network 803. The second multilayer perceptual network 803 is used to predict noise and noise residuals at different levels, and the denoising network adds the noise residuals at different levels to the initial hierarchical embedding after noise removal.

[0150] Step 502 , denoising is performed on the nth intermediate level embedding based on the n+1th prediction noises of different levels to obtain the n+1th intermediate level embedding.

[0151] The computer device denoises the nth intermediate atom embedding based on the n+1th atom prediction noise to obtain the n+1th intermediate atom embedding, denoises the nth intermediate sub-graph embedding based on the n+1th sub-graph prediction noise to obtain the n+1th intermediate sub-graph embedding, and denoises the nth intermediate graph embedding based on the n+1th sub-graph prediction noise to obtain the n+1th intermediate graph embedding.

[0152] In some embodiments, the process of denoising the nth intermediate level embedding based on the n+1th prediction noise of different levels can refer to the inverse denoising formula shown in the above diffusion model for denoising.

[0153] In the embodiment of the present application, the target hierarchical embedding is obtained by performing N-step denoising on the initial hierarchical embedding. The denoising is performed based on the hierarchical relationship between the molecular graph, subgraph, and atomic graph. The information interaction between atoms, subgraphs, and the entire graph in the latent space is taken into account. This can effectively capture the relationship between different molecular feature levels, which is conducive to more accurate generation of diverse molecular structures. In addition, determining the local structural information of the molecule through subgraph embedding requires less storage and is less time-consuming than performing the diffusion process on the chemical bond matrix.

[0154] In some possible implementations, the user has a need to generate molecules with specific molecular properties. Therefore, a conditional generation method can be used to input the desired target molecular properties into the denoising network, thereby generating molecular structure information with the target molecular properties.

[0155] The process of generating molecular structure information based on specific molecular properties will be described below through an exemplary embodiment.

[0156] Please refer to FIG9 , which shows a flowchart of a process for generating molecular structure information provided by an exemplary embodiment of the present application. The process includes the following steps:

[0157] Step 901: embed the target molecule attribute into the input hierarchical denoising network, and convert the target molecule attribute embedding into the target attribute latent space variable through the sixth multi-layer perceptron.

[0158] Assume that s = {s1, s2, ...} represents the target molecule attribute embedding, where each dimension represents a specific molecular attribute, such as water solubility and ease of synthesis.

[0159] The computer device processes the target molecule attribute embedding through the sixth multi-layer perceptron to obtain the target attribute latent space variable as MLP(s).

[0160] In step 902, the n+1th target prediction noise at different levels is determined based on the target attribute latent space variables and the n+1th prediction noise at different levels through a second attention network (ie, attribute attention network).

[0161] First, the computer device determines the second attention scores of the target attribute latent space variables and the n+1th prediction noise at different levels through the second attention network.

[0162] Among them, the second attention score is used to characterize the correlation between the n+1th prediction noise and the latent space variable of the target attribute.

[0163] When the computer device obtains the molecular attribute embedding, it processes the nth intermediate atom embedding, the nth intermediate subgraph embedding, the nth intermediate graph embedding and the target molecular attribute embedding through MLP, and can obtain queries at different levels respectively. as well as And the key K=MLP(s) and the value V=MLP(s) can be determined.

[0164] In the process of updating the embedding using the cross attention mechanism, the second attention score is first determined by the dot product between the query and the key at different levels, and the attention score is normalized by the softmax function. The second attention score at the atomic level can be obtained as The second attention score at the sub-graph level is The second attention score at the molecular graph level is where d k Indicates the dimension of the key.

[0165] Subsequently, the target attribute latent space variables are weighted based on the second attention scores at different levels to obtain the n+1th target prediction noise at different levels.

[0166] After obtaining the second attention score, the computer device performs a weighted calculation on the value V = MLP(s) according to the attention score, thereby obtaining the updated intermediate level dependent variable. The updated atomic level latent variable is The latent variables at the subgraph level are The latent variables at the graph level are The updated intermediate-level latent variables contain information about the properties of the target molecules, which is helpful in guiding the molecular generation towards the direction of generating target molecules with characteristic molecular properties.

[0167] Please refer to Figure 10, which shows a schematic diagram of the structure of a hierarchical denoising network provided by another exemplary embodiment of the present application. It includes a first multi-layer perceptron 1001, a second multi-layer perceptron 1002, M hierarchical blocks 1003, a sixth multi-layer perceptron 1004, and a second attention network 1005. The first multi-layer perceptron 1001 is used to convert the nth intermediate level embedding into the nth intermediate level latent variable, where: represents atomic embedding, represents subgraph embedding and Represents graph embedding. The hierarchical block 1003 is used to update the nth intermediate level latent variables, and the second multilayer perceptron 1002 is used to determine the n+1th prediction noise at different levels. The sixth multilayer perceptron 1004 is used to convert the target molecular attribute embedding into the target attribute latent space variable, and the second attention network 1005 is used to determine the n+1th target prediction noise at different levels based on the target attribute latent space variable and the n+1th prediction noise at different levels. as well as

[0168] Step 903 , denoising the nth intermediate level embedding based on the n+1th target prediction noise at different levels to obtain the n+1th intermediate level embedding.

[0169] The process of denoising the nth intermediate level embedding based on the n+1th target prediction noise at different levels can refer to the process of denoising the nth intermediate level embedding based on the n+1th prediction noise at different levels in the above embodiment, and this application will not go into details again.

[0170] Step 904 : Decode the target hierarchical embedding to obtain molecular structure information of the target molecule. The target molecule has target molecule properties.

[0171] The specific implementation process of this step can refer to the above step 203, and will not be described in detail in this embodiment.

[0172] In the embodiments of the present application, through the conditional generation mechanism, the intermediate level embedding is denoised based on the target molecule attribute embedding through the denoising network, and the target molecule attribute is combined with the hierarchical embedding to generate molecules that meet the feature requirements. Both have high flexibility and can flexibly control the generated molecular attributes and molecular structures.

[0173] In a possible implementation, after obtaining the target hierarchical embedding, the target hierarchical embedding is decoded by a decoding network to obtain molecular structure information of the target molecule.

[0174] During the decoding process, the target graph embedding features, target subgraph embedding features, and target atom embedding features are first decoded through the decoding network, and the hierarchical embedding is converted into a series of subgraph segments, which include atoms and chemical bonds. Finally, the decoding network uses link prediction to predict the connections between the subgraph segments, thereby obtaining molecular structure information.

[0175] In some embodiments, the decoding process can be implemented using a PS-VAE (Principal Subgraph-Variational Auto-Encoder) model. The decoding network uses an autoregressive model implemented as a single-layer recurrent neural network to convert the graph embedding into a series of subgraph segments.

[0176] Schematically, please refer to FIG11, which shows a schematic diagram of the structure of a molecular generation model provided by an exemplary embodiment of the present application, including a hierarchical denoising network 1101 and a decoder 1102. The computer device embeds the initial hierarchical embedding (including the initial atomic embedding Initial subgraph embedding and the initial molecular graph embedding ) is input into the denoising network, and the hierarchical denoising network 1101 performs denoising based on the hierarchical relationship to obtain the target hierarchical embedding (including the target atomic embedding Target subgraph embedding and target graph embedding ), the target hierarchy is embedded into the input decoding network 1102 to obtain the target molecular structure information, including the atomic type X' of the atoms in the target molecule and the chemical bond type E' of the chemical bonds between atoms.

[0177] Before generating the molecular structure information of the target molecule based on the initial hierarchical embedding using the above method, the hierarchical denoising network and the decoding network need to be trained.

[0178] During the training process, it is necessary to train based on the sample molecular structure information provided by the user, so that the decoding network can learn the ability to generate the molecular structure information of the target molecule based on the target hierarchical embedding, and enable the hierarchical denoising network to better utilize the characteristics of the molecular hierarchical structure and perform reverse diffusion operations at different levels of the molecule.

[0179] Schematically, Figure 12 shows a schematic diagram of the structure of the molecular generation model during the training process provided by an exemplary embodiment of the present application. It includes an encoding network 1201, a hierarchical denoising network 1202 and a denoising network 1203. During the application process, the decoding network 1203 is used to decode the target hierarchical embedding to obtain the molecular structure information of the target molecule, and the hierarchical denoising network 1202 is used to denoise the initial hierarchical embedding. During the training process, the encoding network 1201 is used to encode the sample molecular structure information to obtain the sample hierarchical embedding. The sample structure information belongs to the molecular graph space, and the sample hierarchical embedding belongs to the latent space. The decoding network 1203 is used to decode the sample hierarchical embedding to obtain the estimated molecular structure information of the molecular graph space, and the hierarchical denoising network 1202 is used to denoise the sample noisy hierarchical embedding.

[0180] Based on the molecular generation model shown in FIG12 , in one possible implementation, the molecular generation model needs to be trained in two stages. The training process of the two stages is described below.

[0181] In the first stage, the computer device trains the encoding network and the decoding network based on the first sample molecular structure information of the first sample molecule.

[0182] First, the computer device inputs the molecular structure information of the first sample into the encoding network to obtain the first sample hierarchical embedding output by the encoding network.

[0183] The first sample level embedding includes the first sample graph embedding at the molecular graph level, the first sample subgraph embedding at the subgraph level, and the first sample atom embedding at the atom level. The first sample molecular structure information includes the atom type X and the chemical bond type E.

[0184] The encoding network can be φ Indicates that the encoding formula of the encoding network can be Where φ is the trainable parameter z of the encoder X represents the first sample atom embedding, z M represents the first sample subgraph embedding, z G represents the first sample graph embedding.

[0185] Secondly, the first sample level embedding is decoded through the decoding network to obtain the estimated molecular structure information of the sample predicted molecule.

[0186] The decoding network can be Indicates that the decoding formula of the encoding network can be Here, ψ is a trainable parameter of the decoder.

[0187] In some embodiments, the encoder and decoder in PS-VAE are used as the encoding network and decoding network, respectively.

[0188] Then, the estimated loss of the decoding network is determined.

[0189] In some embodiments, a first reconstruction loss is determined based on the difference between the estimated molecular structure information and the first sample molecular structure information. Furthermore, a divergence loss is determined based on the difference between the first sample hierarchical embedding and a standard Gaussian distribution. Ultimately, the sum of the first reconstruction loss and the divergence loss is determined as the total estimated loss.

[0190] Since the atom type X and the chemical bond type E are both discrete features, the cross entropy loss can be used as the reconstruction loss, then the reconstruction loss Furthermore, the divergence loss is used for training so that the latent space embedding is oriented towards the standard Gaussian distribution p(z X ,z M ,z G ) alignment, divergence loss The total estimated loss can be determined as:

[0191] Here, γ is a hyperparameter that controls the weight of the Kullback-Leibler divergence (KL) loss. The divergence loss and the estimation loss are used as the total estimation loss to balance the reconstruction error and KL divergence between the prior and posterior distributions of each layer of embedding.

[0192] Finally, the encoding network and the decoding network are trained based on the total estimated loss.

[0193] The process of training the encoding network and decoding network based on the total estimated loss is to continuously optimize the encoding network and decoding network so that the trainable parameters φ and ψ converge.

[0194] In the second stage, when the encoding network and the decoding network have completed training, the hierarchical denoising network and the encoding network are trained based on the second sample molecular structure information of the second sample molecule.

[0195] In the second phase of training, the trained encoding and decoding networks are combined with the untrained hierarchical denoising network to form a molecular generative model, using the second sample's molecular structure information as the sample. The hierarchical denoising network is trained by determining the loss from the noise addition process and the noise deviation estimated by the denoising network. To increase the optimization ceiling of the denoising network, the encoding network is also optimized during the second phase of training.

[0196] First, the computer device inputs the molecular structure information of the second sample into the encoding network to obtain the second sample hierarchical embedding output by the encoding network.

[0197] The second sample-level embedding includes a second sample graph embedding at a molecular graph level, a second sample subgraph embedding at a subgraph level, and a second sample atom embedding at an atom level.

[0198] The process of encoding the second sample structure information through the encoding network can refer to the process of encoding the first sample structure information through the encoding network in the first stage, which is not described in detail in this embodiment.

[0199] Secondly, the computer device samples sample noise at different levels, and performs noise processing on the second sample hierarchical embedding based on the sample noise at different levels to obtain the second sample noisy hierarchical embedding.

[0200] The second sample noisy hierarchical embedding includes a second sample noisy graph embedding at a molecular graph level, a second sample noisy subgraph embedding at a subgraph level, and a second sample noisy atom embedding at an atom level.

[0201] The process of performing noise addition processing on the second sample level embedding may refer to the forward diffusion process of the diffusion model in the above embodiment, which will not be described in detail in this embodiment.

[0202] Subsequently, based on the noisy hierarchical embedding of the second sample, noise prediction is performed through the hierarchical denoising network to obtain predicted noise at different levels. The noise prediction loss is determined based on the difference between the predicted noise at different levels and the sample noise.

[0203] In the denoising process, the computer device iterates the time step T to complete the T-step reverse diffusion process. After the denoising network iteration is completed, the predicted noise can be obtained as

[0204] In some embodiments, the expected square error between the prediction noise and the sample noise may be determined as the noise estimation loss, and the noise estimation loss is:

[0205] Among them, w(t) is the weighted term.

[0206] Finally, the hierarchical denoising network and encoding network are trained based on the noise prediction loss.

[0207] The process of training the denoising network and the encoding network is the process of optimizing the denoising network and the encoding network so that the noise estimation loss converges.

[0208] In one possible embodiment, if the trained molecular generation model is to be able to generate molecular structure information with the desired molecular properties, it is also necessary to input the sample molecular properties into the hierarchical denoising network during the training process, so that the computer device trains the hierarchical denoising network and the encoding network based on the second molecular structure information of the second sample molecule and the sample molecular properties.

[0209] In some embodiments, in the process of training a hierarchical denoising network based on the second sample structure information of the second sample molecule, the second sample molecular structure information is first input into the encoding network to obtain a second sample hierarchical embedding output by the encoding network. The second sample noisy hierarchical embedding includes a second sample noisy graph embedding at the molecular graph level, a second sample noisy subgraph embedding at the subgraph level, and a second sample noisy atom embedding at the atomic level. Subsequently, based on the second sample noisy hierarchical embedding and the sample molecular attribute embedding s corresponding to the sample molecular attribute, noise prediction is performed through the hierarchical denoising network to obtain prediction noise at different levels. And based on the difference between the prediction noise and the sample noise at different levels, the noise prediction loss is determined, and the hierarchical denoising network and the encoding network are trained based on the noise prediction loss. The noise prediction loss in the training process is:

[0210] In the embodiments of the present application, by training the hierarchical denoising network and the encoding and decoding network, the trained hierarchical denoising network and the decoding network can better utilize the characteristics of the internal hierarchical structure of molecules during the molecule generation process, thereby generating more diverse and higher-quality molecules. Furthermore, by embedding parallel computing at the graph level, subgraph level, and atomic level, it is possible to process large-scale molecule generation tasks in a relatively short time, with efficient computing power, which is conducive to handling more complex molecular systems and larger-scale molecule generation tasks.

[0211] FIG13 shows a structural block diagram of a molecule generation device provided by an exemplary embodiment of the present application. As shown in FIG13 , the device includes the following modules.

[0212] Initial sampling module 1301 is used to generate an initial hierarchical embedding, for example, by sampling. The initial hierarchical embedding includes an initial graph embedding at the molecular graph level, an initial subgraph embedding at the subgraph level, and an initial atom embedding at the atom level. A molecular graph is composed of nodes and edges, wherein the nodes represent atoms, the edges represent chemical bonds connecting atoms, and the subgraphs include the local molecular structure of the molecular graph.

[0213] The denoising module 1302 is used to denoise the initial hierarchical embedding based on the hierarchical relationship between the molecular graph, subgraph and atoms to obtain a target hierarchical embedding, wherein the target hierarchical embedding includes a target graph embedding at the molecular graph level, a target subgraph embedding at the subgraph level and a target atom embedding at the atomic level.

[0214] The decoding module 1303 is configured to decode the target hierarchical embedding to obtain molecular structure information of the target molecule, where the molecular structure information includes atomic types of atoms in the target molecule and chemical bond types of chemical bonds between atoms.

[0215] In some embodiments, the denoising process includes N-step denoising, where N is a positive integer;

[0216] The denoising module 1302 is configured to:

[0217] Performing a first step of denoising on the initial hierarchical embedding based on the hierarchical relationship to obtain a first intermediate hierarchical embedding;

[0218] Performing an n+1th denoising process on the nth intermediate level embedding based on the hierarchical relationship to obtain an n+1th intermediate level embedding, wherein the nth intermediate level embedding includes the nth intermediate graph embedding at the molecular graph level, the nth intermediate subgraph embedding at the subgraph level, and the nth intermediate atom embedding at the atomic level;

[0219] Performing an N-th step of denoising on the N-1th intermediate level embedding based on the hierarchical relationship to obtain the generated level embedding.

[0220] In some embodiments, the denoising module 1302 is configured to:

[0221] performing noise prediction based on the hierarchical relationship and the nth intermediate level embedding to obtain n+1th prediction noises at different levels, wherein the n+1th prediction noises at different levels include n+1th molecular graph prediction noise, n+1th subgraph prediction noise, and n+1th atom prediction noise;

[0222] The nth intermediate level embedding is denoised based on the n+1th prediction noises of different levels to obtain the n+1th intermediate level embedding.

[0223] In some embodiments, the denoising process is performed by a hierarchical denoising network, the hierarchical denoising network comprising a first multi-layer perceptual network, a second multi-layer perceptual network, and at least two hierarchical blocks located between the first multi-layer perceptual network and the second multi-layer perceptual network;

[0224] The denoising module 1302 is configured to:

[0225] Converting the nth intermediate-level embedding into an nth intermediate-level latent variable through the first multi-layer perceptron network, wherein the nth intermediate-level latent variable includes an nth intermediate graph latent variable at a molecular graph level, an nth intermediate subgraph latent variable at a subgraph level, and an nth intermediate atomic latent variable at an atomic level;

[0226] Based on the hierarchical relationship, updating the nth intermediate level latent variable through the hierarchical block to obtain an updated nth intermediate level latent variable;

[0227] Based on the updated nth intermediate level latent variable, the n+1th prediction noise of different levels is predicted through the second multi-layer perception network.

[0228] In some embodiments, the denoising module 1302 is configured to:

[0229] Based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable, the nth intermediate atomic latent variable is updated to obtain the updated nth intermediate atomic latent variable;

[0230] Based on the nth intermediate subgraph latent variable and the nth intermediate atomic latent variable, the nth intermediate subgraph latent variable is updated to obtain the updated nth intermediate subgraph latent variable;

[0231] Based on the nth intermediate subgraph latent variable, the nth intermediate atomic latent variable and the nth intermediate graph latent variable, the nth intermediate graph latent variable is updated to obtain the updated nth intermediate graph latent variable.

[0232] In some embodiments, the hierarchical block comprises a third multilayer perceptron;

[0233] The denoising module 1302 is configured to:

[0234] Converting the nth intermediate atomic latent variable through the third multilayer perceptron to obtain a first converted latent variable, and converting the nth intermediate subgraph latent variable through the third multilayer perceptron to obtain a second converted latent variable;

[0235] fusing the first conversion latent variable and the second conversion latent variable to obtain a first fused variable;

[0236] The first fusion variable is transformed by the third multilayer perceptron to obtain the updated nth intermediate atomic latent variable.

[0237] In some embodiments, the hierarchical block includes a fourth multilayer perceptron and a first attention network;

[0238] The denoising module 1302 is configured to:

[0239] Determining a first attention score based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable by the first attention network;

[0240] Weighting the nth intermediate atomic latent variable by the first attention score to obtain the weighted nth intermediate atomic latent variable;

[0241] Transforming the nth intermediate subgraph latent variable through the fourth multilayer perceptron to obtain a third transformed latent variable;

[0242] fusing the third conversion latent variable with the weighted nth intermediate atomic latent variable to obtain a second fused variable;

[0243] The second fusion variable is transformed by the fourth multi-layer perceptron to obtain the updated n-th intermediate subgraph latent variable.

[0244] In some embodiments, the hierarchical block includes a fifth multilayer perceptron and a neighborhood aggregator;

[0245] The denoising module 1302 is configured to:

[0246] Transforming the nth intermediate graph latent variable through the fifth multilayer perceptron to obtain a fourth transformed variable;

[0247] Performing neighborhood aggregation processing on the nth intermediate atomic latent variable by the neighborhood aggregator to obtain a first aggregated variable;

[0248] Performing neighborhood aggregation processing on the nth intermediate subgraph latent variable by the neighborhood aggregator to obtain a second aggregated variable;

[0249] fusing the fourth transformed variable, the first aggregated variable, and the second aggregated variable to obtain a third fused variable;

[0250] The third fusion variable is transformed by the fifth multilayer perceptron to obtain the updated nth intermediate graph latent variable.

[0251] In some embodiments, the hierarchical denoising network further includes a sixth multilayer perceptron and a second attention network;

[0252] The denoising module 1302 is further configured to:

[0253] Embedding the target molecule attribute into the hierarchical denoising network, and converting the target molecule attribute embedding into a target attribute latent space variable through the sixth multi-layer perceptron;

[0254] Determining, by the second attention network, the n+1th target prediction noise at different levels based on the target attribute latent space variable and the n+1th prediction noise at different levels;

[0255] The nth intermediate level embedding is denoised based on the n+1th target prediction noise at different levels to obtain the n+1th intermediate level embedding.

[0256] In some embodiments, the denoising module 1302 is configured to:

[0257] Determining, by the second attention network, a second attention score between the target attribute latent space variable and the n+1th prediction noise at different levels, wherein the second attention score is used to characterize the correlation between the n+1th prediction noise and the target attribute latent space variable;

[0258] The target attribute latent space variables are weighted based on the second attention scores at different levels to obtain the n+1th target prediction noise at different levels.

[0259] In some embodiments, the apparatus further comprises:

[0260] Noise adding module, used to sample the nth intermediate noise corresponding to different levels;

[0261] The noise adding module is further configured to perform noise adding processing on the nth intermediate level embedding based on the nth intermediate noise to obtain a noisy nth intermediate level embedding;

[0262] The denoising module 1302 is used to:

[0263] Noise prediction is performed based on the nth intermediate level embedding after noise addition to obtain the n+1th predicted noise at different levels.

[0264] In some embodiments, the apparatus further comprises:

[0265] A first training module is configured to train an encoding network and a decoding network based on the first sample molecular structure information of the first sample molecule, wherein the encoding network is configured to encode the sample molecular structure information to obtain a sample-level embedding, and the decoding network is configured to decode the target-level embedding to obtain the molecular structure information of the target molecule;

[0266] A second training module is used to train a hierarchical denoising network and the encoding network based on the second sample molecular structure information of the second sample molecule when the encoding network and the decoding network have completed training, and the hierarchical denoising network is used to denoise the initial hierarchical embedding.

[0267] In some embodiments, the first training module is used to:

[0268] Inputting the first sample molecular structure information into the encoding network to obtain a first sample level embedding output by the encoding network, wherein the first sample level embedding includes a first sample graph embedding at a molecular graph level, a first sample subgraph embedding at a subgraph level, and a first sample atom embedding at an atom level;

[0269] Decoding the first sample hierarchical embedding by the decoding network to obtain estimated molecular structure information of the sample estimated molecule;

[0270] determining a first reconstruction loss based on a difference between the estimated molecular structure information and the first sample molecular structure information;

[0271] determining a divergence loss based on a difference between the first sample level embedding and a standard Gaussian distribution;

[0272] Determine the sum of the first reconstruction loss and the divergence loss as a total estimated loss;

[0273] The encoding network and the decoding network are trained based on the total estimated loss.

[0274] In some embodiments, the second training module is used to:

[0275] Inputting the second sample molecular structure information into the encoding network to obtain a second sample-level embedding output by the encoding network, wherein the second sample-level embedding includes a second sample graph embedding at a molecular graph level, a second sample subgraph embedding at a subgraph level, and a second sample atom embedding at an atom level;

[0276] Sampling noise at different levels;

[0277] performing noise processing on the second sample hierarchical embedding based on the sample noise at different levels to obtain a second sample noisy hierarchical embedding, wherein the second sample noisy hierarchical embedding includes a second sample noisy graph embedding at a molecular graph level, a second sample noisy subgraph embedding at a subgraph level, and a second sample noisy atom embedding at an atom level;

[0278] Based on the noisy hierarchical embedding of the second sample, noise prediction is performed through the hierarchical denoising network to obtain predicted noise at different levels;

[0279] determining a noise prediction loss based on differences between the prediction noise and the sample noise at different levels;

[0280] The hierarchical denoising network and the encoding network are trained based on the noise prediction loss.

[0281] In some embodiments, the second training module is used to train the hierarchical denoising network and the encoding network based on second molecular structure information of second sample molecules and sample molecule properties.

[0282] In summary, in the embodiment of the present application, according to the structure of the molecule, the sampling initial graph embedding corresponding to the molecular graph level, the initial subgraph embedding corresponding to the subgraph level, and the initial atom embedding corresponding to the atomic level are sampled, and according to the hierarchical relationship between the molecular graph, the subgraph and the atomic graph, the initial level embedding is denoised, and finally, the generated level embedding is decoded to obtain the generated molecular structure information. Among them, according to the hierarchical relationship between the molecular graph, the subgraph and the atomic graph, denoising is performed at different levels of the molecular structure, making full use of the internal hierarchical structure of the molecule, which is conducive to improving the diversity of the generated molecules. And making full use of the molecular hierarchical structure for denoising is conducive to increasing the number of generated molecules and generating higher quality generated molecules. In addition, the use of subgraph embedding for diffusion can determine the local structural information of the molecule through the subgraph, which is conducive to reducing the storage requirements of the diffusion process and reducing the time consuming, thereby facilitating the large-scale generation of molecules.

[0283] It should be noted that the apparatus provided in the above embodiments is merely exemplified by the division of the above functional modules. In actual applications, the above functions can be distributed among different functional modules as needed, that is, the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments are based on the same concept. The implementation process is detailed in the method embodiments and will not be repeated here.

[0284] FIG14 shows a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application. The computer device can be a terminal or a server. Specifically, the computer device 1400 includes a central processing unit (CPU) 1401, a system memory 1404 including a random access memory 1402 and a read-only memory 1403, and a system bus 1405 connecting the system memory 1404 and the central processing unit 1401. The computer device 1400 also includes a basic input / output system (I / O system) 1406 that helps transmit information between various components within the computer, and a mass storage device 1407 for storing an operating system 1413, application programs 1414, and other program modules 1415.

[0285] In some embodiments, the basic input / output system 1406 includes a display 1408 for displaying information and an input device 1409, such as a mouse or keyboard, for user input. Both the display 1408 and the input device 1409 are connected to the central processing unit 1401 via an input / output controller 1410 connected to the system bus 1405. The basic input / output system 1406 may also include an input / output controller 1410 for receiving and processing input from a variety of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1410 also provides output to a display screen, printer, or other types of output devices.

[0286] The mass storage device 1407 is connected to the central processing unit 1401 via a mass storage controller (not shown) connected to the system bus 1405. The mass storage device 1407 and its associated computer-readable media provide non-volatile storage for the computer device 1400. In other words, the mass storage device 1407 may include a computer-readable medium (not shown) such as a hard disk or drive.

[0287] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include random access memory (RAM), read-only memory (ROM), flash memory or other solid-state storage technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media are not limited to the above-mentioned ones. The above-mentioned system memory 1404 and mass storage device 1407 can be collectively referred to as memory.

[0288] The memory stores one or more program segments, which are configured to be executed by one or more central processing units 1401. The one or more program segments contain instructions for implementing the above-mentioned method. The central processing unit 1401 executes the one or more program segments to implement the methods provided by the above-mentioned various method embodiments.

[0289] According to various embodiments of the present application, the computer device 1400 may also be connected to a remote computer on a network such as the Internet for operation. That is, the computer device 1400 may be connected to a network 1412 via a network interface unit 1411 connected to the system bus 1405, or the network interface unit 1411 may be used to connect to other types of networks or remote computer systems (not shown).

[0290] An embodiment of the present application further provides a computer-readable storage medium, in which at least one program is stored. The at least one program is loaded and executed by a processor to implement the molecule generation method described in any of the above embodiments.

[0291] The present application provides a computer program product or computer program, which includes at least one program segment stored in a computer-readable storage medium. A processor of a computer device reads the at least one program segment from the computer-readable storage medium and executes the at least one program segment, causing the computer device to perform the molecule generation method provided in the above aspects.

[0292] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, which can be the computer-readable storage medium contained in the memory in the above embodiments; or it can be a computer-readable storage medium that exists independently and is not installed in the terminal.

[0293] Optionally, the computer-readable storage medium may include: ROM, RAM, solid-state drives (SSDs), or optical disks. Among them, RAM may include resistance random access memory (ReRAM) and dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are for descriptive purposes only and do not represent the advantages or disadvantages of the embodiments.

[0294] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.

[0295] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. And the "first", "second", etc. mentioned in this article are used to distinguish similar objects, and are not used to limit a specific order or sequence. In addition, the step numbers described in this article only exemplify a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application do not limit this.

[0296] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0297] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A method for generating a molecule, performed by an electronic device, the method comprising: Generate random initial hierarchical embeddings, including initial molecular graph embeddings representing molecular graphs, initial subgraph embeddings representing subgraphs, and initial atom embeddings representing atoms, where a molecular graph is composed of nodes and edges, the nodes representing atoms, the edges representing chemical bonds connecting atoms, and the subgraphs representing local molecular structures of the molecular graph; Using a trained machine learning model and the learned relationships among the molecular graph, subgraph, and atoms, the trained machine learning model is used to predict and remove noise from the initial molecular graph embedding, the initial subgraph embedding, and the initial atom embedding, thereby obtaining a generated molecular graph embedding, a generated subgraph embedding, and a generated atom embedding that generate a hierarchical embedding; The generated hierarchical embedding is decoded into molecular structure information of the generated molecule, where the molecular structure information includes atomic types of atoms in the generated molecule and chemical bond types of chemical bonds between atoms.

2. The method according to claim 1, wherein The predicting and removing noise from the embedding of the initial molecular graph, the embedding of the initial subgraph, and the embedding of the initial atom comprises: Noise in the embedding of the initial molecular graph, the embedding of the initial subgraph, or the embedding of the initial atom is predicted using at least two embeddings of the embedding of the initial molecular graph, the embedding of the initial subgraph, and the embedding of the initial atom.

3. The method according to claim 1, wherein Generating a random initial hierarchical embedding includes one of the following: The initial graph embedding, the initial subgraph embedding, and the initial atom embedding are respectively sampled from a set of preset candidate molecular graph embeddings, a set of candidate subgraph embeddings, and a set of candidate atom embeddings, wherein the initial graph embedding, the initial subgraph embedding, and the initial atom embedding obey a Gaussian distribution; Sampling values ​​of the at least two parameters are obtained from a preset parameter value set corresponding to each of the at least two parameters, initial molecular structure information is generated based on the sampling values ​​of the at least two parameters, and the initial molecular structure information is converted into the initial graph embedding, the initial subgraph embedding, and the initial atomic embedding, wherein the at least two parameters obey a Gaussian distribution.

4. The method according to any one of claims 1 to 3, wherein The predicting and removing noise from the embedding of the initial molecular graph, the embedding of the initial subgraph, and the embedding of the initial atom comprises: Obtaining a first intermediate level embedding by predicting and removing noise from the embedding of the initial molecular graph, the embedding of the initial subgraph, and the embedding of the initial atom; Obtaining an n+1th intermediate level embedding by predicting and removing an n+1th noise in an nth intermediate level embedding, wherein the nth intermediate level embedding includes an nth intermediate molecule graph embedding, an nth intermediate subgraph embedding, and an nth intermediate atom embedding; Obtaining the generated level embedding by predicting and removing the Nth noise in the N-1th intermediate level embedding; Wherein, N is the total number of preset denoising operations, and n is a positive integer greater than 0 and less than N.

5. The method according to claim 4, wherein The machine learning model includes a hierarchical denoising network, wherein the hierarchical denoising network includes a first multi-layer perceptual network, a second multi-layer perceptual network, and a hierarchical block located between the first multi-layer perceptual network and the second multi-layer perceptual network; The predicting and removing the (n+1)th noise in the (n)th intermediate level embedding includes: Converting the nth intermediate level embedding into nth intermediate level latent variables through the first multi-layer perceptron network, wherein the nth intermediate level latent variables include nth intermediate molecular graph latent variables, nth intermediate subgraph latent variables, and nth intermediate atomic latent variables; updating the nth intermediate level latent variable according to the relationship among the nth intermediate molecular graph latent variable, the nth intermediate subgraph latent variable, and the nth intermediate atomic latent variable through the hierarchical block to obtain an updated nth intermediate level latent variable; Based on the updated nth intermediate level latent variable, the n+1th noise is predicted through the second multi-layer perception network.

6. The method according to claim 5, wherein: The hierarchical denoising network also includes a sixth multilayer perceptron and an attribute attention network; The step of obtaining the n+1th intermediate level embedding by predicting and removing the n+1th noise in the nth intermediate level embedding includes: Removing the (n+1)th noise from the nth intermediate level embedding to obtain a denoised nth intermediate level embedding; Converting the set target molecular attribute embedding into a target attribute latent space variable through the sixth multilayer perceptron; The denoised nth intermediate level embedding is updated based on the target attribute latent space variable through the attribute attention network to obtain the n+1th intermediate level embedding.

7. The method according to claim 5 or 6, wherein: The hierarchical block comprises at least two hierarchical blocks connected in series, The updating of the nth intermediate level latent variable by the hierarchical block to obtain the updated nth intermediate level latent variable includes: Using a first hierarchical block of at least two hierarchical blocks to update the nth intermediate atomic latent variable based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable output by the first multilayer perceptron network; updating the nth intermediate subgraph latent variable based on the nth intermediate subgraph latent variable and the nth intermediate atomic latent variable; updating the nth intermediate molecular graph latent variable based on the nth intermediate subgraph latent variable, the nth intermediate atomic latent variable and the nth intermediate molecular graph latent variable; Using the (m+1)th level block of the at least two level blocks, based on the (n)th intermediate atomic latent variables and the (n)th intermediate subgraph latent variables updated by the (m)th level block, to update the (n)th intermediate atomic latent variables updated by the (m)th level block; based on the (n)th intermediate subgraph latent variables and the (n)th intermediate atomic latent variables updated by the (m)th level block, to update the (n)th intermediate subgraph latent variables updated by the (m)th level block; based on the (n)th intermediate subgraph latent variables, the (n)th intermediate atomic latent variables and the (n)th intermediate molecular graph latent variables updated by the (m)th level block, to update the (n)th intermediate molecular graph latent variables updated by the (m)th level block; After the Mth hierarchical block of the at least two hierarchical blocks updates the nth intermediate atomic latent variable, the nth intermediate subgraph latent variable, and the nth intermediate molecular graph latent variable, the updated nth intermediate atomic latent variable, the nth intermediate subgraph latent variable, and the nth intermediate molecular graph latent variable are output to the second multi-layer perception network; Wherein, M is the total number of the at least two hierarchical blocks, and m is an integer greater than 0 and less than M.

8. The method according to claim 7, wherein: The m+1th hierarchical block comprises a third multilayer perceptron; The updating of the nth intermediate atomic latent variable updated by the mth hierarchical block based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable updated by the mth hierarchical block using the m+1th hierarchical block of the at least two hierarchical blocks includes: Converting the nth intermediate atomic latent variable after being updated by the mth hierarchical block through the third multilayer perceptron to obtain a first converted latent variable, and converting the nth intermediate subgraph latent variable after being updated by the mth hierarchical block through the third multilayer perceptron to obtain a second converted latent variable; fusing the first conversion latent variable and the second conversion latent variable to obtain a first fused variable; The first fusion variable is transformed by the third multilayer perceptron to obtain the nth intermediate atomic latent variable after being updated by the m+1th hierarchical block.

9. The method according to claim 7, wherein: The m+1th hierarchical block includes a fourth multilayer perceptron and an attention network; The updating of the nth intermediate subgraph latent variable updated by the mth hierarchical block based on the nth intermediate subgraph latent variable and the nth intermediate atomic latent variable updated by the mth hierarchical block using the m+1th hierarchical block of the at least two hierarchical blocks includes: Determining a first attention score based on the nth intermediate atomic latent variable and the nth intermediate subgraph latent variable updated by the mth hierarchical block by the attention network; Weighting the nth intermediate atomic latent variable after being updated by the mth hierarchical block by the first attention score to obtain the weighted nth intermediate atomic latent variable; Transforming the nth intermediate subgraph latent variable after being updated by the mth hierarchical block through the fourth multilayer perceptron to obtain a third transformed latent variable; fusing the third conversion latent variable with the weighted nth intermediate atomic latent variable to obtain a second fused variable; The second fusion variable is transformed by the fourth multilayer perceptron to obtain the nth intermediate subgraph latent variable after being updated by the m+1th hierarchical block.

10. The method according to claim 7, wherein: The m+1th hierarchical block includes a fifth multilayer perceptron and a neighborhood aggregator; The updating of the nth intermediate molecular graph latent variable by using the (m+1)th hierarchical block of the at least two hierarchical blocks based on the nth intermediate subgraph latent variable, the nth intermediate atomic latent variable, and the nth intermediate molecular graph latent variable updated by the (m)th hierarchical block comprises: Transforming the nth intermediate molecular graph latent variable after being updated by the mth hierarchical block through the fifth multilayer perceptron to obtain a fourth transformed variable; Performing neighborhood aggregation processing on the nth intermediate atomic latent variable after being updated by the mth hierarchical block by the neighborhood aggregator to obtain a first aggregated variable; Performing neighborhood aggregation processing on the nth intermediate subgraph latent variable after being updated by the mth hierarchical block by the neighborhood aggregator to obtain a second aggregated variable; fusing the fourth transformed variable, the first aggregated variable, and the second aggregated variable to obtain a third fused variable; The third fusion variable is transformed by the fifth multilayer perceptron to obtain the nth intermediate molecular graph latent variable after being updated by the m+1th hierarchical block.

11. The method according to claim 6, wherein: Obtaining the n+1th intermediate level embedding includes: Determining, by the attribute attention network, a second attention score between the target attribute latent space variable and each element in the denoised nth intermediate level embedding, the second attention score being used to characterize the relevance of each element to the target attribute latent space variable, wherein each element comprises at least one of the following: an embedding of an atom in the nth intermediate atom embedding, a subgraph embedding in the nth intermediate subgraph embedding, and an embedding of a node or an edge in the nth intermediate molecular graph embedding; The (n+1)th intermediate level embedding is generated by weighting at least one element in the denoised (n)th intermediate level embedding based on the second attention score.

12. The method according to claim 4, characterized in that The method further comprises: Generate random noise; performing noise processing on the nth intermediate level embedding based on the generated noise to obtain a noisy nth intermediate level embedding; The method of obtaining the n+1th intermediate level embedding by predicting and removing the n+1th noise in the nth intermediate level embedding includes: The n+1th intermediate level embedding is obtained by predicting and removing the n+1th noise in the noisy nth intermediate level embedding.

13. The method according to claim 1, 5 or 6, wherein: The machine learning model includes an encoding network, a hierarchical denoising network, and a decoding network; The method further comprises: The encoding network and the decoding network are trained based on the first sample molecular structure information of the first sample molecule, wherein the encoding network is used to encode the sample molecular structure information to obtain a sample hierarchical embedding, and the decoding network is used to decode the generated hierarchical embedding to obtain the molecular structure information of the generated molecule; When the encoding network and the decoding network have completed training, the hierarchical denoising network and the encoding network are trained based on the second sample molecular structure information of the second sample molecule, and the hierarchical denoising network is used to perform denoising processing on the initial hierarchical embedding.

14. The method according to claim 13, wherein The training of the encoding network and the decoding network based on the first sample molecular structure information of the first sample molecule includes: Inputting the first sample molecular structure information into the encoding network to obtain a first sample level embedding output by the encoding network, wherein the first sample level embedding includes a first sample graph embedding at a molecular graph level, a first sample subgraph embedding at a subgraph level, and a first sample atom embedding at an atom level; Decoding the first sample hierarchical embedding by the decoding network to obtain estimated molecular structure information of the sample estimated molecule; determining a first reconstruction loss based on a difference between the estimated molecular structure information and the first sample molecular structure information; determining a divergence loss based on a difference between the first sample level embedding and a standard Gaussian distribution; Determine the sum of the first reconstruction loss and the divergence loss as a total estimated loss; The encoding network and the decoding network are trained based on the total estimated loss.

15. The method according to claim 13, wherein The training of the hierarchical denoising network and the encoding network based on the second sample molecular structure information of the second sample molecule includes: Inputting the second sample molecular structure information into the encoding network to obtain a second sample-level embedding output by the encoding network, wherein the second sample-level embedding includes a second sample graph embedding at a molecular graph level, a second sample subgraph embedding at a subgraph level, and a second sample atom embedding at an atom level; Randomly generating sample noise corresponding to the second sample graph embedding, the second sample subgraph embedding, and the atom embedding; performing noise processing on the second sample-level embedding based on the sample noise to obtain a second sample noisy hierarchical embedding, wherein the second sample noisy hierarchical embedding includes a second sample noisy graph embedding at a molecular graph level, a second sample noisy subgraph embedding at a subgraph level, and a second sample noisy atom embedding at an atom level; Noise prediction is performed by embedding the second sample with noise in the hierarchical denoising network to obtain predicted noise; determining a noise prediction loss based on a difference between the predicted noise and the sample noise; The hierarchical denoising network and the encoding network are trained based on the noise prediction loss.

16. The method according to claim 13, wherein: The training of the hierarchical denoising network and the encoding network based on the second sample molecular structure information of the second sample molecule includes: The hierarchical denoising network and the encoding network are trained based on the second molecular structure information of the second sample molecule and the sample molecule attributes.

17. A molecular generation device comprising: An initial sampling module for generating random initial hierarchical embeddings, including initial molecular graph embeddings representing molecular graphs, initial subgraph embeddings representing subgraphs, and initial atom embeddings representing atoms. A molecular graph is composed of nodes and edges, wherein the nodes represent atoms, the edges represent chemical bonds connecting atoms, and the subgraphs represent the local molecular structure of the molecular graph. a denoising module for predicting and removing noise from the initial molecular graph embedding, the initial subgraph embedding, and the initial atom embedding by using a trained machine learning model and the learned relationships among the molecular graph, subgraph, and atoms, to obtain a generated molecular graph embedding, a generated subgraph embedding, and a generated atom embedding for generating a hierarchical embedding; A decoding module is used to decode the generated hierarchical embedding into molecular structure information of the generated molecule, where the molecular structure information includes the atomic types of atoms in the generated molecule and the chemical bond types of chemical bonds between atoms.

18. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the molecule generation method according to any one of claims 1 to 16.

19. A computer-readable storage medium, characterized in that The readable storage medium stores at least one program, and the at least one program is loaded and executed by a processor to implement the molecule generation method according to any one of claims 1 to 16.

20. A computer program product, characterized in that The computer program product includes at least one program segment, which is stored in a computer-readable storage medium. A processor of a computer device reads the at least one program segment from the computer-readable storage medium, and the processor executes the at least one program segment to implement the molecule generation method according to any one of claims 1 to 16.

Citation Information

Patent Citations

  • Directional molecule generation method based on graph neural network

    CN113140267A

  • Method and device for training noise data determination model and method and device for determining noise data

    CN116959616A

  • Molecular attribute identification method and device, electronic equipment and readable storage medium

    CN116978466A

  • Adversarial framework for molecular conformation space modeling in internal coordinates

    US20220406404A1