Chemical reaction path reasoning method, device, related equipment and program product
By combining chemical knowledge graphs with large models and adopting strategies such as graph pruning and bidirectional search, the logical errors of large models in chemical reaction path reasoning are solved, the accuracy and feasibility of the paths are improved, and explainability and controllability are achieved.
Patent Information
- Application Number
- CN202510809438.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-06-17
AI Technical Summary
Large models lack the ability to model causal chains in chemical reaction path reasoning tasks, resulting in a lack of feasibility and accuracy in reaction paths, and are prone to chemical logic errors and intermediate errors.
By constructing a chemical knowledge graph that includes reaction nodes and mechanism relationships, combining it with a large model for path retrieval and feature fusion, and adopting strategies such as graph pruning and bidirectional search, the large model is constrained to select a logically self-consistent path.
It improves the accuracy and feasibility of chemical reaction path reasoning, enhances the knowledge coverage capability, and realizes the explainability and controllability of the reasoning path.
Smart Images

Figure CN120340650B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a chemical reaction path reasoning method, apparatus, related equipment, and program product. Background Art
[0002] Existing large models show certain limitations when facing multi-hop reasoning problems. Reaction path reasoning tasks in the field of chemistry naturally have multi-hop characteristics, that is, starting from the initial raw materials, it is necessary to infer the synthesis paths of multiple intermediates, reaction conditions and final products.
[0003] When using large models to reason about chemical reaction pathways, the problem description is typically fed into the large model, which then executes the reasoning process and outputs the final result. Because large models lack the ability to model causal chains, in highly logical and specialized tasks like constructing chemical reaction pathways, the models often encounter issues such as "chemical logic skipping steps," "intermediate errors," or "reaction direction errors," rendering the final reasoning pathway unfeasible. Summary of the Invention
[0004] In view of the above problems, this application is proposed to provide a chemical reaction path reasoning method, apparatus, related equipment and program product to improve the accuracy and certainty of large models in chemical reaction path reasoning tasks and enhance the feasibility of reasoning paths. The specific solution is as follows:
[0005] In a first aspect, the present application provides a chemical reaction pathway reasoning method, comprising:
[0006] Obtaining problem data related to the chemical reaction path reasoning task;
[0007] Performing entity extraction on the problem data to obtain entity information, wherein the entity information includes a reaction substrate and a target product;
[0008] Taking the reaction substrate as the starting point of the chemical reaction path and the target product as the end point of the chemical reaction path, a path search is performed in the configured chemical knowledge graph to obtain a knowledge subgraph representing the chemical reaction path. The chemical knowledge graph includes a number of reaction nodes, and the edges between the reaction nodes represent the reaction mechanism relationship or sequence;
[0009] Feature extraction and feature fusion are performed on the knowledge subgraph and the question data, and the fused features are sent to the large model for processing to obtain the answer corresponding to the question data output by the large model.
[0010] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the method further includes:
[0011] During the process of executing the path retrieval, graph pruning is performed synchronously until the knowledge subgraph is obtained.
[0012] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the method further includes:
[0013] Performing intent extraction on the question data to obtain an intent label;
[0014] The graph pruning process includes:
[0015] The chemical knowledge graph is statically pruned based on configured pruning rules, wherein the pruning rules include pruning rules configured based on the intent tags.
[0016] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the pruning rules further include: pruning rules configured based on chemical prior knowledge.
[0017] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the graph pruning process includes:
[0018] When the current node in the chemical knowledge graph is retrieved, for each candidate node pointed to by the current node in the graph, the mutual information between the candidate node and the known facts is calculated, wherein the known facts include the question data and the retrieved path information up to the current node;
[0019] The mutual information is used as a dynamic pruning indicator to delete candidate nodes that do not meet the mutual information condition requirement from the candidate nodes.
[0020] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the graph pruning process includes:
[0021] After the search termination condition is reached, if the retrieved paths include both first-category paths and second-category paths, the first-category paths are deleted. The first-category paths are paths that cannot be inferred to obtain the target product, and the second-category paths are paths that can be inferred to obtain the target product.
[0022] If there are more than two second-type paths, the path with the largest mutual information is retained, where the mutual information of the path represents the product of the mutual information values corresponding to each step in the path.
[0023] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the graph pruning process includes:
[0024] After reaching the retrieval termination condition, if the only path obtained cannot be inferred to obtain the target product, redundant information pruning is performed on the only path to remove redundant node information in the path.
[0025] In one possible design, in another implementation of the first aspect of the embodiments of the present application, a process of performing redundant information pruning on a path includes:
[0026] For each node in the path, the uncertainty value between the subpath from the starting point of the path to each node and the problem data is calculated to obtain the uncertainty value corresponding to each node;
[0027] A target node with the smallest uncertainty value is selected in the path. If the uncertainty value of the target node does not exceed a set uncertainty threshold, each node after the target node in the path is pruned.
[0028] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the process of performing path retrieval in the configured chemical knowledge graph includes:
[0029] Using the reaction substrate as the starting point of the forward search and the target product as the starting point of the reverse search, a bidirectional search is performed in the configured chemical knowledge graph;
[0030] If there is an intersecting node between the two paths obtained by the bidirectional search, the subpaths from the starting point to the intersecting node of each of the two paths are selected and merged into a complete path.
[0031] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the process of performing path retrieval in the configured chemical knowledge graph includes:
[0032] A beam search method is used to perform path retrieval in the configured chemical knowledge graph. At each step, the first k nodes with the highest correlation with the current node are selected as the next hop nodes, where k is a positive integer not less than 2.
[0033] In one possible design, in another implementation of the first aspect of the embodiments of the present application, after obtaining the entity information, the method further includes:
[0034] Perform entity disambiguation processing on the entity information.
[0035] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the process of extracting and fusing features of the knowledge subgraph and the question data includes:
[0036] Extracting a first encoding feature of the unstructured information of the knowledge subgraph;
[0037] Adding the question data as a node to the knowledge subgraph, and establishing a connection relationship between the newly added node and the remaining nodes in the knowledge subgraph to obtain an edited knowledge subgraph;
[0038] Processing the edited knowledge subgraph through a graph neural network to obtain a second encoding feature of a node corresponding to the question data;
[0039] The first coding feature and the second coding feature are fused to obtain a fused feature.
[0040] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the process of extracting the first coding feature of the unstructured information of the knowledge subgraph includes:
[0041] The triple information in the knowledge subgraph is fed into the large model to instruct the large model to organize the input triple information into a descriptive text, and obtain the features extracted by the hidden layer of the large model as the first coding features.
[0042] In a second aspect of the present application, a chemical reaction path inference device is provided, comprising:
[0043] A question acquisition unit, used to acquire question data related to the chemical reaction path reasoning task;
[0044] An entity extraction unit, configured to extract entities from the problem data to obtain entity information, wherein the entity information includes a reaction substrate and a target product;
[0045] a knowledge graph retrieval unit, configured to perform a path search in a configured chemical knowledge graph using the reaction substrate as the starting point of the chemical reaction path and the target product as the end point of the chemical reaction path, thereby obtaining a knowledge subgraph representing the chemical reaction path, wherein the chemical knowledge graph includes a plurality of reaction nodes, and edges between the reaction nodes represent the reaction mechanism relationship or sequence;
[0046] The feature processing unit is used to extract and fuse features of the knowledge subgraph and the question data, and send the fused features to the large model for processing to obtain the answer corresponding to the question data output by the large model.
[0047] In a third aspect of the present application, an electronic device is provided, comprising: a memory and a processor;
[0048] The memory is used to store programs;
[0049] The processor is used to execute the program to implement each step of the chemical reaction path reasoning method described in any one of the first aspects of the present application.
[0050] In a fourth aspect of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the various steps of the chemical reaction path reasoning method described in any one of the first aspects of the present application are implemented.
[0051] In a fifth aspect of the present application, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the various steps of the chemical reaction path reasoning method described in any one of the aforementioned first aspects of the present application.
[0052] By means of the above technical solution, the present application can obtain a chemical knowledge graph based on prior knowledge in the field of chemistry, such as the reaction mechanism relationship between different chemical substances, the reaction sequence, etc. The chemical knowledge graph is combined with the large model reasoning mechanism to enhance the knowledge retrieval and logical constraint capabilities of the large model through explicit structured graph knowledge. Specifically, entity extraction is performed on the problem data, and the extracted entities are used to perform path retrieval in the knowledge graph to obtain a knowledge subgraph related to the problem data. Feature extraction and fusion are performed on the knowledge subgraph and the problem data, and the fused features are sent to the large model for processing to obtain the answer output by the large model. Clear reaction nodes, mechanism relationships and sequences can be introduced through the knowledge graph to constrain the large model to select a known and logically self-consistent path during the reasoning process, thereby replacing the large model's original free generation based on probability sampling, and improving the rationality and logical certainty of the reaction at each step. The final chemical reaction path reasoning result is also more accurate and more feasible. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present application. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:
[0054] Figure 1 A schematic diagram of an implementation system architecture of the chemical reaction path reasoning method provided in an embodiment of the present application;
[0055] Figure 2 A schematic diagram of a chemical reaction pathway reasoning method provided in an embodiment of the present application;
[0056] Figure 3 A schematic flow chart of another chemical reaction pathway reasoning method provided in an embodiment of the present application;
[0057] Figure 4 A schematic diagram of a chemical knowledge graph search and pruning process provided in an embodiment of the present application;
[0058] Figure 5A schematic diagram of an edited knowledge subgraph integrating question data provided in an embodiment of the present application;
[0059] Figure 6 A schematic diagram of the structure of a chemical reaction path inference device provided in an embodiment of the present application;
[0060] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0062] To address the limitations of large models in multi-hop reasoning, related technologies have expanded the model's pre-training corpus to enable the model to learn more cross-domain and cross-knowledge context associations in order to enhance its ability to build reasoning chains. However, large models still have shortcomings in chemical reaction path reasoning, including but not limited to:
[0063] Lack of certainty in reasoning: Since large models generate content based on probability distribution and lack the ability to model causal chains, it is easy for skipped steps or pseudo-reactions that do not conform to chemical logic to occur in the reaction path.
[0064] Incomplete knowledge coverage: The field of chemistry is plagued by numerous long-tail reaction mechanisms and specialized pathways. Even with extensive model training data, it is difficult to capture these low-frequency or laboratory-specific reaction types. This results in poor performance of large models in inferring these chemical reaction pathways.
[0065] Poor interpretability of reasoning paths: The chemical reaction paths output by current large models lack intermediate visualization and logical traceability mechanisms, making the feasibility of the paths difficult to verify.
[0066] Lack of external constraint mechanism: The large model itself does not have the hard constraint ability of chemical rules, and it is easy to generate paths that violate the principles of valence bond conservation, reaction site selectivity or energy conservation.
[0067] In order to improve the usability of large models in chemical reaction path reasoning tasks and enhance the certainty and accuracy of reasoning paths, this application proposes a technical solution that combines chemical knowledge graphs to enhance the reasoning capabilities of large models. By constructing a knowledge graph containing chemical reaction nodes and reaction mechanism relationships between nodes, reaction sequence and other information, and combining it with the reasoning process of the large model, the large model can rely on structured graph knowledge for path reasoning, thereby improving the certainty and accuracy of the reasoning path.
[0068] This application provides a chemical reaction path reasoning method that can be applied to Figure 1 The system architecture shown in FIG. 1 may include a terminal 100 and a server 200. The server 200 may include one or more servers ( Figure 1 (This section includes a server as an example).
[0069] The terminal 100 or the server 200 can be used alone to execute the chemical reaction path reasoning method provided in the embodiment of the present application. In addition, the terminal 100 and the server 200 can also be used in conjunction to execute the chemical reaction path reasoning method provided in the embodiment of the present application.
[0070] Next describe Figure 1 The product form of the mid-terminal 100;
[0071] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a teaching large screen, a learning machine, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.
[0072] The embodiment of the present application provides a chemical reaction path reasoning method, which is illustrated by applying the method to a computer device. The computer device can be Figure 1 The terminal 100 or the system consisting of the terminal 100 and the server 200. Figure 2 , the chemical reaction path reasoning method specifically includes the following steps:
[0073] Step S100: Acquire problem data related to the chemical reaction path reasoning task.
[0074] Reaction pathway reasoning tasks in chemistry are inherently multi-hop. Starting from initial raw materials, one must infer the synthesis pathways leading to multiple intermediates, reaction conditions, and the final product. Common chemical reaction pathway reasoning tasks include retrosynthetic analysis. Retrosynthetic analysis is a core strategy used in organic synthetic chemistry to design synthetic routes for complex molecules. Its core concept is to start with a target molecule and reverse-engineer it into simpler precursors or known raw materials, thereby planning a feasible synthetic pathway.
[0075] In practical applications, users can propose problem descriptions related to chemical reaction path reasoning tasks.
[0076] Step S110: Entity extraction is performed on the problem data to obtain entity information, where the entity information includes reaction substrates and target products.
[0077] Specifically, entity extraction algorithms can be used to extract the entity information contained in the acquired problem data. Entity information includes reaction substrates and target products. In addition, entity information can also include other types of entities, including but not limited to: catalysts, solvents, temperature, pressure, reaction pH, isomer labels (e.g., D / L, cis / trans), isotope symbols, stereochemical descriptors (R / S labels), etc.
[0078] In some embodiments, a pre-trained entity extraction model can be used to extract entity information from question data. Furthermore, large-scale model technology can be used for entity extraction. For example, the question data can be assembled into a prompt, which is then fed into the large-scale model to instruct the large-scale model to extract entity information from the question data, thereby obtaining entity information output by the large-scale model.
[0079] For example, the prompt for instructing the large model to perform entity extraction may be: "Please extract the entity information contained in [problem data]."
[0080] Optionally, after obtaining the entity information in this step, a further step of entity disambiguation can be added to the entity information. Entity disambiguation can unify the entity expression form, facilitating processing in subsequent steps.
[0081] Entity information can include chemical substance entities and conditional entities. For chemical substance entities, a chemical substance entity may correspond to multiple forms of names, such as the IUPAC name, SMILE name, molecular formula, common name, trade name, etc.
[0082] IUPAC (International Union of Pure and Applied Chemistry) is an internationally recognized authority in chemistry, responsible for establishing globally unified rules for chemical nomenclature, terminology, standard methods, and more. When it comes to naming chemical substances, IUPAC's rules ensure that every compound has a unique and unambiguous name, known as the IUPAC name.
[0083] SIMLE (Simplified Molecular Input Line Entry System) is a method for concisely describing chemical molecular structures using strings (text). Using symbols such as atoms, bonds, branches, and rings, SIMLE converts two-dimensional or three-dimensional chemical structures into a single line of readable code. It is widely used in cheminformatics, database retrieval, and molecular modeling.
[0084] In this embodiment, for the chemical substance entities in the acquired entity information, conversion between IUPAC names, smiles names, molecular formulas, common names, and trade names can be achieved, and the chemical substance entities can be unified into the same description form, for example, uniformly expressed as simles names.
[0085] In one possible implementation, the names of various types of chemical substance entities can be queried through a chemical database, thereby achieving a unified representation of the names. For example, the API service provided by the free chemical database PubChem can be accessed to query various expressions of chemical substance entities.
[0086] For conditional entities, some conditional entities may have default meanings in the field of chemistry. For example, "room temperature" is equal to 20-25°C, "reflux" is equal to the boiling point of the solvent ±5°C, and "ice bath" is equal to 0-5°C. For these default knowledge in the industry, a mapping relationship table between conditional entities and true meaning expressions can be established in advance. In this embodiment, for the conditional entities in the acquired entity information, the true meaning expression corresponding to the conditional entity can be obtained by querying the mapping relationship table, thereby achieving disambiguation of the conditional entity.
[0087] Refer to Table 1 below, which illustrates the results of entity extraction and entity disambiguation on the question data raised by the user.
[0088] Table 1
[0089]
[0090] The problem data in the preceding example contains IUPAC entity information: "4-((3-Butyl-1,1-dimethyl-1H-benzo[e]indol-3-ium-2-yl)methyl ene)-2-(4-(di(naphthalen-1-yl)amino)-2,6-dihydroxyphenyl)-3-oxocyclobut-1-enolate", Smiles entity information: "COc1cc(N)cc(OC)c1", "CCn1c2ccccc2c2ccc(Br)cc21", and molecular formula entity information: "C57H50N4O4". Through entity disambiguation, the entity is converted to Smiles entity information.
[0091] The condition entity "reaction temperature: room temperature" is converted to "reaction temperature: 20-25°C" by querying the mapping table.
[0092] Step S120: Taking the reaction substrate as the starting point of the chemical reaction path and the target product as the end point of the chemical reaction path, a path search is performed in the configured chemical knowledge graph to obtain a knowledge subgraph representing the chemical reaction path.
[0093] The chemical knowledge graph includes several reaction nodes, and the edges between the reaction nodes represent the relationship between the reaction mechanisms or the order of reaction. This application can pre-collect structured knowledge information in the field of chemistry, such as chemical reaction rules, species structure, energy information, etc., and organize it into a chemical knowledge graph.
[0094] The reaction substrates and target products from the problem data have been extracted in the previous step. In this step, the reaction substrates can be used as the starting point of the chemical reaction path, and the target product as the end point of the chemical reaction path. Path search can be performed in the chemical knowledge graph to obtain a knowledge subgraph that represents the chemical reaction path.
[0095] Step S130: extract and fuse features of the knowledge subgraph and the question data, and send the fused features to the large model for processing to obtain the answer corresponding to the question data output by the large model.
[0096] Specifically, the knowledge subgraph can constrain the large model to choose a known and logically self-consistent path in the reasoning process, thereby replacing the large model's original free generation based on probability sampling, and improving the rationality and logical certainty of the response at each step.
[0097] In this step, features are extracted and fused from the knowledge subgraph and question data, respectively, to generate fused features that combine the knowledge subgraph and question data. These fused features are then fed into the feature processing layer of the larger model, where inference is performed to produce the final output corresponding to the question data.
[0098] The chemical reaction path reasoning method provided in the embodiment of the present application can be based on prior knowledge in the field of chemistry, such as the reaction mechanism relationship between different chemical substances, the reaction sequence, etc., to organize and obtain a chemical knowledge graph. The chemical knowledge graph is combined with the large model reasoning mechanism, and the knowledge retrieval and logical constraint capabilities of the large model are enhanced through explicit structured graph knowledge. Specifically, entity extraction is performed on the problem data, and the extracted entities are used to perform path retrieval in the knowledge graph to obtain a knowledge subgraph related to the problem data. Feature extraction and fusion are performed on the knowledge subgraph and the problem data, and the fused features are sent to the large model for processing to obtain the answer output by the large model. Clear reaction nodes, mechanism relationships and sequences can be introduced through the knowledge graph to constrain the large model to select a known and logically self-consistent path during the reasoning process, thereby replacing the large model's original free generation based on probability sampling, and improving the rationality and logical certainty of the reaction at each step. The final chemical reaction path reasoning result is also more accurate and more feasible.
[0099] Furthermore, this application utilizes a chemical knowledge graph to enhance knowledge coverage. The chemical knowledge graph can structuredly store low-frequency reactions and rare reaction types (such as photocatalysis, chiral transfer, and cascade reactions) from literature, databases, and experimental records. By retrieving paths related to the problem data in the chemical knowledge graph, a knowledge subgraph is generated as input for the large model. This effectively mitigates the large model's shortcomings in long-tail knowledge coverage and improves the accuracy of generated results, without requiring further training and resource consumption.
[0100] In addition, the method of this application can also achieve controllable and explainable reasoning paths. This application scheme combines the chemical knowledge graph. The reaction corresponding to each step of reasoning can find a clear source node and connection path in the graph, including but not limited to information such as reactants, products, intermediates, conditions, and literature sources, thereby supporting path-level visual backtracking and improving the explainability of the path.
[0101] Further optionally, the present application may also add an external constraint mechanism to the chemical knowledge graph. Various reaction rules, physical boundaries and structural constraints (such as valence conservation, functional group compatibility, spatial conformational restrictions, etc.) can be embedded in the chemical knowledge graph as "hard constraints" of the reasoning process to constrain and screen the results of large model generation.
[0102] In some embodiments of the present application, another implementation of the chemical reaction path reasoning method is provided. During the process of performing path retrieval in step S120 of the aforementioned embodiment, a graph pruning process can also be performed simultaneously until a knowledge subgraph is obtained.
[0103] Through the graph pruning strategy, infeasible and suboptimal synthesis paths can be filtered out, reducing the interference of redundant information in the knowledge subgraph on the reasoning process of the large model.
[0104] Combine Figure 3 As shown, the chemical reaction path reasoning method of the present application can add an intention extraction process, that is, extract the intention of the problem data to obtain the intention label.
[0105] The intent extraction process may be performed in parallel with the entity extraction process in step S110 , or in any order.
[0106] In addition to the entity information in the form of nouns in the question data, the user's intention also plays an important role in the subsequent graph retrieval method and pruning. For example, the user hopes to use green chemicals as much as possible in the synthesis process, and hopes to achieve high yields and accept certain side reactions.
[0107] In some embodiments, a pre-trained intent extraction model can be used to extract intent labels from question data. Furthermore, large-scale model technology can be used for intent extraction. For example, the question data can be assembled into a prompt, which is then fed into the large-scale model to instruct it to extract intent from the question data and obtain the intent label output by the large-scale model.
[0108] For example, the prompt instructing the large model to extract intent may be: "Please extract the intent labels contained in [question data]."
[0109] The intent extraction task is a multi-classification task, which classifies question data into pre-defined intent labels.
[0110] Taking the question data shown in Table 1 above as an example, the extracted intention labels may include two labels: "green chemistry" and "reaction steps ≤ 6".
[0111] For the extracted intent tags, corresponding pruning rules can be configured based on the intent tags, and then the chemical knowledge graph can be statically pruned according to the pruning rules. The subsequent examples of this application will explain the graph pruning process in detail.
[0112] Further integration Figure 3 As shown, this embodiment introduces an optional implementation scheme for performing path retrieval in the chemical knowledge graph in the aforementioned step S120.
[0113] In this embodiment, a beam search approach can be used to perform path retrieval in the chemical knowledge graph. The beam search process can start with the reaction substrate as the search starting point and search backward. At each step, the first k nodes with the highest correlation with the current node are selected as the next hop nodes, where k is a positive integer not less than 2.
[0114] In a multi-step chemical reaction, there may be multiple feasible solutions from the starting reaction substrate to the final target product. The knowledge graph traversal process is prone to greedy problems. This application uses a beam search method to select the top k nodes with the highest correlation with the current node at each step, expanding the initial receptive field and solving the greed problem to a certain extent.
[0115] Alternatively, the path search process can employ a bidirectional search approach. Specifically, a greedy algorithm may miss the correct path to global optimality in pursuit of a local optimum. By employing a bidirectional search approach, the extracted reaction substrate is used as the starting point for a forward traversal of the graph, and the extracted target product is used as the starting point for a reverse traversal of the graph, performing a bidirectional search within the configured chemical knowledge graph. If the two paths obtained from the bidirectional search intersect at a node, the subpaths from each of the two paths from the starting point to the intersecting node are selected and merged into a complete path.
[0116] By adopting a bidirectional search method, the probability of finding the global optimal correct path can be increased.
[0117] In some embodiments, the present application can also use both beam search and bidirectional search to search for paths. Figure 4 , which illustrates a case diagram of graph search and pruning.
[0118] Define the beam width k=2 of the beam search, the reaction substrate is A, and the target product is M. There are two known correct synthesis pathways: A→B→F→J→M and A→C→F→J→M.
[0119] If the beam search method is not used and the top 1 is selected in each search, only one path will be obtained in the end, such as A→B→E→H→K, which greatly reduces the probability of reaching the final target product M.
[0120] Furthermore, when reasoning to node F, due to the greedy algorithm's local optimal solution, nodes H and I might be selected, ultimately missing the target product M. However, when using a bidirectional search approach, a path M→J→F exists in the reverse search process. After verification, it is found that node F exists in the forward search path. These two paths are then concatenated to form A→B→F→J→M and A→C→F→J→M, achieving the correct path search.
[0121] In some embodiments of the present application, the process of chemical knowledge graph pruning is introduced.
[0122] Combine Figure 3 As shown in the figure, the chemical knowledge graph pruning process can adopt any one or more combinations of the three pruning strategies: static pruning, dynamic pruning, and redundant pruning.
[0123] For static pruning:
[0124] This application can configure pruning rules, and then perform static pruning on the chemical knowledge graph according to the pruning rules. The pruning rules can be continuously updated iteratively.
[0125] Pruning rules can be obtained in two ways. One is to configure the corresponding pruning rules based on the intent labels extracted from the question data; the other is to configure the pruning rules based on chemical prior knowledge.
[0126] Pruning rules based on intent labels include but are not limited to:
[0127] 1. Side reaction products: Directly remove irrelevant entities through material properties (such as functional group matching), for example, excluding nitro-containing side reaction products in the synthesis path.
[0128] 2. Green Chemistry: Directly exclude harmful agent nodes based on node attributes.
[0129] 3. Yield requirement: Combined with relationship attributes, directly exclude paths whose response yield is lower than user demand.
[0130] 4. Reaction step requirements: After a reaction step that exceeds the user limit, the subsequent nodes are directly cut.
[0131] Pruning rules configured based on chemical prior knowledge include but are not limited to:
[0132] 1. Stereochemical compatibility constraints: Introducing molecular chirality descriptors (encoded by CIP rules) adds 3D spatial constraints to the embedding layer, forcibly pruning paths with mismatched configurations. For example, in enzyme-catalyzed reactions, this can eliminate transition states with inconsistent stereoselectivity.
[0133] 2. Reaction network energy topology analysis: Construct a synthetic path energy surface diagram, identify local minimum traps through gradient analysis, and use graph theory algorithms (such as Tarjan strongly connected component detection) to remove energy loop paths.
[0134] 3. Catalyst-substrate matching modeling: Establish a correlation matrix between the electron cloud density of the catalyst active center and the LUMO / HOMO energy level of the substrate, design an attention mechanism to calculate the matching score, and filter out paths with scores below the threshold.
[0135] 4. Energy constraints: Directly eliminate infeasible paths through thermodynamic parameters (such as reactions with ΔG>0), and automatically filter using Gibbs free energy calculation libraries (such as RDKit).
[0136] Combine Figure 4 As shown in the figure, for entity D in the chemical knowledge graph, its corresponding substance is cyanide, which is a highly toxic substance. Based on the intent label "Green Chemistry" obtained from the previous intent extraction, it is necessary to ensure that every substance in the chemical reaction path is non-toxic and safe. Therefore, the path A→D is directly cut off and backward reasoning along this path is no longer carried out.
[0137] For dynamic pruning:
[0138] In this example, mutual information is used as a dynamic pruning metric. When a current node in the chemical knowledge graph is retrieved, the mutual information between each candidate node pointed to by the current node and known facts is calculated. This known fact includes the question data and information about the retrieved path leading to the current node. Candidate nodes that do not meet the mutual information requirement are removed from the candidate nodes, thus achieving dynamic pruning.
[0139] When the beam search method is used, the beam width is k. The corresponding mutual information condition requirement may be to retain the first k candidate nodes with the largest mutual information.
[0140] After pre-training, the large model is more inclined to predict words that frequently appear in combinations with the generated sequence when predicting the next symbol in a sequence. Therefore, this embodiment uses mutual information as a pruning metric. Mutual information can measure the dependencies between candidate nodes and known facts, thus screening knowledge subgraphs with stronger dependencies, which are more consistent with the generation logic of the large model.
[0141] In some embodiments, when the path search termination condition is reached (eg, a set search step is reached, a target product is retrieved, etc.), if the retrieved paths include both first-category paths and second-category paths, the first-category paths are deleted.
[0142] Among them, the first type of path is the path that cannot be inferred to obtain the target product, and the second type of path is the path that can be inferred to obtain the target product.
[0143] Furthermore, if there are more than two second-type paths, the path with the largest mutual information is retained, where the mutual information of a path represents the product of the mutual information values corresponding to each step in the path.
[0144] The dynamic pruning process in this embodiment removes first-category paths that fail to lead to the target product, retaining second-category paths. If there are multiple second-category paths, only the path with the highest mutual information is retained, based on their mutual information. This provides more useful information for subsequent large-scale model generation.
[0145] by Figure 4 In the example shown, when the path search termination condition is reached, two composite paths A→B→F→J→M and A→C→F→J→M are output. The mutual information values corresponding to each step in the composite path can be multiplied together, and the composite path with the largest mutual information value is retained.
[0146] The embodiment of the present application introduces an optional method for calculating mutual information. In addition, those skilled in the art can also use other mathematical calculation methods to calculate the mutual information value.
[0147] Based on a question data Q and knowledge subgraph , since the content of question Q is fixed, its Shannon entropy is a constant. Further, the formula of mutual information can be expressed as follows:
[0148] .
[0149] Since there are a large number of candidate subgraphs in large-scale knowledge graphs , using the exhaustive search method will lead to The amount of calculation is too large. To avoid this problem, Convert to calculation ,In addition, assuming that only one hop triple is considered each time, the calculation target is:
[0150] ,
[0151] because It is a chain structure connected from beginning to end, with h, r, and t representing the head node, relationship, and tail node respectively. Substituting h, r, and t into the above formula yields:
[0152] ,
[0153] Then start calculating , according to the conditional probability conversion formula, we can get:
[0154] ,
[0155] This allows the initial goal to focus on computing , the probability calculation can be used to estimate the probability of each candidate relationship r with the help of a large language model, and then select the top k relationships based on the probability. The specific probability calculation formula is:
[0156] .
[0157] in is the predicted word probability, Represent the problem separately , head entity and relationships Then, Can be further decomposed into Because a relationship usually corresponds to only one tail entity, . Further, Can be decomposed into In addition, since the tail entity of the current triple will become the head entity of the subsequent triple, .therefore, .
[0158] Then repeat the above steps to iterate and set the overall probability Converted into the product of multiple probabilities, the final estimate can be expressed as:
[0159]
[0160] Similarly, the denominator can be decomposed into:
[0161]
[0162] for The last term on the right side of the formula , which can be converted to , since the problem q is fixed, add This conditional restriction does not change its probability, so it is a constant value.
[0163] So far, Each item in can be processed accordingly, where n in the above formula is a pre-given hyperparameter used to terminate the iteration. When the entity corresponding to the last node of the retrieved triple is the target product, the iteration can be terminated early.
[0164] Combine Figure 4In the example shown, when inference reaches node B, the subsequent candidate nodes are E, F, and G. These three candidate nodes cannot be pruned using static pruning alone. We further calculate the mutual information between {Q, A→B} and E, F, and G using the above formula, obtaining a value of [3.1222, 2.9722, 1.0501]. Using the beam width k = 2 in beam search, we retain nodes E and F, which have the highest mutual information.
[0165] The dynamic pruning strategy introduced in the above embodiment can be implemented independently of the static pruning strategy, or the dynamic pruning strategy can be further implemented on the basis of the static pruning strategy.
[0166] For redundant pruning:
[0167] After reaching the retrieval termination condition, if the only path obtained cannot be inferred to obtain the target product, redundant information pruning is performed on the only path to remove redundant node information in the path.
[0168] In practical applications, scenarios may arise where the target product does not exist in the chemical knowledge graph. Consequently, regardless of whether static or dynamic pruning strategies are employed, the path search process will fail to obtain the correct reaction path. This means that the resulting path cannot be used to infer the target product. Assuming the number of searches is limited to n, the resulting path will be an n-hop path. This path contains redundant information that is useless for large-scale model reasoning. Therefore, in this embodiment, this redundant information can be pruned from the path to improve the performance of subsequent large-scale model reasoning.
[0169] In some embodiments, the process of performing redundant information pruning on a path may include:
[0170] For each node in the path, the uncertainty value between the subpath from the starting point of the path to each node and the problem data is calculated to obtain the uncertainty value corresponding to each node.
[0171] The target node with the smallest uncertainty value is selected in the path. If the uncertainty value of the target node does not exceed the set uncertainty threshold, the nodes after the target node in the path are pruned.
[0172] Specifically, the uncertainty value of each node can be quantified by the Shannon formula, which is expressed as:
[0173] ,
[0174] Among them, y represents the answer generated by the language model, Contains question data Q and knowledge subgraph Higher entropy values indicate larger perturbations and lower confidence in the answer, reflecting greater uncertainty.
[0175] Assume that after the above static pruning and dynamic pruning, the resulting path consists of n hops of reaction steps .
[0176] Calculate the problem data Q and each subpath separately The uncertainty of each node is obtained.
[0177] Select the target node with the smallest uncertainty value in the path. If the uncertainty value of the target node does not exceed the set uncertainty threshold, then the nodes after the target node in the path are pruned. For example, The uncertainty value of is the smallest and does not exceed the set uncertainty threshold, then After that, each node is pruned to obtain the path after redundant pruning: This path is used as the retrieved knowledge subgraph and input into the large model for subsequent reasoning.
[0178] by Figure 4 For example, suppose the target product S is desired by the user. This substance does not exist in the chemical knowledge graph, but the synthesis path A→B→E is of certain reference value for generating substance S. Assume that we limit the number of searches to 4 and the uncertainty threshold to 0.5. Through static and dynamic pruning, the final synthesis path obtained is A→B→E→H→K. Since this path does not contain the final product S, redundant pruning is performed:
[0179] Calculate the uncertainty values for {Q,A}, {Q,A→B}, {Q,A→B→E}, {Q,A→B→E→H}, and {Q,A→B→E→H→K}, and obtain [1.0, 0.7, 0.3, 0.7, 0.9]. The uncertainty value of 0.3 for {Q,A→B→E} is the smallest, and 0.3 < 0.5. Therefore, we retain the composite path A→B→E and delete the nodes after node E.
[0180] It should be noted that the redundant pruning strategy can be implemented alone or in addition to the aforementioned static pruning and / or dynamic pruning. In some embodiments of the present application, static pruning, dynamic pruning, and redundant pruning can be combined to achieve better pruning results.
[0181] In some embodiments of the present application, the process of performing feature extraction and feature fusion on the knowledge subgraph and question data in the aforementioned step S130, sending the fused features to the large model for processing, and obtaining the answer corresponding to the question data output by the large model is described.
[0182] Combine Figure 3As shown, the process of extracting features from the knowledge subgraph and question data in this embodiment can be divided into unstructured information extraction and structured information extraction.
[0183] Specifically, the first encoding features of unstructured information (such as text information) in the knowledge subgraph can be extracted.
[0184] In some embodiments, a text processing model may be used to extract text features from triple texts in the knowledge subgraph as first encoding features.
[0185] In other embodiments, the large model can also be used to extract first encoding features of unstructured information in the knowledge subgraph. For example, triple information in the knowledge subgraph is fed into the large model to instruct the large model to organize the input triple information into a descriptive text and obtain the features extracted by the hidden layer of the large model as the first encoding features.
[0186] For the process of extracting structured information:
[0187] The question data can be added as a node to the knowledge subgraph, and a connection relationship between the newly added node and the remaining nodes in the knowledge subgraph is established to obtain the edited knowledge subgraph.
[0188] Reference Figure 5 As shown in Figure 2, it is assumed that the knowledge subgraph obtained by path search is the path: A→C→F→J→M.
[0189] Add the question data Q as a node to the knowledge subgraph, and establish the connection relationship between node Q and other nodes to obtain the edited knowledge subgraph as follows: Figure 5 shown.
[0190] On this basis, the edited knowledge subgraph can be processed by a graph neural network (for example, a GNN network) to obtain the second encoding features of the nodes corresponding to the problem data.
[0191] Specifically, the convergence effect of the graph neural network can be used to obtain a question encoding feature that aggregates the knowledge subgraph structure information, namely the second encoding feature. This second encoding feature simultaneously integrates the question data and the knowledge subgraph structure information.
[0192] The first coding feature and the second coding feature extracted above are fused to obtain a fused feature, which is fed into the large model for processing to obtain the answer corresponding to the question data output by the large model.
[0193] In one possible implementation, the first encoding feature and the second encoding feature can be fused through an attention mechanism to obtain a fused feature. In addition, other feature fusion mechanisms can also be used, such as feature splicing, weighted averaging, and other fusion methods.
[0194] The following provides a real-world example, showing the user's question data question and the answer that the large model ultimately outputs:
[0195] "question": "I would like to obtain the reaction product ['CCC[C@]1(COP(=O)(O)O)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O'].Given the required partial reaction substrates ['C=CC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C', 'COc1ccc(C(Cl)(c2ccccc2)c2ccccc2)cc1'], please help me supplement the remaining required reaction substrates and provide the reaction pathway as well as the conditions required for thereaction.".
[0196] "answer": "The required substrates are 'C=CC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C','COc1ccc(C(Cl)(c2ccccc2)c2ccccc2)cc1','C=CC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C','CCC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C','CCC[C@]1(CO)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O' and 'CCC[C@]1(CO)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O', involving a total of 5 reactionsteps.
[0197] Step 1, Using 'C=CC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C' and 'COc1ccc(C(Cl)(c2ccccc2)c2ccccc2)cc1'as substrate, dichloromethane as solvent, silver nitrate and 2,4,6-trimethyl-pyridine as reagent. The reaction is carried out at room temperature forovernight, ultimately yielding product 'C=CC[C@]1(CO[Si]((C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C', the reaction equation is C=CC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C.COc1ccc(C(Cl)(c2ccccc2)c2ccccc2)cc1>>C=CC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C.
[0198] Step 2, Using 'C=CC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C' assubstrate, methanol as solvent, hydrogen as reagent, 10% Pd / C as catalyst.The reaction is carried out for overnight, ultimately yielding product 'CCC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C', the reaction equation is C=CC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C>>CCC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C.
[0199] Step 3, Using 'CCC[C@]1(CO[Si](C)(C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C' assubstrate, tetrahydrofuran as solvent, tetrabutyl ammonium fluoride asreagent. The reaction is carried out at room temperature for 2 h, ultimatelyyielding product 'CCC[C@]1(CO)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O', the reaction equation is CCC[C@]1(CO[Si](C)C(C)(C)C)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O[Si](C)(C)C(C)(C)C>>CCC[C@]1(CO)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O.
[0200] Step 4, Using 'CCC[C@]1(CO)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O' as substrate, formic acid as reagent. Thereaction is carried out at room temperature for overnight, ultimatelyyielding product 'CCC[C@]1(CO)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O', thereaction equation is CCC[C@]1(CO)O[C@@H](n2ccc(NC(c3ccccc3)(c3ccccc3)c3ccc(OC)cc3)nc2=O)[C@H](F)[C@@H]1O>>CCC[C@]1(CO)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O.
[0201] Step 5, Using 'CCC[C@]1(CO)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O' assubstrate, trimethyl phosphite as solvent, 1-methyl-1H-imidazole andtrichlorophosphate as reagent. The reaction is carried out at roomtemperature for overnight, ultimately yielding product 'CCC[C@]1(COP(=O)(O)O)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O', the reaction equation is CCC[C@]1(CO)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O>>CCC[C@]1(COP(=O)(O)O)O[C@@H](n2ccc(N)nc2=O)[C@H](F)[C@@H]1O."。
[0202] The chemical reaction path inference device provided in an embodiment of the present application is described below. The chemical reaction path inference device described below and the chemical reaction path inference method described above can be referenced to each other.
[0203] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of a chemical reaction path inference device disclosed in an embodiment of the present application.
[0204] like Figure 6 As shown, the device may include:
[0205] A question acquisition unit 11 is used to acquire question data related to the chemical reaction path reasoning task;
[0206] An entity extraction unit 12 is configured to extract entities from the problem data to obtain entity information, wherein the entity information includes reaction substrates and target products;
[0207] The knowledge graph retrieval unit 13 is configured to perform a path search in a configured chemical knowledge graph using the reaction substrate as the starting point of the chemical reaction path and the target product as the end point of the chemical reaction path to obtain a knowledge subgraph representing the chemical reaction path, wherein the chemical knowledge graph includes a plurality of reaction nodes, and the edges between the reaction nodes represent the reaction mechanism relationship or sequence;
[0208] The feature processing unit 14 is used to extract and fuse features of the knowledge subgraph and the question data, and send the fused features to the large model for processing to obtain the answer corresponding to the question data output by the large model.
[0209] In one possible implementation, the apparatus of the present application may further include:
[0210] The knowledge graph pruning unit is used to synchronously perform graph pruning processing when the knowledge graph retrieval unit executes the path retrieval process until the knowledge subgraph is obtained.
[0211] In one possible implementation, the apparatus of the present application may further include:
[0212] An intention extraction unit, configured to extract the intention from the question data to obtain an intention label;
[0213] The graph pruning process performed by the knowledge graph pruning unit includes:
[0214] The chemical knowledge graph is statically pruned based on configured pruning rules, wherein the pruning rules include pruning rules configured based on the intent tags.
[0215] In a possible implementation, the pruning rules further include: pruning rules configured based on chemical prior knowledge.
[0216] In one possible implementation, the graph pruning process performed by the knowledge graph pruning unit includes:
[0217] When the current node in the chemical knowledge graph is retrieved, for each candidate node pointed to by the current node in the graph, the mutual information between the candidate node and the known facts is calculated, wherein the known facts include the question data and the retrieved path information up to the current node;
[0218] The mutual information is used as a dynamic pruning indicator to delete candidate nodes that do not meet the mutual information condition requirement from the candidate nodes.
[0219] In one possible implementation, the graph pruning process performed by the knowledge graph pruning unit includes:
[0220] After the search termination condition is reached, if the retrieved paths include both first-category paths and second-category paths, the first-category paths are deleted. The first-category paths are paths that cannot be inferred to obtain the target product, and the second-category paths are paths that can be inferred to obtain the target product.
[0221] If there are more than two second-type paths, the path with the largest mutual information is retained, where the mutual information of the path represents the product of the mutual information values corresponding to each step in the path.
[0222] In one possible implementation, the graph pruning process performed by the knowledge graph pruning unit includes:
[0223] After reaching the retrieval termination condition, if the only path obtained cannot be inferred to obtain the target product, redundant information pruning is performed on the only path to remove redundant node information in the path.
[0224] In one possible implementation, the knowledge graph pruning unit performs a process of pruning redundant information on a path, including:
[0225] For each node in the path, the uncertainty value between the subpath from the starting point of the path to each node and the problem data is calculated to obtain the uncertainty value corresponding to each node;
[0226] A target node with the smallest uncertainty value is selected in the path. If the uncertainty value of the target node does not exceed a set uncertainty threshold, each node after the target node in the path is pruned.
[0227] In one possible implementation, the process of the knowledge graph retrieval unit performing path retrieval in the configured chemical knowledge graph includes:
[0228] Using the reaction substrate as the starting point of the forward search and the target product as the starting point of the reverse search, a bidirectional search is performed in the configured chemical knowledge graph;
[0229] If there is an intersecting node between the two paths obtained by the bidirectional search, the subpaths from the starting point to the intersecting node of each of the two paths are selected and merged into a complete path.
[0230] In one possible implementation, the process of the knowledge graph retrieval unit performing path retrieval in the configured chemical knowledge graph includes:
[0231] A beam search method is used to perform path retrieval in the configured chemical knowledge graph. At each step, the first k nodes with the highest correlation with the current node are selected as the next hop nodes, where k is a positive integer not less than 2.
[0232] In a possible implementation, after obtaining the entity information, the entity extraction unit is further configured to:
[0233] Perform entity disambiguation processing on the entity information.
[0234] In one possible implementation, the process of extracting and fusing features of the knowledge subgraph and the question data by the feature processing unit includes:
[0235] Extracting a first encoding feature of the unstructured information of the knowledge subgraph;
[0236] Adding the question data as a node to the knowledge subgraph, and establishing a connection relationship between the newly added node and the remaining nodes in the knowledge subgraph to obtain an edited knowledge subgraph;
[0237] Processing the edited knowledge subgraph through a graph neural network to obtain a second encoding feature of a node corresponding to the question data;
[0238] The first coding feature and the second coding feature are fused to obtain a fused feature.
[0239] In one possible implementation, the process of extracting the first coding feature of the unstructured information of the knowledge subgraph by the feature processing unit includes:
[0240] The triple information in the knowledge subgraph is fed into the large model to instruct the large model to organize the input triple information into a descriptive text, and obtain the features extracted by the hidden layer of the large model as the first coding features.
[0241] Each unit in the chemical reaction pathway inference device described above can be implemented in whole or in part through software, hardware, or a combination thereof. Each of the above units can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above units.
[0242] An electronic device is also provided in an embodiment of the present application. Figure 7 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to terminals such as mobile phones, tablet computers, teaching large screens, learning machines, etc. Figure 7 The electronic device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.
[0243] like Figure 7 As shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage device 608 to the random access memory (RAM) 603 to implement the chemical reaction path reasoning method of the aforementioned embodiment of the present application. When the electronic device is powered on, the RAM 603 also stores various programs and data required for the operation of the electronic device. The processing device 601, ROM 602 and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0244] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Figure 7 The electronic device is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0245] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any chemical reaction path reasoning method provided in the embodiment of the present application.
[0246] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any chemical reaction path reasoning method provided in the embodiment of the present application.
[0247] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0248] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0249] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0250] 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 application 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 devices. 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, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. 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 drive (SSD)).
[0251] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.
Claims
1. A chemical reaction path reasoning method, characterized in that: include: Obtaining problem data related to the chemical reaction path reasoning task; Performing entity extraction on the problem data to obtain entity information, wherein the entity information includes a reaction substrate and a target product; Taking the reaction substrate as the starting point of the chemical reaction path and the target product as the end point of the chemical reaction path, a path search is performed in the configured chemical knowledge graph to obtain a knowledge subgraph representing the chemical reaction path. The chemical knowledge graph includes a number of reaction nodes, and the edges between the reaction nodes represent the reaction mechanism relationship or sequence; Feature extraction and feature fusion are performed on the knowledge subgraph and the question data, and the fused features are sent to the large model for processing to obtain the answer corresponding to the question data output by the large model.
2. The method according to claim 1, characterized in that Also includes: During the process of executing the path retrieval, graph pruning is performed synchronously until the knowledge subgraph is obtained.
3. The method according to claim 2, characterized in that Also includes: Performing intent extraction on the question data to obtain an intent label; The graph pruning process includes: The chemical knowledge graph is statically pruned based on configured pruning rules, wherein the pruning rules include pruning rules configured based on the intent tags.
4. The method according to claim 3, characterized in that The pruning rules also include: pruning rules configured based on chemical prior knowledge.
5. The method according to claim 2, characterized in that The graph pruning process includes: When the current node in the chemical knowledge graph is retrieved, for each candidate node pointed to by the current node in the graph, the mutual information between the candidate node and the known facts is calculated, wherein the known facts include the question data and the retrieved path information up to the current node; The mutual information is used as a dynamic pruning indicator to delete candidate nodes that do not meet the mutual information condition requirement from the candidate nodes.
6. The method according to claim 2, characterized in that The graph pruning process includes: After the search termination condition is reached, if the retrieved paths include both first-category paths and second-category paths, the first-category paths are deleted. The first-category paths are paths that cannot be inferred to obtain the target product, and the second-category paths are paths that can be inferred to obtain the target product. If there are more than two second-type paths, the path with the largest mutual information is retained, where the mutual information of the path represents the product of the mutual information values corresponding to each step in the path.
7. The method according to claim 2, characterized in that The graph pruning process includes: After reaching the retrieval termination condition, if the only path obtained cannot be inferred to obtain the target product, redundant information pruning is performed on the only path to remove redundant node information in the path.
8. The method according to claim 7, characterized in that The process of pruning redundant information on a path includes: For each node in the path, the uncertainty value between the subpath from the starting point of the path to each node and the problem data is calculated to obtain the uncertainty value corresponding to each node; A target node with the smallest uncertainty value is selected in the path. If the uncertainty value of the target node does not exceed a set uncertainty threshold, each node after the target node in the path is pruned.
9. The method according to claim 1, characterized in that The process of path retrieval in the configured chemical knowledge graph includes: Using the reaction substrate as the starting point of the forward search and the target product as the starting point of the reverse search, a bidirectional search is performed in the configured chemical knowledge graph; If there is an intersecting node between the two paths obtained by the bidirectional search, the subpaths from the starting point to the intersecting node of each of the two paths are selected and merged into a complete path.
10. The method according to claim 1, characterized in that The process of path retrieval in the configured chemical knowledge graph includes: A beam search method is used to perform path retrieval in the configured chemical knowledge graph. At each step, the first k nodes with the highest correlation with the current node are selected as the next hop nodes, where k is a positive integer not less than 2.
11. The method according to claim 1, wherein After obtaining the entity information, the method further includes: Perform entity disambiguation processing on the entity information.
12. The method according to claim 1, characterized in that The process of extracting and fusing features of the knowledge subgraph and the question data includes: Extracting a first encoding feature of the unstructured information of the knowledge subgraph; Adding the question data as a node to the knowledge subgraph, and establishing a connection relationship between the newly added node and the remaining nodes in the knowledge subgraph to obtain an edited knowledge subgraph; Processing the edited knowledge subgraph through a graph neural network to obtain a second encoding feature of a node corresponding to the question data; The first coding feature and the second coding feature are fused to obtain a fused feature.
13. The method according to claim 12, characterized in that The process of extracting a first coding feature of the unstructured information of the knowledge subgraph includes: The triple information in the knowledge subgraph is fed into the large model to instruct the large model to organize the input triple information into a descriptive text, and obtain the features extracted by the hidden layer of the large model as the first coding features.
14. A chemical reaction path inference device, characterized in that: include: A question acquisition unit, used to acquire question data related to the chemical reaction path reasoning task; An entity extraction unit, configured to extract entities from the problem data to obtain entity information, wherein the entity information includes a reaction substrate and a target product; a knowledge graph retrieval unit, configured to perform a path search in a configured chemical knowledge graph using the reaction substrate as the starting point of the chemical reaction path and the target product as the end point of the chemical reaction path, thereby obtaining a knowledge subgraph representing the chemical reaction path, wherein the chemical knowledge graph includes a plurality of reaction nodes, and edges between the reaction nodes represent the reaction mechanism relationship or sequence; The feature processing unit is used to extract and fuse features of the knowledge subgraph and the question data, and send the fused features to the large model for processing to obtain the answer corresponding to the question data output by the large model.
15. An electronic device, characterized in that: include: memory and processor; The memory is used to store programs; The processor is configured to execute the program to implement each step of the chemical reaction path inference method according to any one of claims 1 to 13.
16. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the chemical reaction pathway inference method according to any one of claims 1 to 13 is implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, each step of the chemical reaction pathway inference method according to any one of claims 1 to 13 is implemented.