Chemical reaction inverse synthesis prediction model training and application method, equipment and medium
By pre-training and fine-tuning the natural language processing model, a chemical reaction inverse synthesis prediction model is generated, which solves the problems of low generalization ability and low accuracy of inverse synthesis prediction in the prior art, and achieves high-accuracy inverse synthesis prediction.
Patent Information
- Application Number
- CN202411658234.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-04-15
AI Technical Summary
Existing computer-aided synthesis planning techniques have low generalization capabilities and low accuracy in reverse synthesis prediction, especially when dealing with multi-reaction center reactions.
By obtaining the preset chemical reaction training set and inverse synthesis training set, the natural language processing model is pre-trained and fine-tuned to generate a chemical reaction inverse synthesis prediction model. This model can improve the accuracy of reverse synthesis prediction based on product in the case of indirectly relying on reaction templates.
It realizes high-accuracy prediction of chemical reaction inverse synthesis without relying on model information, improving the generalization ability and accuracy of computer-aided synthesis planning.
Smart Images

Figure CN119833014A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer-aided synthesis, and in particular to a chemical reaction retrosynthesis prediction model training method, a chemical reaction retrosynthesis prediction model application method, an electronic device and a computer-readable medium. Background Art
[0002] In the prior art, predicting the reactants of organic reactions and planning retrosynthetic routes are important research directions in the field of chemistry. For the situation where the retrosynthetic speculation of the reactants needs to be speculated for the known products, the retrosynthetic speculation is difficult due to the large number of possible reactants and the possibility of multiple different chemical reaction mechanisms.
[0003] Generally speaking, computer-aided synthesis planning (CASP) can be used to assist researchers in inferring and planning chemical reaction retrosynthesis. Computer-aided synthesis planning is currently divided into template-based, semi-template-based, and template-free methods. Template-based methods rely on existing reaction templates for reaction inference, but the number of reaction templates in the reaction template library is limited, resulting in insufficient generalization and expansion capabilities of template-based computer-aided synthesis planning. On the basis of template-based reaction inference, semi-template-based inference methods can also learn new reaction modes to a certain extent during the training process and expand existing reaction templates. However, existing semi-template-based inference methods still have difficulty in handling reactions involving multiple reaction centers. Template-free inference methods can infer retrosynthetic routes without reaction templates, but they may lack expert knowledge related to the chemical reaction mechanism, and the inference results are usually less accurate. Summary of the invention
[0004] Embodiments of the present invention provide a chemical reaction retrosynthesis prediction model training method, a chemical reaction retrosynthesis prediction model application method, an electronic device and a computer-readable medium to solve the problems of low generalization ability and low accuracy of computer-aided synthesis planning.
[0005] The embodiment of the present invention discloses a method for training a chemical reaction retrosynthesis prediction model, characterized in that the method comprises:
[0006] Obtaining a preset chemical reaction training set; the chemical reaction training set includes a plurality of chemical reaction character strings, and the chemical reaction character strings include product characters, reactant characters, and reaction template characters;
[0007] Using the chemical reaction character string to train a preset natural language processing model to obtain a pre-trained model;
[0008] Obtaining a preset chemical reaction retrosynthesis training set; wherein the chemical reaction retrosynthesis training set includes at least one chemical reaction retrosynthesis character string; wherein the chemical reaction retrosynthesis character string includes the product character and the reactant character;
[0009] The product characters in the chemical reaction reverse synthesis character string are used as input, the reactant characters in the chemical reaction reverse synthesis character string are used as output, and the pre-trained model is fine-tuned to obtain a chemical reaction reverse synthesis prediction model.
[0010] Optionally, the step of obtaining a preset chemical reaction training set includes:
[0011] Obtain molecular formulas of several chemical substances from a preset molecular database;
[0012] For a molecular formula of any chemical substance, the molecular formula of the chemical substance is split into several molecular fragments;
[0013] Matching the molecular fragment with a reaction center in a preset reaction template, and using the successfully matched reaction template as a target reaction template;
[0014] The molecular formula of the chemical substance and the target reaction template are used to generate a chemical reaction string to obtain a chemical reaction training set.
[0015] Optionally, the chemical reaction string includes a standard chemical reaction string and a non-standard reaction string; wherein the product characters and reactant characters in the standard chemical reaction string comply with simplified molecular linear input specifications; and the product characters and / or reactant characters in the non-standard reaction string do not comply with simplified molecular linear input specifications.
[0016] Optionally, the step of using the chemical reaction character string to train a preset natural language processing model to obtain a pre-trained model includes:
[0017] Using the product characters in the chemical reaction character string as the input of the natural language processing model, using the reactant characters and the reaction template characters in the chemical reaction character string as the output of the natural language processing model, training the preset natural language processing model to obtain a pre-trained model;
[0018] and / or,
[0019] The reactant characters in the chemical reaction character string are used as the input of the natural language processing model, and the product characters and the reaction template characters in the chemical reaction character string are used as the output of the natural language processing model. The preset natural language processing model is trained to obtain a pre-trained model.
[0020] Optionally, the method further comprises:
[0021] Inputting product characters into the pre-trained model, obtaining reactant characters and reaction template characters output by the pre-trained model; inputting reactant characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtaining product characters output by the chemical reaction processing tool; determining whether the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are the same chemical substance; if the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are not the same chemical substance, adjusting the pre-trained model;
[0022] and / or,
[0023] Input the reactant characters into the pre-trained model, and obtain the product characters and reaction template characters output by the pre-trained model; input the product characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtain the reactant characters output by the chemical reaction processing tool; determine whether the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are the same chemical substance; if the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are not the same chemical substance, adjust the pre-trained model.
[0024] Optionally, the chemical reaction retrosynthesis training set is obtained based on at least one chemical reaction data set;
[0025] The step of taking the product characters in the chemical reaction reverse synthesis character string as input, taking the reactant characters in the chemical reaction reverse synthesis character string as output, and fine-tuning the pre-trained model to obtain a chemical reaction reverse synthesis prediction model comprises:
[0026] For any of the chemical reaction data sets, the product characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set are used as input, and the reactant characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set are used as output, and the pre-trained model is fine-tuned to obtain a chemical reaction reverse synthesis prediction model corresponding to the chemical reaction data set.
[0027] Optionally, the method further comprises:
[0028] Performing word segmentation on the character string corresponding to the chemical substance to obtain a plurality of word units;
[0029] Assign corresponding identifiers to the word-units respectively;
[0030] Based on the correspondence between the word units and the identifiers, a vocabulary of the natural language processing model is constructed, and the vocabulary is used by the natural language processing model to perform word segmentation encoding processing on a character string input to the model.
[0031] The embodiment of the present invention further provides an application method of a chemical reaction retrosynthesis prediction model, wherein the chemical reaction retrosynthesis prediction model is trained using the method described in the embodiment of the present invention;
[0032] The method comprises:
[0033] Get the product string input by the user;
[0034] The product character string is input into the chemical reaction retrosynthesis prediction model to obtain the reactant character string output by the chemical reaction retrosynthesis prediction model.
[0035] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0036] The memory is used to store computer programs;
[0037] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0038] The embodiment of the present invention further discloses one or more computer-readable media on which instructions are stored. When executed by one or more processors, the processors are enabled to execute the method described in the embodiment of the present invention.
[0039] The embodiments of the present invention include the following advantages:
[0040] Through the chemical reaction reverse synthesis prediction model training method provided by the embodiment of the present invention, a preset chemical reaction training set is obtained; the chemical reaction training set includes several chemical reaction character strings, and the chemical reaction character strings include product characters, reactant characters, and reaction template characters; the preset natural language processing model is trained using the chemical reaction character strings to obtain a pre-trained model; a preset chemical reaction reverse synthesis training set is obtained; wherein the chemical reaction reverse synthesis training set includes at least one chemical reaction reverse synthesis character string; wherein the chemical reaction reverse synthesis character string includes product characters and reactant characters; the product characters in the chemical reaction reverse synthesis character string are used as input, and the reactant characters in the chemical reaction reverse synthesis character string are used as output, and the pre-trained model is fine-tuned to obtain a chemical reaction reverse synthesis prediction model. Thus, the model can be trained to learn the characteristics of the chemical reaction in the pre-training stage, so that the model can have the ability to understand the chemical reaction, and then the model is trained to generate reactants based on the product in the fine-tuning process, thereby, the obtained chemical reaction reverse synthesis prediction model can realize the prediction of chemical reaction reverse synthesis without relying on model information, and has a high accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a flow chart of the steps of a chemical reaction retrosynthesis prediction model training method provided in an embodiment of the present invention;
[0042] Figure 2 It is a flow chart of the steps of a chemical reaction retrosynthesis prediction model training method provided in an embodiment of the present invention;
[0043] Figure 3 is a schematic diagram of pre-training of a chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention;
[0044] Figure 4 is a schematic diagram of pre-training of a chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention;
[0045] Figure 5 It is a flow chart of the steps of a method for applying a chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention;
[0046] Figure 6 Schematic diagram of an application method of a chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention;
[0047] Figure 7 It is a structural block diagram of a chemical reaction retrosynthesis prediction model training device provided in an embodiment of the present invention;
[0048] Figure 8 It is a structural block diagram of a chemical reaction retrosynthesis prediction model application device provided in an embodiment of the present invention;
[0049] Fig. 9 is a block diagram of an electronic device provided in an embodiment of the present invention;
[0050] Fig.10 is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0052] Reference Figure 1 , shows a flow chart of the steps of a chemical reaction retrosynthesis prediction model training method provided in an embodiment of the present invention, which may specifically include the following steps:
[0053] Step 101, obtaining a preset chemical reaction training set; the chemical reaction training set includes a plurality of chemical reaction character strings, and the chemical reaction character strings include product characters, reactant characters, and reaction template characters;
[0054] Specifically, in order to train the model, a chemical reaction training set may be prepared, which may include a number of chemical reaction character strings.
[0055] The chemical reaction string can use characters to express information such as reactants and products in the chemical reaction formula. The chemical reaction string can express the chemical reaction synthesis process and the reverse synthesis process of the chemical reaction.
[0056] At the same time, the chemical reaction string may also contain reaction template characters corresponding to the reaction template. The reaction template can be used to describe a chemical reaction, defining which parts of the reactants will be converted into which parts of the products. Thus, other chemical substances with similar structures to the reactants in the reaction template can also react in a similar manner to the reaction in the reaction template to obtain corresponding products.
[0057] As an example of the present invention, Figure 2 It is a schematic diagram of a reaction based on a reaction template shown in an embodiment of the present invention.
[0058] Among them, the reaction template can be Figure 2 As shown in (a), the x structure in the reactant R1 can react with the y structure in the reactant R2 to obtain the product F1 having the z structure. Thus, the reactant R3 having the x structure can react with the reactant R4 having the y structure in the same manner as the reaction template to obtain the product F2 having the z structure.
[0059] Reaction templates can also be represented as characters, so that you can get a reaction template character, for example, Figure 2 The reaction template shown in (a) can be expressed as: (-[c;H0;D3;+0:1](:[c:2]):[c:3][#7;a:4].OB(-O)-[CH;D3;+0:5]1-[C:6]-[C:7]-1)>>([#7;a:4]:[c:3]:[c;H0;D3;+0:1](:[c:2])-[CH;D3;+0:5]1-[C:6]-[C:7]-1).
[0060] In a specific implementation, the chemical reaction string may also include identifiers representing products, reactants, and reaction templates, so that the model can correctly identify the meanings represented by different characters in the chemical reaction string. In addition, the chemical reaction string also includes identifiers for distinguishing chemical reaction synthesis and chemical reaction reverse synthesis, as well as a start identifier for indicating the start of a character, and a stop identifier for indicating the end of a character.
[0061] As a specific example of the present invention, the chemical reaction string can be " <f>" as the reactant identifier, using " <o>" indicates the product identifier, using " <r>" indicates the reaction template identifier, using " <s> " as the starting identifier, using "< / s> " as the termination identifier, using " <isyn>" indicates chemical reaction reverse synthesis. If it does not contain " <isyn>" identifier, it means that the chemical reaction string is a chemical reaction synthesis.
[0062] For example, a chemical reaction string can be represented as <s> <isyn> <o>O=Cc1c(cc(cc1)F)Cl <f1>Fc1ccc(C(Br)Br)c(Cl)c1 <f2> O=CO< / f2> < / o> < / isyn> < / s> .in, <s>Indicates the start character, <isyn>represents a retrosynthetic task, <o>Indicates the product, <f1>represents the first reactant, <f2> represents the second reactant,< / f2> < / o> < / isyn> < / s> is the terminator.
[0063] Step 102, training a preset natural language processing model using the chemical reaction character string to obtain a pre-trained model;
[0064] In an embodiment of the present invention, a natural language processing model may be selected and trained using chemical reaction character strings so that the natural language processing model may have the ability to understand chemical reactions.
[0065] Among them, the natural language processing model can adopt LLaMA2 (Large Language Model Meta AI), BERT (Bidirectional Encoder Representations from Transformers), LSTM (Long Short-Term Memory), etc., and the present invention is not limited to this.
[0066] Among them, LLaMA2 has good natural language processing capabilities. It captures long-distance dependencies in text through the self-attention mechanism, and can better understand the expressions in chemical reaction strings.
[0067] Specifically, the natural language processing model can be trained using a chemical reaction training set, and part of the content in the chemical reaction string can be used as input. The trained natural language processing model can infer the remaining content in the chemical reaction string based on the partial content in the chemical reaction string, and complete the chemical reaction string, so that the natural language processing model has the ability to understand the chemical reaction string as a language, thereby obtaining a pre-trained model.
[0068] Thus, the part describing the product or the part describing the reactant in the chemical reaction string can be input, so that the natural language processing model can use the chemical reaction string as a language, and use the part of the chemical reaction string input as the model as the previous context to infer the following context, that is, the remaining part of the chemical reaction string. Thus, the reactant corresponding to the product in the chemical reaction string, or the product corresponding to the reactant can be inferred. In addition, the reaction templates associated with the product and the reactant can also be inferred according to actual needs.
[0069] Step 103, obtaining a preset chemical reaction retrosynthesis training set; wherein the chemical reaction retrosynthesis training set includes at least one chemical reaction retrosynthesis character string; wherein the chemical reaction retrosynthesis character string includes the product character and the reactant character;
[0070] Specifically, after obtaining a pre-trained model with the ability to understand chemical reaction strings, the pre-trained model can be further fine-tuned so that the model can handle specific chemical reaction retrosynthesis prediction tasks.
[0071] Thus, a chemical reaction retrosynthesis training set can be obtained to fine-tune the pre-trained model. The chemical reaction retrosynthesis training set may include at least one chemical reaction retrosynthesis string. Specifically, the chemical reaction retrosynthesis string includes product characters and reactant characters, but does not include a reaction template. Thus, the fine-tuned trained model can achieve inference of reactants based on products without the assistance of reaction templates.
[0072] Step 104, taking the product characters in the chemical reaction reverse synthesis character string as input, taking the reactant characters in the chemical reaction reverse synthesis character string as output, fine-tuning the pre-trained model to obtain a chemical reaction reverse synthesis prediction model.
[0073] In a specific implementation, the product characters in the chemical reaction reverse synthesis string can be used as input, and the product characters in the chemical reaction reverse synthesis string can be used as output to fine-tune the pre-trained model to obtain a chemical reaction reverse synthesis prediction model. The pre-trained model can output reactants based on the products to achieve chemical reaction reverse synthesis prediction.
[0074] At the same time, since the chemical reaction retrosynthesis string used in fine-tuning does not contain a reaction template, the model does not need the assistance of a reaction template in the process of inferring the chemical reaction retrosynthesis. At the same time, in the pre-training process, the model is trained through the chemical reaction string, and the model has acquired prior knowledge about reactants, products, and reaction templates. Therefore, the chemical reaction retrosynthesis prediction model can accurately infer reactants based on products in the process of processing chemical reaction retrosynthesis tasks based on the knowledge of chemical reaction synthesis and chemical reaction retrosynthesis learned in advance.
[0075] Through the chemical reaction reverse synthesis prediction model training method provided by the embodiment of the present invention, a preset chemical reaction training set is obtained; the chemical reaction training set includes several chemical reaction character strings, and the chemical reaction character strings include product characters, reactant characters, and reaction template characters; the preset natural language processing model is trained using the chemical reaction character strings to obtain a pre-trained model; a preset chemical reaction reverse synthesis training set is obtained; wherein the chemical reaction reverse synthesis training set includes at least one chemical reaction reverse synthesis character string; wherein the chemical reaction reverse synthesis character string includes product characters and reactant characters; the product characters in the chemical reaction reverse synthesis character string are used as input, and the reactant characters in the chemical reaction reverse synthesis character string are used as output, and the pre-trained model is fine-tuned to obtain a chemical reaction reverse synthesis prediction model. Thus, the model can be trained to learn the characteristics of the chemical reaction in the pre-training stage, so that the model can have the ability to understand the chemical reaction, and then the model is trained to generate reactants based on the product in the fine-tuning process, thereby, the obtained chemical reaction reverse synthesis prediction model can realize the prediction of chemical reaction reverse synthesis without relying on model information, and has a high accuracy.
[0076] In one embodiment of the present invention, the step of obtaining a preset chemical reaction training set includes:
[0077] S11, obtaining molecular formulas of several chemical substances from a preset molecular database;
[0078] S12, for a molecular formula of any chemical substance, splitting the molecular formula of the chemical substance into a plurality of molecular fragments;
[0079] S13, matching the molecular fragment with a reaction center in a preset reaction template, and using the successfully matched reaction template as a target reaction template;
[0080] S14, using the molecular formula of the chemical substance and the target reaction template to generate a chemical reaction string to obtain a chemical reaction training set.
[0081] In a specific implementation, the construction of the chemical reaction training set can be based on the matching of the existing chemical substance molecular formula with the reaction template, generate the chemical reaction that can be realized in theory, and obtain the chemical reaction string. Thus, the molecular formula of the known chemical substance can be extracted from the preset molecular database. Among them, the molecular database can be pubchem, chembl, enamine, etc., and the present invention does not limit this.
[0082] Thereafter, in order to facilitate matching of the chemical substance with the reaction template, the molecular formula of the chemical substance may be split. Specifically, by identifying a specific type of chemical bond associated with the chemical reaction in the molecule of the chemical substance, and identifying and breaking the chemical bond based on a preset bond breaking rule, the molecular formula of the chemical substance may be split into several molecular fragments, and each molecular fragment may contain a structure associated with the chemical reaction. As a specific example of the present invention, the BRICS (Breaking of Retrosynthetically Interesting Chemical Substructures) method may be used to split the chemical reaction formula into several molecular fragments.
[0083] For a reaction template, it may have a reaction center, which may refer to an area where chemical bonds are broken and formed during the reaction. Thus, the molecular fragments may be matched with the reaction centers in the reaction template to identify whether there is a structure identical or similar to the reaction center in the molecular fragments. If there is a structure identical or similar to the reaction center in the molecular fragments, it may be considered that the molecular formula of the chemical reaction may be reacted in a reaction manner similar to that of the reaction template, and the reaction template corresponding to the reaction center may be used as the target reaction template.
[0084] Afterwards, the chemical reaction mode related to the chemical substance can be inferred based on the molecular formula of the chemical substance and the target reaction template to generate a chemical reaction string. Specifically, if the molecular fragment matches the reaction center of the product in the reaction template, the chemical reaction string based on the reactant to generate the molecular formula of the chemical substance can be inferred based on the molecular formula of the chemical substance and the target reaction template. If the molecular fragment matches the reactant in the reaction template, the chemical reaction string based on the molecular formula of the chemical substance to generate the product can be inferred based on the molecular formula of the chemical substance and the target reaction template.
[0085] Thus, multiple chemical reaction character strings can be obtained, and the chemical reaction character strings are used as chemical reaction training sets to train the model.
[0086] In one embodiment of the present invention, the chemical reaction string includes a standard chemical reaction string and a non-standard reaction string; wherein the product characters and reactant characters in the standard chemical reaction string comply with the simplified molecular linear input specification; and the product characters and / or reactant characters in the non-standard reaction string do not comply with the simplified molecular linear input specification.
[0087] In order to further train the chemical reaction set so that the trained model can adapt to different types of inputs, the expression form in the chemical reaction string can be adjusted.
[0088] Generally speaking, chemical reaction strings can be expressed using the Simplified Molecular Input Line Entry System (SMILES). The Simplified Molecular Input Line Entry System can be a text format for representing molecular structures, which can describe the topological structure, atom type, and chemical bonds of molecules by using ASCII strings. If the product characters and reactant characters in the chemical reaction string conform to the Simplified Molecular Input Line Entry System, it can be considered a standard chemical reaction string. If the product characters and / or reactant characters in the chemical reaction string do not conform to the Simplified Molecular Input Line Entry System, it can be considered a non-standard reaction string.
[0089] Specifically, the simplified molecular linear input specification may generally have a fixed expression rule, and the corresponding string may generally remain unchanged when the chemical substance remains unchanged. In a specific implementation, the standard chemical reaction string of the chemical reaction may be generated using a chemical programming tool such as RDKit for generating molecular descriptors.
[0090] Subsequently, based on the standard chemical reaction string, the selection of the root node (root) in the product and / or reactant in the process of constructing the chemical reaction string can be changed to generate a character representation different from the simplified molecular linear input specification expression rule, thereby obtaining a non-standard chemical reaction string.
[0091] By including both standard chemical reaction strings and non-standard reaction strings in the chemical reaction strings, the robustness of the trained model can be further enhanced, so that the model can better adapt to different forms of chemical reaction expressions and more accurately realize the inference of chemical reaction retrosynthesis tasks.
[0092] In one embodiment of the present invention, the step of using the chemical reaction character string to train a preset natural language processing model to obtain a pre-trained model includes:
[0093] S21, using the product characters in the chemical reaction character string as the input of the natural language processing model, using the reactant characters and the reaction template characters in the chemical reaction character string as the output of the natural language processing model, training the preset natural language processing model to obtain a pre-trained model;
[0094] and / or,
[0095] S22, using the reactant characters in the chemical reaction character string as the input of the natural language processing model, using the product characters and the reaction template characters in the chemical reaction character string as the output of the natural language processing model, training the preset natural language processing model to obtain a pre-trained model.
[0096] In a specific implementation, in order to enable the model to better understand the knowledge related to chemical reactions, chemical reaction strings related to chemical reaction synthesis and chemical reaction strings related to chemical reaction reverse synthesis can be simultaneously input into the natural language processing model for pre-training.
[0097] Specifically, chemical reaction strings related to chemical reaction synthesis and chemical reaction strings related to chemical reaction retrosynthesis may both contain reactant characters, product characters, and chemical template characters. In chemical reaction strings related to chemical reaction synthesis, characters are arranged in order according to reactants, products, and reaction templates. In chemical reaction strings related to chemical reaction retrosynthesis, characters are arranged in order according to products, reactants, and reaction templates. Thus, the front part of the chemical reaction string can be input into a natural language processing model, so that the natural language processing model uses the front part of the chemical reaction string as the previous context and infers the remaining part of the chemical reaction string that follows the previous context.
[0098] For chemical reaction synthesis tasks, Figure 3 Schematic diagram of a pre-training of a chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention. The reactant characters 301 at the front of the chemical reaction string can be used as the input of the natural language processing model 302, and the natural language processing model 302 is trained to infer the product characters 303 and the reaction template characters 304 following the reactant characters to obtain a pre-trained model.
[0099] For chemical reaction reverse synthesis tasks, Figure 4 4 is a schematic diagram of a pre-training of a chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention. The product characters 401 at the front of the chemical reaction string can be used as the input of the natural language processing model 402, and the natural language processing model 402 is trained to infer the reactant characters 403 and the reaction template characters 404 following the product characters to obtain a pre-trained model.
[0100] In one embodiment of the present invention, the method further comprises:
[0101] S31, inputting product characters into the pre-trained model, obtaining reactant characters and reaction template characters output by the pre-trained model; inputting reactant characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtaining product characters output by the chemical reaction processing tool; determining whether the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are the same chemical substance; if the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are not the same chemical substance, adjusting the pre-trained model;
[0102] and / or,
[0103] S32, inputting the reactant characters into the pre-trained model, and obtaining the product characters and the reaction template characters output by the pre-trained model; inputting the product characters and the reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtaining the reactant characters output by the chemical reaction processing tool; determining whether the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are the same chemical substance; if the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are not the same chemical substance, adjusting the pre-trained model.
[0104] In the specific implementation, in order to further improve the training effect of pre-training, the model training can be optimized by reinforcement learning during the training process. After the natural language model is trained based on the chemical reaction strings in the chemical reaction training set and the pre-training model is obtained, the training effect of the model can be verified by predicting whether the model input can be obtained based on the output of the model.
[0105] Specifically, a tool for processing chemical reactions based on reaction templates, such as RDChiral, can be used to test whether the output of the model is correct.
[0106] For a chemical reaction synthesis task, the reactant characters may be input into the pre-trained model to obtain the product characters and reaction template characters output by the pre-trained model. Thereafter, the product characters and reaction template characters output by the pre-trained model may be input into a chemical reaction processing tool, so that the chemical reaction processing tool outputs reactant characters based on the product characters and reaction template characters.
[0107] Afterwards, the reactant characters in the pre-trained model can be compared with the reactant characters output by the chemical reaction processing tool to determine whether the reactant characters output by the two belong to the same chemical substance, so as to determine whether the output of the model is accurate. If the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are the same chemical substance, then it can be considered that the pre-trained model has output the correct reactant, and the pre-trained model has been trained. If the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are not the same chemical substance, then it can be considered that the accuracy of the pre-trained model has not yet reached the target, and the pre-trained model can continue to be adjusted.
[0108] The parameters in the pre-trained model can be adjusted based on the degree of deviation between the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool, and the product characters and reaction template characters output by the pre-trained model are obtained by inputting the reactant characters into the pre-trained model again, and the product characters and reaction template characters output by the pre-trained model are input into the chemical reaction processing tool, so that the chemical reaction processing tool outputs reactant characters based on the product characters and the reaction template characters, and the reactant characters in the pre-trained model are compared with the reactant characters output by the chemical reaction processing tool to determine whether the reactant characters output by both belong to the same chemical substance, so as to determine whether the output of the model is accurate, and the pre-trained model is iteratively trained until the accuracy of the pre-trained model meets the requirements.
[0109] For a chemical reaction retrosynthesis task, the reactant characters may be input into the pre-trained model to obtain the product characters and reaction template characters output by the pre-trained model. Thereafter, the product characters and reaction template characters output by the pre-trained model may be input into a chemical reaction processing tool, so that the chemical reaction processing tool outputs reactant characters based on the product characters and reaction template characters.
[0110] Afterwards, the reactant characters in the pre-trained model can be compared with the reactant characters output by the chemical reaction processing tool to determine whether the reactant characters output by the two belong to the same chemical substance, so as to determine whether the output of the model is accurate. If the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are the same chemical substance, then it can be considered that the pre-trained model has output the correct reactant, and the pre-trained model has been trained. If the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are not the same chemical substance, then it can be considered that the accuracy of the pre-trained model has not yet reached the target, and the pre-trained model can continue to be adjusted.
[0111] The parameters in the pre-trained model can be adjusted based on the degree of deviation between the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool, and the product characters and reaction template characters output by the pre-trained model are obtained by inputting the reactant characters into the pre-trained model again, and the product characters and reaction template characters output by the pre-trained model are input into the chemical reaction processing tool, so that the chemical reaction processing tool outputs reactant characters based on the product characters and the reaction template characters, and the reactant characters in the pre-trained model are compared with the reactant characters output by the chemical reaction processing tool to determine whether the reactant characters output by both belong to the same chemical substance, so as to determine whether the output of the model is accurate, and the pre-trained model is iteratively trained until the accuracy of the pre-trained model meets the requirements.
[0112] In one embodiment of the present invention, the chemical reaction retrosynthesis training set is obtained based on at least one chemical reaction data set;
[0113] The step of taking the product characters in the chemical reaction reverse synthesis character string as input, taking the reactant characters in the chemical reaction reverse synthesis character string as output, and fine-tuning the pre-trained model to obtain a chemical reaction reverse synthesis prediction model comprises:
[0114] S41, for any of the chemical reaction data sets, using the product characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set as input, and using the reactant characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set as output, fine-tuning the pre-trained model to obtain a chemical reaction reverse synthesis prediction model corresponding to the chemical reaction data set.
[0115] In a specific implementation, in the fine-tuning stage, real chemical reaction data can be used to fine-tune the model so that the model can have the ability to handle chemical reaction reverse synthesis tasks with a higher accuracy.
[0116] In a specific implementation, the real chemical reaction data may have multiple different databases, and the chemical reaction data sets in different databases may be different. The databases may be USPTO-50K, USPTO-MIT, USPTO-FULL, etc.
[0117] In order to adapt to the chemical reaction space in different scenarios, different chemical reaction data sets can be used to construct chemical reaction retrosynthesis training sets, and different chemical reaction retrosynthesis training sets can be used to fine-tune the pre-trained model to obtain one or more chemical reaction retrosynthesis prediction models that are adapted to different scenarios.
[0118] Therefore, for any chemical reaction data set, the product characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set can be used as input, and the reactant characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set can be used as output to fine-tune the pre-trained model to obtain a chemical reaction reverse synthesis prediction model corresponding to the chemical reaction data set.
[0119] In one embodiment of the present invention, the method further comprises:
[0120] S51, performing word segmentation processing on the character string corresponding to the chemical substance to obtain a plurality of word units;
[0121] S52, assigning corresponding identifiers to the word-units respectively;
[0122] S53, constructing a vocabulary of the natural language processing model based on the correspondence between the word unit and the identifier, wherein the vocabulary is used by the natural language processing model to perform word segmentation encoding processing on the character string input to the model.
[0123] Specifically, in order to enable the natural language processing model to have the ability to process chemical reaction strings, when constructing the natural language processing model, the original structure of the natural language processing model can remain unchanged, but a corresponding vocabulary can be constructed for the chemical reaction prediction scenario.
[0124] Thus, the character string representation corresponding to the known chemical substance can be extracted from the preset molecular database, wherein the molecular database can be pubchem, chembl, enamine, etc., and the present invention does not limit this.
[0125] Afterwards, the character string corresponding to the chemical substance can be segmented to obtain a number of tokens. A token can be a basic unit in a text, which can be the smallest unit for a natural language model to process a text. A token can be a word, a subword, a character, or other text fragment, which is not limited in the present invention. In a specific implementation, the token processing can adopt BPE (Byte Pair Encoding) token segmentation.
[0126] Afterwards, corresponding identifiers (IDs) can be assigned to different dimensions respectively, and the correspondence between word units and identifiers can be recorded in a vocabulary to obtain a vocabulary of a natural language processing model.
[0127] Therefore, in the process of the natural language processing model performing word segmentation and encoding processing on the character string input to the model, the input character string can be converted into a coded representation based on the vocabulary of the natural language processing model, so as to facilitate the model to further process the chemical reaction character string.
[0128] refer to Figure 5 , Figure 5 is a flow chart of steps of a method for applying a chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention. The chemical reaction retrosynthesis prediction model is trained using the method described in an embodiment of the present invention;
[0129] The method comprises:
[0130] Step 501, obtaining a product character string input by a user;
[0131] Step 502: input the product character string into the chemical reaction retrosynthesis prediction model to obtain the reactant character string output by the chemical reaction retrosynthesis prediction model.
[0132] After the model training is completed, a chemical reaction retrosynthesis prediction model is obtained, that is, the chemical reaction retrosynthesis prediction model can be used to speculate on the chemical reaction retrosynthesis, and the product string input by the user can be obtained. The product string is input into the chemical reaction retrosynthesis prediction model to obtain the reactant string output by the chemical reaction retrosynthesis prediction model with a high accuracy.
[0133] In the specific implementation, the number of reactants output by chemical reaction retrosynthesis can be controlled, and the chemical reaction retrosynthesis prediction model can be set to specify the output number of reactants during the inference process. For example, in the chemical reaction string, you can use " <f>" represents the reactants, and <f1>Represents the first reactant, <f2>Represents the second reactant, and so on. Thus, the output of the chemical reaction retrosynthesis prediction model can be set <fn>(n≥1), thereby realizing the control of the quantity of reactants output by the chemical reaction retrosynthesis.
[0134] In a specific implementation, the complete inference of the chemical reaction retrosynthesis route can be achieved by repeatedly taking the reactants output by the chemical reaction retrosynthesis prediction model as products, and inputting the output reactants into the chemical reaction retrosynthesis prediction model again until the products cannot be inferred from the reactants.
[0135] As a specific example of the present invention, Figure 6 : is an application schematic diagram of an application method of a chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention. It can be a speculation of the retrosynthesis route of osimertinib output by the chemical reaction retrosynthesis prediction model provided in an embodiment of the present invention. The retrosynthesis route of osimertinib speculated in the embodiment of the present invention is consistent with the route provided by the R&D personnel of the product, which shows that the chemical reaction retrosynthesis prediction model provided in this application has a high accuracy rate.
[0136] Optionally, in the process of inferring the chemical reaction retrosynthesis by the chemical reaction retrosynthesis prediction model, specific data such as top1 / 3 / 5 / 10 can be generated by beam-search to provide more possible results of the chemical reaction retrosynthesis. In addition, the reactants output by the model can be post-processed such as chiral reduction of the retained part and deletion of atoms not generated at the specified site to further expand the possible results of the chemical reaction retrosynthesis, so that more possible results can be provided to R&D personnel while maintaining the accuracy of the output of the chemical reaction retrosynthesis prediction model.
[0137] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0138] Reference Figure 7 , shows a structural block diagram of a chemical reaction retrosynthesis prediction model training device provided in an embodiment of the present invention, which may specifically include the following modules:
[0139] The pre-training training set acquisition module 701 is used to acquire a preset chemical reaction training set; the chemical reaction training set includes a number of chemical reaction character strings, and the chemical reaction character strings include product characters, reactant characters, and reaction template characters;
[0140] A pre-training module 702 is used to train a preset natural language processing model using the chemical reaction string to obtain a pre-training model;
[0141] A fine-tuning training set acquisition module 703 is used to acquire a preset chemical reaction retrosynthesis training set; wherein the chemical reaction retrosynthesis training set includes at least one chemical reaction retrosynthesis string; wherein the chemical reaction retrosynthesis string includes the product character and the reactant character;
[0142] The fine-tuning module 704 is used to take the product characters in the chemical reaction retrosynthesis string as input and the reactant characters in the chemical reaction retrosynthesis string as output, and fine-tune the pre-trained model to obtain a chemical reaction retrosynthesis prediction model.
[0143] Optionally, the pre-training training set acquisition module includes:
[0144] The molecular formula acquisition submodule is used to obtain the molecular formulas of several chemical substances from a preset molecular database;
[0145] A splitting submodule, for splitting the molecular formula of any chemical substance into a plurality of molecular fragments;
[0146] A template matching submodule, used to match the molecular fragment with a reaction center in a preset reaction template, and use the successfully matched reaction template as a target reaction template;
[0147] The training set generation submodule is used to generate a chemical reaction string using the molecular formula of the chemical substance and the target reaction template to obtain a chemical reaction training set.
[0148] Optionally, the chemical reaction string includes a standard chemical reaction string and a non-standard reaction string; wherein the product characters and reactant characters in the standard chemical reaction string comply with simplified molecular linear input specifications; and the product characters and / or reactant characters in the non-standard reaction string do not comply with simplified molecular linear input specifications.
[0149] Optionally, the pre-training module includes:
[0150] A synthesis training submodule, used to use the product characters in the chemical reaction character string as the input of the natural language processing model, use the reactant characters and the reaction template characters in the chemical reaction character string as the output of the natural language processing model, train the preset natural language processing model, and obtain a pre-trained model;
[0151] and / or,
[0152] The retrosynthesis training submodule is used to use the reactant characters in the chemical reaction string as the input of the natural language processing model, and the product characters and the reaction template characters in the chemical reaction string as the output of the natural language processing model, to train the preset natural language processing model to obtain a pre-trained model.
[0153] Optionally, the device further comprises:
[0154] A synthetic reinforcement training submodule, used for inputting product characters into the pre-trained model, obtaining reactant characters and reaction template characters output by the pre-trained model; inputting reactant characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtaining product characters output by the chemical reaction processing tool; determining whether the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are the same chemical substance; if the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are not the same chemical substance, adjusting the pre-trained model;
[0155] and / or,
[0156] The retrosynthesis enhancement training submodule is used to input the reactant characters into the pre-trained model, obtain the product characters and reaction template characters output by the pre-trained model; input the product characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtain the reactant characters output by the chemical reaction processing tool; determine whether the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are the same chemical substance; if the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are not the same chemical substance, adjust the pre-trained model.
[0157] Optionally, the chemical reaction retrosynthesis training set is obtained based on at least one chemical reaction data set;
[0158] The fine-tuning module comprises:
[0159] The fine-tuning submodule is used to, for any of the chemical reaction data sets, use the product characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set as input, and use the reactant characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set as output, to fine-tune the pre-trained model to obtain the chemical reaction reverse synthesis prediction model corresponding to the chemical reaction data set.
[0160] Optionally, the device further comprises:
[0161] A word segmentation processing module is used to perform word segmentation processing on the character string corresponding to the chemical substance to obtain a number of word units;
[0162] An identifier assignment module, used for assigning corresponding identifiers to the word-units respectively;
[0163] The vocabulary building module is used to build the vocabulary of the natural language processing model based on the corresponding relationship between the word element and the identifier, and the vocabulary is used by the natural language processing model to perform word segmentation encoding processing on the character string input to the model.
[0164] Reference Figure 8 , shows a structural block diagram of a chemical reaction retrosynthesis prediction model application device provided in an embodiment of the present invention, which may specifically include the following modules:
[0165] The product input module 801 is used to obtain the product character string input by the user;
[0166] The reactant output module 802 is used to input the product character string into the chemical reaction retrosynthesis prediction model to obtain the reactant character string output by the chemical reaction retrosynthesis prediction model.
[0167] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0168] In addition, an embodiment of the present invention further provides an electronic device, such as Fig. 9 As shown, it includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.
[0169] Memory 903, used for storing computer programs;
[0170] The processor 901 is used to execute the program stored in the memory 903 to implement the following steps:
[0171] Obtaining a preset chemical reaction training set; the chemical reaction training set includes a plurality of chemical reaction character strings, and the chemical reaction character strings include product characters, reactant characters, and reaction template characters;
[0172] Using the chemical reaction character string to train a preset natural language processing model to obtain a pre-trained model;
[0173] Obtaining a preset chemical reaction retrosynthesis training set; wherein the chemical reaction retrosynthesis training set includes at least one chemical reaction retrosynthesis character string; wherein the chemical reaction retrosynthesis character string includes the product character and the reactant character;
[0174] The product characters in the chemical reaction reverse synthesis character string are used as input, the reactant characters in the chemical reaction reverse synthesis character string are used as output, and the pre-trained model is fine-tuned to obtain a chemical reaction reverse synthesis prediction model.
[0175] Optionally, the step of obtaining a preset chemical reaction training set includes:
[0176] Obtain molecular formulas of several chemical substances from a preset molecular database;
[0177] For a molecular formula of any chemical substance, the molecular formula of the chemical substance is split into several molecular fragments;
[0178] Matching the molecular fragment with a reaction center in a preset reaction template, and using the successfully matched reaction template as a target reaction template;
[0179] The molecular formula of the chemical substance and the target reaction template are used to generate a chemical reaction string to obtain a chemical reaction training set.
[0180] Optionally, the chemical reaction string includes a standard chemical reaction string and a non-standard reaction string; wherein the product characters and reactant characters in the standard chemical reaction string comply with simplified molecular linear input specifications; and the product characters and / or reactant characters in the non-standard reaction string do not comply with simplified molecular linear input specifications.
[0181] Optionally, the step of using the chemical reaction character string to train a preset natural language processing model to obtain a pre-trained model includes:
[0182] Using the product characters in the chemical reaction character string as the input of the natural language processing model, using the reactant characters and the reaction template characters in the chemical reaction character string as the output of the natural language processing model, training the preset natural language processing model to obtain a pre-trained model;
[0183] and / or,
[0184] The reactant characters in the chemical reaction character string are used as the input of the natural language processing model, and the product characters and the reaction template characters in the chemical reaction character string are used as the output of the natural language processing model. The preset natural language processing model is trained to obtain a pre-trained model.
[0185] Optionally, the method further comprises:
[0186] Inputting product characters into the pre-trained model, obtaining reactant characters and reaction template characters output by the pre-trained model; inputting reactant characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtaining product characters output by the chemical reaction processing tool; determining whether the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are the same chemical substance; if the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are not the same chemical substance, adjusting the pre-trained model;
[0187] and / or,
[0188] Input the reactant characters into the pre-trained model, and obtain the product characters and reaction template characters output by the pre-trained model; input the product characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtain the reactant characters output by the chemical reaction processing tool; determine whether the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are the same chemical substance; if the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are not the same chemical substance, adjust the pre-trained model.
[0189] Optionally, the chemical reaction retrosynthesis training set is obtained based on at least one chemical reaction data set;
[0190] The step of taking the product characters in the chemical reaction reverse synthesis character string as input, taking the reactant characters in the chemical reaction reverse synthesis character string as output, and fine-tuning the pre-trained model to obtain a chemical reaction reverse synthesis prediction model comprises:
[0191] For any of the chemical reaction data sets, the product characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set are used as input, and the reactant characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set are used as output, and the pre-trained model is fine-tuned to obtain a chemical reaction reverse synthesis prediction model corresponding to the chemical reaction data set.
[0192] Optionally, the method further comprises:
[0193] Performing word segmentation on the character string corresponding to the chemical substance to obtain a plurality of word units;
[0194] Assign corresponding identifiers to the word-units respectively;
[0195] Based on the correspondence between the word units and the identifiers, a vocabulary of the natural language processing model is constructed, and the vocabulary is used by the natural language processing model to perform word segmentation encoding processing on a character string input to the model.
[0196] The processor 901, when used to execute the program stored in the memory 903, further implements the following steps:
[0197] Get the product string input by the user;
[0198] The product character string is input into the chemical reaction retrosynthesis prediction model to obtain the reactant character string output by the chemical reaction retrosynthesis prediction model.
[0199] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0200] The communication interface is used for communication between the above terminal and other devices.
[0201] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0202] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0203] like Fig.10 As shown, in another embodiment provided by the present invention, a computer-readable storage medium 1001 is also provided, in which instructions are stored. When the computer-readable storage medium 1001 is run on a computer, the computer executes the chemical reaction retrosynthesis prediction model training method or the chemical reaction retrosynthesis prediction model application method described in the above embodiments.
[0204] In another embodiment provided by the present invention, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute the chemical reaction retrosynthesis prediction model training method or the chemical reaction retrosynthesis prediction model application method described in the above embodiments.
[0205] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0206] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0207] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0208] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.< / fn> < / f> < / isyn> < / isyn> < / r> < / o> < / f>
Claims
1. A method for training a chemical reaction retrosynthesis prediction model, characterized in that: The method comprises: Obtaining a preset chemical reaction training set; the chemical reaction training set includes a plurality of chemical reaction character strings, and the chemical reaction character strings include product characters, reactant characters, and reaction template characters; Using the chemical reaction character string to train a preset natural language processing model to obtain a pre-trained model; Obtaining a preset chemical reaction retrosynthesis training set; wherein the chemical reaction retrosynthesis training set includes at least one chemical reaction retrosynthesis character string; wherein the chemical reaction retrosynthesis character string includes the product character and the reactant character; The product characters in the chemical reaction reverse synthesis character string are used as input, the reactant characters in the chemical reaction reverse synthesis character string are used as output, and the pre-trained model is fine-tuned to obtain a chemical reaction reverse synthesis prediction model.
2. The method according to claim 1, characterized in that The step of obtaining a preset chemical reaction training set includes: Obtain molecular formulas of several chemical substances from a preset molecular database; For a molecular formula of any chemical substance, the molecular formula of the chemical substance is split into several molecular fragments; Matching the molecular fragment with a reaction center in a preset reaction template, and using the successfully matched reaction template as a target reaction template; The molecular formula of the chemical substance and the target reaction template are used to generate a chemical reaction string to obtain a chemical reaction training set.
3. The method according to claim 1 or 2, characterized in that: The chemical reaction character string includes a standard chemical reaction character string and a non-standard reaction character string; wherein the product characters and reactant characters in the standard chemical reaction character string conform to the simplified molecular linear input specification; and the product characters and / or reactant characters in the non-standard reaction character string do not conform to the simplified molecular linear input specification.
4. The method according to claim 1, characterized in that The step of using the chemical reaction character string to train a preset natural language processing model to obtain a pre-trained model includes: Using the product characters in the chemical reaction character string as the input of the natural language processing model, using the reactant characters and the reaction template characters in the chemical reaction character string as the output of the natural language processing model, training the preset natural language processing model to obtain a pre-trained model; and / or, The reactant characters in the chemical reaction character string are used as the input of the natural language processing model, and the product characters and the reaction template characters in the chemical reaction character string are used as the output of the natural language processing model. The preset natural language processing model is trained to obtain a pre-trained model.
5. The method according to claim 4, characterized in that The method further comprises: Inputting product characters into the pre-trained model, obtaining reactant characters and reaction template characters output by the pre-trained model; inputting reactant characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtaining product characters output by the chemical reaction processing tool; determining whether the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are the same chemical substance; if the product characters input into the pre-trained model and the product characters output by the chemical reaction processing tool are not the same chemical substance, adjusting the pre-trained model; and / or, Input the reactant characters into the pre-trained model, and obtain the product characters and reaction template characters output by the pre-trained model; input the product characters and reaction template characters output by the pre-trained model into a preset chemical reaction processing tool, and obtain the reactant characters output by the chemical reaction processing tool; determine whether the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are the same chemical substance; if the reactant characters input into the pre-trained model and the reactant characters output by the chemical reaction processing tool are not the same chemical substance, adjust the pre-trained model.
6. The method according to claim 1, characterized in that The chemical reaction retrosynthesis training set is obtained based on at least one chemical reaction data set; The step of taking the product characters in the chemical reaction reverse synthesis character string as input, taking the reactant characters in the chemical reaction reverse synthesis character string as output, and fine-tuning the pre-trained model to obtain a chemical reaction reverse synthesis prediction model comprises: For any of the chemical reaction data sets, the product characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set are used as input, and the reactant characters in the chemical reaction reverse synthesis string corresponding to the chemical reaction data set are used as output, and the pre-trained model is fine-tuned to obtain a chemical reaction reverse synthesis prediction model corresponding to the chemical reaction data set.
7. The method according to claim 1, characterized in that The method further comprises: Performing word segmentation on the character string corresponding to the chemical substance to obtain a plurality of word units; Assign corresponding identifiers to the word-units respectively; Based on the correspondence between the word units and the identifiers, a vocabulary of the natural language processing model is constructed, and the vocabulary is used by the natural language processing model to perform word segmentation encoding processing on a character string input to the model.
8. An application method of a chemical reaction retrosynthesis prediction model, characterized in that: The chemical reaction retrosynthesis prediction model is trained by the method described in any one of 1-7; The method comprises: Get the product string input by the user; The product character string is input into the chemical reaction retrosynthesis prediction model to obtain the reactant character string output by the chemical reaction retrosynthesis prediction model.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 8 when executing the program stored in the memory.
10. A computer-readable medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 8.