Single-step retrosynthetic reaction prediction method and system

Through the single-step inverse synthesis reaction prediction method of mutual distillation, the cross entropy loss and distillation loss training of the two Transformer models is solved, and the prediction accuracy of the model on each reaction type in the prior art is improved.

CN120199355BActive Publication Date: 2025-08-26HUNAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510677150.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-08-26
Estimated Expiration
2045-05-26

AI Technical Summary

Technical Problem

The prior art mostly considers the overall accuracy of models under known and unknown reaction types on the USPTO-50K dataset, but does not discuss the prediction accuracy of models for each product molecule under each reaction type.

Method used

Using a single-step inverse synthesis reaction prediction method based on mutual distillation, two Transformer models are constructed, namely Model 1 and Model 2, respectively, cross entropy loss and distillation loss are used for backpropagation training, and the distillation weight parameters are adjusted during each round of training to achieve mutual learning between models.

Benefits of technology

It improves the accuracy of the model on each reaction type, solves the problem that the prediction accuracy is difficult to improve after training of a single Transformer model, and provides a more reliable inverse synthesis reaction prediction tool.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120199355B_ABST
    Figure CN120199355B_ABST
Patent Text Reader

Abstract

The present invention discloses a single-step retrosynthetic reaction prediction method and system, comprising: obtaining multiple retrosynthetic reaction data sets, preprocessing all of the aforementioned reaction data sets to obtain ten updated reaction data sets, and inputting the preprocessed product molecules into a pretrained retrosynthetic model to obtain a list of reactant molecules corresponding to the product molecules. The present invention addresses the problem that existing retrosynthetic reaction prediction systems fail to address the differential performance of different reaction types, improving the model's performance in overall reaction prediction and in predicting reactions for certain reaction types for which data is scarce.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of deep learning and mutual distillation technology, and more specifically, relates to a single-step retrosynthetic reaction prediction method and system. Background Art

[0002] Single-step retrosynthesis aims to efficiently plan the synthetic route to the target compound by strategically breaking down complex product molecules into simple precursor reactants. Methods for this approach are primarily categorized into three categories: template-based, template-free, and semi-template. Template-based methods are a common type of single-step retrosynthetic approach. These methods extract reaction templates from a reaction database and learn the mapping relationship between product molecules and reactants. Template-free methods attempt to break away from the reliance on manually extracted templates and directly model the transformation from reactants to product molecules. Template-free methods mostly employ the Transformer architecture, treating single-step retrosynthesis as a language translation task. Semi-template methods attempt to combine the advantages of both template-based and template-free methods, first locating the reaction center on the product molecule, then breaking chemical bonds to produce synthons, and finally predicting reactants based on the synthons. This approach, to some extent, mimics the retrosynthetic analysis process performed by chemists.

[0003] Many works based on the above three methods mostly consider the overall accuracy of the model for the USPTO-50K dataset under known and unknown reaction types, without discussing the prediction accuracy of the model for each product molecule under each reaction type, which to a certain extent can reflect the model's ability to master different reaction types. Summary of the Invention

[0004] In response to the above-mentioned deficiencies or improvement needs of existing work, the present invention provides a single-step retrosynthetic reaction prediction method and system based on mutual distillation, which aims to solve the technical problem that most existing work considers the overall accuracy of the model for the USPTO-50K dataset under known and unknown reaction types, but does not discuss the prediction accuracy of the model for each product molecule under each reaction type.

[0005] To achieve the above object, according to one aspect of the present invention, a single-step retrosynthetic reaction prediction method and system are provided, comprising the following steps:

[0006] Step 1: Obtain the retrosynthetic reaction data set, construct the first to tenth category reaction data sets according to the reaction type value and process them according to the predetermined process; construct two Transformer models, respectively called Model 1 and Model 2, with the parameters and ; Initialize the total number of epochs and learning rate for model training , temperature sampling parameters and And the distillation weight parameters of model 1 and model 2 and ;

[0007] Step 2: Set the reaction data set in step 1 according to the temperature sampling parameter Get the product molecule p1 and the real reactant list r1, input p1 into model 1 and model 2, and get the predicted reactant list R respectively 11 and R 12 ;

[0008] Step 3: List the reactants obtained in step 2 into R 11 and R 12 Calculate the cross entropy loss and distillation loss with the real reactant list r1, and perform backpropagation training on model 1;

[0009] Step 4: Set the reaction data set according to the temperature sampling parameter Get the product molecule p2 and the true reactant list r2, input p2 into model 2 and the trained model 1 in step 3, and get the predicted reactant list R 22 and R 21 ;

[0010] Step 5: List the reactants obtained in step 4 into R 22 and R 21 Calculate the cross entropy loss and distillation loss with the true reactant list r2, and perform backpropagation training on model 2;

[0011] Step 6: Repeat steps 2 to 5 above in each round of training, iteratively training Model 1 and Model 2; after the current round of training, adjust the distillation weight parameters. and Make adjustments, change the preference coefficients of distillation loss and cross entropy loss in Model 1 and Model 2, and adjust the loss calculation equations for the next round of Model 1 and Model 2;

[0012] Step 7: When the current training epoch is greater than the total epoch, training ends. Test the performance of Model 1 and Model 2 on various reaction types to obtain the trained Model 1 and Model 2.

[0013] Preferably, step 1 is specifically as follows: the Transformer model is mainly divided into an encoder and a decoder. First, the attention mechanism equation of the Transformer encoder is defined, and the attention score of the i-th attention head is ,in , , , , X is the embedding information of each product molecule in the training set, Q is the sequence matrix, K is the bond matrix, and V is the value matrix. represents the matrix weight taken for Q in the i-th attention head, represents the matrix weight taken for K in the i-th attention head, represents the matrix weight taken for V in the i-th attention head, d model is the model dimension, represents the dimension of a single attention head, Indicates that Find the square root, the attention head index i ranges from 1 to 8, and softmax represents the normalized exponential function. Then concatenate the outputs of all attention heads, and the multi-head matrix ,

[0014] in is the weight of the linear layer, h is the number of attention heads, and Concat means to perform a concatenation operation on the matrix in the brackets. It is the abbreviation of multi-head matrix, followed by residual connection and layer normalization. , the result Z1 is then input into the feedforward neural network layer for calculation, FFN is the abbreviation of feedforward neural network, W1, b1, W2, b2 are the weights of the two linear layers, ReLU represents the linear rectification function, and the residual chain connection and layer normalization are performed again. The output of the i-th layer of the encoder is , where the number of layers i ranges from 1 to 6, and LayerNorm is layer normalization. After the input is processed by the multi-head self-attention layer and the feedforward neural network layer of the first encoder layer, the output of the first encoder layer is obtained. , which will be used as the input of the next encoder layer or as the final output of the encoder, and the cycle repeats until the output of the sixth encoder layer is used as the final output of the encoder encoder_out. Then define the mask attention mechanism equation of the Transformer decoder, the attention score of the i-th attention head ,in , Y is the word embedding vector of the target sequence at time t and before t, M is the mask matrix, which is used to mark the future moment results as negative infinity, ensuring that at time t, only elements less than or equal to time t can be focused on, and not future elements. Then, the outputs of all attention heads are spliced ​​together, and the multi-head matrix ,in is the weight of the linear layer, h is the number of attention heads, and then residual connection and layer normalization are performed, and the output of the mask attention layer is Then define the cross attention mechanism equation of the Transformer decoder, the cross attention score of the i-th head ,in , encoder_out is the final output of the encoder; then all the attention head outputs are concatenated and passed through the linear layer, residual connection and layer normalization are performed, and then input into the feedforward neural network layer for calculation, and residual connection and layer normalization are performed again to obtain the output decoder_out1 of the first decoder layer, which is input into the next decoder layer for the same processing until the output of the sixth decoder layer is obtained, which is used as the final output decoder_out of the decoder, and then the output distribution at the current moment is obtained through the linear layer and normalized exponential function;

[0015] The calculation formula of the loss function in step 3 is: ,in It means that the summation operation is performed on the values ​​calculated from the first moment to the rth moment of t, and x is the molecular representation of the product. represents all target sequence representations before time t, is the predicted probability of the correct word by model 1 at time t, Indicates that model 1 is based on the current parameters And the target sequence before time step t gives the correct output The probability of represents the cross entropy loss; ,in Indicates that model 2 gives a certain output at time step t The probability distribution of Indicates that model 1 gives a certain output at time step t The logarithmic probability of ,in is the distillation weight of model 1 The degree of learning of the output of model 2 in response type i is finally minimized by the total loss Represents the parameters of optimization model 1 , so that the reactant list predicted by model 1 is aligned with the true reactant list and the reactant list predicted by model 2.

[0016] The calculation formula of the loss function in step 5 is: , where x is the molecular characterization of the product, represents all target sequence representations before time t, is the predicted probability of the correct word by model 2 at time t, represents the cross entropy loss function; ,in Indicates that model 1 gives a certain output at time step t The probability distribution of Indicates that model 2 gives a certain output at time step t The logarithmic probability of represents the knowledge distillation loss function; ,in is the distillation weight of model 2 The degree of learning of the output of model 1 in response type i is finally minimized by the total loss Represents the parameters of optimization model 2 , so that the reactant list predicted by model 2 is aligned with the true reactant list and the reactant list predicted by model 1.

[0017] Step 6 is specifically to search the space O k There are three update strategies: reducing the distillation weight, keeping the distillation weight unchanged, and increasing the distillation weight. For model 1, the parameters of model 1 are and distillation weights Save to a temporary variable for subsequent recovery, traverse O k The update strategy in , under the current update strategy The distillation weights of all reaction types in the model are adjusted, and one epoch is continued to be trained based on the adjusted distillation weights. Then, model 1 is verified, the cross entropy loss with the real reactant list is calculated, and the result is stored in the matrix R. After traversing all update strategies, for each reaction type of model 1, the candidate weight corresponding to the minimum verification loss is selected from the matrix R and set as the updated distillation weight. Then, all strategies are traversed and verified for model 2 in the same way, and the distillation weights in model 2 are updated.

[0018] Preferably, step 1 is specifically as follows: first, the reaction data is downloaded from the open source data set USPTO-50K. The reaction data is mainly divided into two columns, one column is the reaction type value of the synthesis reaction, and the other column is the RXN reaction equation. The framework of the equation is such as reactant 1. reactant 2>> product molecule. The reactants and product molecules are represented using the simplified molecular input line specification SMILES format, that is, the text representation of the molecule. Then, the reaction data is divided into 10 reaction data sets according to the reaction type value, the chemical reaction data of each reaction data set is preprocessed, the CSV file or TXT file containing the reaction data is read, the SMILES of the reactants and the SMILES of the product molecules are extracted, the SMILES of the reactants and the product molecules are quality checked, and some unqualified data are filtered out, such as the reactant or product molecule is empty, the reactant or product molecule is If SMILES is invalid, the molecule is too small, or the atomic mapping of the reactant and product molecules is inconsistent, the root alignment mode is then used to randomly select an atom from the product molecule as the root atom. The atomic order of the reactant is then adjusted according to the atomic mapping to align it with the product molecule. The enhanced data is generated repeatedly until the data is amplified 20 times the original. The SMILES is then segmented. The segmentation is achieved through regular expressions, and the parts that meet the following rules are regarded as tokens, such as atoms in square brackets, element symbols, special symbols, two-digit % plus numbers, and single numbers. The reaction expression is converted into tokens separated by spaces. Finally, the processed source data and target data are saved in the source data file and target data file respectively. Finally, the information of the product molecules and reactant lists is extracted for the ten reaction data sets to obtain the updated reaction data sets.

[0019] Preferably, the reactant list obtained in step 1 is a list of multiple reactant molecule SMILES corresponding to the enhanced product molecule SMILES, and the SMILES are connected by ".";

[0020] The retrosynthetic reaction prediction model is implemented based on the Transformer model. Both Transformer models consist of an encoder, a decoder, and an output linear layer.

[0021] Preferably, the encoder is mainly composed of an embedding layer, a multi-head attention layer, and a feedforward neural network layer, and its specific structure is as follows:

[0022] The embedding layer is a linear network. The input of the embedding layer is the molecular information of a batch of product molecules corresponding to the reaction data set under a certain reaction category, and the output is an embedding vector set of size Batch_size×Seq_length×512, where Batch_size×Seq_length×512 is the dimension of the latent space;

[0023] The embedding layer includes word embedding layer and position encoding layer;

[0024] The embedding layer includes word embedding layer and position encoding layer;

[0025] The input of the word embedding layer is the molecular information of a batch of molecules corresponding to the reaction data set under a certain reaction type, that is, a matrix of Batch_size×Seq_length×Len, and the output is a word embedding vector set of Batch_size×Seq_length×512;

[0026] The input of the position encoding layer is the molecular information of a batch of molecules corresponding to the reaction data set under a certain reaction type, that is, a matrix of Batch_size×Seq_length×Len, and the output is a word embedding vector set of Batch_size×Seq_length×512.

[0027] The specific structure of the feedforward neural network layer and the input processing process are exactly the same as the feedforward neural network layer in the encoder;

[0028] The decoder layer consists of a masked multi-head attention layer, a multi-head attention layer, and a feedforward neural network layer, with a total of 6 layers stacked; the input of the decoder layer is the result x at time t t The word embedding vector set is output as the molecular representation vector set decoder_out;

[0029] The input of the output linear layer is the output decoder_out of the decoder, and the output is a matrix vector of Batch_size×Seq_length×V, where V is the number of molecular vocabularies;

[0030] In the process of predicting reactants, the product molecule SMILES is input into the encoder to obtain the encoder output encoder_out. Starting from time t=0, the first symbol of the output data is the start symbol, and the rest are masked. The data passes through the decoder and the output linear layer to obtain the probability distribution of the next word unit token. The index of the token is extracted according to the probability and used as known information. The above process is repeated until the data passes through the decoder and the output linear layer and the index of the terminator is extracted. The prediction process ends and the reactant list is obtained.

[0031] Specifically, the word embedding layer first uses the torch.nn.Embedding module in the deep learning pytorch framework to upscale the molecular information of a batch of molecules corresponding to the input product molecular information set to obtain a set of product molecular feature vectors. Each element of the embedding vector is then multiplied by a predefined scaling factor to obtain a set of scaled feature vectors. The positional encoding layer also processes the molecular information of the batch of molecules, using the SinusoidalPositionalEmbedding module in the sequence modeling toolkit fairseq framework to generate a corresponding set of position vectors based on the position of the molecular information. The molecular feature vector set and the position vector set are then element-wise added to obtain a new embedding vector x, with the dimension of vector x remaining unchanged. The intermediate vector set is again layer-normalized using the torch.nn.LayerNorm module in the pytorch framework. Finally, the embedding vector x is randomly dropped using the torch.nn.Dropout module in the pytorch framework to output a set of word embedding vectors of size Batch_size × Seq_length × 512.

[0032] Preferably, the input of the multi-head self-attention layer is the word embedding vector set output by the embedding layer, that is, a matrix of Batch_size×Seq_length×512, and the output is a set of attention vectors of Batch_size×Seq_length×512;

[0033] Specifically, the multi-head attention layer first uses the Linear layer in the PyTorch framework to perform a linear transformation on the word embedding vector set to obtain an intermediate vector set, and then uses the attention mechanism to process the intermediate vector set to obtain an attention vector set. The residual connection is used to add the residual of the attention vector set to its input and the torch.nn.LayerNorm module in the pytorch framework is used for layer normalization to output a vector set of size Batch_size×Seq_length×512.

[0034] Preferably, the input of the feedforward neural network layer is a vector set of size Batch_size×Seq_length×512 output by the multi-head attention layer, and the output is a molecular representation vector set of size Batch_size×Seq_length×512;

[0035] Specifically, the feedforward neural network layer first uses the Linear layer in the PyTorch framework to increase the dimension of the vector set, then uses the linear rectification function ReLU to perform nonlinear processing on the increased-dimensional vector, and again uses the Linear layer in the PyTorch framework to reduce the dimension. Finally, a residual connection is used to add the residual of the attention vector set to its input and the torch.nn.LayerNorm module in the pytorch framework is used for layer normalization to output a molecular representation vector set of size Batch_size×Seq_length×512.

[0036] The encoder layer consists of a multi-head self-attention layer and a feedforward neural network layer, with a total of 6 layers stacked. The input of the encoder layer is a set of word embedding vectors, and the output is a set of molecule representation vectors encoder_out.

[0037] Specifically, the word embedding vector passes through the first encoder layer to obtain the first encoder layer output encoder_out1, and then encoder_out1 is input into the second encoder layer to obtain the second encoder layer output encoder_out2. Then, the obtained second encoder layer output is continuously input into the next encoder layer, and the above process is repeated until it is input into the sixth encoder layer, and the output of the sixth encoder layer encoder_out6 is obtained as the final output of the entire encoder.

[0038] Preferably, the decoder mainly consists of an embedding layer, a masked multi-head attention layer, a multi-head attention layer, and a feedforward neural network layer;

[0039] The embedding layer is a linear neural network whose input is the known result x from the beginning to the current time t t , output word embedding vector set of size Batch_size×Seq_length×512;

[0040] The specific structure of the embedding layer and the input processing process are exactly the same as those of the encoder's embedding layer module.

[0041] The input of the masked multi-head attention layer module is the word embedding vector set output by the decoder embedding layer, and the output is a masked attention vector set of size Batch_size×Seq_length×512.

[0042] Specifically, the masked multi-head attention layer first uses the Linear layer in the PyTorch framework to perform a linear transformation on the word embedding vector set to obtain an intermediate vector set, and then uses the attention mechanism to process the intermediate vector set to ensure that future information is not used in prediction, obtaining an attention vector set, and using a residual connection to add the residual of the attention vector set to its input and use the torch.nn.LayerNorm module in the pytorch framework for layer normalization to output a vector set of size Batch_size×Seq_length×512.

[0043] The input of the multi-head attention layer module is the vector set output by the decoder mask multi-head attention layer, and the output size is Batch_size×Seq_length×512 attention vector set;

[0044] Specifically, the multi-head attention layer uses the Linear layer in the PyTorch framework to perform linear transformation on the molecular representation encoder_out output by the encoder and the vector set output by the mask multi-head attention layer to obtain an intermediate vector set, and then uses the attention mechanism to process the intermediate vector set to obtain an attention vector set. The residual connection is used to add the residual of the attention vector set to its input and the torch.nn.LayerNorm module in the pytorch framework is used for layer normalization to output a vector set of size Batch_size×Seq_length×512.

[0045] The specific structure of the feedforward neural network layer and the input processing process are exactly the same as the feedforward neural network layer in the encoder.

[0046] The decoder layer consists of a masked multi-head attention layer, a multi-head attention layer, and a feedforward neural network layer, with a total of 6 layers stacked. The input of the decoder layer is the result x at time t t The word embedding vector set is output as the molecular representation vector set decoder_out.

[0047] Specifically, x t After the word embedding vector passes through the first decoder layer, the first decoder layer output decoder_out1 is obtained, and then decoder_out1 is input into the second decoder layer to obtain the second decoder layer output decoder_out2. Then, for the obtained second decoder layer output, it is continuously input into the next decoder layer, and the above process is repeated until it is input into the sixth decoder layer, and the output of the sixth decoder layer decoder_out6 is obtained as the final output decoder_out of the decoder.

[0048] The input of the output linear layer is the output decoder_out of the decoder. The output potential vector of size Batch_size × Seq_length × 512 is mapped to a vector of the vocabulary size, and then the probability distribution is obtained through the softmax method.

[0049] In the process of predicting reactants, the product molecule SMILES is input into the encoder to obtain the encoder output encoder_out. Starting from time t=0, the first symbol of the output data is the start symbol, and the rest are masked. The data passes through the decoder and the output linear layer to obtain the probability distribution of the next word unit token. The index of the token is extracted according to the probability and used as known information. The above process is repeated until the data passes through the decoder and the output linear layer and the index of the terminator is extracted. The prediction process ends and the reactant list is obtained.

[0050] According to another aspect of the present invention, a retrosynthetic reaction prediction system is provided, comprising:

[0051] The first module obtains a plurality of synthesis reaction data, each synthesis reaction data having a reaction type value, constructs all reaction data with reaction type values ​​of 1 to 10 into first to tenth category reaction data sets, and preprocesses all the above reaction data sets to obtain ten updated reaction data sets;

[0052] The second module inputs the product molecule information sets from the ten reaction data information sets obtained in the first module into a pre-trained retrosynthesis reaction prediction model to obtain a list of reactants required to generate each product molecule.

[0053] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:

[0054] 1. The present invention adopts steps 2 to 6, which performs mutual distillation learning on two Transformer-based models. The data of different reaction types are trained by temperature sampling. The accuracy of each reaction type can be calculated, which solves the problem of existing work that does not consider the analysis accuracy of each reaction type.

[0055] 2. The present invention adopts steps 2 to 6, constructs two different sampling distributions to train the two models, and enables mutual distillation learning between the two models, thereby improving the accuracy of the models for various reaction types. This can solve the technical problem that the prediction accuracy of a single Transformer model is difficult to further improve after training;

[0056] 3. The method of the present invention can solve the problem of single-step retrosynthetic reaction prediction, improve the performance and accuracy of the model, and provide a more reliable tool and method for single-step retrosynthetic reaction prediction in the medical field;

[0057] 4. The present invention can be widely applied to various retrosynthetic reaction prediction tasks and can improve the performance of model training. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 It is an overall flow chart of the single-step retrosynthetic reaction prediction method based on mutual distillation of the present invention. DETAILED DESCRIPTION

[0059] The principles of the present invention are described below with reference to the accompanying drawings and examples. The examples provided are only used to illustrate and explain the present invention, rather than to limit the present invention.

[0060] The basic idea of ​​the present invention is to realize the prediction of retrosynthetic reaction based on mutual distillation and two Transformer models. According to the sequence of the product molecule, the sequence is preprocessed to obtain a sequence representation, which is then input into a pretrained encoder to obtain a molecular code. Finally, the molecular code is input into a decoder to generate a text sequence of the reactant list.

[0061] like Figure 1 As shown, the present invention provides a single-step retrosynthetic reaction prediction method, comprising the following steps:

[0062] Step 1: Obtain the retrosynthetic reaction data set, construct the first to tenth category reaction data sets according to the reaction type value and process them according to the predetermined process; construct two Transformer models, respectively called Model 1 and Model 2, with the parameters and ; Initialize the total number of epochs and learning rate for model training , temperature sampling parameters and And the distillation weight parameters of model 1 and model 2 and ;

[0063] Specifically, the molecules obtained in this step are all text data, and the molecular information is stored in the form of text. This step first downloads the reaction data from the open source dataset USPTO-50K. The reaction data is mainly divided into two columns, one is the reaction type value of the synthesis reaction, and the other is the RXN reaction equation. The framework of the equation is such as reactant 1. reactant 2 >> product molecule. The reactant and product molecules are represented using the simplified molecular input line specification SMILES format, that is, the text representation of the molecule. Then, the reaction data is divided into 10 reaction data sets according to the reaction type value, and the chemical reaction data of each reaction data set is preprocessed. The CSV file or TXT file containing the reaction data is read, and the SMILES of the reactant and the SMILES of the product molecules are extracted. The quality of the reactant and product molecule SMILES is checked to filter out some unqualified data, such as the reactant or product molecule is empty, the SMILES of the reactant or product molecule is invalid, the molecule is too small, or the reactant and product The atomic mapping of the molecules is inconsistent, and then the root alignment mode is used. An atom is randomly selected from the product molecule as the root atom, and then the atomic order of the reactant is adjusted according to the atomic mapping to align it with the product molecule. The enhanced data is generated repeatedly until the data is amplified 20 times the original. Then the SMILES is segmented. The segmentation is achieved through regular expressions. The parts that meet the following rules are regarded as words, such as atoms in square brackets, element symbols, special symbols, two-digit % plus numbers, and single numbers. The reaction expression is converted into word tokens separated by spaces, and finally the processed source data and target data are saved in the source data file and the target data file respectively; the final reverse synthesis reaction prediction result is to predict the corresponding multiple reactant molecule SMILES of the preprocessed product molecule SMILES, and the SMILES are connected by "."; finally, the information of the product molecule and the reactant list is extracted from the ten reaction data sets to obtain the corresponding reaction data information set. The total number of iterations epoch in this step ranges from 100 to 200, preferably 150; the learning rate The value range is between 0 and 1, preferably 0.0015; temperature sampling parameter The value range is between 0-10, preferably 1; temperature sampling parameter The value range is between 0-10, preferably 5.

[0064] Specifically, the Transformer model is mainly divided into an encoder and a decoder. First, the attention mechanism equation of the Transformer encoder is defined. The attention score of the i-th attention head is ,in , , , , X is the embedding information of each product molecule in the training set, Q is the sequence matrix, K is the bond matrix, and V is the value matrix. represents the matrix weight taken for Q in the i-th attention head, represents the matrix weight taken for K in the i-th attention head, represents the matrix weight taken for V in the i-th attention head, d model is the model dimension, represents the dimension of a single attention head, Indicates that Find the square root, the attention head index i ranges from 1 to 8, and softmax represents the normalized exponential function. Then concatenate the outputs of all attention heads, and the multi-head matrix ,in is the weight of the linear layer, h is the number of attention heads, and Concat means to perform a concatenation operation on the matrix in the brackets. It is the abbreviation of multi-head matrix, followed by residual connection and layer normalization. , the result Z1 is then input into the feedforward neural network layer for calculation, FFN is the abbreviation of feedforward neural network, W1, b1, W2, b2 are the weights of the two linear layers, ReLU represents the linear rectification function, and the residual chain connection and layer normalization are performed again. The output of the i-th layer of the encoder is , where the number of layers i ranges from 1 to 6, and LayerNorm is layer normalization. After the input is processed by the multi-head self-attention layer and the feedforward neural network layer of the first encoder layer, the output of the first encoder layer is obtained. , which will be used as the input of the next encoder layer or as the final output of the encoder, and the cycle repeats until the output of the sixth encoder layer is used as the final output of the encoder encoder_out. Then define the mask attention mechanism equation of the Transformer decoder, the attention score of the i-th attention head ,in , Y is the word embedding vector of the target sequence at time t and before t, M is the mask matrix, which is used to mark the future moment results as negative infinity, ensuring that at time t, only elements less than or equal to time t can be focused on, and not future elements. Then, the outputs of all attention heads are spliced ​​together, and the multi-head matrix ,in is the weight of the linear layer, h is the number of attention heads, and then residual connection and layer normalization are performed, and the output of the mask attention layer is Then define the cross attention mechanism equation of the Transformer decoder, the cross attention score of the i-th head ,in , encoder_out is the final output of the encoder; then all the attention head outputs are concatenated and passed through the linear layer, residual connection and layer normalization are performed, and then input into the feedforward neural network layer for calculation, and residual connection and layer normalization are performed again to obtain the output decoder_out1 of the first decoder layer, which is input into the next decoder layer for the same processing until the output of the sixth decoder layer is obtained, which is used as the final output decoder_out of the decoder, and then the output distribution at the current moment is obtained through the linear layer and normalized exponential function.

[0065] Step 2: Set the reaction data set in step 1 according to the temperature sampling parameter Get the product molecule p1 and the real reactant list r1, input p1 into model 1 and model 2, and get the predicted reactant list R respectively 11 and R 12 ;

[0066] Step 3: List the reactants obtained in step 2 into R 11 With R 12 Calculate the cross entropy loss and distillation loss with the true reactant list r1, and perform backpropagation training on model 1.

[0067] Specifically, the calculation formula of the loss function in this step is: ,in It means to sum the values ​​calculated from the first moment to the rth moment of t, where x is the molecular representation of the product. represents all target sequence representations before time t, is the predicted probability of the correct word by model 1 at time t, Indicates that model 1 is based on the current parameters And the target sequence before time step t gives the correct output The probability of represents the cross entropy loss; ,in Indicates that model 2 gives a certain output at time step t The probability distribution of Indicates that model 1 gives a certain output at time step t The logarithmic probability of ,in is the distillation weight of model 1 The degree of learning of the output of model 2 in response type i is finally minimized by the total loss Represents the parameters of optimization model 1 , so that the reactant list predicted by model 1 is aligned with the true reactant list and the reactant list predicted by model 2.

[0068] Step 4: Set the reaction data set according to the temperature sampling parameter Get the product molecule p2 and the real reactant list r2, input p2 into model 1 and model 2, and get the predicted reactant list R respectively 21 and R 22 ;

[0069] Step 5: List the reactants obtained in step 4 into R 21 With R 22 Calculate the cross entropy loss and distillation loss with the true reactant list r2, and perform backpropagation training on model 2;

[0070] Specifically, the calculation formula of the loss function in this step is: , where x is the molecular characterization of the product, represents all target sequence representations before time t, is the predicted probability of the correct word by model 2 at time t, represents the cross entropy loss function; ,in Indicates that model 1 gives a certain output at time step t The probability distribution of Indicates that model 2 gives a certain output at time step t The logarithmic probability of represents the knowledge distillation loss function; ,in is the distillation weight of model 2 The degree of learning of the output of model 1 in response type i is finally minimized by the total loss Represents the parameters of optimization model 2 , so that the reactant list predicted by model 2 is aligned with the true reactant list and the reactant list predicted by model 1.

[0071] Step 6: Repeat steps 2 to 5 above in each round of training, iteratively training Model 1 and Model 2; after the current round of training, adjust the distillation weight parameters. and Make adjustments, change the preference coefficients of distillation loss and cross entropy loss in Model 1 and Model 2, and adjust the loss calculation equations for the next round of Model 1 and Model 2.

[0072] Specifically, the search space O k There are three update strategies: reducing the distillation weight, keeping the distillation weight unchanged, and increasing the distillation weight. For model 1, the parameters of model 1 are and distillation weights Save to a temporary variable for subsequent recovery, traverse O kThe update strategy in , under the current update strategy The distillation weights of all reaction types in the model are adjusted, and one epoch is continued to be trained based on the adjusted distillation weights. Then, model 1 is verified, the cross entropy loss with the real reactant list is calculated, and the result is stored in the matrix R. After traversing all update strategies, for each reaction type of model 1, the candidate weight corresponding to the minimum verification loss is selected from the matrix R and set as the updated distillation weight. Then, all strategies are traversed and verified for model 2 in the same way, and the distillation weights in model 2 are updated.

[0073] Step 7: When the current training epoch is greater than the total epoch, training ends. Test the performance of Model 1 and Model 2 on various reaction types to obtain the trained Model 1 and Model 2.

[0074] The retrosynthetic reaction prediction model of the present invention is implemented based on the Transformer model. Figure 1 As shown, the two Transformer models each include an encoder, a decoder, and an output linear layer.

[0075] The encoder mainly consists of an embedding layer, a multi-head attention layer, and a feedforward neural network layer. Its specific structure is as follows:

[0076] The embedding layer is a linear network. The input of the embedding layer is the molecular information of a batch of product molecules corresponding to the reaction data set under a certain reaction category, and the output is an embedding vector set of size Batch_size×Seq_length×512, where Batch_size×Seq_length×512 is the dimension of the latent space;

[0077] The embedding layer includes the word embedding layer and the position encoding layer.

[0078] The input of the word embedding layer is the molecular information of a batch of molecules corresponding to the reaction data set under a certain reaction type, that is, the word embedding vector set of Batch_size×Seq_length×512.

[0079] The input of the position encoding layer is the molecular information of a batch of molecules corresponding to the reaction data set under a certain reaction type, that is, the word embedding vector set of Batch_size×Seq_length×512.

[0080] Specifically, the word embedding layer first uses the torch.nn.Embedding module in the deep learning pytorch framework to upscale the molecular information of a batch of molecules corresponding to the input product molecular information set to obtain a set of product molecular feature vectors. Each element of the embedding vector is then multiplied by a predefined scaling factor to obtain a set of scaled feature vectors. The positional encoding layer also processes the molecular information of the batch of molecules, using the SinusoidalPositionalEmbedding module in the sequence modeling toolkit fairseq framework to generate a corresponding set of position vectors based on the position of the molecular information. The molecular feature vector set and the position vector set are then element-wise added to obtain a new embedding vector x, with the dimension of vector x remaining unchanged. The intermediate vector set is again layer-normalized using the torch.nn.LayerNorm module in the pytorch framework. Finally, the embedding vector x is randomly dropped using the torch.nn.Dropout module in the pytorch framework to output a set of word embedding vectors of size Batch_size × Seq_length × 512.

[0081] The input of the multi-head self-attention layer is the word embedding vector set output by the embedding layer, that is, a matrix of Batch_size×Seq_length×512, and the output is a set of attention vectors of Batch_size×Seq_length×512;

[0082] Specifically, the multi-head attention layer first uses the Linear layer in the PyTorch framework to perform a linear transformation on the word embedding vector set to obtain an intermediate vector set, and then uses the attention mechanism to process the intermediate vector set to obtain an attention vector set. The residual connection is used to add the residual of the attention vector set to its input and the torch.nn.LayerNorm module in the pytorch framework is used for layer normalization to output a vector set of size Batch_size×Seq_length×512.

[0083] The input of the feedforward neural network layer is a vector set of size Batch_size×Seq_length×512 output by the multi-head attention layer, and the output is a molecular representation vector set of size Batch_size×Seq_length×512.

[0084] Specifically, the feedforward neural network layer first uses the Linear layer in the PyTorch framework to increase the dimension of the vector set, then uses the linear rectification function ReLU to perform nonlinear processing on the increased-dimensional vector, and again uses the Linear layer in the PyTorch framework to reduce the dimension. Finally, a residual connection is used to add the residual of the attention vector set to its input and the torch.nn.LayerNorm module in the pytorch framework is used for layer normalization to output a molecular representation vector set of size Batch_size×Seq_length×512.

[0085] The encoder layer consists of a multi-head self-attention layer and a feedforward neural network layer, with a total of 6 layers stacked. The input of the encoder layer is a set of word embedding vectors, and the output is a set of molecule representation vectors encoder_out.

[0086] Specifically, the word embedding vector passes through the first encoder layer to obtain the first encoder layer output encoder_out1, and then encoder_out1 is input into the second encoder layer to obtain the second encoder layer output encoder_out2. Then, the obtained second encoder layer output is continuously input into the next encoder layer, and the above process is repeated until it is input into the sixth encoder layer, and the output of the sixth encoder layer encoder_out6 is obtained as the final output of the entire encoder.

[0087] The decoder mainly consists of an embedding layer, a masked multi-head attention layer, a multi-head attention layer, and a feedforward neural network layer.

[0088] The embedding layer is a linear neural network whose input is the known result x from the beginning to the current time t t , the output word embedding vector set is of size Batch_size×Seq_length×512.

[0089] The specific structure of the embedding layer and the input processing process are exactly the same as the embedding layer module of the encoder;

[0090] The input of the masked multi-head attention layer module is the word embedding vector set output by the decoder embedding layer, and the output is a masked attention vector set of size Batch_size×Seq_length×512.

[0091] Specifically, the masked multi-head attention layer first uses the Linear layer in the PyTorch framework to perform a linear transformation on the word embedding vector set to obtain an intermediate vector set, and then uses the attention mechanism to process the intermediate vector set to ensure that future information is not used in prediction, obtaining an attention vector set, and using a residual connection to add the residual of the attention vector set to its input and use the torch.nn.LayerNorm module in the pytorch framework for layer normalization to output a vector set of size Batch_size×Seq_length×512.

[0092] The input of the multi-head attention layer module is the vector set output by the decoder mask multi-head attention layer, and the output size is a set of attention vectors of Batch_size×Seq_length×512.

[0093] Specifically, the multi-head attention layer uses the Linear layer in the PyTorch framework to perform linear transformation on the molecular representation encoder_out output by the encoder and the vector set output by the mask multi-head attention layer to obtain an intermediate vector set, and then uses the attention mechanism to process the intermediate vector set to obtain an attention vector set. The residual connection is used to add the residual of the attention vector set to its input and the torch.nn.LayerNorm module in the pytorch framework is used for layer normalization to output a vector set of size Batch_size×Seq_length×512.

[0094] The specific structure of the feedforward neural network layer and the input processing process are exactly the same as the feedforward neural network layer in the encoder;

[0095] The decoder layer consists of a masked multi-head attention layer, a multi-head attention layer, and a feedforward neural network layer, with a total of 6 layers stacked. The input of the decoder layer is the result x at time t t The word embedding vector set is output as the molecular representation vector set decoder_out.

[0096] Specifically, x t After the word embedding vector passes through the first decoder layer, the first decoder layer output decoder_out1 is obtained, and then decoder_out1 is input into the second decoder layer to obtain the second decoder layer output decoder_out2. Then, for the obtained second decoder layer output, it is continuously input into the next decoder layer, and the above process is repeated until it is input into the sixth decoder layer, and the output of the sixth decoder layer decoder_out6 is obtained as the final output decoder_out of the decoder.

[0097] The input of the output linear layer is the decoder output decoder_out, and the output potential vector of size Batch_size × Seq_length × 512 is mapped to a vector of the vocabulary size, and then the probability distribution is obtained through the Softmax method.

[0098] In the process of predicting reactants, the product molecule SMILES is input into the encoder to obtain the encoder output encoder_out. Starting from time t=0, the first symbol of the output data is the start symbol, and the rest are masked. The data passes through the decoder and the output linear layer to obtain the probability distribution of the next token. The index of the token is extracted according to the probability and used as known information. The above process is repeated until the data passes through the decoder and the output linear layer and the index of the terminator is extracted. The prediction process ends and the reactant list is obtained.

[0099] Test results

[0100] The test environment of the present invention is as follows: under the Ubuntu 20.04 operating system, the CPU is an Intel(R) Xeon(R) Gold6330 CPU @ 2.00GHz, the GPU is an NVIDIA RTX 3090 24GB, and Python 3.8 is used to program and implement the algorithm of the present invention.

[0101] To illustrate the effectiveness of the method of the present invention and its improvement in the prediction effect of retrosynthetic reactions, the method was tested on a test set derived from the USPTO-50K dataset. The test results obtained by the present invention were compared with the current advanced methods. The evaluation results are shown in Table 1.

[0102] According to the test results recorded in Table 1 on the test set derived from the USPTO-50K dataset, it can be seen that the single-step retrosynthetic reaction prediction method based on mutual distillation proposed in the present invention is superior to the existing methods in the four retrosynthetic prediction indicators of top-1, top-3, top-5 and top-10.

[0103] Table 1 Comparison of retrosynthetic reaction prediction results

[0104]

[0105] While the above is a description of the specific implementation of the present invention with reference to the accompanying drawings, the present invention is not limited to the specific embodiments described above. The above examples and descriptions are intended only to illustrate the principles of the present invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall fall within the scope of protection of the present invention.

Claims

1. A single-step retrosynthetic reaction prediction method, characterized in that: The following steps are included: Step 1: Obtain the retrosynthetic reaction data set, construct the first to tenth category reaction data sets according to the reaction type value and process them according to the predetermined process; construct two Transformer models, respectively called Model 1 and Model 2, with the parameters and ; Initialize the total number of epochs and learning rate for model training , temperature sampling parameters and And the distillation weight parameters of model 1 and model 2 and ; Step 2: Set the reaction data set in step 1 according to the temperature sampling parameter Get the product molecule p1 and the real reactant list r1, input p1 into model 1 and model 2, and get the predicted reactant list R respectively 11 and R 12 ; Step 3: List the reactants obtained in step 2 into R 11 With R 12 Calculate the cross entropy loss and distillation loss with the real reactant list r1, and perform backpropagation training on model 1; Step 4: Set the reaction data set according to the temperature sampling parameter Get the product molecule p2 and the true reactant list r2, input p2 into model 2 and the trained model 1 in step 3, and get the predicted reactant list R 22 and R 21 ; Step 5: List the reactants obtained in step 4 into R 21 With R 22 Calculate the cross entropy loss and distillation loss with the true reactant list r2, and perform backpropagation training on model 2; Step 6: Repeat steps 2 to 5 above in each round of training, iteratively training Model 1 and Model 2; after the current round of training, adjust the distillation weight parameters. and Make adjustments, change the preference coefficients of distillation loss and cross entropy loss in Model 1 and Model 2, and adjust the loss calculation equations for the next round of Model 1 and Model 2; Step 7: When the current training round is greater than the total round epoch, the training ends; the performance of Model 1 and Model 2 is tested on each reaction type to obtain the trained Model 1 and Model 2.

2. The single-step retrosynthetic reaction prediction method according to claim 1, wherein Step 1 is as follows: the Transformer model is mainly divided into an encoder and a decoder. First, the attention mechanism equation of the Transformer encoder is defined. The attention score of the i-th attention head is ,in , , , , X is the embedding information of each product molecule in the training set, Q is the sequence matrix, K is the bond matrix, and V is the value matrix. represents the matrix weight taken for Q in the i-th attention head, represents the matrix weight taken for K in the i-th attention head, represents the matrix weight taken for V in the i-th attention head, d model is the model dimension, represents the dimension of a single attention head, Indicates that Find the square root, the attention head index i ranges from 1 to 8, and softmax represents the normalized exponential function; then concatenate the outputs of all attention heads, the multi-head matrix ,in is the weight of the linear layer, h is the number of attention heads, and Concat means to perform a concatenation operation on the matrix in the brackets. It is the abbreviation of multi-head matrix, followed by residual connection and layer normalization. , the result Z1 is then input into the feedforward neural network layer for calculation, FFN is the abbreviation of feedforward neural network, W1, b1, W2, b2 are the weights of the two linear layers, ReLU represents the linear rectification function, and the residual chain connection and layer normalization are performed again. The output of the i-th layer of the encoder is , where the number of layers i ranges from 1 to 6, and LayerNorm is layer normalization; after the input is processed by the multi-head self-attention layer and the feedforward neural network layer of the first encoder layer, the output of the first encoder layer is obtained. , which will be used as the input of the next encoder layer or as the final output of the encoder, and the cycle repeats until the output of the sixth encoder layer is used as the final output of the encoder encoder_out; then define the mask attention mechanism equation of the Transformer decoder, the attention score of the i-th attention head ,in , Y is the word embedding vector of the target sequence at time t and before t, M is the mask matrix, which is used to mark the future moment results as negative infinity, ensuring that at time t, only elements less than or equal to time t can be focused on, and not future elements. Then, the outputs of all attention heads are spliced ​​together, and the multi-head matrix ,in is the weight of the linear layer, h is the number of attention heads, and then residual connection and layer normalization are performed, and the output of the mask attention layer is ; Then define the cross attention mechanism equation of the Transformer decoder, the cross attention score of the i-th head ,in , encoder_out is the final output of the encoder; then all the attention head outputs are concatenated and passed through the linear layer, residual connection and layer normalization are performed, and then input into the feedforward neural network layer for calculation, and residual connection and layer normalization are performed again to obtain the output decoder_out1 of the first decoder layer, which is input into the next decoder layer for the same processing until the output of the sixth decoder layer is obtained, which is used as the final output decoder_out of the decoder, and then the output distribution at the current moment is obtained through the linear layer and normalized exponential function; The calculation formula of the loss function in step 3 is: ,in It means that the summation operation is performed on the values ​​calculated from the first moment to the rth moment of t, and x is the molecular representation of the product. represents all target sequence representations before time t, is the predicted probability of the correct word by model 1 at time t, Indicates that model 1 is based on the current parameters And the target sequence before time step t gives the correct output The probability of represents the cross entropy loss; ,in Indicates that model 2 gives a certain output at time step t The probability distribution of Indicates that model 1 gives a certain output at time step t The logarithmic probability of ,in is the distillation weight of model 1 The degree of learning of the output of model 2 in response type i is finally minimized by the total loss Represents the parameters of optimization model 1 , align the reactant list predicted by model 1 with the true reactant list and the reactant list predicted by model 2; The calculation formula of the loss function in step 5 is: , where x is the molecular characterization of the product, represents all target sequence representations before time t, is the predicted probability of the correct word by model 2 at time t, represents the cross entropy loss function; ,in Indicates that model 1 gives a certain output at time step t The probability distribution of Indicates that model 2 gives a certain output at time step t The logarithmic probability of represents the knowledge distillation loss function; ,in is the distillation weight of model 2 The degree of learning of the output of model 1 in response type i is finally minimized by the total loss Represents the parameters of optimization model 2 , align the reactant list predicted by model 2 with the true reactant list and the reactant list predicted by model 1; Step 6 is specifically to search the space O k There are three update strategies: reducing the distillation weight, keeping the distillation weight unchanged, and increasing the distillation weight; for model 1, the parameters of model 1 are and distillation weights Save to a temporary variable for subsequent recovery, traverse O k The update strategy in , under the current update strategy The distillation weights of all reaction types in the model are adjusted, and one epoch is continued to be trained based on the adjusted distillation weights. Then, model 1 is verified, the cross entropy loss with the real reactant list is calculated, and the result is stored in the matrix R. After traversing all update strategies, for each reaction type of model 1, the candidate weight corresponding to the minimum verification loss is selected from the matrix R and set as the updated distillation weight. Then, all strategies are traversed and verified for model 2 in the same way, and the distillation weights in model 2 are updated.

3. The single-step retrosynthetic reaction prediction method according to claim 1, wherein Specifically, step 1 is to first download the reaction data from the open source dataset USPTO-50K. The reaction data is mainly divided into two columns, one is the reaction type value of the synthesis reaction, and the other is the RXN reaction equation. The framework of the equation is such as reactant 1. reactant 2 >> product molecule. The reactants and product molecules are represented using the simplified molecular input line specification SMILES format, that is, the text representation of the molecule. Then, the reaction data is divided into 10 reaction data sets according to the reaction type value. The chemical reaction data of each reaction data set is preprocessed. The CSV file or TXT file containing the reaction data is read, and the SMILES of the reactants and the SMILES of the product molecules are extracted. The quality of the reactant and product molecule SMILES is checked. Unqualified data was filtered out, and then the root alignment mode was used to randomly select an atom from the product molecule as the root atom. The atomic order of the reactants was then adjusted according to the atomic mapping to align them with the product molecule. The enhanced data was generated repeatedly until the data was amplified 20 times the original. The SMILES was then segmented. The segmentation was achieved through regular expressions, and the parts that met the following rules were regarded as tokens. The rules included atoms in square brackets, element symbols, and single numbers. The reaction expressions were converted into tokens separated by spaces. Finally, the processed source data and target data were saved in the source data file and the target data file respectively. Finally, the information of the product molecules and reactant lists was extracted for the ten reaction data sets to obtain the updated reaction data sets.

4. The single-step retrosynthetic reaction prediction method according to claim 2, wherein The reactant list obtained in step 1 is the SMILES of multiple reactant molecules corresponding to the SMILES of the enhanced product molecule predicted, and the SMILES are connected by ".". The retrosynthetic reaction prediction model is implemented based on the Transformer model. Both Transformer models consist of an encoder, a decoder, and an output linear layer.

5. The single-step retrosynthetic reaction prediction method according to claim 4, wherein The encoder mainly consists of an embedding layer, a multi-head attention layer, and a feedforward neural network layer. Its specific structure is as follows: The embedding layer is a linear network. The input of the embedding layer is the molecular information of a batch of product molecules corresponding to the reaction data set under a certain reaction category. The output is a set of embedding vectors of Batch_size×Seq_length×512, where Batch_size represents the batch size, Seq_length represents the maximum number of tokens used for each molecule in the current batch, and 512 is the dimension of the latent space. The embedding layer includes word embedding layer and position encoding layer; The input of the word embedding layer is the molecular information of a batch of molecules corresponding to the reaction data set under a certain reaction type, that is, a matrix of Batch_size×Seq_length×Len, and the output is a word embedding vector set of Batch_size×Seq_length×512; The input of the position encoding layer is the molecular information of a batch of molecules corresponding to the reaction data set under a certain reaction type, that is, a matrix of Batch_size×Seq_length×Len, and the output is a word embedding vector set of Batch_size×Seq_length×512.

6. The single-step retrosynthetic reaction prediction method according to claim 5, wherein The input of the multi-head self-attention layer is the word embedding vector set output by the embedding layer, that is, a matrix of Batch_size×Seq_length×512, and the output is a set of attention vectors of Batch_size×Seq_length×512.

7. The single-step retrosynthetic reaction prediction method according to claim 6, wherein The input of the feedforward neural network layer is the vector set of Batch_size×Seq_length×512 output by the multi-head attention layer, and the output is the molecular representation vector set of Batch_size×Seq_length×512; The encoder layer consists of a multi-head self-attention layer and a feedforward neural network layer, with a total of 6 layers stacked; the input of the encoder layer is a word embedding vector set, and the output is a molecular representation vector set encoder_out.

8. The single-step retrosynthetic reaction prediction method according to claim 7, wherein The decoder mainly consists of an embedding layer, a masked multi-head attention layer, a multi-head attention layer, and a feedforward neural network layer; The embedding layer is a linear neural network whose input is the known result x from the beginning to the current time t t , the output is a word embedding vector set of Batch_size×Seq_length×512; The specific structure of the embedding layer and the input processing process are exactly the same as the embedding layer module of the encoder; The input of the masked multi-head attention layer module is the word embedding vector set output by the decoder embedding layer, and the output is a masked attention vector set of Batch_size×Seq_length×512; The input of the multi-head attention layer module is the vector set output by the decoder mask multi-head attention layer, and the output is a set of attention vectors of Batch_size×Seq_length×512; The specific structure of the feedforward neural network layer and the input processing process are exactly the same as the feedforward neural network layer in the encoder; The decoder layer consists of a masked multi-head attention layer, a multi-head attention layer, and a feedforward neural network layer, with a total of 6 layers stacked; The input of the decoder layer is the result x at time t t The word embedding vector set is output as the molecular representation vector set decoder_out; The input of the output linear layer is the output decoder_out of the decoder, and the output is a matrix vector of Batch_size×Seq_length×V, where V is the number of molecular vocabularies; In the process of predicting reactants, the product molecule SMILES is input into the encoder to obtain the encoder output encoder_out. Starting from time t=0, the first symbol of the output data is the start symbol, and the rest are masked. The data passes through the decoder and the output linear layer to obtain the probability distribution of the next word unit token. The index of the token is extracted according to the probability and used as known information. The above process is repeated until the data passes through the decoder and the output linear layer and the index of the terminator is extracted. The prediction process ends and the reactant list is obtained.

9. The single-step retrosynthetic reaction prediction method according to claim 7, wherein In step 1, the predetermined process processing is performed as follows: data processing is performed on the first to tenth category reaction data sets according to the division of the training set, test set and validation set in the data set USPTO-50K to obtain the training set, test set and validation set of each reaction type; all the above sets are preprocessed to obtain updated reaction data sets respectively, and the information of each product molecule and reactant list is extracted from each reaction data set respectively, and then the information of all product molecules and reactant lists in the first to tenth category reaction data sets are respectively formed into updated first to tenth category reaction data sets.

10. A single-step retrosynthetic reaction prediction system based on the method according to any one of claims 1 to 9, characterized in that: include: The first module obtains a plurality of synthesis reaction data, each synthesis reaction data having a reaction type value, constructs all reaction data with reaction type values ​​of 1 to 10 into first to tenth category reaction data sets, and preprocesses all the above reaction data sets to obtain ten updated reaction data sets; The second module inputs the product molecule information sets from the ten reaction data information sets obtained in the first module into a pre-trained retrosynthesis reaction prediction model to obtain a list of reactants required to generate each product molecule.

Citation Information

Patent Citations

  • Deep learning-based inverse synthesis prediction method and device, medium and equipment

    CN114220496A

  • Diversified inverse synthesis analysis model evaluation method and device

    CN117972531A