Chemical reaction path reasoning method and device, related equipment and program product

By combining chemical reaction path inference methods with chemical knowledge graphs and large models, the problem of illogical and insufficient knowledge coverage of large models in chemical reaction path inference is solved, and more accurate and feasible reaction path generation is achieved, enhancing the interpretability and controllability of the path.

CN120340650AActive Publication Date: 2025-07-18IFLYTEK CO LTD

Patent Information

Application Number
CN202510809438.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-17
Publication Date
2025-07-18
Estimated Expiration
2045-06-17

AI Technical Summary

Technical Problem

Large models lack the modeling ability of causal chains in the chemical reaction path reasoning task, resulting in irreconcilable jumps or pseudo-reactions in the reaction path, and the knowledge coverage is not comprehensive, making it difficult to include the long-tail reaction mechanism, the generation effect is poor, and the intermediate visualization and logical traceability mechanism are lacking, and the path feasibility is difficult to verify.

Method used

Combining chemical knowledge graphs to enhance the inference ability of big models, by constructing a knowledge graph containing reaction nodes and mechanism relationships, performing path retrieval and feature extraction, using pruning strategies to filter infeasible paths, introducing clear reaction nodes and sequential inference process that constrains the big models.

Benefits of technology

It improves the accuracy and feasibility of chemical reaction path reasoning, enhances the interpretability and controllability of paths, alleviates the defects of long-tail knowledge coverage, and improves the accuracy and certainty of generated results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120340650A_ABST
    Figure CN120340650A_ABST
Patent Text Reader

Abstract

The invention discloses a chemical reaction path reasoning method and device, related equipment and a program product, and relates to the technical field of artificial intelligence. The chemical knowledge graph is obtained based on priori knowledge arrangement in the chemical field. A chemical knowledge graph is combined with a large model reasoning mechanism, and the knowledge retrieval and logic constraint capability of a large model is enhanced through explicit structured graph knowledge. The method comprises the following steps: performing entity extraction on question data, performing path retrieval in a knowledge graph by utilizing an extracted entity to obtain a knowledge sub-graph related to the question data, performing feature extraction and fusion on the knowledge sub-graph and the question data, and sending a fused feature into a large model for processing to obtain an answer output by the large model. A knowledge graph constraint large model is used for selecting a known and logic self-consistent path in the reasoning process, so that the original free generation based on probability sampling of the large model is replaced, and the reaction rationality and logic certainty of each step are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and more specifically, to a chemical reaction path inference method, device, related equipment and program product. Background Art

[0002] Existing large models show certain limitations when facing multi-hop reasoning problems, while the reaction path inference task in the chemical field naturally has 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 currently using a large model to perform the chemical reaction path inference task, generally the problem description of the task to be inferred is sent into the large model, and the large model performs the inference process and outputs the final result. Due to the lack of the ability of the large model to model causal chains, in tasks such as chemical reaction path construction with high logic and high professionalism, the model often has problems such as "chemical logic skipping", "intermediate error" or "reaction direction error", resulting in the lack of feasibility of the final inference path. Summary of the Invention

[0004] In view of the above problems, this application is proposed to provide a chemical reaction path inference method, device, related equipment and program product, so as to improve the accuracy and certainty of the large model in the chemical reaction path inference task and enhance the feasibility of the inference path. The specific solutions are as follows:

[0005] In the first aspect of this application, a chemical reaction path inference method is provided, including:

[0006] Obtain problem data related to the chemical reaction path inference task;

[0007] Perform entity extraction on the problem data to obtain entity information, where the entity information includes reaction substrates and target products;

[0008] Use 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, and perform path retrieval in the configured chemical knowledge graph to obtain a knowledge subgraph representing the chemical reaction path. The chemical knowledge graph includes several reaction nodes, and the edges between the reaction nodes represent reaction mechanism relationships or sequential orders;

[0009] Perform feature extraction and feature fusion on the knowledge subgraph and the problem data, and send the fused features into the large model for processing to obtain the answer corresponding to the problem data output by the large model.

[0010] In a possible design, in another implementation manner of the first aspect of the embodiments of this application, it further includes:

[0011] During the execution of the path retrieval, the graph pruning process is synchronously executed until the knowledge sub-graph is obtained.

[0012] In a possible design, in another implementation manner of the first aspect of the embodiments of the present application, it further includes:

[0013] Extract the intent from the problem data to obtain an intent label;

[0014] The graph pruning process includes:

[0015] Perform static pruning on the chemical knowledge graph based on the configured pruning rules, where the pruning rules include the pruning rules configured based on the intent label.

[0016] In a possible design, in another implementation manner 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 a possible design, in another implementation manner 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, calculate the mutual information between the candidate node and the known facts, where the known facts include the problem data and the retrieved path information up to the current node;

[0019] Using the mutual information as a dynamic pruning index, delete the candidate nodes that do not meet the mutual information condition requirements from each of the candidate nodes.

[0020] In a possible design, in another implementation manner of the first aspect of the embodiments of the present application, the graph pruning process includes:

[0021] After reaching the retrieval termination condition, if the retrieved path includes both the first type of path and the second type of path, delete the first type of path, where the first type of path is the path that cannot infer the target product, and the second type of path is the path that can infer the target product;

[0022] If there are more than two second type of paths, retain the one with the largest mutual information, where the mutual information of a path represents the product of the mutual information values corresponding to each step in the path.

[0023] In a possible design, in another implementation manner 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 infer the target product, redundant information pruning is performed on the only path to remove redundant node information in the path.

[0025] In a possible design, in another implementation manner of the first aspect of the embodiments of the present application, the process of performing redundant information pruning on a path includes:

[0026] For each node in the path, calculate the uncertainty value between the sub-path from the starting point of the path to each node and the problem data, and obtain the uncertainty value corresponding to each node;

[0027] 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 remove the nodes after the target node in the path.

[0028] In a possible design, in another implementation manner 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] Use the reaction substrate as the starting point for forward search and the target product as the starting point for backward search, and perform bidirectional search in the configured chemical knowledge graph;

[0030] If there are intersecting nodes in the two paths obtained by bidirectional search, select the sub-paths of the two paths from the starting point to the intersecting node respectively, and merge them into a complete path.

[0031] In a possible design, in another implementation manner 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] Adopt beam search to perform path retrieval in the configured chemical knowledge graph, and select the top k nodes with the highest relevance to the current node as the next-hop nodes at each step, where k is a positive integer not less than 2.

[0033] In a possible design, in another implementation manner of the first aspect of the embodiments of the present application, after obtaining the entity information, it further includes:

[0034] Perform entity disambiguation processing on the entity information.

[0035] In a possible design, in another implementation manner of the first aspect of the embodiments of the present application, the process of feature extraction and feature fusion for the knowledge sub-graph and the problem data includes:

[0036] Extract the first encoding feature of the unstructured information of the knowledge sub-graph;

[0037] Add the problem data as a node to the knowledge sub-graph, and establish connection relationships between the newly added node and the remaining nodes in the knowledge sub-graph to obtain an edited knowledge sub-graph;

[0038] Process the edited knowledge sub-graph through a graph neural network to obtain a second encoded feature of the node corresponding to the problem data;

[0039] Fuse the first encoded feature and the second encoded feature to obtain a fused feature.

[0040] In a possible design, in another implementation manner of the first aspect of the embodiments of the present application, the process of extracting the first encoded feature of the unstructured information of the knowledge sub-graph includes:

[0041] Send the triple information in the knowledge sub-graph into a large model to instruct the large model to organize the input triple information into a descriptive text, and obtain the features extracted from the hidden layer of the large model as the first encoded feature.

[0042] In the second aspect of the present application, a chemical reaction path reasoning device is provided, including:

[0043] A problem acquisition unit, configured to acquire problem data related to a chemical reaction path reasoning task;

[0044] An entity extraction unit, configured to perform entity extraction on the problem data to obtain entity information, where the entity information includes reaction substrates and target products;

[0045] A knowledge graph retrieval unit, configured to use 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 perform path retrieval in a configured chemical knowledge graph to obtain a knowledge sub-graph representing the chemical reaction path, where the chemical knowledge graph includes a number of reaction nodes, and the edges between the reaction nodes represent reaction mechanism relationships or sequence orders;

[0046] A feature processing unit, configured to perform feature extraction and feature fusion on the knowledge sub-graph and the problem data, and send the fused feature into a large model for processing to obtain an answer corresponding to the problem data output by the large model.

[0047] In the third aspect of the present application, an electronic device is provided, including: a memory and a processor;

[0048] The memory is configured to store a program;

[0049] The processor is configured to execute the program to implement each step of the chemical reaction path reasoning method described in any one of the foregoing first aspects of the present application.

[0050] In the 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, each step of the chemical reaction path inference method described in any one of the foregoing first aspects of the present application is implemented.

[0051] In the fifth aspect of the present application, a computer program product is provided, including a computer program. When the computer program is executed by a processor, each step of the chemical reaction path inference method described in any one of the foregoing first aspects of the present application is implemented.

[0052] With the above technical solutions, the present application can organize a chemical knowledge graph based on prior knowledge in the chemical field, such as the reaction mechanism relationship and reaction sequence between different chemical substances. By combining the chemical knowledge graph with the large model inference mechanism, 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 path retrieval is carried out in the knowledge graph using the extracted entities 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. Through the knowledge graph, explicit reaction nodes, mechanism relationships, and sequence can be introduced to constrain the large model to select known and logically consistent paths during the inference process, thereby replacing the original free generation based on probability sampling of the large model and enhancing the reaction rationality and logical certainty of each step. The finally obtained chemical reaction path inference result is also more accurate and has higher feasibility. Description of the Drawings

[0053] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present application. Moreover, throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:

[0054] Figure 1 It is a schematic diagram of an implementation system architecture for the chemical reaction path inference method provided by an embodiment of the present application;

[0055] Figure 2 It is a schematic diagram of the process flow of a chemical reaction path inference method provided by an embodiment of the present application;

[0056] Figure 3 It is a schematic diagram of the process flow of another chemical reaction path inference method provided by an embodiment of the present application;

[0057] Figure 4 It is a schematic diagram of the search pruning process of a chemical knowledge graph provided by an embodiment of the present application;

[0058] Figure 5Schematic diagram of an edited knowledge subgraph integrating problem data provided by an embodiment of the present application;

[0059] Figure 6 Schematic diagram of the structure of a chemical reaction path reasoning device provided by an embodiment of the present application;

[0060] Figure 7 Schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0061] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0062] In view of the limitations of large models in multi-hop reasoning, in the related art, by expanding the pre-training corpus of the model, the model is enabled to learn more cross-domain and cross-knowledge-point context associations in order to enhance its reasoning chain construction ability. However, there are still defects in the chemical reaction path reasoning of large models. Including but not limited to:

[0063] Lack of certainty in reasoning: Since large models generate content based on probability distributions and lack the ability to model causal chains, it is easy to have illogical jumps or pseudo-reactions in the reaction path.

[0064] Incomplete knowledge coverage: There are a large number of long-tail reaction mechanisms and professional paths in the chemical field. Even if the model training data is huge, it is difficult to cover these low-frequency or laboratory-specific reaction types. As a result, the generation effect of large models in such chemical reaction path reasoning tasks is poor.

[0065] Poor interpretability of the reasoning path: The current chemical reaction paths output by large models lack intermediate visualization and logical traceability mechanisms, and the feasibility of the paths is difficult to verify.

[0066] Lack of external constraint mechanism: Large models themselves do not have the hard constraint ability of chemical rules and are prone to generating paths that violate the principles of valence bond conservation, reaction site selectivity, or energy conservation.

[0067] To improve the usability of large models in the task of chemical reaction path reasoning and enhance the certainty and accuracy of the reasoning path, this application proposes a technical solution that combines a chemical knowledge graph to enhance the reasoning ability of large models. By constructing a knowledge graph that includes chemical reaction nodes and information such as the reaction mechanism relationships and reaction order between nodes, and integrating it with the reasoning process of the large model, the large model can rely on the structured graph knowledge for path reasoning, improving the certainty and accuracy of the reasoning path.

[0068] This application provides a chemical reaction path reasoning method, which can be applied to a system architecture as shown in Figure 1 The system may include a terminal 100 and a server 200. The server 200 may include one or more servers ( Figure 1 In this example, it is illustrated by including one server).

[0069] Either the terminal 100 or the server 200 can be used alone to execute the chemical reaction path reasoning method provided in the embodiments of this application. In addition, the terminal 100 and the server 200 can also be used in cooperation to execute the chemical reaction path reasoning method provided in the embodiments of this application.

[0070] Next, describe Figure 1 the product form of the terminal 100;

[0071] The terminal 100 in the embodiments of this application can be a mobile phone, a tablet computer, a teaching large screen, a learning machine, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and this application does not impose any restrictions on this.

[0072] The embodiments of this application provide a chemical reaction path reasoning method. Taking the application of this method to a computer device as an example, the computer device can specifically be Figure 1 the terminal 100 in Figure 2 or a system composed of the terminal 100 and the server 200. Referring to

[0073] Step S100: Obtain problem data related to the chemical reaction path reasoning task.

[0074] The reaction path inference task in the field of chemistry naturally has the multi-hop characteristic, that is, starting from the initial raw materials, it is necessary to infer the synthesis paths of multiple intermediates, reaction conditions and final products. Common chemical reaction path inference tasks include retrosynthetic analysis tasks, etc. Retrosynthetic analysis is the core strategy in organic synthetic chemistry for designing the synthesis routes of complex molecules. Its core idea is to start from the target molecule and disassemble it reversely into simpler precursors or known raw materials, so as to plan a feasible synthesis path.

[0075] In practical applications, users can put forward problem descriptions related to the chemical reaction path inference task.

[0076] Step S110: Extract entity information from the problem data. The entity information includes reaction substrates and target products.

[0077] Specifically, for the obtained problem data, an entity extraction algorithm can be used to extract the entity information contained therein. The entity information includes reaction substrates and target products. In addition, the entity information can also include other types of entities, including but not limited to: catalysts, solvents, temperature, pressure, reaction pH value, isomer markers (such as D / L, cis / trans), isotope symbols, stereochemical descriptors (R / S markers), etc.

[0078] In some embodiments, a pre-trained entity extraction model can be used to extract entity information from the problem data. In addition, large model technology can also be used for entity extraction. For example, the problem data is assembled into a prompt instruction, and the prompt is sent to the large model to instruct the large model to extract entity information from the problem data, and the entity information output by the large model is obtained.

[0079] Exemplarily, the prompt instruction prompt for instructing the large model to perform entity extraction can be: "Please extract the entity information contained in [problem data]."

[0080] Optionally, after obtaining the entity information in this step, a step of further performing entity disambiguation processing on the entity information can be added. Through entity disambiguation, the entity expression form can be unified, which is convenient for processing in subsequent steps.

[0081] The entity information can include chemical substance entities and condition entities. For chemical substance entities, one chemical substance entity may correspond to multiple forms of names, such as the IUPAC name, smiles name, molecular formula, common name, trade name, etc. of the chemical substance entity.

[0082] Among them, IUPAC (International Union of Pure and Applied Chemistry) is an international authoritative organization in the field of chemistry, responsible for formulating globally unified rules for chemical nomenclature, terminology, standard methods, etc. In terms of naming chemical substances, the rules of IUPAC ensure that each compound has a unique and clear name, namely the IUPAC name.

[0083] SMILES (Simplified Molecular Input Line Entry System) is a notation method that concisely describes the chemical molecular structure using strings (text). It converts two-dimensional or three-dimensional chemical structures into a single line of readable code through symbols such as atoms, bonds, branches, and ring structures, and is widely used in cheminformatics, database retrieval, and molecular modeling.

[0084] In this embodiment, for the chemical substance entities in the obtained entity information, conversions between IUPAC names, SMILES names, molecular formulas, common names, and trade names can be realized, unifying the chemical substance entities into the same description form. For example, they can be uniformly represented as SMILES names.

[0085] In a possible implementation, various types of names of chemical substance entities can be queried through a chemical database, thereby realizing the unified representation of names. Exemplarily, the API service provided by the free chemical database PubChem can be accessed to query various expression forms of chemical substance entities.

[0086] For conditional entities, some conditional entities may have default meanings in the chemical field. For example, "room temperature" is equal to 20 - 25 °C, "reflux" is equal to the solvent boiling point ±5 °C, "ice bath" is equal to 0 - 5 °C, etc. For this default knowledge in the industry, a mapping relationship table between conditional entities and real meaning expressions can be established in advance. Then, in this embodiment, for the conditional entities in the obtained entity information, the real meaning expression corresponding to the conditional entity can be obtained by querying the mapping relationship table, realizing the disambiguation of conditional entities.

[0087] Referring to Table 1 below, it exemplifies the results after entity extraction and entity disambiguation of the question data proposed by the user.

[0088] Table 1

[0089]

[0090] Among the problem data of the above examples, it simultaneously contains entity information in IUPAC form: "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", entity information in smiles form: "COc1cc(N)cc(OC)c1", "CCn1c2ccccc2c2ccc(Br)cc21", and entity information in molecular formula form: "C57H50N4O4". Through entity disambiguation, it is converted into smiles form.

[0091] For the conditional entity "reaction temperature: room temperature", by querying the mapping table, it is converted into "reaction temperature: 20-25 °C".

[0092] Step S120: Use the reaction substrate as the starting point of the chemical reaction path and the target product as the ending point of the chemical reaction path, and perform path retrieval in the configured chemical knowledge graph to obtain a knowledge subgraph representing the chemical reaction path.

[0093] Among them, the chemical knowledge graph includes several reaction nodes, and the edges between the reaction nodes represent reaction mechanism relationships or sequence. This application can pre-collect structured knowledge information in the chemical field, such as chemical reaction rules, species structures, energy information, etc., and organize them into a chemical knowledge graph.

[0094] In the previous steps, the reaction substrate and the target product in the problem data have been extracted. In this step, the reaction substrate can be used as the starting point of the chemical reaction path and the target product as the ending point of the chemical reaction path, and path retrieval is performed in the chemical knowledge graph to obtain a knowledge subgraph, which represents the chemical reaction path.

[0095] Step S130: Extract features and fuse features for the knowledge subgraph and the problem data, and send the fused features into a large model for processing to obtain the answer corresponding to the problem data output by the large model.

[0096] Specifically, the knowledge subgraph can constrain the large model to select known and logically consistent paths during the reasoning process, thereby replacing the original free generation based on probability sampling of the large model and improving the reaction rationality and logical certainty of each step.

[0097] In this step, by separately performing feature extraction and feature fusion on the knowledge sub-graph and the problem data, a fusion feature integrating the knowledge sub-graph and the problem data is obtained. The fusion feature can be input into the feature processing layer of the large model, and through the inference of the large model, the answer corresponding to the problem data can be obtained as the final output.

[0098] The chemical reaction path inference method provided by the embodiments of the present application can organize a chemical knowledge graph based on prior knowledge in the chemical field, such as the reaction mechanism relationship and reaction sequence between different chemical substances. By combining the chemical knowledge graph with the large model inference mechanism, 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 path retrieval is carried out in the knowledge graph using the extracted entities to obtain a knowledge sub-graph related to the problem data. Feature extraction and fusion are performed on the knowledge sub-graph and the problem data, and the fusion feature is fed into the large model for processing to obtain the answer output by the large model. By introducing clear reaction nodes, mechanism relationships, and sequence through the knowledge graph, the large model is constrained to select known and logically consistent paths during the inference process, thereby replacing the original free generation based on probability sampling of the large model and enhancing the reaction rationality and logical certainty of each step. The finally obtained chemical reaction path inference result is also more accurate and has higher feasibility.

[0099] Furthermore, the form of the chemical knowledge graph adopted in the present application can enhance the knowledge coverage ability. The chemical knowledge graph can structurally store low-frequency reactions and rare reaction types (such as photocatalysis, chiral transfer, tandem reactions) from literature, databases, and experimental records. By retrieving the path related to the problem data in the chemical knowledge graph and using the obtained knowledge sub-graph as the input of the large model, the defect of the large model in covering long-tail knowledge can be effectively alleviated without consuming additional resources for continuous training of the large model, and the accuracy of the generated result can be improved.

[0100] In addition, the method of the present application can also achieve controllable and interpretable inference paths. The solution of the present application combines the chemical knowledge graph, and the reaction corresponding to each step of inference can find clear source nodes and connection paths in the graph, including but not limited to information such as reactants, products, intermediates, conditions, and literature sources, thereby supporting visual backtracking at the path level and enhancing the interpretability of the path.

[0101] Further optionally, the present application can 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 conformation limitations, etc.) can be embedded in the chemical knowledge graph as "hard constraints" for the inference process to constrain and screen the generation results of the large model.

[0102] In some embodiments of the present application, another implementation of the chemical reaction path inference method is provided. During the process of performing path retrieval in step S120 of the foregoing embodiment, graph pruning processing can also be synchronously performed until a knowledge subgraph is obtained.

[0103] Through the graph pruning strategy, infeasible and sub-optimal synthesis paths can be filtered out, reducing the interference of redundant information in the knowledge subgraph on the large model inference process.

[0104] Combined with Figure 3 As shown, the chemical reaction path inference method of the present application can add an intention extraction process, that is, extract the intention of the problem data to obtain an intention label.

[0105] Among them, the intention extraction process can be executed in parallel with the entity extraction process in step S110 described above, or can be executed in any order.

[0106] In addition to the entity information in the form of nouns in the problem 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 chemical reagents as much as possible during the synthesis process, and is willing to accept certain side reactions for high yield, etc.

[0107] In some embodiments, a pre-trained intention extraction model can be used to extract intention labels from the problem data. In addition, large model technology can also be used for intention extraction. For example, the problem data can be assembled into a prompt instruction, and this prompt is sent to the large model to instruct the large model to extract the intention of the problem data, obtaining the intention label output by the large model.

[0108] Exemplarily, the prompt instruction for instructing the large model to perform intention extraction can be: "Please extract the intention labels included in [problem data]."

[0109] The intention extraction task belongs to a multi-classification task, and the problem data is classified into pre-defined intention labels.

[0110] Taking the problem data shown in Table 1 above as an example, the extracted intention labels can include: "green chemistry", "reaction steps ≤ 6" two labels.

[0111] For the extracted intention labels, corresponding pruning rules can be configured based on the intention labels, and then the chemical knowledge graph can be statically pruned according to the pruning rules. The subsequent embodiments of the present application will elaborate on the process of graph pruning.

[0112] Further combined with Figure 3 As shown, an optional implementation of performing path retrieval in the chemical knowledge graph in step S120 described above is introduced in this embodiment.

[0113] In this embodiment, a beam search method can be adopted to perform path retrieval in the chemical knowledge graph. In the beam search process, the reaction substrate can be used as the starting point for search and search backward. At each step, the top k nodes with the highest relevance to the current node are selected as the next-hop nodes, where k is a positive integer not less than 2.

[0114] Since there may be multiple feasible solutions between the starting reaction substrate and the final target product in a multi-step chemical reaction, there is an easy greedy problem in the process of traversing the knowledge graph. By adopting the beam search method, the top k nodes with the highest relevance to the current node are selected at each step, expanding the initial receptive field, and solving the greedy problem to a certain extent.

[0115] Further optionally, the path search process can also adopt a bidirectional search method. Specifically, the greedy algorithm may miss the correct path to reach the global optimum for the sake of local optimum. By adopting the bidirectional search method, the extracted reaction substrate is used as the starting point for forward traversing the graph, and the extracted target product is used as the starting point for backward traversing the graph, and bidirectional search is performed in the configured chemical knowledge graph. If there are intersecting nodes in the two paths obtained by the bidirectional search, then the sub-paths of the two paths from the starting point to the intersecting node are selected and merged into a complete path.

[0116] By adopting the bidirectional search method, the probability of obtaining the correct path of the global optimum can be increased.

[0117] In some embodiments, the present application can also adopt both the beam search and the bidirectional search methods to perform path search. For ease of understanding, combined with Figure 4 , it exemplifies a case diagram of graph search and pruning.

[0118] Define the beam width k of the beam search as 2, the reaction substrate as A, and the target product as M. It is known that there are two correct synthesis paths, namely: A→B→F→J→M and A→C→F→J→M.

[0119] If the beam search method is not adopted and top1 is selected for each search, then only one path will be obtained finally, such as A→B→E→H→K, greatly reducing the probability of reaching the final target product M.

[0120] In addition, when reasoning to the F node, due to the local optimum solution of the greedy algorithm, the two nodes H and I may be selected, and finally the target product M is missed. However, when the bidirectional retrieval method is adopted, there is a path M→J→F in the backward search process. After checking, it is found that there is an F node in the forward retrieval path, so the two paths are spliced to obtain A→B→F→J→M and A→C→F→J→M. The search for the correct path is realized.

[0121] In some embodiments of the present application, the process of pruning the chemical knowledge graph is introduced.

[0122] Combined with Figure 3 As shown, any one or a combination of multiple pruning strategies, such as static pruning, dynamic pruning, and redundant pruning, can be adopted in the chemical knowledge graph pruning process.

[0123] For static pruning:

[0124] The present application can configure pruning rules, and then perform static pruning on the chemical knowledge graph according to the pruning rules. Among them, the pruning rules can be continuously iteratively updated.

[0125] The pruning rules can be obtained in two ways. One is to configure corresponding pruning rules based on the intent tags extracted from the problem data; the other can be to configure pruning rules based on chemical prior knowledge.

[0126] The pruning rules based on intent tags include but are not limited to:

[0127] 1. Side reaction products: Directly delete irrelevant entities through substance attributes (such as functional group matching degree). For example, exclude side reaction products containing nitro groups in the synthesis path.

[0128] 2. Green chemistry: Directly exclude harmful reagent nodes according to node attributes.

[0129] 3. Yield requirement: Combine relationship attributes and directly exclude paths with reaction yields lower than the user's requirements.

[0130] 4. Reaction step requirement: After exceeding the user's limit of reaction steps, directly cut the subsequent nodes.

[0131] The pruning rules configured based on chemical prior knowledge include but are not limited to:

[0132] 1. Stereochemical compatibility constraint: Introduce a molecular chirality descriptor (CIP rule encoding), add 3D space constraints in the embedding layer, and forcefully cut paths with mismatched configurations. For example, exclude transition states with inconsistent stereoselectivity in enzyme-catalyzed reactions.

[0133] 2. Reaction network energy topology analysis: Construct an energy surface diagram of the synthesis path, identify local minimum traps through gradient analysis, and use graph theory algorithms (such as Tarjan strongly connected component detection) to cut energy loop paths.

[0134] 3. Catalyst-substrate matching degree modeling: Establish a correlation matrix between the electron cloud density of the active center of the catalyst and the LUMO / HOMO energy levels of the substrate, design an attention mechanism to calculate the matching score, and filter paths with scores lower than the threshold.

[0135] 4. Energy Constraint: Directly exclude infeasible paths through thermodynamic parameters (such as reactions with ΔG>0), and automate filtering by combining with a Gibbs free energy calculation library (such as RDKit).

[0136] Combine Figure 4 As shown, for entity D in the chemical knowledge graph, the corresponding substance is cyanide, which is a highly toxic substance. According to the intention label "green chemistry" extracted as described above, it is necessary to ensure that every substance in the chemical reaction path is a non-toxic and safe chemical substance. Therefore, directly cut off the path A→D and no longer reason backward along this path.

[0137] For dynamic pruning:

[0138] In this embodiment, mutual information is used as the dynamic pruning metric. When the current node in the chemical knowledge graph is retrieved, for each candidate node pointed to by the current node in the graph, calculate the mutual information between the candidate node and the known facts, where the known facts include the problem data and the retrieved path information up to the current node. Delete the candidate nodes that do not meet the mutual information condition requirements from the candidate nodes, thereby achieving dynamic pruning.

[0139] Among them, when using the beam search method, the beam width is k. The corresponding mutual information condition requirement can be to retain the top 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 combination with the generated sequence when predicting the next token in the prediction sequence. Therefore, in this embodiment, by using mutual information as the pruning metric, mutual information can measure the dependence relationship between the candidate node and the known facts, so it can filter out knowledge subgraphs with stronger dependence relationships, which is more in line with the generation logic of the large model.

[0141] In some embodiments, after reaching the path retrieval termination condition (such as reaching the set search steps, retrieving the target product, etc.), if the retrieved path includes both the first type of path and the second type of path, then delete the first type of path.

[0142] Among them, the first type of path is the path that cannot infer the target product, and the second type of path is the path that can infer the target product.

[0143] Furthermore, if there are more than two second type of paths, then retain the one with the largest mutual information, where the mutual information of the path represents the product of the mutual information values corresponding to each step in the path.

[0144] In the dynamic pruning process of this embodiment, for the retrieved paths, the first type of paths that cannot be inferred to obtain the target product can be removed, and the second type of paths can be retained. When there are multiple second-type paths, only the path with the largest mutual information can be retained according to the mutual information size of the paths, which can provide more beneficial information for the generation of the subsequent large model.

[0145] Take Figure 4 the example shown. When the path retrieval termination condition is reached, two synthesis paths A→B→F→J→M and A→C→F→J→M are output. The mutual information values corresponding to each step in the synthesis path can be multiplied, and the synthesis path with the largest mutual information value can be retained.

[0146] This embodiment of the present application introduces an optional calculation method for 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 problem data Q and a knowledge subgraph , since the content of problem Q is fixed, its Shannon entropy is a constant. Further, the formula for mutual information can be expressed as follows:

[0148] .

[0149] In a large-scale knowledge graph, there are a large number of candidate subgraphs . Using the exhaustive search method will result in too large a computational amount. To avoid this problem, is converted to calculate . In addition, assuming that only one-hop triples are considered each time, the calculation target is:

[0150] ,

[0151] Since is a chain structure connected end to end, h, r, and t are used to represent the head node, relationship, and tail node respectively. Substituting h, r, and t into the above formula gives:

[0152] ,

[0153] Then start to calculate . According to the conditional probability conversion formula, it can be obtained that:

[0154] ,

[0155] Thus, the initial target can be focused on calculating , the calculation of this probability can be assisted by a large language model to estimate the probability of each candidate relationship r, and then select the top k relationships according to the probability size. The specific probability calculation formula is:

[0156] .

[0157] Among them is the predicted word probability, respectively represent the question , the head entity and the relationship in the words. Then, can be further decomposed into . Because a relationship usually corresponds to only one tail entity, so . Further, can be decomposed into . In addition, since the tail entity of the current triple will become the head entity in the subsequent triple, so . Therefore, .

[0158] Then repeat the above steps for iteration, and convert the overall probability into a product of multiple probabilities. The final estimate can be expressed as:

[0159]

[0160] Similarly, the denominator term can be decomposed into:

[0161]

[0162] For the last term on the right side of the formula equal sign , it can be converted to . Since the question q is fixed, adding this conditional restriction will not change its probability, so this is a constant value.

[0163] So far, each term in can be processed accordingly, where n in the above formula is a hyperparameter given in advance and is used to terminate the iteration. When the entity corresponding to the tail node of the retrieved triple is the target product, the iteration can be terminated in advance.

[0164] Combined with Figure 4In the example shown, when reasoning to node B, the subsequent candidate nodes are E, F, and G. These three candidate nodes cannot be pruned simply by static pruning. We further calculate the mutual information between {Q, A→B} and E, F, and G according to the above formula, and obtain the mutual information value of [3.1222, 2.9722, 1.0501]. Then, according to the beam width k=2 of the beam search, the two nodes E and F with larger mutual information are retained.

[0165] The dynamic pruning strategy introduced in the above embodiment may be implemented independently of the static pruning strategy, or the dynamic pruning strategy may 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, there may be a scenario where the target product does not exist in the chemical knowledge graph. In this case, the path search process, regardless of whether the static / dynamic pruning strategy is adopted, cannot obtain the correct reaction path, that is, the final path cannot be inferred to obtain the target product. Assuming that the number of retrievals is limited to n times, the final searched path will be an n-hop path. There is redundant information in this path that is useless for large model reasoning. For this reason, in this embodiment, the redundant information in the path can be pruned to improve the performance of subsequent large 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 specifically 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 aforementioned static pruning and dynamic pruning, a path obtained includes reaction steps with n hops. .

[0176] Calculate the uncertainties of the problem data Q and each sub-path respectively, to obtain the uncertainty values corresponding to each node.

[0177] Select the target node with the minimum uncertainty value in the path. If the uncertainty value of the target node does not exceed the set uncertainty threshold, then prune each node after the target node in this path. Exemplarily, has the minimum uncertainty value and it does not exceed the set uncertainty threshold, then each node after can be pruned to obtain the path after redundant pruning: . Use this path as the retrieved knowledge sub-graph and input it into the large model for subsequent reasoning.

[0178] Taking Figure 4 as an example, assume that the target product required by the user is S, and this substance does not exist in the chemical knowledge graph. However, the synthesis path A→B→E has certain reference significance for generating the substance S. Assume that we limit the number of retrievals to 4 and the uncertainty threshold to 0.5. Through static pruning and dynamic pruning methods, the final synthesis path obtained is A→B→E→H→K. Since this path does not contain the final product S, perform redundant pruning:

[0179] Calculate the uncertainty values of {Q,A},{Q,A→B},{Q,A→B→E},{Q,A→B→E→H},{Q,A→B→E→H→K} respectively, to obtain [1.0,0.7,0.3,0.7,0.9]. Among them, the uncertainty value corresponding to {Q,A→B→E} is the minimum at 0.3, and 0.3 < 0.5. Therefore, retain the synthesis path A→B→E and delete the nodes after the node E.

[0180] It should be noted that the redundant pruning strategy can be implemented alone or on the basis of 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 a better pruning effect.

[0181] In some embodiments of the present application, the process of step S130 is described, where feature extraction and feature fusion are performed on the knowledge sub-graph and the problem data, and the fused features are sent to the large model for processing to obtain the answer corresponding to the problem data output by the large model.

[0182] Combined with Figure 3As shown, in this embodiment, the process of extracting features from the knowledge subgraph and question data can be divided into unstructured information extraction and structured information extraction.

[0183] Specifically, the first encoding feature of the unstructured information (such as text information) in the knowledge subgraph can be extracted.

[0184] In some embodiments, a text processing model can be used to extract text features from the triple text in the knowledge subgraph as the first encoding feature.

[0185] In other embodiments, the first encoding feature of the unstructured information in the knowledge subgraph can also be extracted through a large model. For example, 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 the features extracted from the hidden layer of the large model are obtained as the first encoding feature.

[0186] For the process of structured information extraction:

[0187] The question data can be added as a node to the knowledge subgraph, and the connection relationships between the newly added node and the other nodes in the knowledge subgraph are established to obtain the edited knowledge subgraph.

[0188] Referring to Figure 5 As shown, assume that the knowledge subgraph obtained by path search is the path: A→C→F→J→M.

[0189] The question data Q is added as a node to the knowledge subgraph, and the connection relationships between node Q and other nodes are established to obtain the edited knowledge subgraph as Figure 5 shown.

[0190] On this basis, the edited knowledge subgraph can be processed through a graph neural network (such as a GNN network) to obtain the second encoding feature of the node corresponding to the question data.

[0191] Specifically, by leveraging the aggregation effect of the graph neural network, a question encoding feature that aggregates the structural information of the knowledge subgraph can be obtained, that is, the second encoding feature. This second encoding feature fuses both the question data and the structural information of the knowledge subgraph.

[0192] The above-extracted first encoding feature and second encoding feature are fused to obtain a fused feature. The fused feature is fed into the large model for processing to obtain the answer corresponding to the question data output by the large model.

[0193] In a possible implementation, the first encoding feature and the second encoding feature can be fused through an attention mechanism to obtain the fused feature. In addition, other feature fusion mechanisms can also be used, such as feature concatenation, weighted average and other fusion methods.

[0194] The following provides a factual case, showing the user's question data "question" and the answer "answer" finally output by the large model:

[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 the reaction."。

[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 reaction steps.

[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 for overnight, 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' as substrate, 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' as substrate, tetrahydrofuran as solvent, tetrabutyl ammonium fluoride as reagent. The reaction is carried out at room temperature for 2 h, ultimately yielding 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. The reaction is carried out at room temperature for overnight, ultimately yielding product 'CCC[C@]1(CO)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(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' as substrate, trimethyl phosphite as solvent, 1-methyl-1H-imidazole and trichlorophosphate as reagent. The reaction is carried out at room temperature 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 by the embodiments of the present application will be described below. The chemical reaction path inference device described below can be correspondingly referred to the chemical reaction path inference method described above.

[0203] See Figure 6 , Figure 6 which is a schematic structural diagram of a chemical reaction path inference device disclosed in the embodiments of the present application.

[0204] As Figure 6 shown, the device may include:

[0205] A problem acquisition unit 11, configured to acquire problem data related to the chemical reaction path inference task;

[0206] An entity extraction unit 12, configured to perform entity extraction on the problem data to obtain entity information, where the entity information includes reaction substrates and target products;

[0207] A knowledge graph retrieval unit 13, configured to use 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, and perform path retrieval in the configured chemical knowledge graph to obtain a knowledge subgraph representing the chemical reaction path. The chemical knowledge graph includes several reaction nodes, and the edges between the reaction nodes represent reaction mechanism relationships or sequence orders;

[0208] A feature processing unit 14, configured to perform feature extraction and feature fusion on the knowledge subgraph and the problem data, and send the fused features to a large model for processing to obtain the answer corresponding to the problem data output by the large model.

[0209] In a possible implementation, the device of the present application may further include:

[0210] A knowledge graph pruning unit, configured to perform graph pruning processing synchronously during the process of the knowledge graph retrieval unit performing the path retrieval until the knowledge subgraph is obtained.

[0211] In a possible implementation, the device of the present application may further include:

[0212] An intention extraction unit, configured to perform intention extraction on the problem data to obtain intention labels;

[0213] Then, the graph pruning processing performed by the knowledge graph pruning unit includes:

[0214] Performing static pruning processing on the chemical knowledge graph based on the configured pruning rules, where the pruning rules include the pruning rules configured based on the intention labels.

[0215] In a possible implementation, the pruning rules further include: pruning rules configured based on chemical prior knowledge.

[0216] In a 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, calculate the mutual information between the candidate node and the known facts respectively, where the known facts include the problem data and the retrieved path information up to the current node;

[0218] Using the mutual information as the dynamic pruning index, delete the candidate nodes that do not meet the mutual information condition requirements from each of the candidate nodes.

[0219] In a possible implementation, the graph pruning process performed by the knowledge graph pruning unit includes:

[0220] After reaching the retrieval termination condition, if the retrieved path includes both a first type of path and a second type of path, delete the first type of path, where the first type of path is the path that cannot infer the target product, and the second type of path is the path that can infer the target product;

[0221] If there are more than two second type of paths, retain the one with the largest mutual information, where the mutual information of the path represents the product of the mutual information values corresponding to each step in the path.

[0222] In a 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 infer the target product, perform redundant information pruning on the only path to remove the redundant node information in the path.

[0224] In a possible implementation, the process of the knowledge graph pruning unit performing redundant information pruning on a path includes:

[0225] For each node in the path, calculate the uncertainty value between the sub-path from the start point of the path to each node and the problem data respectively, to obtain the uncertainty value corresponding to each node;

[0226] 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 remove the nodes after the target node in the path.

[0227] In a 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 for forward search and the target product as the starting point for backward search, perform a two-way search in the configured chemical knowledge graph;

[0229] If there are intersecting nodes in the two paths obtained from the two-way search, select the sub-paths of the two paths from the starting point to the intersecting node respectively and merge them into a complete path.

[0230] In a possible implementation, the process of the knowledge graph retrieval unit performing path retrieval in the configured chemical knowledge graph includes:

[0231] Perform path retrieval in the configured chemical knowledge graph in a beam search manner, and select the top k nodes with the highest relevance to the current node as the next-hop nodes at each step, 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 used for:

[0233] Perform entity disambiguation processing on the entity information.

[0234] In a possible implementation, the process of the feature processing unit performing feature extraction and feature fusion on the knowledge subgraph and the problem data includes:

[0235] Extract the first encoded feature of the unstructured information of the knowledge subgraph;

[0236] Add the problem data as a node to the knowledge subgraph and establish the connection relationship between the new node and the other nodes in the knowledge subgraph to obtain the edited knowledge subgraph;

[0237] Process the edited knowledge subgraph through a graph neural network to obtain the second encoded feature of the node corresponding to the problem data;

[0238] Fuse the first encoded feature and the second encoded feature to obtain the fused feature.

[0239] In a possible implementation, the process of the feature processing unit extracting the first encoded feature of the unstructured information of the knowledge subgraph includes:

[0240] Send the triple information in the knowledge subgraph into a large model to instruct the large model to organize the input triple information into a descriptive text, and obtain the features extracted from the hidden layer of the large model as the first encoded feature.

[0241] Each unit in the above chemical reaction path inference device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above units can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above units.

[0242] An embodiment of this application also provides an electronic device. Referring to Figure 7 as shown, it shows a schematic structural diagram of an electronic device suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application can 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 impose any limitation on the functions and usage scope of the embodiments of this application.

[0243] As Figure 7 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 into the random access memory (RAM) 603, so as to implement the chemical reaction path inference method in the foregoing embodiments of this application. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.

[0244] Generally, the following devices can 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 can allow the electronic device to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 7 the electronic device with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices can be implemented or had.

[0245] An embodiment of this application also provides a computer program product, including computer-readable instructions, which, when running on an electronic device, enable the electronic device to implement any chemical reaction path inference method provided in the embodiments of this application.

[0246] In an embodiment of the present application, a computer-readable storage medium is further provided. 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 inference method provided by the embodiments of the present application.

[0247] In addition, it should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the attached drawings of the device embodiments provided in the present application, the connection relationship between the modules indicates that they have a communication connection, 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, it can also be implemented by means of dedicated hardware, including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures for implementing the same function can also be various, such as analog circuits, digital circuits or dedicated circuits. However, for the present application, in more cases, software program implementation is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a readable storage medium, such as a floppy disk, a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disc of a computer, and includes several instructions for causing a computer device (which may be a personal computer, a training device, or a network device, etc.) to execute the methods described in the various embodiments of the present application.

[0249] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part 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 processes or functions described in the embodiments of the present application are all or partially generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, a computer, a training device, or a data center to another website, a computer, a training device, or a data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0251] The various embodiments in this specification are described in a progressive manner. 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 referred to each other.

Claims

1. A method for inferring a chemical reaction path, characterized in that Including: Obtain problem data related to the chemical reaction path inference task; Perform entity extraction on the problem data to obtain entity information, where the entity information includes reaction substrates and target products; Using the reaction substrate as the starting point of the chemical reaction path and the target product as the ending point of the chemical reaction path, perform path retrieval 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 reaction mechanism relationships or sequential orders; Perform feature extraction and feature fusion on the knowledge subgraph and the problem data, and send the fused features to a large model for processing to obtain the answer corresponding to the problem data output by the large model.

2. The method according to claim 1, characterized in that It also includes: During the execution of the path retrieval, perform graph pruning processing synchronously until the knowledge subgraph is obtained.

3. The method according to claim 2, wherein It also includes: Perform intention extraction on the problem data to obtain intention labels; The graph pruning processing includes: Perform static pruning processing on the chemical knowledge graph based on the configured pruning rules, where the pruning rules include pruning rules configured based on the intention labels.

4. The method according to claim 3, wherein 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 processing includes: When a current node in the chemical knowledge graph is retrieved, for each candidate node pointed to by the current node in the graph, calculate the mutual information between the candidate node and the known facts, where the known facts include the problem data and the retrieved path information up to the current node; Using the mutual information as a dynamic pruning index, delete candidate nodes that do not meet the mutual information condition requirements from each of the candidate nodes.

6. The method according to claim 2, wherein The graph pruning processing includes: After reaching the retrieval termination condition, if the retrieved path includes both a first type of path and a second type of path, then delete the first type of path. The first type of path is a path that cannot infer the target product, and the second type of path is a path that can infer the target product; If there are more than two second type of paths, then retain the one with the largest mutual information, where the mutual information of a 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 processing includes: After reaching the retrieval termination condition, if the only obtained path cannot infer the target product, then perform redundant information pruning on the only path to prune the redundant node information in the path.

8. The method according to claim 7, characterized in that, The process of performing redundant information pruning on a path includes: For each node in the path, calculate the uncertainty value between the sub-path from the starting point of the path to each node and the problem data, and obtain the uncertainty value corresponding to each node; 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 prune the nodes after the target node in the path.

9. The method according to claim 1, characterized in that, The process of performing path retrieval in the configured chemical knowledge graph includes: Using the reaction substrate as the starting point for forward search and the target product as the starting point for backward search, perform bidirectional search in the configured chemical knowledge graph; If there are intersecting nodes in the two paths obtained by bidirectional search, select the sub-paths of the two paths from the starting point to the intersecting node respectively, and merge them into a complete path.

10. The method according to claim 1, wherein The process of path retrieval in the configured chemical knowledge graph includes: Adopt beam search to perform path retrieval in the configured chemical knowledge graph, and select the top k nodes with the highest relevance to the current node as the next-hop nodes at each step, where k is a positive integer not less than 2.

11. The method according to claim 1, characterized in that, After obtaining the entity information, it further includes: Perform entity disambiguation processing on the entity information.

12. The method according to claim 1, wherein The process of feature extraction and feature fusion for the knowledge subgraph and the problem data includes: Extract the first encoded feature of the unstructured information of the knowledge subgraph; Add the problem data as a node to the knowledge subgraph, and establish connection relationships between the newly added node and the remaining nodes in the knowledge subgraph to obtain an edited knowledge subgraph; Process the edited knowledge subgraph through a graph neural network to obtain the second encoded feature of the node corresponding to the problem data; Fuse the first encoded feature and the second encoded feature to obtain a fused feature.

13. The method according to claim 12, characterized in that The process of extracting the first encoded feature of the unstructured information of the knowledge subgraph includes: Send the triple information in the knowledge subgraph into a large model to instruct the large model to organize the input triple information into a descriptive text, and obtain the features extracted from the hidden layer of the large model as the first encoded feature.

14. A chemical reaction path inference device, characterized in that, It includes: A problem acquisition unit for acquiring problem data related to the chemical reaction path inference task; An entity extraction unit for extracting entity information from the problem data, where the entity information includes reaction substrates and target products; A knowledge graph retrieval unit for performing path retrieval in the configured chemical knowledge graph with 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, where the chemical knowledge graph includes several reaction nodes, and the edges between the reaction nodes represent reaction mechanism relationships or sequential orders; A feature processing unit for performing feature extraction and feature fusion on the knowledge subgraph and the problem data, and sending the fused feature into a large model for processing to obtain the answer corresponding to the problem data output by the large model.

15. An electronic device, characterized in that, It includes: A memory and a processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the chemical reaction path inference method described in any one of claims 1 to 13.

16. A readable storage medium, on which a computer program is stored, characterized in that, When the computer program is executed by the processor, it implements each step of the chemical reaction path inference method described in any one of claims 1 to 13.

17. A computer program product, comprising a computer program, characterized in that, When this computer program is executed by the processor, it implements each step of the chemical reaction path inference method described in any one of claims 1 to 13.

Citation Information

Patent Citations

  • Chemical reaction path acquisition method and device, electronic device, and storage medium

    CN108959845A

  • Chemical reaction knowledge graph construction method and system and chemical reaction route mining method

    CN113517041A

  • Knowledge reasoning method based on heterogeneous knowledge fusion

    CN117235216A

  • Organic synthesis path planning method, system and device and storage medium

    CN118380083A

  • Construction of catalysis knowledge graph and multi-step catalysis path recommendation method based on catalysis knowledge graph

    CN118503451A

Cited By

  • Knowledge graph and dynamic pruning optimization-based big language model mathematical inference method

    CN120671854A

  • Mathematical inference method of large language model based on knowledge graph and dynamic pruning optimization

    CN120671854B

  • Chemical molecule information generation method and device, equipment and storage medium

    CN122531528A