Data intelligent question answering method and system based on search enhancement generated data
By introducing knowledge graphs and projection mapping of Riemannian manifold space into traditional question-answering systems, and combining the information fusion of forward and backward reasoning paths, we solve the problems of global consistency and multi-source information integration in traditional question-answering systems when dealing with complex problems, and achieve more efficient answer generation and improved user experience.
Patent Information
- Application Number
- CN202511108127.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-08-08
AI Technical Summary
Traditional question-answering systems lack global consistency when dealing with complex problems and find it difficult to integrate multi-source information to provide effective answers.
Based on the knowledge graph, the question information is mapped into thinking nodes, and the answer text is generated by using the projection mapping and geodesic distance calculation of the Riemann manifold space, combined with the information fusion of the forward and reverse reasoning paths.
It improves the ability to understand complex questions and the accuracy of answers, enhances the system's reasoning depth and logical coherence, and improves system response speed and user experience.
Smart Images

Figure CN120596645B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence and knowledge graph technology, and particularly relates to a data intelligent question answering method and system based on retrieval enhancement generation. BACKGROUND
[0002] With the rapid development of artificial intelligence technology, data intelligent question answering systems have become an important tool for enterprises and individuals to obtain information. Traditional question answering systems mainly rely on keyword matching and rule engines, and lack of global information integration, resulting in a lack of global consistency when generating answers, making it difficult to handle complex problems that require comprehensive multi-source information. In recent years, question answering technology based on deep learning has made significant progress, especially the retrieval enhancement generation method combined with knowledge graph and large language model, which provides new possibilities for solving complex problems. The question answering system based on knowledge graph can use structured knowledge for reasoning, while the retrieval enhancement generation technology can combine external knowledge to enhance the accuracy and reliability of the generated answers. SUMMARY
[0003] The embodiments of the present application provide a data intelligent question answering method and system based on retrieval enhancement generation, which can solve the problems in the prior art.
[0004] In a first aspect, the embodiments of the present application provide a data intelligent question answering method based on retrieval enhancement generation, comprising:
[0005] Receiving user input question information, extracting the knowledge entities corresponding to the question information based on the knowledge graph, mapping the knowledge entities to thinking nodes, and mapping the semantic associations between entities to the connection relationships between nodes;
[0006] Constructing an optimal projection mapping function, projecting the question semantic vector to an n-dimensional Riemannian manifold space, selecting a thinking node with the minimum geodesic distance and moderate curvature as the reasoning starting node, calculating the information potential energy of the neighbor nodes, and selecting the neighbor node with the maximum information potential energy to extend into a forward reasoning path; starting from the candidate answer node, extracting the local structure representation of the candidate answer node based on the k-hop neighborhood subgraph of the candidate answer node, integrating the local features and global features by combining the multi-scale diffusion equation, and generating a reverse reasoning path; the candidate answer node is a thinking node with a similarity higher than an answer threshold to the question semantic vector;
[0007] Performing information fusion on the forward reasoning path and the reverse reasoning path, calculating the similarity of the fused path, and selecting the path combination with the highest similarity as the optimal reasoning result; retrieving related thinking node information along the optimal reasoning path, generating an answer text based on the retrieved thinking node information, and returning the answer text to the user.
[0008] mapping the knowledge entities to thinking nodes and mapping semantic associations between the entities to node connection relationships, including:
[0009] extracting noun phrases, verb phrases, and adjective phrases in the question information as knowledge entity candidates, retrieving graph nodes that have semantic overlap with the knowledge entity candidates from a knowledge graph, and extracting attribute information and relationship information of the graph nodes as knowledge entities;
[0010] calculating information entropy and mutual information of the knowledge entities, generating a mapping matrix based on the information entropy and mutual information, and converting the knowledge entities into thinking nodes according to the mapping matrix; extracting semantic association features, theme association features, and context association features between the thinking nodes, and mapping them to node connection relationships; and establishing connections between corresponding thinking nodes according to the node connection relationships to form a thinking network structure with semantic associations.
[0011] constructing an optimal projection mapping function to project the question semantic vector to an n-dimensional Riemannian manifold space, selecting a thinking node with minimum geodesic distance and moderate curvature as a reasoning starting node, calculating information potential energy of neighbor nodes, and selecting a neighbor node with maximum information potential energy to extend into a forward reasoning path, including:
[0012] constructing an optimal projection mapping function to project the question semantic vector from a d-dimensional Euclidean space to an n-dimensional Riemannian manifold space, establishing an adaptive metric tensor on the Riemannian manifold through a coordinate transformation matrix, and the metric tensor describes the local distance structure in the semantic space;
[0013] in the manifold space, calculating a geodesic path of the question semantic vector to each thinking node to obtain a geodesic distance; establishing an orthogonal coordinate system in the local neighborhood of each thinking node, calculating a Riemann curvature tensor at the point, and then obtaining the Gaussian curvature and the mean curvature at the point; combining the Gaussian curvature and the mean curvature by weighting as a curvature index of the node, setting a curvature threshold interval, selecting thinking nodes with curvature indexes in the interval to form a candidate thinking node set, and selecting a thinking node with minimum geodesic distance as a reasoning starting node;
[0014] calculating conditional entropy and mutual information for each neighbor node, defining a ratio of the mutual information to the conditional entropy as the information potential energy of the node, and selecting a neighbor node with maximum information potential energy as a next-hop node;
[0015] starting from the next-hop node, iteratively performing information potential energy calculation until a preset stability threshold or a maximum hop count threshold is reached to obtain a reasoning path from the reasoning starting node to a target node.
[0016] An optimal projection mapping function is constructed to project the problem semantic vector from a d-dimensional Euclidean space to an n-dimensional Riemannian manifold space, an adaptive metric tensor on the Riemannian manifold is established through a coordinate transformation matrix, including:
[0017] A plurality of Gaussian kernel functions with different scales are constructed, and convolution operations are respectively performed on the problem semantic vectors to obtain multi-scale feature vectors; local density distribution is calculated according to the multi-scale feature vectors, and a neighbor graph is constructed, and the local neighborhood structure of each problem semantic vector is calculated based on the neighbor graph; a constraint condition for maintaining the local neighborhood structure is established, and a penalty term is introduced to avoid dimension collapse, and the constraint condition and the penalty term are constructed as a constrained optimization objective; the optimization objective is iteratively optimized through a gradient descent algorithm to obtain an optimal projection mapping function from a d-dimensional Euclidean space to an n-dimensional Riemannian manifold space;
[0018] The problem semantic vector is projected onto the n-dimensional Riemannian manifold through the optimal projection mapping function to obtain a projection vector, an n-dimensional tangent space is constructed based on the projection vector, and n linearly independent local coordinate bases are established in the n-dimensional tangent space; an n-order coordinate transformation matrix is calculated according to the local coordinate bases;
[0019] K basic metric tensors are constructed based on the coordinate transformation matrix, position-related adaptive weights of the projection vector are calculated, the K basic metric tensors and the corresponding position-related adaptive weights are weighted and combined to obtain an adaptive metric tensor, and the adaptive metric tensor satisfies the symmetry and positive definiteness constraints.
[0020] Starting from the candidate answer node, a local structure representation of the candidate answer node is extracted based on a k-hop neighborhood subgraph of the candidate answer node, local features and global features are integrated by combining a multi-scale diffusion equation, and a reverse reasoning path is generated, including:
[0021] A set of k-hop neighborhood subgraphs of the candidate answer node are extracted, and the neighborhood subgraphs contain structural features and semantic features of the candidate answer node; adaptive weights of each neighborhood subgraph are calculated based on Euclidean distances between feature vectors of the center node and the neighborhood nodes, the adaptive weights and the structural features of the corresponding neighborhood subgraphs are weighted and combined to obtain a neighborhood representation of the candidate answer node;
[0022] Local structure similarity between nodes is calculated using the neighborhood representation and a state transition matrix is constructed, a node probability distribution equation is constructed based on the state transition matrix, a steady-state distribution is obtained through iterative calculation, and a local structure representation of the node is calculated using the steady-state distribution and the state transition matrix; the correlation strength of the candidate answer node and the k-hop neighbor nodes is calculated respectively, and global structure representation of the candidate answer node is obtained through multi-scale propagation based on the correlation strength;
[0023] The transition probability between the candidate answer node and the k-hop neighbor node is calculated in combination with the local structure representation and the global structure representation, and the reverse reasoning path from the candidate answer node to the question node is determined using the transition probability.
[0024] The forward reasoning path and the reverse reasoning path are feature fused, the similarity of the fused path is calculated, and the path combination with the highest similarity is selected as the optimal reasoning path, including:
[0025] The path structure features of the forward reasoning path and the reverse reasoning path to be fused are extracted, the path structure features are obtained by calculating the weighted sum of the position weight of the thinking node and the distance between adjacent nodes; the path importance of the corresponding reasoning path is calculated based on the path structure features, and weighted fusion is performed through an adaptive weight coefficient;
[0026] Based on the structural similarity calculated based on the path thinking node, the semantic similarity calculated based on the path semantic vector, the comprehensive similarity is obtained by weighting the structural similarity and the semantic similarity; the fused path with the highest comprehensive similarity is selected as the optimal reasoning path.
[0027] The related thinking node information is retrieved along the optimal reasoning path, the answer text is generated based on the retrieved thinking node information, and the answer text is returned to the user, including:
[0028] The global importance score of the thinking node is calculated, the global importance score is obtained based on the weighted combination of the node position feature, the correlation degree feature and the centrality feature, the thinking node is layered according to the global importance score, and a hierarchical node set is generated;
[0029] The appearance frequency of the node information in the hierarchical node set is counted, the node information entropy is calculated based on the appearance frequency, the redundant nodes with a node information entropy lower than a redundancy threshold are removed, the number of subject concepts covered by the non-redundant node information is counted, the ratio of the number of subject concepts to the total number of standard subject concepts in the knowledge graph is calculated, the ratio is taken as the information coverage of the node, and the information integrity score of the hierarchical node set is determined according to the information coverage of the node and the node weight;
[0030] According to the information integrity score, the node information of the hierarchical node set is mapped to different levels of text structure, a text score is generated based on a logical coherence score and a subject relevance score, the logical coherence score is the ratio of the number of associated words of adjacent nodes to the total number of words of the node, and the subject relevance score is the ratio of the number of subject keywords in the node to the total number of words of the node;
[0031] According to the high and low of the text score, the organization order of node information is adjusted, an information mapping relationship is established between adjacent text levels, and the node information is converted into hierarchical answer text according to the information mapping relationship.
[0032] In a second aspect of the embodiments of the present application, a data intelligent question answering system based on retrieval enhancement generation is provided, comprising:
[0033] A first unit is configured to receive user input question information, extract knowledge entities corresponding to the question information based on a knowledge graph, map the knowledge entities into thinking nodes, and map semantic associations between the entities into connection relationships between the nodes.
[0034] A second unit is configured to construct an optimal projection mapping function, project a question semantic vector to an n-dimensional Riemannian manifold space, select a thinking node with minimum geodesic distance and moderate curvature as a reasoning starting node, calculate information potential energy of neighbor nodes, and select a neighbor node with maximum information potential energy to extend into a forward reasoning path; starting from a candidate answer node, extract a local structure representation of the candidate answer node based on a k-hop neighborhood subgraph of the candidate answer node, integrate local features and global features by combining a multi-scale diffusion equation, and generate a reverse reasoning path; the candidate answer node is a thinking node with a similarity higher than an answer threshold to the question semantic vector.
[0035] A third unit is configured to perform information fusion on the forward reasoning path and the reverse reasoning path, calculate a similarity of the fused path, and select a path combination with the highest similarity as an optimal reasoning result; search for related thinking node information along the optimal reasoning path, generate an answer text based on the searched thinking node information, and return the answer text to the user.
[0036] In a third aspect of the embodiments of the present application,
[0037] An electronic device is provided, comprising:
[0038] a processor;
[0039] a memory for storing processor-executable instructions;
[0040] The processor is configured to invoke the instructions stored in the memory to perform the method described above.
[0041] In a fourth aspect of the embodiments of the present application,
[0042] A computer readable storage medium is provided, which stores computer program instructions, and the computer program instructions are executed by a processor to implement the method described above.
[0043] The beneficial effects of the present application are as follows:
[0044] By mapping knowledge entities as thinking nodes and establishing semantic association, combining the projection mapping of Riemann manifold space and the calculation of geodesic distance, accurate matching and efficient retrieval between questions and knowledge are realized, and the understanding ability of complex problems and the accuracy of answers are improved.
[0045] A bidirectional search strategy combining forward reasoning and backward reasoning is adopted, the optimal path is selected based on information potential energy, and local and global features are integrated through a multi-scale diffusion equation, effectively solving the bottleneck of traditional question and answer systems in processing complex semantics and multi-step reasoning, and enhancing the reasoning depth and logical coherence of the system.
[0046] Through information fusion and similarity evaluation of forward and backward reasoning paths, the optimal reasoning result is automatically selected, and the answer text is generated based on the retrieved thinking node information, realizing the explainability and transparency of the question and answer process, and improving the system response speed and user experience. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 The flowchart of the data intelligent question and answer method based on retrieval enhancement generated by the embodiment of the present application is shown in the figure.
[0048] Figure 2 The schematic diagram of the thinking node forward reasoning path construction method based on the optimal projection mapping function is shown in the figure. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical scheme and advantages of the embodiment of the present application clearer, the technical scheme in the embodiment of the present application will be described clearly and completely below in combination with the drawings in the embodiment of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0050] The technical scheme of the present application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in some embodiments.
[0051] Figure 1 The flowchart of the data intelligent question and answer method based on retrieval enhancement generated by the embodiment of the present application is shown in the figure. Figure 1 As shown in the figure, the method comprises:
[0052] Receiving user input question information, extracting the knowledge entities corresponding to the question information based on the knowledge graph, mapping the knowledge entities as thinking nodes, and mapping the semantic association between entities as the connection relationship between nodes;
[0053] An optimal projection mapping function is constructed to project the problem semantic vector to an n-dimensional Riemannian manifold space, a thought node with minimum geodesic distance and moderate curvature is selected as a reasoning starting node, information potential energy of neighbor nodes is calculated, and a neighbor node with maximum information potential energy is selected to extend into a forward reasoning path; a local structure representation of the candidate answer node is extracted based on a k-hop neighborhood subgraph of the candidate answer node, local features and global features are integrated by combining a multi-scale diffusion equation, and a backward reasoning path is generated; the candidate answer node is a thought node with a similarity to the problem semantic vector higher than an answer threshold;
[0054] Information fusion is performed on the forward reasoning path and the backward reasoning path, similarity of the fused path is calculated, and a path combination with the highest similarity is selected as an optimal reasoning result; relevant thought node information is retrieved along the optimal reasoning path, an answer text is generated based on the retrieved thought node information, and the answer text is returned to the user.
[0055] In an optional embodiment, knowledge entities corresponding to the problem information are extracted based on a knowledge graph, the knowledge entities are mapped into thought nodes, and semantic associations between entities are mapped into node connection relationships, including:
[0056] Noun phrases, verb phrases, and adjective phrases in the problem information are extracted as knowledge entity candidates; graph nodes with semantic overlap with the knowledge entity candidates are retrieved from the knowledge graph, attribute information and relationship information of the graph nodes are extracted as knowledge entities;
[0057] Information entropy and mutual information of the knowledge entities are calculated, a mapping matrix is generated based on the information entropy and the mutual information, the knowledge entities are converted into thought nodes according to the mapping matrix, semantic association features, theme association features, and context association features between the thought nodes are extracted and mapped into node connection relationships, and connections are established between corresponding thought nodes according to the node connection relationships to form a thought network structure with semantic associations.
[0058] In the embodiment, a problem information processing method based on a knowledge graph is proposed, which includes a server, a database, and a client, the server is used to implement construction and retrieval of the knowledge graph, the database is used to store the knowledge graph and intermediate processing results, and the client is used to receive user input and display processing results.
[0059] Starting from the question information input by the user, the system processes the text through natural language processing techniques for word segmentation and part-of-speech tagging. In the word segmentation stage, a bidirectional maximum matching algorithm is used in combination with a preset dictionary to achieve high-precision word segmentation, and part-of-speech tagging is based on a conditional random field model. For the Chinese question "How does the winter temperature in Beijing change?", the word segmentation result is "Beijing / winter / temperature / how / change", and the part-of-speech tagging result is "Beijing (noun) / winter (noun) / temperature (noun) / how (interrogative) / change (verb)".
[0060] After obtaining the word segmentation and part-of-speech tagging results, the system extracts the noun phrases, verb phrases, and adjective phrases as knowledge entity candidates. For the above example, the extracted candidates include "Beijing", "winter", "temperature", and "change". The system then accesses a pre-constructed knowledge graph that contains entities and their relationships in multiple domains, and retrieves graph nodes that have semantic overlap with the candidates through similarity calculation.
[0061] The similarity calculation uses a combination of character matching and semantic vector similarity. Taking "Beijing" as an example, the system finds the node "Beijing" in the knowledge graph and extracts its attribute information, including "capital of China", "area of 16410 square kilometers", "geographical location: 39°56'N, 116°20'E", etc., as well as relationship information such as "located in - North China Plain", "belongs to - China", "has - Great Wall", etc. For the "temperature" entity, the system extracts attribute information such as "physical quantity unit", "measurement method", and relationship information such as "influencing factor - altitude", "influencing factor - latitude".
[0062] After completing the knowledge entity extraction, the system calculates the information entropy and mutual information of each knowledge entity to evaluate their importance in question answering and the degree of association between entities. The information entropy calculation is based on the frequency of the entity in the corpus, and the lower the frequency, the higher the information entropy, indicating that the entity contains more information. For the four entities "Beijing", "winter", "temperature", and "change", the system calculates the information entropy as 3.2, 2.8, 2.5, and 1.9 respectively, indicating that "Beijing" provides the most information in the question.
[0063] Mutual information calculation reflects the degree of association between entities. The system constructs an entity co-occurrence matrix to count the co-occurrence frequency of each entity pair in the corpus, and obtains the mutual information value through normalization processing. For example, the mutual information value of "Beijing-temperature" is 0.65, "winter-temperature" is 0.78, and "temperature-change" is 0.82, indicating that "temperature-change" has the highest degree of association.
[0064] Based on information entropy and mutual information, the system generates a mapping matrix. The element value of the matrix represents the weight of the source entity mapping to the target thought node. The mapping process considers the information entropy, mutual information and semantic correlation of the entity, ensuring that important information is retained. For the above example, the generated mapping matrix maps "Beijing" to the geographical location node, "winter" to the time attribute node, "temperature" to the weather feature node, and "change" to the trend description node.
[0065] After the thought nodes are generated, the system extracts the correlation features between the nodes. Semantic correlation features are calculated by word vector similarity, topic correlation features are extracted based on topic models, and context correlation features consider the positional relationship of the nodes in the question. For the "Beijing" and "temperature" nodes, the system extracts semantic correlation feature value 0.62, topic correlation feature value 0.58, and context correlation feature value 0.75.
[0066] The node connection relationship is determined based on the correlation features. The system sets a threshold of 0.5, and when the comprehensive correlation degree exceeds the threshold, a connection is established. The correlation degree is calculated as the weighted sum of the three features, with weights of 0.3, 0.3, and 0.4. Taking "Beijing-temperature" as an example, the comprehensive correlation degree is 0.62x0.3+0.58x0.3+0.75x0.4=0.66, which exceeds the threshold, and the system establishes a connection between the two nodes.
[0067] After completing the node connection, the thought network structure is formed. For the example question, the final network contains four thought nodes and five connection relationships: "Beijing-winter", "Beijing-temperature", "winter-temperature", "temperature-change", and "winter-change". This network structure reflects the semantic correlation in the question information, and the system can infer that the user is asking about the change trend of Beijing's winter temperature based on this network.
[0068] To improve system performance, a caching mechanism is used to store intermediate results during implementation, and entity information is preloaded for frequent queries, significantly improving response speed. Experiments show that using this method to process question information improves the accuracy of subsequent question and answer systems by 15% and processing efficiency by 20%, effectively enhancing the system's ability to understand complex questions.
[0069] Figure 2 The method for constructing the forward reasoning path of the thought node based on the optimal projection mapping function is shown in the figure. In an optional implementation, the optimal projection mapping function is constructed, the question semantic vector is projected into an n-dimensional Riemannian manifold space, the thought node with the smallest geodesic distance and moderate curvature is selected as the starting node of reasoning, the information potential energy of the neighbor nodes is calculated, and the neighbor node with the maximum information potential energy is selected to extend into the forward reasoning path, including:
[0070] An optimal projection mapping function is constructed to project the problem semantic vector from a d-dimensional Euclidean space to an n-dimensional Riemannian manifold space, and an adaptive metric tensor on the Riemannian manifold is established through a coordinate transformation matrix, which describes the local distance structure in the semantic space;
[0071] In the manifold space, the geodesic line path of the problem semantic vector to each thinking node is calculated to obtain the geodesic line distance; an orthogonal coordinate system is established in the local neighborhood of each thinking node, the Riemann curvature tensor at the point is calculated, and then the Gaussian curvature and the mean curvature at the point are obtained; the weighted combination of the Gaussian curvature and the mean curvature is taken as the curvature index of the node, a curvature threshold interval is set, the thinking nodes whose curvature indexes are located in the interval are screened to form a candidate thinking node set, and the thinking node with the minimum geodesic line distance is selected as the reasoning starting node;
[0072] The conditional entropy and mutual information of each neighbor node are calculated, and the ratio of the mutual information to the conditional entropy is defined as the information potential energy of the node; the neighbor node with the maximum information potential energy is selected as the next hop node;
[0073] From the next hop node, the information potential energy calculation is iteratively performed until a preset stability threshold or a maximum hop count threshold is reached, and a reasoning path from the reasoning starting node to the target node is obtained.
[0074] In the embodiment, a thinking node forward reasoning path construction method based on an optimal projection mapping function is provided. The method projects the problem semantic vector from the original high-dimensional Euclidean space to an n-dimensional Riemannian manifold space through the construction of an optimal projection mapping function. Specifically, it is assumed that the original problem semantic vector is d-dimensional, represented as vector V d , and the target Riemannian manifold is n-dimensional, where n is less than d. The projection process is performed using a coordinate transformation matrix T, which has a dimension of nxd.
[0075] To construct an adaptive metric tensor on the Riemannian manifold, a local coordinate system {x 1 , x 2 ,..., x n} is selected, and a metric tensor g is defined, whose components g ij represent the inner product between coordinate basis vectors. The metric tensor g is a symmetric positive definite matrix that changes with the space point and reflects the local distance structure in the semantic space. For example, in the two-dimensional case, the metric tensor can be represented as a 2x2 matrix, and its elements are dynamically adjusted according to the local semantic density. For semantic dense areas, the element values of the metric tensor are larger, which increases the geodesic distance; for semantic sparse areas, the element values of the metric tensor are smaller, which shortens the geodesic distance.
[0076] After constructing the metric tensor, the geodesic path from the problem semantic vector to each thought node is computed. Suppose there are M thought nodes on the manifold, and the projected position of the problem semantic vector is point P, and the position of each thought node is Q i (i = 1, 2, …, M). The geodesic path from point P to each point Q i is computed using the numerical solution of the geodesic equation. The geodesic equation is a second-order ordinary differential equation about the spatial curve, which can be solved by the fourth-order Runge-Kutta method. In the solving process, the initial position is set as P, and the initial direction is the unit vector of P pointing to Q i . Then the path is iteratively calculated until it reaches the vicinity of Q i (distance less than a preset threshold, such as 0.01) or reaches the maximum number of iterations (such as 1000 times). The length of the geodesic is the geodesic distance d_geo(P, Q i ).
[0077] An orthogonal coordinate system is established in the local neighborhood of each thought node Q i , and the Riemann curvature tensor at this point is calculated. The Riemann curvature tensor is a fourth-order tensor that describes the degree of spatial curvature. Through the Riemann curvature tensor, the Gaussian curvature K G and the mean curvature H can be calculated. On a two-dimensional manifold, the Gaussian curvature is the determinant of the Riemann curvature tensor, and the mean curvature is half the trace of the Riemann curvature tensor. In the case of high dimensions, the Gaussian curvature is the average of the Gaussian curvatures of all two-dimensional tangent planes, and the mean curvature is the average of the principal curvatures in all directions.
[0078] The weighted combination of the Gaussian curvature K G and the mean curvature H is defined as the curvature index C of the node, i.e. C = αK G + βH, where α and β are weight parameters, such as α = 0.6 and β = 0.4. A curvature threshold interval [C min , C max ] is set, such as [-0.5, 0.5], and the thought nodes with curvature index C in this interval are selected to form a candidate thought node set S. The thought node Q start with the smallest geodesic distance d geo (P, Q i ) is selected from the set S as the reasoning starting node.
[0079] For each neighbor node N j of the reasoning starting node Q start , the conditional entropy H(N j | Q start ) and the mutual information I(Q start ; N j). The conditional entropy represents the uncertainty of the neighbor node given the starting node, and the mutual information represents the degree of information sharing between the two nodes. The information potential energy of a node is defined as E j = I(Q start ;N j ) / H(N j |Q start ). The greater the information potential energy, the higher the correlation between the neighbor node and the starting node, and the lower the uncertainty of the neighbor node. The neighbor node N max with the maximum information potential energy is selected as the next hop node.
[0080] Starting from the next hop node N max , it is set as the new current node, and the information potential energy calculation process is iteratively performed. In each iteration, the information potential energy of all neighbors of the current node is calculated, and the neighbor with the maximum information potential energy is selected as the new next hop node and added to the reasoning path. The iteration process continues until the termination condition is met: when the stability of the path reaches a preset threshold (such as 0.95) or reaches a maximum hop threshold (such as 10 hops), the process stops. The path stability can be evaluated by the semantic similarity between the continuously added nodes, and a high similarity indicates that the path tends to be stable. Finally, the complete reasoning path P start from the reasoning starting node Q path to the target node is obtained as P start = {Q k , N1, N2,..., N .
[0081] In an optional implementation, an optimal projection mapping function is constructed to project the problem semantic vector from a d-dimensional Euclidean space to an n-dimensional Riemannian manifold space, and an adaptive metric tensor on the Riemannian manifold is established through a coordinate transformation matrix, including:
[0082] A plurality of Gaussian kernel functions with different scales are constructed, and convolution operations are respectively performed on the problem semantic vectors to obtain multi-scale feature vectors; local density distributions are calculated according to the multi-scale feature vectors, and a neighbor graph is constructed; based on the neighbor graph, the local neighborhood structure of each problem semantic vector is calculated; a constraint condition is established to maintain the local neighborhood structure, and a penalty term is introduced to avoid dimension collapse; the constraint condition and the penalty term are constructed as a constrained optimization objective; the optimization objective is iteratively optimized through a gradient descent algorithm to obtain an optimal projection mapping function from the d-dimensional Euclidean space to the n-dimensional Riemannian manifold space;
[0083] The problem semantic vector is projected onto the n-dimensional Riemannian manifold through the optimal projection mapping function to obtain a projected vector, an n-dimensional tangent space is constructed based on the projected vector, n linearly independent local coordinate bases are established in the n-dimensional tangent space, and an n-order coordinate transformation matrix is calculated according to the local coordinate bases.
[0084] Based on the coordinate transformation matrix, K basic metric tensors are constructed, the position-dependent adaptive weights of the projection vectors are calculated, the K basic metric tensors are combined with the corresponding position-dependent adaptive weights to obtain an adaptive metric tensor, and the adaptive metric tensor satisfies the symmetry and positive definiteness constraints.
[0085] In the embodiment, a method for projecting a question semantic vector from a high-dimensional Euclidean space to a low-dimensional Riemannian manifold space is provided. The method needs to construct a plurality of Gaussian kernel functions with different scales, and the standard deviations of the kernel functions are set to 0.1, 0.5, 1.0, 2.0 and 5.0 respectively to capture the features of the question semantic vector at different scales. Taking an actual case as an example, assuming that the dimension of the original question semantic vector is 100, the convolution operation is performed on each question semantic vector v i and the five Gaussian kernel functions respectively to obtain the corresponding multi-scale feature vectors f i1 , f i2 , f i3 , f i4 and f i5 .
[0086] The local density distribution is calculated based on the multi-scale feature vectors, and the specific implementation manner is as follows: for each question semantic vector v i , the Euclidean distances between each point in the k-nearest neighbors of v i and v i are counted, the value of k is set to 20, and the local density p i is calculated through the distances. Taking 10,000 question vectors in the data set as an example, the 20 nearest neighbors of each vector are calculated to form a local density distribution diagram.
[0087] The neighbor graph G is constructed according to the local density distribution, the nodes in the graph represent the question semantic vectors, and the edges represent the adjacent relationship between the vectors. If the vectors v i and v j are k-nearest neighbors, the two nodes are connected in G, and the weight of the edge is set to exp(-||v i -v j || 2 / σ), where s is a local scale parameter, and the value of s is the average value of the distances in the local neighborhood, which is about 0.8 in actual calculation.
[0088] The local neighborhood structure of each question semantic vector is calculated based on the neighbor graph, including the local linear relationship and the manifold geometric structure. For each vector v i , the weight matrix W i representing the local structure is obtained by analyzing the relationship between v i and the neighbor vectors, and the size of the matrix is k*k, where k is the number of neighbors 20.
[0089] Establish the constraint condition of maintaining the local neighborhood structure, requiring the projected vector to maintain the original local neighborhood relationship in the Riemann manifold space. The constraint condition is expressed as: the projected vector y i and its neighbor vector y j The distance between them should be the same as v in the original space i With v j The relationship between them remains consistent. At the same time, a penalty term is introduced to avoid dimensionality collapse in the projection result. The penalty term is designed as a regularization term of the projection matrix, and its value is the square of the projection matrix norm multiplied by the regularization coefficient λ=0.01.
[0090] The constraints and penalty terms are constructed as a constrained optimization objective function J:
[0091] ,
[0092] in, N represents the total number of samples, y i Represents the projected vector, y j represents its nearest neighbor vector, k is the number of neighbors, W ij Represents vector v i For its j The weight of the nearest neighbors, λ is the regularization coefficient, F The first part is the local structure preservation term, and the second part is the regularization term. The optimization objective is iteratively optimized by the gradient descent algorithm. The initial learning rate is set to 0.05, and the learning rate is decayed to 0.9 times the original value every 500 iterations. The total number of iterations is 10,000. When the objective function value changes by less than 10 for 10 consecutive iterations, the optimization objective is optimized. -6 When , it is determined to be convergent and the optimal projection mapping function P is obtained.
[0093] The question semantic vector is projected onto the n-dimensional Riemann manifold through the optimal projection mapping function P, where n is 20, to obtain the projection vector y i . Construct n-dimensional tangent space T based on projection vector yi , establish n linearly independent local coordinate bases {e1, e2, ..., e n These bases are generated from the k nearest neighbors of the projection vector by the Gram-Schmidt orthogonalization method. The specific operation is: select the projection vector y i k nearest neighbors, and calculate the difference between these vectors and y i The difference vectors are then orthogonalized.
[0094] Calculate the n-order coordinate transformation matrix J based on the local coordinate basis i , each column of the matrix corresponds to a coordinate basis vector. For example, in actual implementation, for the projected vector y iits coordinate transformation matrix J i are 20x20 matrices, each representing the transformation relationship from the local coordinate system to the global coordinate system.
[0095] Based on the coordinate transformation matrix, K basic metric tensors {G1, G2,..., G K} are constructed, K is 5. Each basic metric tensor G k is an n x n symmetric matrix, representing the metric information in different directions. For example, G1 can represent the metric of the coordinate axis direction, G2 can represent the metric of the diagonal direction, and so on.
[0096] The position-dependent adaptive weights {α1(y), α2(y),..., α K (y)} of the projection vector are calculated, which are related to the position of the projection vector y on the manifold. The weight calculation method is: according to the distance between the projection vector y and the K reference points, interpolation is carried out through the radial basis function. In actual cases, the K reference points are uniformly distributed on the manifold, and the reference point spacing is about 1 / 5 of the diameter of the manifold.
[0097] The K basic metric tensors and the corresponding position-dependent adaptive weights are combined to obtain the adaptive metric tensor G(y)=α1(y)G1+α2(y)G2+...+α K (y)GK. In the weighting process, the sum of the weights is ensured to be 1, and each weight is non-negative, so as to ensure that the result satisfies the symmetry and positive definiteness constraints. For any projection vector y, its adaptive metric tensor G(y) is a 20x20 symmetric positive definite matrix, which can accurately describe the local geometric structure of the manifold near the point.
[0098] In an optional implementation, a local structure representation of a candidate answer node is extracted based on a k-hop neighborhood subgraph of the candidate answer node from the candidate answer node, local features and global features are integrated by combining a multi-scale diffusion equation, and a reverse reasoning path is generated, including:
[0099] A set of k-hop neighborhood subgraphs of the candidate answer node are extracted, the neighborhood subgraphs contain structural features and semantic features of the candidate answer node; adaptive weights of each neighborhood subgraph are calculated based on the Euclidean distance between the feature vectors of the center node and the neighborhood nodes, the adaptive weights and the structural features of the corresponding neighborhood subgraphs are combined to obtain a neighborhood representation of the candidate answer node;
[0100] The local structure similarity between the nodes is calculated by using the neighborhood representation, and a state transition matrix is constructed. A node probability distribution equation is constructed based on the state transition matrix, and a steady-state distribution is obtained by iterative calculation. The local structure representation of the node is calculated by using the steady-state distribution and the state transition matrix. The correlation strength of the candidate answer node and the k-hop neighbor node is calculated, and the global structure representation of the candidate answer node is obtained by multi-scale propagation based on the correlation strength.
[0101] The transition probability between the candidate answer node and the k-hop neighbor node is calculated by combining the local structure representation and the global structure representation. The reverse reasoning path from the candidate answer node to the question node is determined by using the transition probability.
[0102] In this embodiment, a knowledge graph reasoning method based on a candidate answer node is provided. For a candidate answer node in a knowledge graph, a set of k-hop neighborhood subgraphs is extracted. Taking the entity "Apple Inc." in the knowledge graph as an example, when k = 2, a 2-hop neighborhood subgraph containing the "Apple Inc." node is extracted. The subgraph contains 1-hop nodes directly connected to the "Apple Inc." node, such as "iPhone", "iOS", "Tim Cook", etc., and 2-hop nodes connected to these 1-hop nodes, such as "smartphone", "operating system", "CEO", etc. The neighborhood subgraph not only contains the topological structure information between nodes, but also contains the semantic features of the nodes themselves, such as node name, attribute, description, etc. The text information is converted into a semantic feature vector with a dimension of 768 by a text encoder.
[0103] For the extracted neighborhood subgraph, the adaptive weight of each neighborhood subgraph is calculated based on the Euclidean distance between the feature vectors of the center node and the neighborhood nodes. Specifically, for the feature vector of the center node "Apple Inc." and the feature vector of the neighborhood node "iPhone", the Euclidean distance between the two is calculated. The smaller the distance, the higher the semantic relevance, and the greater the weight. For example, the Euclidean distance between "Apple Inc." and "iPhone" is 0.25, which is converted to a weight of 0.8; the Euclidean distance between "Apple Inc." and "iOS" is 0.3, which is converted to a weight of 0.75; the Euclidean distance between "Apple Inc." and "Tim Cook" is 0.4, which is converted to a weight of 0.65. The adaptive weights are combined with the structural features of the corresponding neighborhood subgraphs to obtain the neighborhood representation of the candidate answer node "Apple Inc.", which is a vector with a dimension of 512, integrating the local structure information and semantic information of the node.
[0104] Based on neighborhood representation, the technical solution calculates the local structural similarity between nodes, and constructs the state transition matrix. For any two nodes in the 2-hop neighborhood of "Apple Inc.", such as "iPhone" and "iOS", the cosine similarity of their neighborhood representation is calculated, and the value is 0.85, indicating that the two are highly similar in local structure. By calculating the similarity of all node pairs, a state transition matrix of size n x n is constructed, where n is the number of nodes in the 2-hop neighborhood, for example, n = 50. The elements in the transition matrix represent the probability of transition from one node to another, such as the probability of transition from "iPhone" to "iOS" is 0.2, and the probability of transition from "iOS" to "iPhone" is 0.15.
[0105] Based on the state transition matrix, the technical solution constructs the node probability distribution equation, and obtains the steady-state distribution through iterative calculation. Initially, the probability of the "Apple Inc." node is set to 1, and the probabilities of other nodes are set to 0, and multiple iterations are performed until the node probability distribution converges. For example, after 10 iterations, the probability of the "iPhone" node is 0.15, the probability of the "iOS" node is 0.12, and the probability of the "Tim Cook" node is 0.08. The steady-state distribution and the state transition matrix are used to calculate the local structure representation of the node, which captures the importance and structural characteristics of the node in the local subgraph.
[0106] The association strength between the candidate answer node and the k-hop neighbor nodes is calculated respectively, which is used for multi-scale propagation. For "Apple Inc." and its neighbor nodes, the association strength is calculated based on factors such as direct connection relationship, number of common neighbors, path length, etc. For example, the association strength between "Apple Inc." and "iPhone" is 0.9, the association strength between "Apple Inc." and "iOS" is 0.85, and the association strength between "Apple Inc." and "smartphone" is 0.6. Based on these association strengths, multi-scale information propagation is performed, and the information of different hop number neighbors is integrated from near to far to obtain the global structure representation of the candidate answer node "Apple Inc.", which is a vector with dimension 512, capturing the position and influence of the node in the whole graph.
[0107] The transition probability between the candidate answer node and the k-hop neighbor nodes is calculated by combining the local structure representation and the global structure representation. The local representation and the global representation are spliced or weighted to obtain a comprehensive representation, based on which the transition probability between nodes is calculated. For example, the transition probability from "Apple Inc." to "iPhone" is 0.25, and the transition probability from "iPhone" to "smartphone" is 0.3. Using these transition probabilities, the reverse reasoning path from the candidate answer node "Apple Inc." to the question node such as "smartphone industry" is determined, which is "Apple Inc." → "iPhone" → "smartphone" → "smartphone industry", and each step of transition has corresponding probability support, thereby providing an explanatory reasoning result.
[0108] Through the above method, we can generate interpretable knowledge graph reasoning paths based on the local and global structure information of candidate answer nodes, thereby improving the accuracy and interpretability of knowledge graph question answering.
[0109] In an optional implementation, the forward reasoning path and the reverse reasoning path are feature-fused, the similarity of the fused paths is calculated, and the path combination with the highest similarity is selected as the optimal reasoning path, including:
[0110] Extract the path structure features of the forward reasoning path and the reverse reasoning path to be fused, the path structure features are obtained by calculating the weighted sum of the thinking node position weight and the distance between adjacent nodes; calculate the path importance of the corresponding reasoning path based on the path structure features, and perform weighted fusion using an adaptive weight coefficient;
[0111] The structural similarity calculated based on the path thinking nodes and the semantic similarity calculated based on the path semantic vectors are weighted to obtain a comprehensive similarity; the fused path with the highest comprehensive similarity is selected as the optimal reasoning path.
[0112] In this embodiment, a method for fusing reasoning paths and determining the optimal reasoning path is provided. This method obtains forward and backward reasoning paths, each containing multiple thought nodes, from a knowledge graph to be processed. A forward reasoning path derives from a question to an answer, such as "cat → mammal → has hair." A backward reasoning path derives from an answer back to the question, such as "has hair → mammal → cat."
[0113] For each reasoning path, the system extracts path structural features. Path structural features are obtained by calculating the weighted sum of the position weights of thought nodes and the distances between adjacent nodes. Specifically, for the i-th node in path P, its position weight is the node's relative position in the path (typically, the first and last nodes of the path have higher weights, while intermediate nodes have lower weights). For example, for a path containing five nodes, the position weight of the first node can be set to 0.9, the second node to 0.7, the third node to 0.5, the fourth node to 0.7, and the fifth node to 0.9. The distance between adjacent nodes indicates the degree of association between two adjacent nodes and can be defined by the strength of the relationship between the nodes. The closer the relationship, the smaller the distance value. For example, the distance between "cat" and "mammal" is 0.2, while the distance between "mammal" and "hairy" is 0.3.
[0114] Assume a reasoning path contains nodes A, B, C, D, and the position weight of each node is 0.9, 0.6, 0.6, and 0.9, respectively, and the distance between adjacent nodes is A-B: 0.3, B-C: 0.4, and C-D: 0.2. The structural feature value of this path is calculated as 0.9 × 0.3 × 0.6 + 0.6 × 0.4 × 0.6 + 0.6 × 0.2 × 0.9 = 0.162 + 0.144 + 0.108 = 0.414.
[0115] According to the path structure feature, the system calculates the path importance of each reasoning path. Path importance is related to path structure feature value, path length, and the number of key concepts contained in the path. For example, for a path with a structural feature value of 0.414, if the path length is 4 (containing 4 nodes) and contains 2 key concepts, its path importance can be calculated as 0.414 × (1 / 4) × (2 / 4) = 0.05175.
[0116] For the forward reasoning path set F and the reverse reasoning path set B, the system uses adaptive weight coefficients for weighted fusion. The adaptive weight coefficients are dynamically adjusted according to the path importance, and the paths with higher importance get greater weights. Assuming the importance of forward path F1 is 0.05 and the importance of reverse path B1 is 0.07, the weight of F1 is 0.05 / (0.05+0.07)=0.417, and the weight of B1 is 0.07 / (0.05+0.07)=0.583. The path feature after fusion is obtained by weighted combination: 0.417 × F1 feature + 0.583 × B1 feature.
[0117] After fusion, the system needs to evaluate the similarity of different path combinations. Similarity evaluation includes two parts: structural similarity and semantic similarity. Structural similarity is calculated based on the topological structure of path thinking nodes, considering factors such as node order and hierarchical relationship. Assuming there are two fused paths P1 and P2, their node sequences are A-B-C-D and A-B-E-D respectively, their structural similarity can be calculated by the matching degree of the same position nodes. In this example, the first and second position nodes are the same, the fourth position node is the same, and the third position node is different, so the structural similarity is 0.75.
[0118] Semantic similarity is obtained by calculating the cosine similarity of path semantic vectors. Each node and relationship in the path is converted into a semantic vector, and the semantic vector of the entire path is combined to obtain the path semantic vector. For example, the semantic vector of path A-B-C-D is [0.2, 0.5, 0.3, 0.1], and the semantic vector of path A-B-E-D is [0.2, 0.5, 0.4, 0.1]. Their semantic similarity is obtained by calculating the cosine similarity of these two vectors, and the result is 0.982.
[0119] The system weights the structural similarity and the semantic similarity to obtain a comprehensive similarity. The weighting coefficients can be adjusted according to specific application scenarios. For example, the structural similarity weight is 0.4, the semantic similarity weight is 0.6, and the comprehensive similarity is 0.4 x 0.75 + 0.6 x 0.982 = 0.3 + 0.5892 = 0.8892.
[0120] The fusion path with the highest comprehensive similarity is selected as the optimal reasoning path. For example, the system compares the fusion results of 10 different forward paths and reverse paths, and calculates their comprehensive similarities as [0.889, 0.753, 0.921, 0.842, 0.795, 0.863, 0.901, 0.732, 0.875, 0.811] respectively. The system will select the third group of fusion paths (with a similarity of 0.921) as the optimal reasoning path.
[0121] This method can effectively improve the reasoning accuracy in practical applications. For example, in the medical diagnosis field, this method can fuse the forward reasoning path and the reverse reasoning path between the patient's symptoms (questions) and possible diseases (answers) to find the optimal diagnosis path; in financial risk assessment, the reasoning path between user behavior and risk results can be optimized to improve risk prediction accuracy; in intelligent customer service systems, the reasoning process of question answering can be optimized to provide more accurate answers and explanations.
[0122] In an optional implementation, relevant thought node information is retrieved along the optimal reasoning path, an answer text is generated based on the retrieved thought node information, and the answer text is returned to the user, including:
[0123] A global importance score of the thought node is calculated, the global importance score is obtained based on a weighted combination of node position features, correlation degree features and centrality features, the thought nodes are layered according to the global importance score, and a hierarchical node set is generated;
[0124] The frequency of occurrence of each node information in the hierarchical node set is counted, the node information entropy is calculated based on the frequency of occurrence, the redundant nodes with a node information entropy lower than a redundancy threshold are removed, the number of subject concepts covered by the non-redundant node information is counted, the ratio of the number of subject concepts to the total number of standard subject concepts in the knowledge graph is calculated as the information coverage of the node, and the information integrity score of the hierarchical node set is determined according to the information coverage of the node and the node weight;
[0125] According to the information integrity score, the node information of the hierarchical node set is mapped to different levels of text structure, a text score is generated based on a logical coherence score and a theme relevance score, the logical coherence score being a ratio of the number of associated words of adjacent nodes to the total number of words of the nodes, and the theme relevance score being a ratio of the number of theme keywords in the nodes to the total number of words of the nodes;
[0126] According to the high and low of the text score, the organization order of the node information is adjusted, an information mapping relationship is established between adjacent text levels, and the node information is converted into hierarchical answer text according to the information mapping relationship.
[0127] In this embodiment, a method for generating high-quality answer text based on thinking node information is provided. The method calculates the global importance score of the thinking node, stratifies the thinking node, generates a hierarchical node set, removes redundant nodes, calculates the information integrity score, and converts the node information into hierarchical answer text.
[0128] When calculating the global importance score of the thinking node, the system comprehensively considers the node position feature, the correlation degree feature and the centrality feature. The node position feature is determined according to the position of the node in the reasoning path, and the nodes close to the start and end points of the path have higher weights. For example, for a reasoning path containing 10 nodes, the position weight of the start and end nodes can be set to 0.9, and the position weight of the intermediate nodes decreases linearly according to the distance from the start and end points, and the minimum can reach 0.3. The correlation degree feature is calculated by the semantic similarity between the node and the problem keywords. For example, the cosine similarity is used to calculate the similarity between the node content and the problem description. The correlation degree feature value of the node with a similarity greater than 0.7 is set to 0.8, the value between 0.4 and 0.7 is set to 0.5, and the value below 0.4 is set to 0.2. The centrality feature is based on the number of connections of the node in the knowledge graph. The centrality feature value of the node with more than 20 connections is 0.9, the value between 10 and 20 is 0.6, and the value below 10 is 0.3.
[0129] The global importance score is calculated by weighted combination. The weight of the position feature is 0.3, the weight of the correlation degree feature is 0.4, and the weight of the centrality feature is 0.3. For example, the position feature value of a certain node is 0.7, the correlation degree feature value is 0.8, and the centrality feature value is 0.5. Then the global importance score is 0.3×0.7+0.4×0.8+0.3×0.5=0.68. The system divides the nodes into core layer (score≥0.7), important layer (0.4≤score<0.7) and supplementary layer (score<0.4) according to the global importance score, forming a hierarchical node set.
[0130] To eliminate redundant nodes, the system calculates the frequency of each node information in the hierarchical node set. For example, if a certain information segment appears in 6 nodes out of a set of 10 nodes, its frequency is 0.6. Based on the frequency, the information entropy is calculated as the negative sum of the product of the frequency and its logarithm. For example, node A contains 3 information segments with frequencies of 0.7, 0.5, and 0.2, respectively. The information entropy is -(0.7×log0.7+0.5×log0.5+0.2×log0.2)=0.94. If the redundancy threshold is set to 0.8, nodes with information entropy lower than 0.8 are considered redundant and are eliminated.
[0131] For non-redundant nodes, the system calculates the number of subject concepts covered by their information. Assuming that the total number of standard subject concepts in the knowledge graph is 100, a certain node set covers 75 subject concepts, and its information coverage is 0.75. Combined with node weights (core layer 1.0, important layer 0.7, supplementary layer 0.4), the information integrity score is calculated. For example, the core layer covers 40 concepts, the important layer covers 25 concepts, and the supplementary layer covers 10 concepts, so the information integrity score is (40×1.0+25×0.7+10×0.4) / 100=0.615.
[0132] According to the information integrity score, the system maps the node information of the hierarchical node set to different levels of text structure. The logical coherence and thematic relevance between nodes are evaluated, and the text score is calculated. The logical coherence score is determined by the ratio of the number of associated words between adjacent nodes to the total number of words in the node. For example, nodes A and B have a total of 200 words, of which 30 are associated words (such as "therefore", "based on", etc.), and the logical coherence score is 30 / 200=0.15. The thematic relevance score is the ratio of the number of thematic keywords in the node to the total number of words in the node. For example, under the theme "artificial intelligence", the node contains 200 words, of which 40 are directly related to the theme, and the thematic relevance score is 40 / 200=0.2.
[0133] The text score is the weighted sum of the logical coherence score and the thematic relevance score, with weights of 0.4 and 0.6 respectively. For example, the logical coherence score of a certain node pair is 0.15, and the thematic relevance score is 0.2, so the text score is 0.4×0.15+0.6×0.2=0.18. The system adjusts the organization order of node information based on the text score, and the node pair with a higher score is prioritized to ensure the smoothness of the text flow.
[0134] The information mapping relationship is established between adjacent text levels, the core layer node is mapped to the main argument and conclusion of the text, the important layer node is mapped to the key evidence and analysis supporting the argument, and the supplementary layer node is mapped to the detail explanation and supplementary description. The system converts the node information into hierarchical answer text according to the information mapping relationship, and ensures that the information of each level is organically integrated by adding appropriate transition words and connecting sentences, so that the final answer text with clear structure and logical coherence is formed.
[0135] Through the above technical means, the application realizes the automatic generation of high-quality answer text, which not only guarantees the integrity and accuracy of the information, but also ensures the hierarchy and coherence of the text, and can meet the needs of users for professional and clear answers.
[0136] The data intelligent question answering system based on retrieval enhancement generated by the embodiment of the application comprises:
[0137] The first unit is used for receiving user input question information, extracting the knowledge entity corresponding to the question information based on the knowledge graph, mapping the knowledge entity into a thinking node, and mapping the semantic association between entities into a connection relationship between nodes;
[0138] The second unit is used for constructing an optimal projection mapping function, projecting the question semantic vector to an n-dimensional Riemannian manifold space, selecting a thinking node with the minimum geodesic distance and moderate curvature as a reasoning starting node, calculating the information potential energy of the neighbor nodes, and selecting the neighbor node with the maximum information potential energy to extend into a forward reasoning path; starting from the candidate answer node, extracting the local structure representation of the candidate answer node based on the k-hop neighborhood subgraph of the candidate answer node, integrating the local features and global features by combining a multi-scale diffusion equation, and generating a reverse reasoning path; the candidate answer node is a thinking node with a similarity higher than an answer threshold to the question semantic vector;
[0139] The third unit is used for information fusion of the forward reasoning path and the reverse reasoning path, calculating the similarity of the fused path, and selecting the path combination with the highest similarity as the optimal reasoning result; retrieving the relevant thinking node information along the optimal reasoning path, generating an answer text based on the retrieved thinking node information, and returning the answer text to the user.
[0140] The third aspect of the embodiment of the application provides an electronic device, comprising:
[0141] A processor;
[0142] A memory for storing processor executable instructions;
[0143] The processor is configured to call the instructions stored in the memory to execute the method described above.
[0144] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.
[0145] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. The data intelligent question answering method based on retrieval enhancement generation is characterized by: include: Receive question information input by the user, extract the knowledge entities corresponding to the question information based on the knowledge graph, map the knowledge entities into thinking nodes, and map the semantic associations between entities into connection relationships between nodes; The question semantic vector is projected onto the n-dimensional Riemannian manifold space, and the thinking node with the smallest geodesic distance and moderate curvature is selected as the starting node for reasoning. The information potential of the neighboring nodes is calculated, and the neighboring node with the largest information potential is selected to extend into a forward reasoning path. Starting from the candidate answer node, the local structure representation of the candidate answer node is extracted based on the k-hop neighborhood subgraph of the candidate answer node. The local features and global features are integrated with the multi-scale diffusion equation to generate a reverse reasoning path. The candidate answer node is a thinking node whose similarity with the question semantic vector is higher than the answer threshold. Perform information fusion on the forward reasoning path and the reverse reasoning path, calculate the similarity of the fused paths, and select the path combination with the highest similarity as the optimal reasoning result; Relevant thinking node information is retrieved along the optimal reasoning path, an answer text is generated based on the retrieved thinking node information, and the answer text is returned to the user.
2. The method according to claim 1, characterized in that Based on the knowledge graph, the knowledge entities corresponding to the question information are extracted, the knowledge entities are mapped into thought nodes, and the semantic associations between the entities are mapped into node connection relationships, including: Extract noun phrases, verb phrases, and adjective phrases from the question information as knowledge entity candidates; retrieve graph nodes that have semantic overlap with the knowledge entity candidates from the knowledge graph, and extract attribute information and relationship information of the graph nodes as knowledge entities; Calculate the information entropy and mutual information of the knowledge entity, generate a mapping matrix based on the information entropy and mutual information, and convert the knowledge entity into a thinking node according to the mapping matrix; extract the semantic association features, topic association features, and context association features between the thinking nodes, and map them into node connection relationships; establish connections between corresponding thinking nodes according to the node connection relationships to form a thinking network structure with semantic associations.
3. The method according to claim 1, characterized in that Project the question semantic vector onto the n-dimensional Riemannian manifold space, select the thinking node with the smallest geodesic distance and moderate curvature as the starting node for reasoning, calculate the information potential of the neighboring nodes, and select the neighboring node with the largest information potential to extend it into a forward reasoning path, including: Construct an optimal projection mapping function to project the question semantic vector from the d-dimensional Euclidean space to the n-dimensional Riemannian manifold space, and establish an adaptive metric tensor on the Riemannian manifold through the coordinate transformation matrix. The metric tensor describes the local distance structure in the semantic space. In the manifold space, the geodesic path from the problem semantic vector to each thinking node is calculated to obtain the geodesic distance; an orthogonal coordinate system is established in the local neighborhood of each thinking node, and the Riemann curvature tensor at the point is calculated to obtain the Gaussian curvature and the mean curvature of the point; a weighted combination of the Gaussian curvature and the mean curvature is used as the curvature index of the node, a curvature threshold interval is set, and thinking nodes whose curvature index is within the interval are screened to form a set of candidate thinking nodes, and the thinking node with the smallest geodesic distance is selected as the inference starting node; Calculate the conditional entropy and mutual information for each neighbor node, and define the ratio of the mutual information to the conditional entropy as the information potential of the node; select the neighbor node with the largest information potential as the next hop node; Starting from the next hop node, the information potential energy calculation is iteratively performed until a preset stability threshold or a maximum hop count threshold is reached, and an inference path from the inference start node to the target node is obtained.
4. The method according to claim 3, characterized in that Construct an optimal projection mapping function to project the problem semantic vector from the d-dimensional Euclidean space to the n-dimensional Riemannian manifold space, and establish an adaptive metric tensor on the Riemannian manifold through the coordinate transformation matrix, including: Constructing multiple Gaussian kernel functions of different scales and performing convolution operations with the question semantic vector respectively to obtain multi-scale feature vectors; calculating the local density distribution based on the multi-scale feature vectors, constructing a neighbor graph, and calculating the local neighborhood structure of each question semantic vector based on the neighbor graph; establishing constraints that maintain the local neighborhood structure, while introducing a penalty term to avoid dimensionality collapse, and constructing the constraints and the penalty term into a constrained optimization objective; iteratively optimizing the optimization objective through a gradient descent algorithm to obtain an optimal projection mapping function from a d-dimensional Euclidean space to an n-dimensional Riemannian manifold space; Projecting the question semantic vector onto the n-dimensional Riemannian manifold using the optimal projection mapping function to obtain a projection vector, constructing an n-dimensional tangent space based on the projection vector, establishing n linearly independent local coordinate bases in the n-dimensional tangent space, and calculating an n-order coordinate transformation matrix based on the local coordinate bases; K basic metric tensors are constructed based on the coordinate transformation matrix, the position-dependent adaptive weights of the projection vector are calculated, and the K basic metric tensors are weightedly combined with the corresponding position-dependent adaptive weights to obtain an adaptive metric tensor, wherein the adaptive metric tensor satisfies symmetry and positive definiteness constraints.
5. The method according to claim 1, wherein Starting from the candidate answer node, the local structure representation of the candidate answer node is extracted based on its k-hop neighborhood subgraph. The local and global features are integrated with the multi-scale diffusion equation to generate a reverse reasoning path, including: Extracting a set of k-hop neighborhood subgraphs of the candidate answer node, wherein the neighborhood subgraphs contain structural and semantic features of the candidate answer node; calculating an adaptive weight for each neighborhood subgraph based on the Euclidean distance between feature vectors of the central node and the neighborhood nodes, and performing a weighted combination of the adaptive weights and the structural features of the corresponding domain subgraph to obtain a neighborhood representation of the candidate answer node; The neighborhood representation is used to calculate the local structural similarity between nodes and construct a state transfer matrix. A node probability distribution equation is constructed based on the state transfer matrix. A steady-state distribution is obtained through iterative calculation. The local structural representation of the node is calculated using the steady-state distribution and the state transfer matrix. The association strength between the candidate answer node and the k-hop neighboring nodes is respectively calculated. Multi-scale propagation is performed based on the association strength to obtain a global structural representation of the candidate answer node. The local structure representation and the global structure representation are combined to calculate the transition probability between the candidate answer node and the k-hop neighboring nodes, and the reverse reasoning path from the candidate answer node to the question node is determined using the transition probability.
6. The method according to claim 1, characterized in that Perform feature fusion on the forward reasoning path and the reverse reasoning path, calculate the similarity of the fused paths, and select the path combination with the highest similarity as the optimal reasoning path, including: Extract the path structure features of the forward reasoning path and the reverse reasoning path to be fused, the path structure features are obtained by calculating the weighted sum of the thinking node position weight and the distance between adjacent nodes; calculate the path importance of the corresponding reasoning path based on the path structure features, and perform weighted fusion using an adaptive weight coefficient; The structural similarity calculated based on the path thinking nodes and the semantic similarity calculated based on the path semantic vectors are weighted to obtain a comprehensive similarity; the fused path with the highest comprehensive similarity is selected as the optimal reasoning path.
7. The method according to claim 1, characterized in that Retrieving relevant thinking node information along the optimal reasoning path, generating an answer text based on the retrieved thinking node information, and returning the answer text to the user, including: Calculating a global importance score for a thought node, where the global importance score is obtained based on a weighted combination of node position features, relevance features, and centrality features, and stratifying the thought nodes according to the global importance score to generate a hierarchical node set; Counting the frequency of occurrence of each node information in the hierarchical node set, calculating the node information entropy based on the frequency of occurrence, removing redundant nodes whose node information entropy is lower than the redundancy threshold, counting the number of subject concepts covered by non-redundant node information, calculating the ratio of the number of subject concepts to the total number of standard subject concepts in the knowledge graph, using the ratio as the information coverage of the node, and determining the information integrity score of the hierarchical node set according to the information coverage of the node and the node weight; Mapping the node information of the hierarchical node set to different levels of text structure according to the information completeness score, and generating a text score based on a logical coherence score and a topic relevance score, wherein the logical coherence score is the ratio of the number of associated words of adjacent nodes to the total number of words in the node, and the topic relevance score is the ratio of the number of topic keywords in the node to the total number of words in the node; The organization order of the node information is adjusted according to the text score, an information mapping relationship is established between adjacent text levels, and the node information is converted into a hierarchical answer text based on the information mapping relationship.
8. A data intelligent question answering system based on retrieval enhancement generation, used to implement the method according to any one of claims 1 to 7, characterized in that: include: The first unit is used to receive question information input by the user, extract the knowledge entities corresponding to the question information based on the knowledge graph, map the knowledge entities into thought nodes, and map the semantic associations between the entities into connection relationships between the nodes; The second unit is used to construct an optimal projection mapping function, project the question semantic vector onto an n-dimensional Riemannian manifold space, select the thinking node with the smallest geodesic distance and moderate curvature as the starting node for reasoning, calculate the information potential of the neighboring nodes, and select the neighboring node with the largest information potential to extend into a forward reasoning path; starting from the candidate answer node, the local structure representation of the candidate answer node is extracted based on the k-hop neighborhood subgraph of the candidate answer node, and the local and global features are integrated with the multi-scale diffusion equation to generate a reverse reasoning path; the candidate answer node is a thinking node whose similarity with the question semantic vector is higher than the answer threshold; The third unit is used to fuse the information of the forward reasoning path and the reverse reasoning path, calculate the similarity of the fused paths, and select the path combination with the highest similarity as the optimal reasoning result; Relevant thinking node information is retrieved along the optimal reasoning path, an answer text is generated based on the retrieved thinking node information, and the answer text is returned to the user.
9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data intelligent question and answer method and system fusing domain knowledge
CN118779438A
Visual navigation image processing algorithm based on Riemannian manifold learning
CN120259591A