A deep chemical reaction prediction method and system based on domain knowledge editing
By introducing chemical reaction constraints and deep learning models in chemical reaction prediction, combined with multiple decoding strategies, the existing methods have solved the problems of high dependence on experts and ineffective generation of existing methods, and effective prediction of specific chemical reactions is achieved.
Patent Information
- Application Number
- CN202510467532.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-15
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-04-15
AI Technical Summary
The existing chemical reaction prediction methods are highly dependent on experts in the field, and the production results are highly ineffective, making it difficult to predict specific chemical reactions.
By adding chemical reaction constraints to the reaction data of the chemical reaction to be predicted as a dynamic constraint mark, the neural network deep learning model is used for prediction, and combined with multi-head attention mechanism, position coding, beam search strategy, Top-k sampling and Top-p sampling and other technologies, SMILES sequences that meet chemical reaction constraints are generated, and post-processing and verification are performed.
It reduces the hallucination problem of generative models, improves the accuracy and coverage of prediction of specific chemical reactions, and reduces the dependence on experts in the field of chemistry.
Smart Images

Figure CN119993301B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of chemical reaction prediction, and in particular to a deep chemical reaction prediction method and system based on domain knowledge editing. Background Art
[0002] Chemical reaction prediction is a key research area in cheminformatics, aiming to predict the products of chemical reactions or, alternatively, to predict the reactants based on the products using computer algorithms. Traditional methods rely primarily on expert systems and rule-based reasoning, using predefined reaction templates and chemical transformation rules for prediction. However, these methods are limited in their generalization and ability to handle novel reactions. In recent years, with the advancement of machine learning, data-driven prediction methods have gradually become mainstream.
[0003] Existing methods for molecular reaction prediction can be broadly categorized into three categories: template-based, semi-template, and template-free. Template-based methods essentially mimic the process by which chemists select suitable reactions for target molecules based on known reaction types. These methods construct reaction templates by extracting core transformation rules from chemical reaction datasets. After establishing a library of reaction templates, algorithms match target molecules to these templates to generate corresponding predictions. Semi-template-based methods employ a strategy that combines template-driven and deep learning methods. These methods predict outputs by considering intermediates or synthetic intermediates generated during multiple steps. Typical solutions include MEGAN and Graph2Edits. Template-free methods avoid the need for building external template databases. They utilize deep learning models to directly encode reaction mechanisms, thereby enabling predictions from reactants to products. Within this technical field, this task is often compared to neural machine translation. To achieve this translation, existing solutions typically employ Transformer models equipped with graph-structured or sequence encoders and decoders. The sequence encoder and decoder are used to process and generate SMILES (Simplified Molecular Linear Input Specification System) representations of chemical substances. Template-free methods not only rely on training datasets but also lack constraints during model generation. This makes them prone to hallucinations caused by the underlying generative model, resulting in invalid or erroneous chemical reaction formulas. Summary of the Invention
[0004] In order to solve the problems of current methods that are highly dependent on domain experts, generate highly invalid results, and have difficulty in predicting specific chemical reactions, the present invention proposes a chemical reaction prediction method and system based on domain knowledge editing.
[0005] Specifically, this application is implemented through the following technical solutions:
[0006] On the one hand, this application provides a chemical reaction prediction method based on domain knowledge editing, including:
[0007] Adding chemical reaction constraints as dynamic constraint tags to reaction data of a chemical reaction to be predicted, wherein the reaction data of the chemical reaction to be predicted includes a SMILES string of a reactant or a product; and constructing a molecular graph of the reactant or the product;
[0008] Inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints;
[0009] The SMILES sequence that meets the chemical reaction constraints is post-processed and verified to obtain a prediction result of the chemical reaction to be predicted.
[0010] In one embodiment, inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints comprises:
[0011] Performing graphic encoding on the molecular graph and performing sequence decoding on the encoded molecular graph features;
[0012] The sequential decoding of the encoded molecular graph features includes: using a beam search strategy to calculate the cumulative probability of all candidate paths, retaining the top n optimal paths, where n is the beam width; and dynamically filtering the candidate paths in combination with chemical reaction constraints to exclude tokens that do not meet the chemical reaction constraints.
[0013] In one embodiment, inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints comprises:
[0014] Performing graphic encoding on the molecular graph and performing sequence decoding on the encoded molecular graph features;
[0015] The sequential decoding of the encoded molecular graph features includes: generating tokens using a Top-k sampling strategy, and limiting the Top-k candidate range through a mask mechanism based on chemical reaction constraints.
[0016] In one embodiment, inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints comprises:
[0017] Performing graphic encoding on the molecular graph and performing sequence decoding on the encoded molecular graph features;
[0018] The sequential decoding of the encoded molecular graph features includes: generating tokens using a Top-p sampling strategy, and adding chemical descriptors based on chemical reaction constraints to the Top-p candidate set.
[0019] In one embodiment, graph encoding the molecular graph includes utilizing a multi-head attention mechanism and position encoding molecular topology information.
[0020] In one embodiment, post-processing and verifying the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted includes:
[0021] By using any one or more of chemical reaction conservation verification, chemical rationality verification, and atomic mapping backtracking, SMILES sequences that do not conform to the essence of the chemical reaction are eliminated to obtain the prediction result of the chemical reaction to be predicted.
[0022] In one embodiment, after acquiring the data of the chemical reaction to be predicted and before adding chemical reaction constraints as dynamic constraint tags to the reaction data of the chemical reaction to be predicted, the method further includes expanding the data volume of the chemical reaction data to be predicted by data enhancement.
[0023] On the other hand, the present application provides a chemical reaction prediction system based on domain knowledge editing, including:
[0024] a data processing module, configured to add chemical reaction constraints as dynamic constraint tags to reaction data of a chemical reaction to be predicted, wherein the reaction data of the chemical reaction to be predicted includes a SMILES string of reactants or products; and construct a molecular graph of the reactants or products;
[0025] A chemical reaction prediction module, configured to input the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints;
[0026] The post-processing module is used to post-process and verify the SMILES sequence that meets the chemical reaction constraints to obtain the prediction result of the chemical reaction to be predicted.
[0027] On the other hand, the present application provides a computer-readable storage medium, which stores a computer program, wherein the computer program implements the above method when executed by a processor.
[0028] On the other hand, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above method is implemented when the processor executes the program.
[0029] The technical solution provided by this application can achieve the following beneficial effects:
[0030] While the domain knowledge-based chemical reaction prediction method provided in this application is somewhat dependent on training data, by introducing chemical reaction constraints during the training data construction, decoder inference, and post-generation processing stages, it eliminates the need for in-depth involvement of chemical experts and effectively reduces the problem of hallucinations in the generative model. In particular, the method, based on the quantized reaction mechanisms obtained by the model and combined with domain knowledge, can effectively predict specific chemical reactions, improving the effectiveness of the reaction types covered by the model prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram of a process for deep chemical reaction prediction based on domain knowledge editing provided in this specification is shown;
[0032] Figure 2 A schematic diagram of a deep chemical reaction prediction system based on domain knowledge editing provided in this specification is shown;
[0033] Figure 3 This specification provides a corresponding Figure 1 Schematic diagram of electronic equipment. DETAILED DESCRIPTION
[0034] To make the objectives, technical solutions, and advantages of this specification more clear, the following will clearly and completely describe the technical solutions of this specification in conjunction with the specific embodiments of this specification and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this specification.
[0035] The technical solutions provided by the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0036] Chemical reaction prediction involves forward prediction, inferring products from reactants, and reverse prediction, inferring possible reaction pathways from target products. It can be applied to areas such as the design of new drug molecules and planning material synthesis pathways. Figure 1 This is a flow chart of the deep chemical reaction prediction method based on domain knowledge editing provided in this specification, including the following steps S101-S103:
[0037] S101: adding chemical reaction constraints as dynamic constraint tags to reaction data of a chemical reaction to be predicted, wherein the reaction data of the chemical reaction to be predicted includes a SMILES string of reactants or products; and constructing a molecular graph of the reactants or products.
[0038] Reaction data for the chemical reactions to be predicted can be extracted from chemical databases (such as the USPTO and Reaxys) and include SMILES strings representing reactants, products, and reaction conditions (temperature, solvent, etc.). SMILES (Simplified Molecular Linear Input System) is a standard method for representing chemical structures using ASCII strings, converting three-dimensional molecular structure information into a one-dimensional string format. Data cleaning can be performed on the reaction data, for example, using RDKit to verify the validity of the SMILES and filter out molecules that cannot be parsed or have unusual valence states.
[0039] In this application, chemical reaction constraints refer to physical, chemical, or engineering restrictions that must be followed during the reaction process, covering multiple dimensions such as thermodynamics, kinetics, control strategies, and computational methods. More specifically, chemical reaction constraints can be chemical reaction conservation constraints, which refer to a set of constraints constructed based on basic laws such as conservation of atomic number, charge, and mass in chemical reactions. Reaction conservation knowledge can be used to verify the rationality of prediction results and improve the accuracy of model predictions.
[0040] In one embodiment provided herein, the reaction conservation knowledge refers to the charge and atomic count of reactants or products. For example, in the equation 0&C~3N~1H~1, the "&" symbol separates the charge and atomic count information, while the symbol "~" separates the elements and their counts, and the symbol "~" separates the atoms and their counts. In this embodiment, the 0 in "0&C~3N~1H~1" represents zero charge, three carbon atoms, one nitrogen atom, and one hydrogen atom.
[0041] In chemical reaction prediction, when processing data related to chemical reactions, the encoder can dynamically prefix the charge and atom counts of reactants or products. For example, for each input reactant or product, the encoder can count the charge and atom counts and prefix this information to the input data. This allows the encoder to take reaction conservation knowledge into account when processing the data, potentially improving data processing accuracy and generating output that is more consistent with reaction conservation knowledge. The decoder can also factor reaction conservation knowledge into its output generation.
[0042] In an embodiment provided in this specification, before adding chemical reaction constraints as dynamic constraint tags to the reaction data of the chemical reaction to be predicted, the method may further include expanding the data volume of the chemical reaction data to be predicted by data enhancement.
[0043] Increasing data volume through data augmentation is a common method in deep learning. Starting from a starting atom (any atom), the entire molecular graph is traversed in a depth-first manner, and the corresponding characters are recorded according to the atoms and bond types encountered to construct a SMILES for the molecule. This allows for multiple SMILES representations of the same molecule depending on the starting atom. This diverse SMILES representation facilitates data augmentation. Hydrogenation within SMILES can be used to increase data volume. The following is a simplified example showing how hydrogenation of [C-]#[N+]C#C>>[C]#C.[C]#N yields [H]C#C[N+]#[C-]>>[H]C#[C].[C]#N. Generating equivalent or modified SMILES can also increase data volume. As a simplified example, [H]C#C[N+]#[C-]>>[H]C#[C].[C]#N can be expressed as C([H])#C[N+]#[C-]>>[C]#C[H].[C]#N; [H]C#C[N+]#[C-]>>C(#[C])[H].N#[C]; [C-]#[N+]C#C[H]>>C(#[C])[H].[C]#N, etc. Increasing the amount of data through data augmentation can improve the generalization ability of the model.
[0044] S102: Inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints.
[0045] In one embodiment provided in this specification, inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints includes: graphically encoding the molecular graph and sequentially decoding the encoded molecular graph features.
[0046] In one embodiment provided herein, graph encoding of the molecular graph includes utilizing a multi-head attention mechanism and position encoding of molecular topology information. For example, a Graph Attention Network (GAT) or Graph Transformer is used to capture key interactions between atoms (such as nucleophilic / electrophilic sites) through a multi-head attention mechanism; and random walks or Laplace position encoding are used to preserve the topological relationships of the molecular three-dimensional conformation.
[0047] The multi-head attention mechanism allows the model to simultaneously focus on different parts of the input data, including local attention and global attention. Local attention focuses on local molecular structural features, such as specific atomic clusters or functional groups. By limiting the scope of attention, it can more finely understand local features in the molecule. Global attention integrates the overall information of the entire molecule and captures global features at the molecular level. This helps the model understand the overall configuration and properties of the molecule. The multi-head attention mechanism processes multiple attention heads in parallel, each focusing on different aspects of the input data, thereby improving the model's ability to capture complex relationships.
[0048] Position encoding is used to provide the model with information about the positions of atoms in the graph. Position encoding includes centrality encoding, spatial encoding, and edge encoding. Centrality encoding reflects the relative importance or centrality of atoms in a molecule. Spatial encoding provides information about the relative positions of atoms in molecular space. Edge encoding captures the type and nature of chemical bonds between atoms. Combining these three encoding modes can capture key information about 2D molecular graphs, including the type, position, and connectivity of atoms, as well as the configuration and properties of the entire molecule. This information is crucial for subsequent tasks such as chemical reaction prediction and molecular property prediction.
[0049] In one embodiment provided in this specification, sequential decoding of the encoded molecular graph features includes: using a beam search strategy to calculate the cumulative probability of all candidate paths, retaining the top n optimal paths, where n is the beam width; and dynamically filtering the candidate paths in combination with chemical reaction constraints to exclude tokens that do not meet the chemical reaction constraints.
[0050] During the decoding process, beam search maintains a fixed-size set of candidate paths (i.e., beam width, such as beam_size=2), and only retains the top beam_size candidate sequences with the highest cumulative probability at each generation step. In this way, the local optimal trap of greedy search is avoided, and the high computational cost of exhaustive search is reduced. Each time a new token is generated, the cumulative probability of all possible paths is calculated (i.e., the product of the probabilities of each step), and only some of the paths with the highest probability are retained, and the remaining paths are pruned and discarded. While utilizing the beam search strategy and combining chemical reaction constraints (such as atomic conservation), candidate paths are dynamically filtered, for example, tokens that do not meet the valence legality (such as pentavalent carbon) are excluded. Through the above mechanism, beam search significantly improves the rationality and diversity of the generated results while maintaining high efficiency.
[0051] In one embodiment provided in this specification, sequential decoding of the encoded molecular graph features includes: generating tokens using a Top-k sampling strategy, and limiting the Top-k candidate range through a mask mechanism based on chemical reaction constraints.
[0052] The Top-k sampling strategy retains only the top k highest-probability tokens (e.g., k = 50) in the model's predicted probability distribution at each token generation step. The remaining tokens are directly filtered to form a candidate pool. The probabilities of the selected k tokens are then renormalized (i.e., their summed probabilities are recalculated to 1) to ensure a valid sampling probability distribution. While utilizing the Top-k sampling strategy, a masking mechanism based on chemical reaction constraints is also used to restrict the Top-k candidate range. For example, when generating ring structures, only bond types that meet ring strain requirements (such as conjugated double bonds in aromatic rings) are allowed to avoid unusual structures. This mechanism achieves a controllable balance between quality and diversity during the generation process.
[0053] In one embodiment provided in this specification, sequential decoding of the encoded molecular graph features includes: generating tokens using a Top-p sampling strategy, and adding chemical descriptors based on chemical reaction constraints to the Top-p candidate set.
[0054] The top-p sampling strategy samples from the smallest set of tokens whose cumulative probability exceeds a threshold p (e.g., p = 0.95). The number of candidates is dynamically adjusted to accommodate the uncertainty at different stages of generation. This strategy is suitable for handling ambiguous reaction pathways, such as predicting intermediates in catalytic reactions, by adaptively selecting reasonable atomic connections. By combining the top-p sampling strategy with chemical descriptors based on chemical reaction constraints (e.g., reaction activation energy) within the top-p candidate set, thermodynamically stable structures can be prioritized. This mechanism avoids low-probability noise (e.g., illegal chemical structures) while retaining appropriate diversity (e.g., diverse reaction mechanistic pathways).
[0055] In one embodiment provided in this specification, the above three methods: beam search strategy combined with chemical reaction constraints, Top-k sampling strategy combined with chemical reaction constraints, and Top-p sampling strategy combined with chemical reaction constraints can work together. Beam search provides global optimal path guidance, Top-k and Top-p enhance local diversity, and the combination of the three methods improves the coverage and accuracy of the generated results.
[0056] In one embodiment provided in this specification, training a neural network deep learning model includes generating a molecular graph for all reactants in a training set and a validation set, wherein the molecular graph generated for all products includes the structure, node features, and edge features of the graph; inputting the structure, node features, and edge features of the graph into the neural network deep learning model to obtain a SMILES sequence that conforms to the chemical reaction constraints; optimizing the parameters of the neural network deep learning model using the training set as input, performing a preliminary evaluation of the capabilities of the neural network deep learning model using the validation set as input, and saving the neural network deep learning model with the smallest validation set loss (cross entropy loss) during the training process.
[0057] In one embodiment provided in this specification, the encoded molecular graph features are sequentially decoded to obtain a token_ids sequence, for example, [25, 7, 61, 24, 0], and the corresponding tokens are 'O', '.', '[CH2+]', 'N', '[EOS]'.
[0058] Step S103: post-processing and verifying the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted.
[0059] In one embodiment provided in this specification, post-processing and verifying the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted includes:
[0060] By using any one or more of chemical reaction conservation verification, chemical rationality verification, and atomic mapping backtracking, SMILES sequences that do not conform to the essence of the chemical reaction are eliminated to obtain the prediction result of the chemical reaction to be predicted.
[0061] Chemical reaction conservation verification includes counting the types and quantities of atoms in reactants and products (such as C, O, H, etc.) to ensure the consistency of the total number, and verifying whether the total ion charge before and after the reaction is equal to avoid illegal reactions that do not conserve charge (such as H in acidic solution). + With OH - Chemical plausibility verification includes checking whether the valence of atoms in the product conforms to chemical laws (e.g., carbon atoms do not exceed tetravalence, oxygen atoms do not have positive valence), and determining whether the SMILES sequence meets the reaction type characteristics based on known reaction mechanisms (e.g., nucleophilic substitution, redox). Atom mapping backtracking involves establishing a mapping relationship between reactant and product atoms, ensuring that each product atom has a clear source. Sequences where a complete mapping cannot be established (e.g., oxygen atoms appearing out of thin air) are considered illegal. Combining these three methods can improve the accuracy of generated results.
[0062] In one embodiment provided in this specification, post-processing and verifying the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted includes:
[0063] Use pre-trained ChemBERTa to encode the SMILES of reactants and products into vectors;
[0064] Using contrastive learning to fine-tune the pre-trained ChemBERTa to close the semantic distance of positive sample pairs and distance the semantic distance of negative sample pairs; the positive sample pairs are verified reactant-product pairs, and the negative sample pairs are combinations of reactants and products that do not match the reaction mechanism;
[0065] Use beam search to generate Top-K products;
[0066] The optimal result is selected through weighted sorting based on comprehensive model generation probability, comparative similarity, atomic conservation, valence state legitimacy, and mechanism matching.
[0067] By bringing positive pairs closer together and negative pairs further apart, the model more accurately captures the essential relationships between reactants and products. Supervised comparative learning enables the deep transfer of chemical knowledge, significantly improving the practicality and reliability of generated results.
[0068] This application's deep chemical reaction prediction method, based on domain knowledge editing, significantly reduces the hallucination problem in the generative model by imposing chemical reaction conservation constraints, effectively avoiding the generation of invalid and erroneous chemical reaction formulas. Furthermore, it demonstrates robustness in predicting specific chemical reactions, maintaining high prediction accuracy even when training data is sparse.
[0069] The above is the deep chemical reaction prediction method based on domain knowledge editing in this manual. Based on the same idea, this manual also provides a corresponding deep chemical reaction prediction system based on domain knowledge editing, such as Figure 2 As shown, including:
[0070] A data processing module 201 is configured to add chemical reaction constraints as dynamic constraint tags to reaction data of a chemical reaction to be predicted, wherein the reaction data of the chemical reaction to be predicted includes a SMILES string of reactants or products; and to construct a molecular graph of the reactants or products;
[0071] A chemical reaction prediction module 202 is configured to input the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints;
[0072] The post-processing module 203 is used to perform post-processing and verification on the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted.
[0073] This specification also provides a computer-readable storage medium, which stores a computer program that can be used to execute the above Figure 1 Provided is a deep chemical reaction prediction method based on domain knowledge editing.
[0074] This manual also provides Figure 3 The one shown corresponds to Figure 1 Schematic diagram of the electronic equipment. Figure 3 As mentioned above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The deep chemical reaction prediction method based on domain knowledge editing. Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0075] Improvements to a technology can be clearly categorized as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with technological advancements, many process flow improvements can now be considered direct hardware circuit structure improvements. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using physical hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can integrate a digital system onto a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly performed using software called a "logic compiler." This is similar to the software compilers used during program development. Before compilation, the original code must be written in a specific programming language, called a hardware description language (HDL). There are many types of HDL, including ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0076] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the memory control logic. Those skilled in the art will also appreciate that, in addition to implementing the controller purely in computer-readable program code, the controller can also be implemented in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, an embedded microcontroller, etc. by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the means for implementing the various functions included therein can also be considered as structures within the hardware component. Alternatively, the means for implementing the various functions can be considered both a software module implementing the method and a structure within the hardware component.
[0077] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0078] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0079] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Thus, this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0080] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0081] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0082] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0083] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0084] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0085] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0086] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0087] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0088] This specification may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.
[0089] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0090] The foregoing is merely an example of the present invention and is not intended to limit the present invention. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims of the present invention.
Claims
1. A chemical reaction prediction method, characterized in that: The method comprises: Expand the amount of chemical reaction data to be predicted through data augmentation; adding chemical reaction constraints as dynamic constraint tags to reaction data of a chemical reaction to be predicted, wherein the reaction data of the chemical reaction to be predicted includes a SMILES string of a reactant or a product; and constructing a molecular graph of the reactant or the product; Inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints; Post-processing and verifying the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted; Post-processing and verifying the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted includes: Use pre-trained ChemBERTa to encode the SMILES of reactants and products into vectors; Using contrastive learning to fine-tune the pre-trained ChemBERTa to close the semantic distance of positive sample pairs and distance the semantic distance of negative sample pairs; the positive sample pairs are verified reactant-product pairs, and the negative sample pairs are combinations of reactants and products that do not match the reaction mechanism; Use beam search to generate Top-K products; Comprehensive model generation probability, comparison similarity, atomic conservation, valence legitimacy, and mechanism matching, and weighted sorting to select the best result; The chemical reaction constraints are chemical reaction conservation constraints, which refer to a set of constraints constructed based on the basic laws of atomic number conservation, charge conservation, and mass conservation in chemical reactions.
2. The chemical reaction prediction method according to claim 1, characterized in that: Inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints includes: Performing graphic encoding on the molecular graph and performing sequence decoding on the encoded molecular graph features; The sequential decoding of the encoded molecular graph features includes: using a beam search strategy to calculate the cumulative probability of all candidate paths, retaining the top n optimal paths, where n is the beam width; and dynamically filtering the candidate paths in combination with chemical reaction constraints to exclude tokens that do not meet the chemical reaction constraints.
3. The chemical reaction prediction method according to claim 1 or 2, characterized in that: Inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints includes: Performing graphic encoding on the molecular graph and performing sequence decoding on the encoded molecular graph features; The sequential decoding of the encoded molecular graph features includes: generating tokens using a Top-k sampling strategy, and limiting the Top-k candidate range through a mask mechanism based on chemical reaction constraints.
4. The chemical reaction prediction method according to claim 3, characterized in that: Inputting the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints includes: The sequential decoding of the encoded molecular graph features includes: generating tokens using a Top-p sampling strategy, and adding chemical descriptors based on chemical reaction constraints to the Top-p candidate set.
5. The chemical reaction prediction method according to claim 4, characterized in that: The graphical encoding of the molecular graph includes: utilizing a multi-head attention mechanism and position encoding molecular topology information.
6. A chemical reaction prediction system, characterized in that: The system comprises: a data processing module that expands the data volume of the chemical reaction data to be predicted through data enhancement; adds chemical reaction constraints as dynamic constraint tags to the reaction data of the chemical reaction to be predicted, wherein the reaction data of the chemical reaction to be predicted includes SMILES strings of reactants or products; and constructs a molecular graph of the reactants or products, wherein the chemical reaction constraints are chemical reaction conservation constraints, which refer to a set of constraint conditions constructed based on the basic laws of conservation of atomic number, conservation of charge, and conservation of mass in chemical reactions; A chemical reaction prediction module, configured to input the molecular graph into a trained neural network deep learning model to obtain a SMILES sequence that meets the chemical reaction constraints; A post-processing module is used to post-process and verify the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted; wherein, post-processing and verifying the SMILES sequence that meets the chemical reaction constraints to obtain a prediction result of the chemical reaction to be predicted includes: using pre-trained ChemBERTa to encode the SMILES of reactants and products as vectors; using contrastive learning to fine-tune the pre-trained ChemBERTa to shorten the semantic distance of positive sample pairs and distance the semantics of negative sample pairs; the positive sample pairs are verified reactant-product pairs, and the negative sample pairs are combinations of reactants and products that do not match the reaction mechanism; using beam search to generate Top-K products; and comprehensively considering model generation probability, contrast similarity, atomic conservation, valence state legality, and mechanism matching, and weighted sorting to select the optimal result.
7. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Systems and methods for designing organic synthesis pathways for desired organic molecules
CN114730618A
Molecular generation model training method and device
CN117198411A