A geometric embedding knowledge graph question answering method based on a large language model

By employing multi-geometric embedding representation learning and path-level evidence screening, the problems of insufficient evidence and unstable reasoning chains in knowledge graph question answering are addressed, enabling more accurate and interpretable multi-hop question answering and reducing the risk of hallucinations.

CN122334469APending Publication Date: 2026-07-03BEIFANG UNIV OF NATITIES

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIFANG UNIV OF NATITIES
Filing Date
2026-03-20
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing knowledge graph question answering systems are prone to illusions when there is insufficient evidence, unstable reasoning chains, or structural heterogeneity. Furthermore, large language models struggle to effectively integrate complex relationships across multiple geometric spaces, leading to inaccurate and uninterpretable outputs.

Method used

We employ multi-geometric embedding representation learning in Euclidean space, hyperbolic space, and spherical space. By calculating the triple score function and combining it with the loss function for training, we dynamically fuse the embedding representations of different geometric spaces, construct multi-hop inference paths, and inject them into a large language model to generate traceable answers.

Benefits of technology

It improves the accuracy and interpretability of multi-hop question answering, reduces the risk of hallucination output, and enhances the reasoning ability of large language models in complex knowledge graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122334469A_ABST
    Figure CN122334469A_ABST
Patent Text Reader

Abstract

The application discloses a geometric embedding knowledge graph question answering method based on a large language model, first, aiming at the structural heterogeneity of knowledge graph chain, level and cycle, entity and relationship embedding is learned in Euclidean space, hyperbolic space (Poincare ball model) and spherical space (unit sphere) respectively, and the triple score of the three geometric spaces is optimized by combining negative sampling and maximum interval loss. Secondly, in the reasoning stage, the large language model analyzes the problem and identifies the key entity, constructs the relevant subgraph, and generates the candidate path by using the breadth-first search or beam search; the path node is projected in three ways and spliced to calculate the attention weight, the fusion node representation and edge level fusion score are obtained, and the path score is accumulated. Finally, the structured prompt is formed by selecting the Top-K evidence path and its weight, contribution value, the large model is constrained to generate the answer and explanation, the traceability and accuracy are improved, the consistency is enhanced, and the illusion is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of knowledge graph representation learning, multi-hop reasoning, and large model retrieval enhancement generation, and in particular to a geometric embedding knowledge graph question answering method based on a large language model. Background Technology

[0002] With the development of large language models and knowledge graph technologies, knowledge graph question answering is widely used in scenarios such as government affairs, healthcare, enterprise knowledge bases, and intelligent customer service. Knowledge graphs provide structured facts in the form of triples, which can provide evidentiary support for question answering; however, in real-world systems, large language models may still generate "illusory" answers inconsistent with the facts when evidence is insufficient, reasoning chains are incomplete, or multi-hop relationships are ambiguous, thus reducing the system's credibility. Therefore, how to effectively integrate knowledge graph evidence into large language model reasoning and achieve traceable multi-hop reasoning and interpretation has become a key issue. Existing knowledge graph representation learning methods mostly employ Euclidean space embedding, modeling entities and relationships through vector addition or linear transformations, performing well on local, chained, or approximately linear relationships. However, knowledge graphs often contain complex features such as hierarchical structures, tree-like expansion, long-tail distributions, and circular dependencies. A single Euclidean geometry cannot accurately represent hierarchical semantics and complex combinatorial relationships, easily leading to metric distortion. This makes the ranking of candidate evidence paths unstable in multi-hop path search and relational combinatorial reasoning, thus providing inaccurate or inconsistent context for large language models and increasing the risk of illusion. To improve the ability to represent hierarchical structures, researchers have introduced hyperbolic space embeddings, utilizing their exponential volume growth characteristics to better characterize tree-like hierarchies. To characterize circular dependencies and closed-loop relationships, some methods have introduced positively curvature manifolds such as spherical spaces. However, these methods mostly rely on a single geometric space. When faced with the coexistence of heterogeneous structures such as chains, hierarchies, and cycles within the same knowledge graph, they often struggle to accommodate different relation types, leading to the problem of "adapting to one type of structure while ignoring others," affecting the uniformity and robustness of evidence path evaluation.

[0003] Furthermore, in the knowledge graph question-answering process involving large language models, steps such as retrieval, path construction, ranking, and prompt injection are typically required. If path construction and ranking rely solely on symbolic rules or static scoring, it is difficult to dynamically highlight hierarchical evidence, circular evidence, or local chain evidence based on the specific semantics of the question. If only unstructured fragments are provided to the large language model, the lack of verifiable path evidence, scoring criteria, and contribution explanations can lead to uncontrollable reasoning and untraceable output, thus easily inducing hallucinations even when evidence is conflicting or incomplete. Therefore, a technical solution for knowledge graph question answering using large language models is urgently needed: one that can learn embedding representations in multiple geometric spaces to address structural heterogeneity, perform dynamic fusion and scoring ranking based on geometric perception during the path reasoning stage, and further inject Top-K high-confidence evidence paths into prompts in a structured form to improve the accuracy and interpretability of multi-hop reasoning and reduce the risk of hallucination output from large language models. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings and deficiencies of existing knowledge graph question answering methods, such as the large language model's tendency to produce illusions when there is insufficient evidence, unstable reasoning chains, or insufficient modeling of structurally heterogeneous relationships. This invention proposes a geometric embedding knowledge graph question answering method based on a large language model. By combining multi-geometric space representation learning with path-level evidence screening, traceable structured evidence is injected into the reasoning process of the large language model, thereby improving the accuracy, interpretability, and credibility of multi-hop question answering and reducing the risk of illusion output.

[0005] To achieve the above objectives, the technical solution provided by this invention is: a geometric embedding knowledge graph question answering method based on a large language model, comprising the following steps:

[0006] S1: Using a large language model, entities and relations are extracted from the original question input by the user, and the corresponding entities and relations are retrieved in the knowledge graph. Based on the retrieval results, the triples of the knowledge graph are embedded in three geometric spaces: Euclidean space, hyperbolic space, and spherical space. The chain structure in the knowledge graph is represented in Euclidean space, the hierarchical structure in the knowledge graph is represented in hyperbolic space, and the loop structure in the knowledge graph is represented in spherical space. The triples include a head entity, a relation, and a tail entity.

[0007] S2: For the same triple, score functions are calculated in Euclidean space, hyperbolic space, and spherical space, respectively. The score functions are based on the Euclidean norm metric of Euclidean space, the hyperbolic geodesic distance metric of the Poincaré sphere model in hyperbolic space, and the spherical geodesic metric of spherical space, respectively, to quantitatively evaluate the consistency of the triple in the corresponding geometric spaces: when the head entity embedding is closer to the tail entity embedding under the corresponding spatial metric after relational action, i.e., Euclidean translation, hyperbolic Möbius operation, and spherical exponential mapping, the score is better, and the embedding representation in that space is considered more reasonable; conversely, if the two are far apart under the corresponding spatial metric, the representation is considered unreasonable. The evaluation results, i.e., the scores calculated for each triple in the three geometric spaces, are used to train the data and make ranking predictions during path reasoning. Among them, the triples that actually exist in the knowledge graph are defined as positive sample triples, and negative sample triples are constructed by replacing the head entity or the tail entity.

[0008] S3: The score functions of Euclidean space, hyperbolic space, and spherical space are combined into a loss function for optimization, and the embedding representation is trained based on the loss function. The training objective is to maximize the score of positive sample triples and minimize the score of negative sample triples. The loss function includes a margin hyperparameter, which can separate positive sample triples from negative sample triples in each geometric space, so that Euclidean space is better at representing chain-structured knowledge graphs, hyperbolic space is better at representing hierarchical structured knowledge graphs, and spherical space is better at representing cyclic structured knowledge graphs.

[0009] S4: By learning representations in Euclidean space, hyperbolic space and spherical space, a knowledge graph containing multiple geometric embedding representations is constructed. During the reasoning process of the knowledge graph, path planning is performed according to the embedding representations of different geometric spaces to provide evidence for path reasoning. Entities and relations in the knowledge graph are represented as nodes and relations in the path, respectively. When there are multiple reasoning paths, entities or relations with high similarity in the knowledge graph are selected as intermediate nodes first.

[0010] S5: Filter out subgraphs related to the question from the knowledge graph, enumerate candidate simple paths using breadth-first search or bundle search, obtain embedded representations of nodes on each candidate path in Euclidean space, hyperbolic space, and spherical space respectively, map the embedded nodes to the same dimension, and calculate the attention weights in the three geometric spaces. Determine the more suitable geometric space for the node based on the attention weights, and fuse the node information in the three geometric spaces into a unified representation according to the attention weights to provide a basis for candidate path selection. For each edge in the candidate path, calculate the score of each edge in the three geometric spaces, i.e., the similarity between entities, and obtain the fusion score of each edge based on the attention weights. Accumulate the edge-level fusion scores in the candidate paths to obtain the geometric perception path score of each candidate path, select the Top-K paths with the highest scores, and use the candidate paths and their node fusion representations and weight information as structured context, inputting them together with the user's original question into the large language model. The large language model generates the answer with the highest probability and provides an inference explanation based on the candidate paths and weight information.

[0011] Furthermore, in step S1, for a given set of entities and a set of relations in a knowledge graph, embedding representations are learned for each entity and each relation in Euclidean space, hyperbolic space, and spherical space, respectively, to explicitly model the structural heterogeneity of the knowledge graph and enable different types of structures, including chain structures, hierarchical structures, and cyclic structures, to be represented in a suitable geometric space.

[0012] Furthermore, in step S2, for any triple in the knowledge graph Calculate the corresponding triplet scores in the three geometric spaces respectively;

[0013] In Euclidean space, a score function is defined to measure the "closeness between the head entity and the tail entity after relational transformation," which is suitable for capturing chain-like structural relationships. The score function calculated in Euclidean space is defined as follows:

[0014] ;

[0015] In the formula, Let be the score function in Euclidean space. For Euclidean space The head entity of the triple. The relationship is that of triples. For the tail entity of the triple, It is a 2-norm. Let be the embedding vector of the head entity in Euclidean space. Let be the embedding vector of the relation in Euclidean space. The embedding vector of the tail entity in Euclidean space;

[0016] In hyperbolic space, the Poincaré sphere model is adopted, relational transformations are performed using Möbius addition, and triple scores are calculated based on the Poincaré hyperbolic distance. Simultaneously, the embedding vectors are normalized and projected to ensure they lie within the unit sphere. The score function calculated in hyperbolic space is defined as follows:

[0017] ;

[0018] In the formula, Let be the score function for hyperbolic space. For hyperbolic space, For dual distances, Addition for Möbius, Let be the embedding vector of the head entity in hyperbolic space. Let be the embedding vector of the relation in hyperbolic space. Let be the embedding vector of the tail entity in hyperbolic space;

[0019] In spherical space, entities and relationships are embedded onto a unit sphere using exponential mapping. The predicted position is obtained by moving along the tangent vector direction on the sphere, and normalized projection is used to ensure that the embedding always lies on the unit sphere, thus characterizing the cyclic structure in the knowledge graph. The score function for spherical space computation is defined as:

[0020] ;

[0021] In the formula, Let be the scoring function for spherical space. For spherical space, The geodesic distance between two points in spherical space. Let be the embedding vector of the head entity in the spherical space. Let be the embedding vector of the relation in spherical space. Let be the embedding vector of the tail entity in the spherical space. Indicates from Starting from point, along Move forward a preset arc in the specified direction on the sphere to reach a new point on the sphere.

[0022] Furthermore, in step S3, the embedding training phase, a triplet-based loss function is used for embedding training. For each positive sample triplet, a negative sample triplet is randomly sampled. The training objective is to maximize the positive sample score and minimize the negative sample score. The training process combines embedding information from Euclidean, hyperbolic, and spherical spaces. By learning embeddings in these three geometric spaces, the diverse structural features in the knowledge graph can be captured more comprehensively. The loss function is defined as:

[0023] ;

[0024] In the formula, For the overall training loss, For positive sample triples, For negative sample triples The head entity of the negative sample triple. For the tail entity of the negative sample triple, For the set of positive sample triples, For the set of negative sample triples, The weights of the Euclidean space loss term, The weights of the hyperbolic space loss term, The weights of the spherical space loss term, For the interval hyperparameter, is the scoring function for three spatial samples.

[0025] Furthermore, in step S4, the embedding representation learning of the three geometric spaces provides high flexibility for the reasoning process, and dynamically selects Euclidean space embedding, hyperbolic space embedding, and spherical space embedding according to specific task requirements or reasoning stages. When dealing with reasoning tasks with obvious hierarchical structures, hyperbolic space embedding is preferred to better capture the hierarchical relationships between entities. In scenarios with dense local relationships, Euclidean space embedding is emphasized to improve the accuracy of local reasoning. For reasoning tasks with complex or diverse structures, a multi-space fusion strategy is adopted, that is, combining the advantages of various embeddings to achieve more comprehensive and robust reasoning. In the reasoning stage, the embedding representation of the three geometric spaces can provide multi-space geometric information support for the entity similarity calculation and relation path selection of downstream tasks. For any two entities, their similarity is calculated in Euclidean space, hyperbolic space, and spherical space respectively. The similarity calculation formula is as follows:

[0026] ;

[0027] ;

[0028] ;

[0029] ;

[0030] In the formula, This represents the similarity of Euclidean spaces. Represents the similarity of hyperbolic spaces. Represents the similarity of spherical spaces. Representing entities , Representing entities , Represents the vector dot product. Describing the vector norm, Representing entities Embedded vectors in Euclidean space Representing entities Embedded vectors in Euclidean space Representing entities Embedding vector in hyperbolic space, Representing entities Embedding vector in hyperbolic space, Representing entities Embedding vector in spherical space, Representing entities Embedding vector in spherical space, Let be the distance function in hyperbolic space. Let be the distance function in spherical space. Indicates the similarity of multi-space fusion. For the fusion weight coefficients of Euclidean space similarity, For the fusion weight coefficients of hyperbolic space similarity, For the fusion weight coefficient of spherical space similarity;

[0031] In knowledge graph reasoning, the reasoning process plans paths based on embedded information from different spaces. In multi-hop reasoning, entities or relationships with high similarity in the knowledge graph are prioritized as intermediate nodes, thereby improving the rationality and diversity of the reasoning path. For a given starting entity and target entity, the path score is defined as:

[0032] ;

[0033] In the formula, The final score for the path is given by the path itself, where path is a candidate inference path. Sum the triples corresponding to each hop on the path. For the first on the path An entity is a physical entity. , To immediately follow The next entity after that, For connection and The relationship between these two entities, Let represent the score function of the triplet corresponding to the jump in Euclidean space. This represents the score function of the triplet corresponding to the jump in hyperbolic space. This represents the scoring function of the triplet corresponding to the jump in spherical space;

[0034] Furthermore, in step S5, the input question is understood using a large language model, which automatically identifies the key entities involved in the question and obtains the nodes and edges in the subgraph related to the question. This step effectively handles complex, ambiguous, or polysemous question expressions by leveraging the powerful semantic understanding capabilities of the large language model. In the subgraph related to the question, breadth-first search or bundle search is used to enumerate all candidate simple paths. For each node on a candidate path, the three geometric spaces are first projected through three paths, and the projection results are concatenated to calculate attention weights. Based on the attention weights, the three spatial fusion representations of the node are obtained. Simultaneously, for each edge in the candidate path, its fusion score is calculated by weighting the edge-level scores of the three spatial spaces, as shown in the following formulas:

[0035] ;

[0036] ;

[0037] ;

[0038] In the formula, For the first Jump to the corresponding node index. For the first The attention weight vector of each node. This means transforming the output into a normalized function of the weight distribution. The weight matrix is ​​a learnable matrix. For activation function, This represents a vector concatenation operation. This represents projecting the embedding of Euclidean space onto a fusionable representation space. This represents projecting the embedding of hyperbolic space onto a fusionable representation space. This represents projecting the embedding of a spherical space onto a blendable representation space. For the candidate path, the first An entity is a physical entity. , For the first The fused representation of the nodes This represents the components of the attention vector in Euclidean space. This represents the components of the attention vector in hyperbolic space. This represents the components of the attention vector in spherical space. The first candidate path Jumping fusion score, Let be the boundary score function in Euclidean space. Let the edge-level scoring function be defined in hyperbolic space. For edge-level scoring functions in spherical space, For the first The starting point entity of the jump, For the first The relationship of jumping, For the first The final entity of the jump;

[0039] The overall representation of the candidate path is obtained by aggregating the mean of the nodes. The final score of the candidate path is the sum of the edge-level scores, as shown in the following expression:

[0040] ;

[0041] ;

[0042] In the formula, This represents the overall representation of the candidate paths. Indicates a candidate reasoning path. The candidate path length, For candidate path location index, For the candidate path, the first The fused node representation of the nodes. Indicate candidate path The final score, The first candidate path Jumping fusion score;

[0043] Among all candidate paths, the top-K paths with the highest scores are selected. These candidate paths, their fused representations, and attention weights are then injected into the prompts as structured context. The final answer is then generated by a large language model that maximizes the conditional probability.

[0044] ;

[0045] In the formula, Let be a probability function. For the answer, For input questions, Representing a knowledge graph, This represents the overall representation of the candidate paths. Indicates the question The resulting Top-K candidate path set.

[0046] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0047] 1. This invention employs three geometric spaces—Euclidean space, hyperbolic space, and spherical space—to embed and represent knowledge graph entities and relationships. These spaces are adapted to structural features such as chain, hierarchical, and cyclic structures, enabling the same fact to be expressed complementaryly under different geometric assumptions. This alleviates the metric distortion caused by single-space modeling and improves the accuracy and generalization ability of complex semantic relationship representation.

[0048] 2. In the path reasoning stage, this invention performs three-way projection and splicing on the three spatial representations of the path nodes, dynamically allocates weights according to the contribution of each spatial representation, and weights and sums the edge-level triple scores to form a path score. At the same time, the aggregated node fusion representations are used to obtain the path representation, thereby achieving more stable evidence path sorting and screening.

[0049] In summary, this invention injects structured information such as Top-K high-confidence evidence paths, path representations, and weights into the prompts of a large language model, and can decompose edge-level fusion scores to obtain the spatial contributions of each space, which are used to generate traceable and interpretable reasoning processes, thereby improving the accuracy and credibility of question answering and significantly reducing the risk of hallucination output by the large language model in scenarios with insufficient evidence or ambiguous relationships. Attached Figure Description

[0050] Figure 1 This is a framework diagram of the method of the present invention; in the diagram, For knowledge graphs, Represents a set of entities. Represents a set of relations. This represents the geometric space representation of a knowledge graph after representation learning. Indicates the similarity of multi-space fusion. Let be a probability function. This represents the overall candidate path. For the question, For the answer, As candidate paths, In response to the problem The selected Top-K high-scoring candidate paths. Detailed Implementation

[0051] The present invention will be further described in detail below with reference to the embodiments and accompanying drawings, but the embodiments of the present invention are not limited thereto.

[0052] like Figure 1 As shown, this embodiment discloses a geometric embedding knowledge graph question answering method based on a large language model (referred to as MultSpace-KG), which has the following characteristics:

[0053] 1) Knowledge graph embedding:

[0054] Entities and relations are extracted from the user's original input question using a large language model, and the corresponding entities and relations are retrieved from the knowledge graph. Based on the retrieval results, the triples of the knowledge graph are embedded in three geometric spaces: Euclidean space, hyperbolic space, and spherical space. The chain structure in the knowledge graph is represented in Euclidean space, the hierarchical structure in the knowledge graph is represented in hyperbolic space, and the loop structure in the knowledge graph is represented in spherical space. The triples include a head entity, a relation, and a tail entity.

[0055] For any triple in the knowledge graph The corresponding triplet scores are calculated in three geometric spaces. In Euclidean space, a scoring function is defined to measure the "closeness between the head entity and the tail entity after relational transformation," which is suitable for capturing local, flat structural relationships. The scoring function calculated in Euclidean space is defined as follows:

[0056] ;

[0057] In the formula, Let be the score function in Euclidean space. For Euclidean space The head entity of the triple. The relationship is that of triples. For the tail entity of the triple, It is a 2-norm. Let be the embedding vector of the head entity in Euclidean space. Let be the embedding vector of the relation in Euclidean space. The embedding vector of the tail entity in Euclidean space;

[0058] In hyperbolic space, the Poincaré sphere model is adopted, relational transformations are performed using Möbius addition, and triple scores are calculated based on the Poincaré hyperbolic distance. Simultaneously, the embedding vectors are normalized and projected to ensure they lie within the unit sphere. The score function calculated in hyperbolic space is defined as follows:

[0059] ;

[0060] In the formula, Let be the score function for hyperbolic space. For hyperbolic space, For dual distances, Addition for Möbius, Let be the embedding vector of the head entity in hyperbolic space. Let be the embedding vector of the relation in hyperbolic space. Let be the embedding vector of the tail entity in hyperbolic space;

[0061] In spherical space, entities and relationships are embedded onto a unit sphere using exponential mapping. The predicted position is obtained by moving along the tangent vector direction on the sphere, and the embedding is always located on the unit sphere by normalized projection, thus characterizing periodic or closed structures. The score function for spherical space computation is defined as:

[0062] ;

[0063] In the formula, Let be the scoring function for spherical space. For spherical space, The geodesic distance between two points in spherical space. Let be the embedding vector of the head entity in the spherical space. Let be the embedding vector of the relation in spherical space. Let be the embedding vector of the tail entity in the spherical space. From Starting from point, along The ball travels in a specified direction along a certain arc on the sphere until it reaches a new point on the sphere.

[0064] 2) Embedding training:

[0065] For the same triple, score functions are calculated in Euclidean space, hyperbolic space, and spherical space, respectively. These score functions are based on the Euclidean norm metric in Euclidean space, the hyperbolic geodesic distance metric of the Poincaré sphere model in hyperbolic space, and the spherical geodesic metric in spherical space, respectively, to quantitatively evaluate the consistency of the triple in the corresponding geometric spaces. When the head entity embedding, after relational operations (i.e., Euclidean translation, hyperbolic Möbius operation, and spherical exponential mapping), is closer to the tail entity embedding under the corresponding spatial metric, the score is better, and the embedding representation in that space is considered more reasonable. Conversely, if the two are far apart under the corresponding spatial metric, the representation is considered unreasonable. The evaluation results, i.e., the scores calculated for each triple in the three geometric spaces, are used to train data and perform ranking prediction during path reasoning. Triples that actually exist in the knowledge graph are defined as positive sample triples, and negative sample triples are constructed by replacing the head or tail entities.

[0066] During the embedding training phase, a triplet-based loss function is used for embedding training. For each positive sample triplet, a negative sample triplet is randomly sampled. The training objective is to maximize the positive sample score and minimize the negative sample score. The training process incorporates embedding information from Euclidean, hyperbolic, and spherical spaces. By learning embeddings in these three geometric spaces, the diverse structural features in the knowledge graph can be captured more comprehensively. The loss function is defined as:

[0067] ;

[0068] In the formula, For the overall training loss, For positive sample triples, For negative sample triples The head entity of the negative sample triple. For the tail entity of the negative sample triple, For the set of positive sample triples, For the set of negative sample triples, The weights of the Euclidean space loss term, The weights of the hyperbolic space loss term, The weights of the spherical space loss term, For the interval hyperparameter, is the scoring function for three spatial samples.

[0069] 3) Information fusion and reasoning utilization:

[0070] The scoring functions of Euclidean space, hyperbolic space, and spherical space are combined into a loss function for optimization. Embedding representation training is performed based on the loss function. The training objective is to maximize the score of positive sample triples and minimize the score of negative sample triples. The loss function includes a margin hyperparameter, which can separate positive sample triples from negative sample triples in each geometric space. This makes Euclidean space better at representing chain-structured knowledge graphs, hyperbolic space better at representing hierarchical structured knowledge graphs, and spherical space better at representing cyclic structured knowledge graphs.

[0071] The embedding representation learning of three geometric spaces provides high flexibility for the reasoning process, dynamically selecting Euclidean, hyperbolic, and spherical embeddings based on specific task requirements or reasoning stages. When handling reasoning tasks with clear hierarchical structures, hyperbolic embedding is prioritized to better capture hierarchical relationships between entities; in scenarios with dense local relationships, Euclidean embedding is emphasized to improve the accuracy of local reasoning; for complex or diverse reasoning tasks, a multi-space fusion strategy is used to integrate the advantages of various embeddings, achieving more comprehensive and robust reasoning. During the reasoning stage, the embedding representations of the three geometric spaces provide multi-space geometric information support for downstream tasks such as entity similarity calculation and relation path selection; for any two entities, their similarity can be calculated in Euclidean, hyperbolic, and spherical spaces respectively, using the following formula:

[0072] ;

[0073] ;

[0074] ;

[0075] ;

[0076] In the formula, This represents the similarity of Euclidean spaces. Represents the similarity of hyperbolic spaces. Represents the similarity of spherical spaces. Representing entities , Representing entities , Represents the vector dot product. Describing the vector norm, Representing entities Embedded vectors in Euclidean space Representing entities Embedded vectors in Euclidean space Representing entities Embedding vector in hyperbolic space, Representing entities Embedding vector in hyperbolic space, Representing entities Embedding vector in spherical space, Representing entities Embedding vector in spherical space, Let be the distance function in hyperbolic space. Let be the distance function in spherical space. Indicates the similarity of multi-space fusion. For the fusion weight coefficients of Euclidean space similarity, For the fusion weight coefficients of hyperbolic space similarity, For the fusion weight coefficient of spherical space similarity;

[0077] In knowledge graph reasoning, the reasoning process plans paths based on embedded information from different spaces. In multi-hop reasoning, entities or relationships with high similarity in the knowledge graph are prioritized as intermediate nodes, thereby improving the rationality and diversity of the reasoning paths. For a given starting entity and target entity, a path score can be defined as:

[0078] ;

[0079] In the formula, The final score for the path is given by the path itself, where path is a candidate inference path. Sum the triples corresponding to each hop on the path. For the first on the path An entity is a physical entity. , To immediately follow The next entity after that, For connection and The relationship between these two entities, Let represent the score function of the triplet corresponding to the jump in Euclidean space. This represents the score function of the triplet corresponding to the jump in hyperbolic space. This represents the scoring function of the triplet corresponding to the jump in spherical space.

[0080] 4) Path construction and spatial adaptive fusion:

[0081] By performing representation learning in Euclidean space, hyperbolic space, and spherical space, a knowledge graph containing multiple geometric embedding representations is constructed. During the reasoning process of the knowledge graph, path planning is performed based on the embedding representations of different geometric spaces to provide evidence for path reasoning. Entities and relations in the knowledge graph are represented as nodes and relations in the path, respectively. When there are multiple reasoning paths, entities or relations with high similarity in the knowledge graph are preferentially selected as intermediate nodes.

[0082] This process leverages a large language model to understand the input question, automatically identifying key entities involved and obtaining nodes and edges in the subgraph related to the question. This step utilizes the powerful semantic understanding capabilities of the large language model to effectively handle complex, ambiguous, or polysemous question expressions. In the subgraph related to the question, breadth-first search or bundle search is used to enumerate all candidate simple paths. For each node on a candidate path, its three-space embedding is first projected through three paths, and the projection results are concatenated to calculate attention weights. Based on these attention weights, a fused representation of the node in the three spaces is obtained. Simultaneously, for each edge in the candidate path, its fusion score is calculated by weighting the edge-level scores in the three spaces, as shown in the following formulas:

[0083] ;

[0084] ;

[0085] ;

[0086] In the formula, For the first Jump to the corresponding node index. For the first The attention weight vector of each node. This means transforming the output into a normalized function of the weight distribution. The weight matrix is ​​a learnable matrix. For activation function, This represents a vector concatenation operation. This represents projecting the embedding of Euclidean space onto a fusionable representation space. This represents projecting the embedding of hyperbolic space onto a fusionable representation space. This represents projecting the embedding of the spherical space onto a fused representation space. For the candidate path, the first An entity is a physical entity. , For the first The fused representation of the nodes This represents the components of the attention vector in Euclidean space. This represents the components of the attention vector in hyperbolic space. This represents the components of the attention vector in spherical space. The first candidate path Jumping fusion score, Let be the boundary score function in Euclidean space. Let the edge-level scoring function be defined in hyperbolic space. For edge-level scoring functions in spherical space, For the first The starting point entity of the jump, For the first The relationship of jumping, For the first The final entity of the jump;

[0087] The overall representation of the candidate path is obtained by aggregating the mean of the nodes. The final score of the candidate path is the sum of the edge-level scores, as shown in the following expression:

[0088] ;

[0089] ;

[0090] In the formula, This represents the overall representation of the candidate paths. Indicates a candidate reasoning path. The candidate path length, For candidate path location index, For the candidate path, the first The fused node representation of the nodes. Indicate candidate path The final score, The first candidate path The score is based on the fusion of jumps.

[0091] 5) Answer generation:

[0092] Subgraphs relevant to the question are selected from the knowledge graph. Breadth-first search or bundle search is used to enumerate candidate simple paths. Nodes on each candidate path are embedded in Euclidean space, hyperbolic space, and spherical space, respectively. The embedded nodes are mapped to the same dimension, and attention weights are calculated in the three geometric spaces. The most suitable geometric space for a node is determined based on the attention weights. The node information in the three geometric spaces is fused into a unified representation according to the attention weights, providing a basis for candidate path selection. For each edge in the candidate path, the score of each edge, i.e., the similarity between entities, is calculated in the three geometric spaces. The fusion score of each edge is obtained by weighting based on the attention weights. The edge-level fusion scores of the candidate paths are accumulated to obtain the geometric perception path score of each candidate path. The Top-K paths with the highest scores are selected. The fusion representations of the candidate paths and their nodes, along with the weight information, are used as structured context and input into a large language model along with the original question input by the user. The large language model generates the answer with the highest probability and provides an inference explanation based on the candidate paths and weight information.

[0093] Among all candidate paths, the top-K paths with the highest scores are selected. These candidate paths, their fused representations, and attention weights are then injected into the prompts as structured context. The final answer is then generated by a large language model that maximizes the conditional probability.

[0094] ;

[0095] In the formula, Let be a probability function. For the answer, For input questions, Representing a knowledge graph, The overall representation of the candidate path Indicates the question The resulting Top-K candidate path set.

[0096] This paper selects RoG-WebQSP and RoG-CWQ, two widely used datasets in knowledge graph question answering research, to evaluate the inference performance of the proposed multi-geometric embedding, path enhancement, and structured prompt-guided large language model. Both datasets take natural language questions as input and provide relevant local subgraphs as structured evidence for each question. These subgraphs can be expanded into multiple triples. These methods are suitable for testing the ability to construct multi-hop paths, score paths, and screen evidence. Among them, RoG-WebQSP has a relatively small problem size and a relatively short inference path, while RoG-CWQ has a larger problem size, more complex problem combinations, and a longer and more difficult inference path.

[0097] This paper uses Hits@1 and F1, which are widely used in existing research, as the main evaluation metrics. Hits@1 measures whether the top-1 answer predicted using multi-geometric space embeddings is consistent with the standard answer, reflecting the accuracy in selecting the most likely answer. F1 considers both the accuracy and recall of the predicted answer, and can more comprehensively reflect the performance in multi-answer scenarios. It is suitable for measuring the coverage and generalization ability of multi-geometric embeddings and large language models in MultSpace-KG collaborative reasoning.

[0098] To systematically evaluate the performance of the method of this invention, this paper divides the 18 selected baseline methods into the following five categories, each representing a different research paradigm and technical route in the field of knowledge question answering. These include: embedding-based methods, retrieval enhancement methods, semantic parsing methods, large language models, and large language models that integrate knowledge graphs. The experimental results are shown in Table 1.

[0099] Table 1. Analysis of Experimental Results

[0100]

[0101] Experimental results show that the proposed geometric embedding knowledge graph question answering method outperforms existing representative models on both the WebQSP and CWQ benchmark datasets. Compared with traditional embedding methods, the proposed method significantly improves the accuracy of hitting the correct answer, indicating that multi-geometric embedding can better distinguish complex relationships and reduce false localization in multi-hop reasoning. Compared with retrieval enhancement and semantic parsing methods, the proposed method is more stable in long-chain and multi-constraint problems, and is less prone to significant performance fluctuations due to improper path selection, demonstrating the effectiveness of geometric-aware path scoring and Top-K evidence screening. In the comparison with large language models combined with knowledge graphs, the proposed method also achieves optimal or near-optimal performance, while large language models relying solely on language generation capabilities are significantly inadequate in complex multi-hop scenarios. Overall, the experimental system verifies that the design of multi-geometric spatial embedding and path-level adaptive fusion can significantly enhance the knowledge reasoning ability of large language models, improve answer accuracy and robustness, and effectively suppress the illusion phenomenon caused by insufficient evidence or unreliable reasoning chains.

[0102] Experimental Conclusions: This invention's method, by integrating embeddings from Euclidean space, hyperbolic space, and spherical space, achieves multi-perspective modeling of entities and relations in knowledge graphs. It also innovatively combines the semantic understanding capabilities of large language models, significantly improving the reasoning ability and interpretability of complex knowledge question-answering tasks. Experimental results show that this method exhibits strong modeling and generalization capabilities for complex semantic paths in multi-hop reasoning tasks. The multi-geometric embedding mechanism is not only suitable for scenarios with dense local relations but also effectively captures hierarchical global structures, providing a flexible and efficient solution for complex knowledge graph reasoning. Future research will further explore its applicability in other knowledge question-answering scenarios and combine it with more geometric embedding forms or more powerful language models to fully tap its potential.

[0103] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.

Claims

1. A large language model-based geometric embedding knowledge graph question answering method, characterized in that, Includes the following steps: S1: Using a large language model, entities and relations are extracted from the original question input by the user, and the corresponding entities and relations are retrieved in the knowledge graph. Based on the retrieval results, the triples of the knowledge graph are embedded in three geometric spaces: Euclidean space, hyperbolic space, and spherical space. The chain structure in the knowledge graph is represented in Euclidean space, the hierarchical structure in the knowledge graph is represented in hyperbolic space, and the loop structure in the knowledge graph is represented in spherical space. The triples include a head entity, a relation, and a tail entity. S2: For the same triple, score functions are calculated in Euclidean space, hyperbolic space, and spherical space, respectively. The score functions are based on the Euclidean norm metric of Euclidean space, the hyperbolic geodesic distance metric of the Poincaré sphere model in hyperbolic space, and the spherical geodesic metric of spherical space, respectively, to quantitatively evaluate the consistency of the triple in the corresponding geometric spaces: when the head entity embedding is closer to the tail entity embedding under the corresponding spatial metric after relational action, i.e., Euclidean translation, hyperbolic Möbius operation, and spherical exponential mapping, the score is better, and the embedding representation in that space is considered more reasonable; conversely, if the two are far apart under the corresponding spatial metric, the representation is considered unreasonable. The evaluation results, i.e., the scores calculated for each triple in the three geometric spaces, are used to train the data and make ranking predictions during path reasoning. Among them, the triples that actually exist in the knowledge graph are defined as positive sample triples, and negative sample triples are constructed by replacing the head entity or the tail entity. S3: The score functions of Euclidean space, hyperbolic space, and spherical space are combined into a loss function for optimization, and the embedding representation is trained based on the loss function. The training objective is to maximize the score of positive sample triples and minimize the score of negative sample triples. The loss function includes a margin hyperparameter, which can separate positive sample triples from negative sample triples in each geometric space, so that Euclidean space is better at representing chain-structured knowledge graphs, hyperbolic space is better at representing hierarchical structured knowledge graphs, and spherical space is better at representing cyclic structured knowledge graphs. S4: By learning representations in Euclidean space, hyperbolic space and spherical space, a knowledge graph containing multiple geometric embedding representations is constructed. During the reasoning process of the knowledge graph, path planning is performed according to the embedding representations of different geometric spaces to provide evidence for path reasoning. Entities and relations in the knowledge graph are represented as nodes and relations in the path, respectively. When there are multiple reasoning paths, entities or relations with high similarity in the knowledge graph are selected as intermediate nodes first. S5: Filter out subgraphs related to the question from the knowledge graph, enumerate candidate simple paths using breadth-first search or bundle search, obtain embedded representations of nodes on each candidate path in Euclidean space, hyperbolic space, and spherical space respectively, map the embedded nodes to the same dimension, and calculate the attention weights in the three geometric spaces. Determine the more suitable geometric space for the node based on the attention weights, and fuse the node information in the three geometric spaces into a unified representation according to the attention weights to provide a basis for candidate path selection. For each edge in the candidate path, calculate the score of each edge in the three geometric spaces, i.e., the similarity between entities, and obtain the fusion score of each edge based on the attention weights. Accumulate the edge-level fusion scores in the candidate paths to obtain the geometric perception path score of each candidate path, select the Top-K paths with the highest scores, and use the candidate paths and their node fusion representations and weight information as structured context, inputting them together with the user's original question into the large language model. The large language model generates the answer with the highest probability and provides an inference explanation based on the candidate paths and weight information.

2. The method according to claim 1, wherein, In step S1, for a given set of entities and sets of relations in a knowledge graph, embedding representations are learned for each entity and each relation in Euclidean space, hyperbolic space, and spherical space, respectively, to explicitly model the structural heterogeneity of the knowledge graph and enable different types of structures, including chain structures, hierarchical structures, and cyclic structures, to be represented in a suitable geometric space.

3. The geometric embedding knowledge graph question answering method based on a large language model according to claim 2, characterized in that, At step S2, for any triple in the knowledge graph , the corresponding triple score is calculated in the three geometric spaces respectively; In Euclidean space, a score function is defined to measure the "closeness between the head entity and the tail entity after relational transformation," which is suitable for capturing chain-like structural relationships. The score function calculated in Euclidean space is defined as follows: ; wherein, is a scoring function for Euclidean space, is a Euclidean space, is a head entity of a triple, is a relation of a triple, is a tail entity of a triple, is a two-norm, is an embedding vector of the head entity in the Euclidean space, is an embedding vector of the relation in the Euclidean space, is an embedding vector of the tail entity in the Euclidean space; In hyperbolic space, the Poincaré sphere model is adopted, relational transformations are performed using Möbius addition, and triple scores are calculated based on the Poincaré hyperbolic distance. Simultaneously, the embedding vectors are normalized and projected to ensure they lie within the unit sphere. The score function calculated in hyperbolic space is defined as follows: ; In the formula, Let be the score function for hyperbolic space. For hyperbolic space, For dual distances, Addition for Möbius, Let be the embedding vector of the head entity in hyperbolic space. Let be the embedding vector of the relation in hyperbolic space. Let be the embedding vector of the tail entity in hyperbolic space; In spherical space, entities and relationships are embedded onto a unit sphere using exponential mapping. The predicted position is obtained by moving the point along the tangent vector direction on the sphere, and the embedding is always located on the unit sphere by normalized projection, thus characterizing the cyclic structure in the knowledge graph. The score function for spherical space computation is defined as: ; In the formula, Let be the scoring function for spherical space. For spherical space, The geodesic distance between two points in spherical space. Let be the embedding vector of the head entity in the spherical space. Let be the embedding vector of the relation in spherical space. Let be the embedding vector of the tail entity in the spherical space. Indicates from Starting from point, along Move forward a preset arc in the specified direction on the sphere to reach a new point on the sphere.

4. The geometric embedding knowledge graph question answering method based on a large language model according to claim 3, characterized in that, In step S3, during the embedding training phase, a triplet-based loss function is used for embedding training. For each positive triplet, a negative triplet is randomly sampled. The training objective is to maximize the positive sample score and minimize the negative sample score. The training process incorporates embedding information from Euclidean, hyperbolic, and spherical spaces; By learning embeddings in these three geometric spaces, we can more comprehensively capture the diverse structural features in the knowledge graph. The loss function is defined as: ; In the formula, For the overall training loss, For positive sample triples, For negative sample triples The head entity of the negative sample triple. For the tail entity of the negative sample triple, For the set of positive sample triples, For the set of negative sample triples, The weights of the Euclidean space loss term, The weights of the hyperbolic space loss term, The weights of the spherical space loss term, For the interval hyperparameter, is the scoring function for three spatial samples.

5. The geometric embedding knowledge graph question answering method based on a large language model according to claim 4, characterized in that, In step S4, the embedding representation learning of the three geometric spaces provides high flexibility for the reasoning process, and dynamically selects Euclidean space embedding, hyperbolic space embedding, and spherical space embedding according to specific task requirements or reasoning stages. When dealing with reasoning tasks with obvious hierarchical structures, hyperbolic space embedding is preferred to better capture the hierarchical relationships between entities. In scenarios with dense local relationships, Euclidean space embedding is emphasized to improve the accuracy of local reasoning. For reasoning tasks with complex or diverse structures, a multi-space fusion strategy is adopted, that is, combining the advantages of various embeddings to achieve more comprehensive and robust reasoning. In the reasoning stage, the embedding representation of the three geometric spaces can provide multi-space geometric information support for the entity similarity calculation and relation path selection of downstream tasks. For any two entities, their similarity is calculated in Euclidean space, hyperbolic space, and spherical space respectively. The similarity calculation formula is as follows: ; ; ; ; In the formula, This represents the similarity of Euclidean spaces. Represents the similarity of hyperbolic spaces. Represents the similarity of spherical spaces. Representing entities , Representing entities , Represents the vector dot product. Describing the vector norm, Representing entities Embedded vectors in Euclidean space Representing entities Embedded vectors in Euclidean space Representing entities Embedding vector in hyperbolic space, Representing entities Embedding vector in hyperbolic space, Representing entities Embedding vector in spherical space, Representing entities Embedding vector in spherical space, Let be the distance function in hyperbolic space. Let be the distance function in spherical space. Indicates the similarity of multi-space fusion. For the fusion weight coefficients of Euclidean space similarity, For the fusion weight coefficients of hyperbolic space similarity, For the fusion weight coefficient of spherical space similarity; In knowledge graph reasoning, the reasoning process plans paths based on embedded information from different spaces. In multi-hop reasoning, entities or relationships with high similarity in the knowledge graph are prioritized as intermediate nodes, thereby improving the rationality and diversity of the reasoning path. For a given starting entity and target entity, the path score is defined as: ; In the formula, The final score for the path is given by the path itself, where path is a candidate inference path. Sum the triples corresponding to each hop on the path. For the first on the path An entity is a physical entity. , To immediately follow The next entity after that, For connection and The relationship between these two entities, Let represent the score function of the triplet corresponding to the jump in Euclidean space. This represents the score function of the triplet corresponding to the jump in hyperbolic space. This represents the scoring function of the triplet corresponding to the jump in spherical space.

6. The geometric embedding knowledge graph question answering method based on a large language model according to claim 5, characterized in that, In step S5, the input problem is understood using a large language model, and key entities involved in the problem are automatically identified to obtain nodes and edges in the subgraph related to the problem. This step can effectively handle complex, ambiguous or polysemous problem expressions through the powerful semantic understanding capabilities of the large language model. In the subgraph related to the problem, breadth-first search or bundle search is used to enumerate all candidate simple paths. For each node on a candidate path, the three geometric spaces are first projected through three paths, and the projection results are then stitched together to calculate the attention weights. Based on attention weights, three spatial fusion representations of the node are obtained; simultaneously, for each edge in the candidate path, its fusion score is calculated by weighting the scores of the three spatial edge levels, as shown in the following formulas: ; ; ; In the formula, For the first Jump to the corresponding node index. For the first The attention weight vector of each node. This means transforming the output into a normalized function of the weight distribution. The weight matrix is ​​a learnable matrix. For activation function, This represents a vector concatenation operation. This represents projecting the embedding of Euclidean space onto a fusionable representation space. This represents projecting the embedding of hyperbolic space onto a fusionable representation space. This represents projecting the embedding of a spherical space onto a blendable representation space. For the candidate path, the first An entity is a physical entity. , For the first The fused representation of the nodes This represents the components of the attention vector in Euclidean space. This represents the components of the attention vector in hyperbolic space. This represents the components of the attention vector in spherical space. The first candidate path Jumping fusion score, Let be the boundary score function in Euclidean space. Let the edge-level scoring function be defined in hyperbolic space. Let the edge-level scoring function be defined in spherical space. For the first The starting point entity of the jump, For the first The relationship of jumping, For the first The final entity of the jump; The overall representation of the candidate path is obtained by aggregating the mean of the nodes. The final score of the candidate path is the sum of the edge-level scores, as shown in the following expression: ; ; In the formula, This represents the overall representation of the candidate paths. Indicates a candidate reasoning path. The candidate path length, For candidate path location index, For the candidate path, the first The fused node representation of the nodes. Indicate candidate path The final score, The first candidate path Jumping fusion score; Among all candidate paths, the top-K paths with the highest scores are selected. These candidate paths, their fused representations, and attention weights are then injected into the prompts as structured context. The final answer is then generated by a large language model that maximizes the conditional probability. ; In the formula, Let be a probability function. For the answer, For input questions, Representing a knowledge graph, This represents the overall candidate path. Indicates the question The resulting Top-K candidate path set.