Information reasoning method, device and computer equipment

By performing multi-scale transformation and interaction on the knowledge graph and constructing a multi-scale zoom graph, the problem of ignoring the global information of the graph in the existing technology is solved, and the accuracy and ability of information reasoning are improved.

CN119940523BActive Publication Date: 2025-09-30SHANGHAI YUANYUAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411771385.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-09-30
Estimated Expiration
2044-12-04

AI Technical Summary

Technical Problem

When existing technologies use graph structure information to enhance large language models (LLMs), they ignore the global relevant information of the target graph, resulting in reduced accuracy of information reasoning.

Method used

By performing multi-scale transformation on the knowledge graph, a multi-scale zoom graph is constructed, and multi-scale interaction is performed by combining the sub-graph to be inferred and the multi-scale transformation weight matrix, the information of neighboring nodes at different scales is aggregated to construct a more accurate retrieval sub-graph.

Benefits of technology

It improves the accuracy of graph information reasoning, makes full use of information at different scales, and enhances the ability to reason about graph information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119940523B_ABST
    Figure CN119940523B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of natural language processing, and in particular to an information reasoning method, apparatus, computer equipment, and storage medium, which perform multi-scale transformation on a knowledge graph, construct a multi-scale zoom graph of the knowledge graph, and perform multi-scale interaction in combination with a subgraph to be inferred and a multi-scale transformation weight matrix constructed based on the subgraph to be inferred, aggregate neighboring node information from different scales, make full use of information at different scales, and construct a more accurate retrieval subgraph for performing graph information reasoning, thereby improving the accuracy of accurate information reasoning on the graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to an information reasoning method, apparatus, computer equipment, and storage medium. Background Art

[0002] Large language models (LLMs) excel at understanding and summarizing unstructured text. Given the powerful capabilities of graphs in representing structured data, it is natural to combine LLMs with graphs to achieve better performance in natural language processing, including classification and generation tasks.

[0003] Recently, there has been a surge in research on methods for effectively utilizing graph structural information to enhance the capabilities of LLMs. These methods enhance the structural information of LLMs by accurately matching the obtained subgraphs. Some of these studies combine graph embedding with LLMs. GNP uses soft hints to provide structural information modeled by graph neural networks (GNNs) to LLMs, while GraphAdapter combines GNNs as adapters with LLMs. Other studies enable LLMs to reason based on graph structure and integrate structural information into the reasoning process. ToG and MD-QA directly query graphs through LLMs. However, the exact matching of the target graph only utilizes local information in the large graph, ignores the global relevant information in the entire graph, and reduces the accuracy of accurate information reasoning about the graph. Summary of the Invention

[0004] Based on this, the purpose of the present invention is to provide an information reasoning method, device, computer equipment and storage medium to perform multi-scale transformation on the knowledge graph, construct a multi-scale zoom graph of the knowledge graph, and combine the sub-graph to be inferred and the multi-scale transformation weight matrix constructed based on the sub-graph to be inferred to perform multi-scale interaction, aggregate neighboring node information from different scales, make full use of information at different scales, and construct a more accurate retrieval sub-graph for graph information reasoning, thereby improving the accuracy of accurate information reasoning on the graph.

[0005] In a first aspect, an embodiment of the present application provides an information reasoning method, the method comprising the following steps:

[0006] Obtaining a knowledge graph, a subgraph to be inferred, and a graph-enhanced language model, wherein the graph-enhanced language model includes a multi-scale transformation module, a multi-scale interaction module, and a reasoning module; the multi-scale interaction module includes a matrix construction unit, an interaction unit, and a graph core retrieval unit;

[0007] Inputting the knowledge graph into the multi-scale transformation module for transformation processing and feature extraction to obtain scaling graphs of several scales and feature matrices of the scaling graphs;

[0008] Inputting the subgraph to be inferred into the matrix construction unit to construct a transformation weight matrix to obtain transformation weight matrices of multiple scales;

[0009] Obtaining a feature matrix of the subgraph to be inferred, a retrieval subgraph set of a previous scale, and feature matrices of several retrieval subgraphs in the retrieval subgraph set; inputting the retrieval subgraph set of a previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred, and the transformation weight matrix of the current scale into the interaction unit for interactive processing to obtain an interactive feature matrix of the subgraph to be inferred at the current scale;

[0010] Inputting the zoom graph of the current scale and the feature matrix of the zoom graph, the subgraph to be inferred and the interactive feature matrix of the subgraph to be inferred into the graph core retrieval unit to construct a retrieval subgraph, obtaining a retrieval subgraph set of the current scale, and repeating the process until a retrieval subgraph set of the last scale is obtained, thereby obtaining retrieval subgraph sets of several scales;

[0011] The subgraph to be inferred and a set of retrieval subgraphs of several scales are input into the inference module for information inference to obtain an information inference result of the subgraph to be inferred.

[0012] In a second aspect, an embodiment of the present application provides an information inference device, comprising:

[0013] A data acquisition module is used to obtain a knowledge graph, a subgraph to be inferred, and a graph-enhanced language model, wherein the graph-enhanced language model includes a multi-scale transformation module, a multi-scale interaction module, and a reasoning module; the multi-scale interaction module includes a matrix construction unit, an interaction unit, and a graph core retrieval unit;

[0014] A multi-scale feature extraction module is used to input the knowledge graph into the multi-scale transformation module for transformation processing and feature extraction, and obtain scaled graphs of several scales and feature matrices of the scaled graphs;

[0015] A transformation weight matrix construction module is used to input the subgraph to be inferred into the matrix construction unit to construct a transformation weight matrix, and obtain transformation weight matrices of multiple scales;

[0016] A multi-scale interaction processing module is used to obtain the feature matrix of the subgraph to be inferred, the retrieval subgraph set of the previous scale, and the feature matrices of several retrieval subgraphs in the retrieval subgraph set; input the retrieval subgraph set of the previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred, and the transformation weight matrix of the current scale into the interaction unit for interaction processing to obtain the interaction feature matrix of the subgraph to be inferred at the current scale;

[0017] A retrieval subgraph construction module is used to input the zoomed graph of the current scale and the feature matrix of the zoomed graph, the subgraph to be inferred and the interactive feature matrix of the subgraph to be inferred into the graph core retrieval unit to construct a retrieval subgraph, obtain a retrieval subgraph set of the current scale, and repeat the process until a retrieval subgraph set of the last scale is obtained, thereby obtaining retrieval subgraph sets of several scales;

[0018] The subgraph information reasoning module is used to input the subgraph to be reasoned and a set of search subgraphs of several scales into the reasoning module for information reasoning to obtain the information reasoning result of the subgraph to be reasoned.

[0019] In a third aspect, an embodiment of the present application provides a computer device comprising: a processor, a memory, and a computer program stored on the memory and executable on the processor; when the computer program is executed by the processor, the steps of the information reasoning method described in the first aspect are implemented.

[0020] In a fourth aspect, an embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the information reasoning method as described in the first aspect are implemented.

[0021] In an embodiment of the present application, an information reasoning method, apparatus, computer equipment, and storage medium are provided to perform multi-scale transformation on a knowledge graph, construct a multi-scale zoom graph of the knowledge graph, and perform multi-scale interaction in combination with a subgraph to be reasoned and a multi-scale transformation weight matrix constructed based on the subgraph to be reasoned, aggregate neighboring node information from different scales, make full use of information at different scales, and construct a more accurate retrieval subgraph for performing graph information reasoning, thereby improving the accuracy of accurate information reasoning on the graph.

[0022] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 A flowchart of an information reasoning method provided in one embodiment of the present application;

[0024] Figure 2 A schematic diagram of the process of step S2 in the information reasoning method provided in one embodiment of the present application;

[0025] Figure 3 A schematic diagram of the process of step S3 in the information reasoning method provided in one embodiment of the present application;

[0026] Figure 4 A schematic diagram of the process of step S4 in the information reasoning method provided in one embodiment of the present application;

[0027] Figure 5 A schematic diagram of the process of step S4 in the information reasoning method provided in one embodiment of the present application;

[0028] Figure 6 A flowchart of an information reasoning method provided in another embodiment of the present application;

[0029] Figure 7 A schematic diagram of the structure of an information inference device provided in one embodiment of the present application;

[0030] Figure 8 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0031] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0032] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. As used in this application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0033] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words "if" / "if" as used herein may be interpreted as "at the time of" or "when" or "in response to a determination."

[0034] See also Figure 1 , Figure 1 A flowchart of an information reasoning method provided in one embodiment of the present application is provided, wherein the method comprises the following steps:

[0035] S1: Obtain the knowledge graph, the subgraph to be inferred, and the graph-enhanced language model.

[0036] The executor of the information reasoning method is the reasoning device of the information reasoning method (hereinafter referred to as the reasoning device). The reasoning device can be implemented by software and / or hardware, and the information reasoning method can be implemented by software and / or hardware. The reasoning device can be composed of two or more physical entities, or it can be composed of one physical entity. The hardware pointed to by the reasoning device essentially refers to computer equipment. For example, the reasoning device can be a computer, a mobile phone, a tablet or an interactive tablet. In an optional embodiment, the reasoning device can specifically be a server, or a server cluster composed of multiple computer devices.

[0037] In this embodiment, the inference device can obtain the knowledge graph and the subgraph to be inferred input by the user, or obtain the knowledge graph, the subgraph to be inferred, and the graph-enhanced language model from a preset database, wherein the graph-enhanced language model includes a multi-scale transformation module, a multi-scale interaction module, and an inference module; the multi-scale interaction module includes a matrix construction unit, an interaction unit, and a graph core retrieval unit.

[0038] S2: Input the knowledge graph into the multi-scale transformation module for transformation processing and feature extraction to obtain scaling graphs of several scales and feature matrices of the scaling graphs.

[0039] In this embodiment, the inference device inputs the knowledge graph into the multi-scale transformation module for transformation processing and feature extraction, obtaining scaled graphs of several scales and feature matrices of the scaled graphs to capture the multi-scale information of the knowledge graph. The larger scale maintains the global information of the graph, while the smaller scale retains the details of the fine-grained substructure.

[0040] See also Figure 2 , Figure 2 The flowchart of S2 in the information reasoning method provided in one embodiment of the present application includes steps S21 to S23, which are specifically as follows:

[0041] S21: Aggregating and classifying the nodes in the knowledge graph according to the preset scaling factors of several scales, converting the knowledge graph into scaling graphs of several scales, and obtaining scaling graphs of several scales.

[0042] In this embodiment, the inference device aggregates and classifies the nodes in the knowledge graph according to the preset scaling factors of several scales, converts the knowledge graph into a scaling graph of several scales, and obtains the scaling graph of several scales, wherein the scaling graph includes several nodes, and the nodes include important nodes and non-important nodes.

[0043] Specifically, the inference device calculates the value of the scaling factor r according to the scaling factor r. k, aggregate the nodes in the knowledge graph, convert the knowledge graph into a scaled graph of several scales, and obtain a scaled graph of several scales. To ensure the retention of key information in the graph, the inference device scores the nodes in the scaled graph through an importance function, which uses task-specific indicators (such as information entropy, degree or other related indicators) to evaluate the nodes. According to the scaling factor r k Keep the top k nodes with the highest scores, denoted as Represents the set of important nodes retained after scaling, while the set of remaining unimportant nodes is represented as

[0044] S22: converting text attributes of a plurality of nodes in the zoom graphs of a plurality of scales, and constructing important node feature matrices and non-important node feature matrices of the zoom graphs of the plurality of scales.

[0045] In this embodiment, the inference device uses a pre-trained language model (PLM) to convert the text attributes of several nodes in the zoom graphs of several scales, and constructs important node feature matrices and non-important node feature matrices of the zoom graphs of several scales to promote alignment and interaction between multi-scale graphs.

[0046] S23: Obtain a node matching relationship matrix of the zoom graphs of several scales, and obtain a feature aggregation matrix of the zoom graphs of several scales according to the node matching relationship matrix of the zoom graphs of several scales, the important node feature matrix, the non-important node feature matrix, and a preset feature aggregation algorithm, as the feature matrix of the zoom graph.

[0047] To mitigate the loss of graph information due to scaling, in this embodiment, the inference device obtains a node matching relationship matrix for scaled graphs at multiple scales. The node matching relationship matrix includes node matching relationship vectors between multiple nodes, and the node matching relationship vectors are used to indicate whether a matching relationship exists between the nodes. The inference device obtains a feature aggregation matrix for the scaled graphs at multiple scales based on the node matching relationship matrix, the important node feature matrix, the unimportant node feature matrix, and a preset feature aggregation algorithm, as the feature matrix of the scaled graphs. The feature aggregation algorithm is:

[0048]

[0049] Where M k is the node matching relationship matrix of the k-th scale, is the node matching relationship vector between the i-th node and the j-th node in the node matching relationship matrix of the k-th scale, is the node matching relationship matrix M k The degree vector of the i-th node in , D kThe node matching relationship matrix M k The degree matrix of is the feature matrix of the non-important nodes of the scaled graph at the kth scale, X ′ k Based on matching relationship The cumulative feature matrix of is the important node feature matrix of the k-th scaled graph, is the similarity feature matrix between the feature matrix of important nodes and the feature matrix of non-important nodes in the scaled graph of the kth scale, I is the unit matrix, is the feature aggregation matrix of the scaled graph at the kth scale.

[0050] S3: Inputting the subgraph to be inferred into the matrix construction unit to construct a transformation weight matrix to obtain transformation weight matrices of several scales.

[0051] In order to better utilize the graph information in the subgraph to be inferred and promote the information flow between the multi-scale zoom graph and the subgraph to be inferred, in this embodiment, the inference device inputs the subgraph to be inferred into the matrix construction unit to construct a transformation weight matrix to obtain transformation weight matrices of several scales.

[0052] See also Figure 3 , Figure 3 The flowchart of S3 in the information reasoning method provided in one embodiment of the present application includes steps S31 to S32, which are specifically as follows:

[0053] S31: extracting the text supplementary information of the subgraph to be inferred, performing multi-scale embedding processing on the text supplementary information, and obtaining text supplementary information representations at several scales.

[0054] In this embodiment, the inference device uses a pre-trained language model (PLM) to extract the text supplementary information of the subgraph to be inferred, performs multi-scale embedding processing on the text supplementary information, and obtains text supplementary information representations at several scales.

[0055] S32: Obtaining transformation weight matrices of several scales according to the text supplementary information representations of several scales and a preset transformation weight matrix calculation algorithm.

[0056] In this embodiment, the inference device uses a graph neural network (GNN) to integrate the text supplementary information representations of several scales into the information aggregation process of the graph neural network. According to the text supplementary information representations of several scales and a preset transformation weight matrix calculation algorithm, combined with the text supplementary information representation, the initial weight matrix is ​​modulated by scaling and translation to capture the common global structure of the graph, and a specific intra-scale transformation weight matrix is ​​constructed to obtain the transformation weight matrices of several scales. The transformation weight matrix calculation algorithm is as follows:

[0057]

[0058] Where, is the transformation weight matrix of the kth scale, W intra is the initial weight matrix, ⊙ is the element-by-element multiplication symbol, σ(·) is the activation function, M a 、M b are the first and second learnable parameter matrices, e k is the supplementary information representation of the text at the k-th scale, and d is the number of matrix columns.

[0059] S4: Obtain the feature matrix of the subgraph to be inferred, the retrieval subgraph set of the previous scale, and the feature matrices of several retrieval subgraphs in the retrieval subgraph set; input the retrieval subgraph set of the previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred, and the transformation weight matrix of the current scale into the interaction unit for interactive processing to obtain the interactive feature matrix of the subgraph to be inferred at the current scale.

[0060] In this embodiment, the inference device obtains the feature matrix of the subgraph to be inferred, a retrieval subgraph set of the previous scale, and the feature matrices of several retrieval subgraphs in the retrieval subgraph set.

[0061] To ensure that the subgraph to be inferred can fully utilize the graph topology in the current scale, while absorbing important information from the retrieval subgraph set retrieved from the previous scale and several retrieval subgraphs in the retrieval subgraph set, the inference device inputs the retrieval subgraph set of the previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred, and the transformation weight matrix of the current scale into the interaction unit for interactive processing to obtain the interactive feature matrix of the subgraph to be inferred at the current scale.

[0062] See also Figure 4 , Figure 4 The flowchart of S4 in the information reasoning method provided in one embodiment of the present application includes steps S41 to S42, which are specifically as follows:

[0063] S41: performing similarity calculations on the node vectors of several nodes in the subgraph to be inferred, and constructing an intra-scale adjacency matrix; performing similarity calculations on the node vectors of several nodes in the subgraph to be inferred and a set of retrieval subgraphs in a previous scale, and constructing a cross-scale adjacency matrix.

[0064] In this embodiment, the inference device calculates the similarity of the node vectors of several nodes in the subgraph to be inferred, and selects the first several nodes to establish a connection with the currently selected node based on the similarity, which is recorded as Topk nodes1 The inference device is between the currently selected node and Topk nodes1 Edges are established between the nodes to construct an intra-scale adjacency matrix, wherein the intra-scale adjacency matrix includes similarity vectors between several nodes in the subgraph to be inferred.

[0065] Since different scales use different node aggregation ratios, there may be differences between scales. The inference device calculates the similarity between the node vectors of several nodes in the subgraph to be inferred and the retrieval subgraph set of the previous scale. According to the similarity, the first several nodes are selected to establish a connection with the currently selected node, which is recorded as Topk nodes2 The inference device is between the currently selected node and Topk nodes2 Edges are established between the nodes to construct a cross-scale adjacency matrix, wherein the cross-scale adjacency matrix includes similarity vectors between several nodes in the subgraph to be inferred and several nodes in the retrieval subgraphs.

[0066] S42: Obtain an interaction feature matrix of the subgraph to be inferred at the current scale based on the feature matrices of several retrieval subgraphs in the retrieval subgraph set at the previous scale, the feature matrix of the subgraph to be inferred, the transformation weight matrix of the current scale, and a preset multi-scale interaction algorithm.

[0067] In this embodiment, the inference device uses a graph neural network to obtain the interaction feature matrix of the subgraph to be inferred at the current scale based on the feature matrices of several retrieval subgraphs in the retrieval subgraph set at the previous scale, the feature matrix of the subgraph to be inferred, the transformation weight matrix at the current scale, and a preset multi-scale interaction algorithm. The multi-scale interaction algorithm is:

[0068]

[0069] Where, is the interaction feature matrix of the k-th scale subgraph to be inferred, σ(·) is the activation function, A intra is the intra-scale adjacency matrix, H t is the feature matrix of the subgraph to be inferred, is the transformation weight matrix of the kth scale, Across is the cross-scale adjacency matrix, is the feature matrix of the rth retrieval subgraph in the k-1th scale retrieval subgraph set, W cross is the preset cross-scale weight matrix.

[0070] S5: Input the zoom graph of the current scale and the feature matrix of the zoom graph, the subgraph to be inferred, and the interactive feature matrix of the subgraph to be inferred into the graph core retrieval unit to construct a retrieval subgraph, obtain the retrieval subgraph set of the current scale, and repeat the process until the retrieval subgraph set of the last scale is obtained, and obtain retrieval subgraph sets of several scales.

[0071] In this embodiment, the inference device inputs the zoom graph of the current scale and the feature matrix of the zoom graph, the subgraph to be inferred and the interactive feature matrix of the subgraph to be inferred into the graph core retrieval unit to construct the retrieval subgraph, obtain the retrieval subgraph set of the current scale, and repeat the execution until the retrieval subgraph set of the last scale is obtained, and obtain the retrieval subgraph sets of several scales.

[0072] By adopting graph neural networks and combining transformation weight matrices of different scales to aggregate neighboring node information from different scales, we can make full use of information at different scales and improve the accuracy of retrieval subgraph construction.

[0073] See also Figure 5 , Figure 5 The flowchart of S4 in the information reasoning method provided in one embodiment of the present application includes steps S51 to S52, which are specifically as follows:

[0074] S51: using a random sampling method to obtain several candidate subgraphs from the zoomed graph of the current scale, and obtaining adjacency matrices and feature matrices of the several candidate subgraphs of the current scale according to the zoomed graph of the current scale and the feature matrix of the zoomed graph.

[0075] In this embodiment, the inference device adopts a random sampling method to obtain several candidate subgraphs from the zoom graph of the current scale, and obtains the adjacency matrix and feature matrix of the several candidate subgraphs of the current scale based on the zoom graph of the current scale and the feature matrix of the zoom graph.

[0076] S52: Obtain the adjacency matrix of the subgraph to be inferred as the interactive adjacency matrix of the current scale; obtain the similarity between the subgraph to be inferred and several candidate subgraphs of the current scale based on the interactive adjacency matrix of the current scale, the interactive feature matrix of the subgraph to be inferred, the adjacency matrices and feature matrices of several candidate subgraphs, and a preset similarity calculation algorithm; determine several retrieval subgraphs from the several candidate subgraphs based on the similarity, and obtain a retrieval subgraph set of the current scale.

[0077] In this embodiment, the inference device obtains the adjacency matrix of the subgraph to be inferred as the interactive adjacency matrix of the current scale, and uses the random walk graph kernel to search based on the interactive adjacency matrix of the current scale, the interactive feature matrix of the subgraph to be inferred, the adjacency matrices and feature matrices of several candidate subgraphs, and a preset similarity calculation algorithm. The structural similarity between the graphs is measured by calculating the number of common paths, and the feature similarity is further evaluated by node attributes to obtain the similarity between the subgraph to be inferred and several candidate subgraphs of the current scale. The similarity calculation algorithm is as follows:

[0078]

[0079] Where simi(·) is the similarity function, is the interaction adjacency matrix of the k-th scale, is the feature matrix of the lth candidate subgraph at the kth scale, is the adjacency matrix of the lth candidate subgraph at the kth scale, vec(·) is the matrix function, is the dot product symbol.

[0080] The inference device selects the first several candidate subgraphs with the highest similarity from the candidate subgraphs as retrieval subgraphs according to the similarity, determines several retrieval subgraphs, and obtains a retrieval subgraph set of the current scale.

[0081] S6: Inputting the subgraph to be inferred and a set of retrieval subgraphs of several scales into the reasoning module for information reasoning to obtain an information reasoning result of the subgraph to be inferred.

[0082] In this embodiment, the inference device inputs the subgraph to be inferred and a set of retrieval subgraphs of several scales into the inference module to perform information inference, and obtains an information inference result of the subgraph to be inferred.

[0083] Specifically, in order to make full use of the information in several retrieval subgraphs in the retrieval subgraph set, the reasoning device adopts a large language model (LLM) as the reasoning module. The reasoning device inputs the subgraph to be inferred and the retrieval subgraph set of several scales into the large language model in the form of chain thinking (CoT). This method clearly models the reasoning process and gradually stimulates the large language model so that the large language model can gradually understand the multi-scale graph structure through predefined reasoning steps and strengthen the output of the large language model. The reasoning device extracts text information from several retrieval subgraphs in the retrieval subgraph set of several scales, and performs information reasoning on the subgraph to be inferred and the extracted text information of the multi-scale retrieval subgraphs to obtain the information reasoning result of the subgraph to be inferred.

[0084] In an optional embodiment, the step S7 is further included: training the multi-scale interaction module. Figure 6 , Figure 6 A flowchart of an information reasoning method provided in another embodiment of the present application includes steps S71 to S74, which are specifically as follows:

[0085] S71: Obtain several sample subgraphs, feature matrices of the sample subgraphs, and real label data of several scales of the sample subgraphs.

[0086] In this embodiment, the inference device obtains several sample subgraphs, feature matrices of the sample subgraphs, and real label data of several scales of the sample subgraphs, wherein the real label data includes real label probability vectors of several categories, and the label probability vectors are used to indicate the training of the multi-scale interaction module.

[0087] S72: Inputting the plurality of sample subgraphs into the weight construction unit in the multi-scale interaction module to be trained respectively, and obtaining transformation weight matrices of the plurality of scales of the plurality of sample subgraphs.

[0088] In this embodiment, the inference device inputs several sample subgraphs into the weight construction unit of the multi-scale interaction module to be trained to obtain the transformation weight matrices of several scales of the sample subgraphs. For the specific embodiment, please refer to step S32 and will not be repeated here.

[0089] S73: Obtain a set of retrieval subgraphs of several scales corresponding to several sample subgraphs and feature matrices of several retrieval subgraphs in the retrieval subgraph set; input the retrieval subgraph set of the previous scale of the same sample subgraph, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the sample subgraph, the feature matrix of the sample subgraph and the transformation weight matrix of the current scale into the interaction unit in the multi-scale interaction module to be trained for interaction processing, and obtain interaction feature matrices of several scales of several sample subgraphs.

[0090] In this embodiment, the inference device obtains a set of retrieval subgraphs of several scales corresponding to several sample subgraphs and feature matrices of several retrieval subgraphs in the set of retrieval subgraphs.

[0091] The inference device inputs the retrieval subgraph set of the same sample subgraph at the previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the sample subgraph, the feature matrices of the sample subgraph, and the transformation weight matrix at the current scale into an interaction unit in the multi-scale interaction module to be trained for interaction processing, thereby obtaining interaction feature matrices of several scales of the several sample subgraphs. For a specific embodiment, please refer to steps S4-S5 and will not be repeated here.

[0092] S74: Inputting the interaction feature matrices of several scales of several sample subgraphs into a preset fully connected layer respectively to obtain predicted label data of several scales of several sample subgraphs; obtaining a cross-entropy loss value according to the predicted label data of several scales of several sample subgraphs, the true label data and a preset cross-entropy loss algorithm, and training the multi-scale interaction module to be trained according to the cross-entropy loss value.

[0093] In this embodiment, the inference device inputs the interaction feature matrices of several scales of several sample subgraphs into a preset fully connected layer, respectively, to obtain predicted label data of several scales of several sample subgraphs, wherein the predicted label data includes predicted label probability vectors of several categories.

[0094] The inference device obtains a cross-entropy loss value based on the predicted label data of several scales of several sample subgraphs, the real label data, and a preset cross-entropy loss algorithm, and trains the multi-scale interaction module to be trained according to the cross-entropy loss value, wherein the cross-entropy loss algorithm is:

[0095]

[0096] Where L is the cross entropy loss value, N is the number of sample subgraphs, is the true label data of the k-th scale of the i-th sample subgraph, is the predicted label data of the kth scale of the i-th sample subgraph.

[0097] Please refer to Figure 7 , Figure 7 This is a schematic diagram of the structure of an information inference device provided in one embodiment of the present application. The device can implement all or part of the information inference device through software, hardware, or a combination of both. The device 7 includes:

[0098] A data acquisition module 71 is configured to obtain a knowledge graph, a subgraph to be inferred, and a graph-enhanced language model, wherein the graph-enhanced language model includes a multi-scale transformation module, a multi-scale interaction module, and a reasoning module; the multi-scale interaction module includes a matrix construction unit, an interaction unit, and a graph core retrieval unit;

[0099] A multi-scale feature extraction module 72 is used to input the knowledge graph into the multi-scale transformation module for transformation processing and feature extraction, and obtain scaling graphs of several scales and feature matrices of the scaling graphs;

[0100] A transformation weight matrix construction module 73 is used to input the subgraph to be inferred into the matrix construction unit to construct a transformation weight matrix, thereby obtaining transformation weight matrices of multiple scales;

[0101] The multi-scale interaction processing module 74 is configured to obtain a feature matrix of the subgraph to be inferred, a retrieval subgraph set at a previous scale, and feature matrices of several retrieval subgraphs in the retrieval subgraph set; input the retrieval subgraph set at a previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred, and the transformation weight matrix of the current scale into the interaction unit for interaction processing to obtain an interaction feature matrix of the subgraph to be inferred at the current scale;

[0102] A retrieval subgraph construction module 75 is configured to input the zoomed graph of the current scale and its feature matrix, the subgraph to be inferred, and its interaction feature matrix into the graph core retrieval unit to construct a retrieval subgraph, thereby obtaining a retrieval subgraph set of the current scale. This process is repeated until a retrieval subgraph set of the last scale is obtained, thereby obtaining retrieval subgraph sets of multiple scales.

[0103] The subgraph information reasoning module 76 is used to input the subgraph to be reasoned and a set of search subgraphs of several scales into the reasoning module for information reasoning to obtain the information reasoning result of the subgraph to be reasoned.

[0104] In an embodiment of the present application, a knowledge graph, a subgraph to be inferred, and a graph-enhanced language model are obtained through a data acquisition module, wherein the graph-enhanced language model includes a multi-scale transformation module, a multi-scale interaction module, and an inference module; the multi-scale interaction module includes a matrix construction unit, an interaction unit, and a graph core retrieval unit; through a multi-scale feature extraction module, the knowledge graph is input into the multi-scale transformation module for transformation processing and feature extraction to obtain scaling graphs of several scales and feature matrices of scaling graphs; through a transformation weight matrix construction module, the subgraph to be inferred is input into the matrix construction unit for transformation weight matrix construction to obtain transformation weight matrices of several scales; through a multi-scale interaction processing module, the feature matrix of the subgraph to be inferred, the retrieval subgraph set of the previous scale, and the feature matrices of several retrieval subgraphs in the retrieval subgraph set are obtained. Matrix; input the retrieval subgraph set of the previous scale, the feature matrix of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred and the transformation weight matrix of the current scale into the interaction unit for interactive processing to obtain the interactive feature matrix of the subgraph to be inferred at the current scale; through the retrieval subgraph construction module, input the zoom graph of the current scale and the feature matrix of the zoom graph, the subgraph to be inferred and the interactive feature matrix of the subgraph to be inferred into the graph core retrieval unit for retrieval subgraph construction to obtain the retrieval subgraph set of the current scale, and repeat the execution until the retrieval subgraph set of the last scale is obtained, and the retrieval subgraph sets of several scales are obtained; through the subgraph information reasoning module, input the subgraph to be inferred and the retrieval subgraph sets of several scales into the reasoning module for information reasoning to obtain the information reasoning result of the subgraph to be inferred. Perform multi-scale transformation on the knowledge graph, construct a multi-scale zoom graph of the knowledge graph, and perform multi-scale interaction by combining the sub-graph to be inferred and the multi-scale transformation weight matrix constructed based on the sub-graph to be inferred. Aggregate the information of neighboring nodes from different scales, make full use of information at different scales, and construct a more accurate retrieval sub-graph for graph information reasoning, thereby improving the accuracy of accurate information reasoning on the graph.

[0105] Please refer to Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device provided in one embodiment of the present application. The computer device 8 includes: a processor 81, a memory 82, and a computer program 83 stored in the memory 82 and executable on the processor 81; the computer device may store multiple instructions, which are suitable for being loaded and executed by the processor 81. Figures 1 to 8 The specific execution process can be found in the method steps shown in Figures 1 to 8 The specific description shown will not be repeated here.

[0106] The processor 81 may include one or more processing cores. The processor 81 utilizes various interfaces and circuits to connect to various components within the server. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 82, and accessing data within the memory 82, the processor 81 performs various functions and processes data of the information inference device 7. Optionally, the processor 81 may be implemented in the form of at least one of a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 81 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content displayed on the touchscreen display; and the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 81 and may be implemented as a separate chip.

[0107] Among them, the memory 82 may include a random access memory 82 (Random Access Memory, RAM), and may also include a read-only memory 82 (Read-Only Memory). Optionally, the memory 82 includes a non-transitory computer-readable storage medium. The memory 82 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 82 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch instructions, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 82 may also be optionally at least one storage device located away from the aforementioned processor 81.

[0108] The embodiment of the present application also provides a storage medium, which can store multiple instructions, which are suitable for the processor to load and execute the above Figures 1 to 8 The specific execution process can be found in the method steps shown in Figures 1 to 8 The specific description shown will not be repeated here.

[0109] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0110] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0111] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraint algorithm of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0112] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0113] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0114] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0115] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of the above-mentioned various method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form.

[0116] The present invention is not limited to the above-mentioned embodiments. If various changes or modifications of the present invention do not depart from the spirit and scope of the present invention, and if these changes and modifications fall within the scope of the claims of the present invention and equivalent technologies, the present invention is also intended to include these changes and modifications.

Claims

1. An information reasoning method, characterized in that: The method comprises the following steps: Obtaining a knowledge graph, a subgraph to be inferred, and a graph-enhanced language model, wherein the graph-enhanced language model includes a multi-scale transformation module, a multi-scale interaction module, and a reasoning module; the multi-scale interaction module includes a matrix construction unit, an interaction unit, and a graph core retrieval unit; Inputting the knowledge graph into the multi-scale transformation module for transformation processing and feature extraction to obtain scaling graphs of several scales and feature matrices of the scaling graphs; Inputting the subgraph to be inferred into the matrix construction unit to construct a transformation weight matrix to obtain transformation weight matrices of multiple scales; Obtaining a feature matrix of the subgraph to be inferred, a retrieval subgraph set of a previous scale, and feature matrices of several retrieval subgraphs in the retrieval subgraph set; inputting the retrieval subgraph set of a previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred, and the transformation weight matrix of the current scale into the interaction unit for interactive processing to obtain an interactive feature matrix of the subgraph to be inferred at the current scale; Inputting the zoom graph of the current scale and the feature matrix of the zoom graph, the subgraph to be inferred and the interactive feature matrix of the subgraph to be inferred into the graph core retrieval unit to construct a retrieval subgraph, obtaining a retrieval subgraph set of the current scale, and repeating the process until a retrieval subgraph set of the last scale is obtained, thereby obtaining retrieval subgraph sets of several scales; The subgraph to be inferred and a set of retrieval subgraphs of several scales are input into the inference module for information inference to obtain an information inference result of the subgraph to be inferred.

2. The information inference method according to claim 1, characterized in that: The step of inputting the knowledge graph into the multi-scale transformation module for transformation processing and feature extraction to obtain scaling graphs of several scales and feature matrices of the scaling graphs includes the following steps: Aggregating and classifying the nodes in the knowledge graph according to the preset scaling factors of several scales, converting the knowledge graph into scaling graphs of several scales, and obtaining scaling graphs of several scales, wherein the scaling graphs include several nodes, and the nodes include important nodes and non-important nodes; Convert text attributes of several nodes in the zoom graphs of several scales, and construct feature matrices of important nodes and feature matrices of unimportant nodes in the zoom graphs of several scales; Obtain node matching relationship matrices of zoom graphs at several scales, and obtain feature aggregation matrices of the zoom graphs at several scales based on the node matching relationship matrices, important node feature matrices, non-important node feature matrices, and a preset feature aggregation algorithm as the feature matrices of the zoom graphs. The feature aggregation algorithm is: Where M k is the node matching relationship matrix of the k-th scale, is the node matching relationship vector between the i-th node and the j-th node in the node matching relationship matrix of the k-th scale, is the node matching relationship matrix M k The degree vector of the i-th node in , D k The node matching relationship matrix M k The degree matrix of is the feature matrix of the non-important nodes of the scaled graph at the kth scale, X ′ k Based on matching relationship The cumulative feature matrix of is the important node feature matrix of the k-th scaled graph, is the similarity feature matrix between the feature matrix of important nodes and the feature matrix of non-important nodes in the scaled graph of the kth scale, I is the unit matrix, is the feature aggregation matrix of the scaled graph at the kth scale.

3. The information inference method according to claim 2, characterized in that: The step of inputting the subgraph to be inferred into the matrix construction unit to construct a transformation weight matrix to obtain transformation weight matrices of multiple scales includes the following steps: Extracting the text supplementary information of the subgraph to be inferred, performing multi-scale embedding processing on the text supplementary information, and obtaining text supplementary information representations at multiple scales; According to the text supplementary information representation of several scales and a preset transformation weight matrix calculation algorithm, transformation weight matrices of several scales are obtained, wherein the transformation weight matrix calculation algorithm is: Where, is the transformation weight matrix of the kth scale, W intra is the initial weight matrix, ⊙ is the element-by-element multiplication symbol, σ(·) is the activation function, M a 、M b are the first and second learnable parameter matrices, e k is the supplementary information representation of the text at the k-th scale, and d is the number of matrix columns.

4. The information inference method according to claim 2 or 3, characterized in that: The step of inputting the retrieval subgraph set of the previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred, and the transformation weight matrix of the current scale into the multi-scale interaction module for interactive processing to obtain the interactive feature matrix of the subgraph to be inferred at the current scale includes the following steps: Perform similarity calculations on the node vectors of several nodes in the subgraph to be inferred to construct an intra-scale adjacency matrix; perform similarity calculations on the node vectors of several nodes in the subgraph to be inferred and several retrieval subgraphs in the retrieval subgraph set of the previous scale to construct a cross-scale adjacency matrix, wherein the intra-scale adjacency matrix includes similarity vectors between several nodes in the subgraph to be inferred; and the cross-scale adjacency matrix includes similarity vectors between several nodes in the subgraph to be inferred and several nodes in several retrieval subgraphs; According to the feature matrices of several retrieval subgraphs in the retrieval subgraph set of the previous scale, the feature matrix of the subgraph to be inferred, the transformation weight matrix of the current scale, and the preset multi-scale interaction algorithm, the interaction feature matrix of the subgraph to be inferred at the current scale is obtained, wherein the multi-scale interaction algorithm is: Where, is the interaction feature matrix of the k-th scale subgraph to be inferred, σ(·) is the activation function, A intra is the intra-scale adjacency matrix, H t is the feature matrix of the subgraph to be inferred, is the transformation weight matrix of the kth scale, A cross is the cross-scale adjacency matrix, is the feature matrix of the rth retrieval subgraph in the k-1th scale retrieval subgraph set, W cross is the preset cross-scale weight matrix.

5. The information inference method according to claim 4, characterized in that: The step of inputting the zoomed graph of the current scale and the feature matrix of the zoomed graph, the subgraph to be inferred and the interactive feature matrix of the subgraph to be inferred into the graph core retrieval unit to construct a retrieval subgraph and obtain a retrieval subgraph set of the current scale includes the following steps: A random sampling method is used to obtain a plurality of candidate subgraphs from the zoomed graph of the current scale, and an adjacency matrix and a feature matrix of the plurality of candidate subgraphs of the current scale are obtained according to the zoomed graph of the current scale and the feature matrix of the zoomed graph; The adjacency matrix of the subgraph to be inferred is obtained as the interactive adjacency matrix of the current scale. The similarity between the subgraph to be inferred and the candidate subgraphs of the current scale is obtained based on the interactive adjacency matrix of the current scale, the interactive feature matrix of the subgraph to be inferred, the adjacency matrix and feature matrix of several candidate subgraphs, and a preset similarity calculation algorithm. Based on the similarity, several retrieval subgraphs are determined from the candidate subgraphs to obtain a retrieval subgraph set of the current scale, wherein the similarity calculation algorithm is: Where simi(·) is the similarity function, is the interaction adjacency matrix of the k-th scale, is the feature matrix of the lth candidate subgraph at the kth scale, is the adjacency matrix of the lth candidate subgraph at the kth scale, vec(·) is the matrix function, is the dot product symbol.

6. The information inference method according to claim 5, characterized in that: The method further includes the steps of: training the multi-scale interaction module; The training of the multi-scale interaction module comprises the steps of: Obtaining a plurality of sample subgraphs, feature matrices of the sample subgraphs, and true label data of a plurality of scales of the sample subgraphs; Inputting several sample subgraphs into the weight construction unit in the multi-scale interaction module to be trained respectively to obtain transformation weight matrices of several scales of the several sample subgraphs; Obtaining a set of retrieval subgraphs of several scales corresponding to the sample subgraphs and feature matrices of several retrieval subgraphs in the retrieval subgraph set; inputting the retrieval subgraph set of the previous scale of the same sample subgraph, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the sample subgraph, the feature matrix of the sample subgraph, and the transformation weight matrix of the current scale into an interaction unit in a multi-scale interaction module to be trained for interaction processing, thereby obtaining interaction feature matrices of several scales of the sample subgraphs; The interaction feature matrices of several scales of several sample subgraphs are respectively input into a preset fully connected layer to obtain predicted label data of several scales of the several sample subgraphs; a cross-entropy loss value is obtained according to the predicted label data of several scales of the several sample subgraphs, the true label data and a preset cross-entropy loss algorithm, and the multi-scale interaction module to be trained is trained according to the cross-entropy loss value, wherein the cross-entropy loss algorithm is: Where L is the cross entropy loss value, N is the number of sample subgraphs, is the true label data of the k-th scale of the i-th sample subgraph, is the predicted label data of the kth scale of the i-th sample subgraph.

7. An information inference device, characterized in that: include: A data acquisition module is used to obtain a knowledge graph, a subgraph to be inferred, and a graph-enhanced language model, wherein the graph-enhanced language model includes a multi-scale transformation module, a multi-scale interaction module, and a reasoning module; the multi-scale interaction module includes a matrix construction unit, an interaction unit, and a graph core retrieval unit; A multi-scale feature extraction module is used to input the knowledge graph into the multi-scale transformation module for transformation processing and feature extraction, and obtain scaled graphs of several scales and feature matrices of the scaled graphs; A transformation weight matrix construction module is used to input the subgraph to be inferred into the matrix construction unit to construct a transformation weight matrix, and obtain transformation weight matrices of multiple scales; A multi-scale interaction processing module is used to obtain the feature matrix of the subgraph to be inferred, the retrieval subgraph set of the previous scale, and the feature matrices of several retrieval subgraphs in the retrieval subgraph set; input the retrieval subgraph set of the previous scale, the feature matrices of several retrieval subgraphs in the retrieval subgraph set, the subgraph to be inferred, the feature matrix of the subgraph to be inferred, and the transformation weight matrix of the current scale into the interaction unit for interaction processing to obtain the interaction feature matrix of the subgraph to be inferred at the current scale; A retrieval subgraph construction module is used to input the zoomed graph of the current scale and the feature matrix of the zoomed graph, the subgraph to be inferred and the interactive feature matrix of the subgraph to be inferred into the graph core retrieval unit to construct a retrieval subgraph, obtain a retrieval subgraph set of the current scale, and repeat the process until a retrieval subgraph set of the last scale is obtained, thereby obtaining retrieval subgraph sets of several scales; The subgraph information reasoning module is used to input the subgraph to be reasoned and a set of search subgraphs of several scales into the reasoning module for information reasoning to obtain the information reasoning result of the subgraph to be reasoned.

8. A computer device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor; when the computer program is executed by the processor, the steps of the information reasoning method according to any one of claims 1 to 6 are implemented.

9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the information reasoning method according to any one of claims 1 to 6 are implemented.