Attribute fusion-oriented knowledge graph multi-hop reasoning method and device
By integrating attribute information into knowledge graph multi-hop reasoning, using entity attribute message delivery network and graph attention mechanism, building an AMR-KG architecture, the existing methods are inefficient and attribute information is ignored, and more efficient and accurate multi-hop reasoning is achieved.
Patent Information
- Application Number
- CN202510489863.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-04-18
AI Technical Summary
The existing knowledge graph multi-hop reasoning method is inefficient when dealing with large-scale graphs, ignoring rich attribute information, especially spatiotemporal attributes, resulting in insufficient inference accuracy and efficiency.
A knowledge graph multi-hop reasoning method for attribute fusion is proposed. Through the entity attribute message delivery network (EAMN) and graph attention mechanism, attribute information is integrated into entity embedding, and an AMR-KG architecture is built to achieve the organic combination of attributes and multi-hop reasoning.
It significantly improves the accuracy and efficiency of multi-hop reasoning, can better capture the complex relationships between entities, and enhances the model's understanding of complex logical query problems.
Smart Images

Figure CN120012947A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent question answering, and in particular, relates to a knowledge graph multi-hop reasoning method and device for attribute fusion. Background Art
[0002] Knowledge graph reasoning is one of the core tasks of knowledge graph applications, and its purpose is to derive new knowledge from existing knowledge. Reasoning tasks can be divided into single-hop reasoning and multi-hop reasoning. Single-hop reasoning focuses on completing missing entities or relationships, while multi-hop reasoning is more complex and requires reasoning between multiple entities and relationships to answer complex query questions. For example, given a query "find all entities related to A and connected to C through B", it needs to be completed through multi-hop reasoning.
[0003] As the scale of knowledge graphs continues to expand and application scenarios become increasingly complex, the importance of multi-hop reasoning becomes increasingly prominent. However, existing multi-hop reasoning methods face many challenges when processing large-scale knowledge graphs, such as low reasoning efficiency, insufficient support for sparse graphs, and difficulty in processing complex logical queries. In addition, the rich attribute information (especially spatiotemporal information) in knowledge graphs is often ignored, which is important for understanding the relationship between entities.
[0004] In the research of multi-hop reasoning in knowledge graphs, there are currently three main methods:
[0005] (1) Reasoning based on rule logic
[0006] This type of method uses a reasoning engine to perform logical reasoning based on pre-defined reasoning rules. For example, Datalog and Prolog are two typical rule-based reasoning tools. Datalog is a logic programming language that can perform reasoning through recursive rules, while Prolog is a more general logic programming language suitable for complex logical reasoning tasks. However, the disadvantage of this type of method is that the labor cost is extremely high and it is difficult to expand to other knowledge graphs.
[0007] (2) Reasoning based on path search
[0008] This type of method starts from the starting node, builds a search space in the knowledge graph, and moves along possible relationship paths to find the target node. Search algorithms are used for knowledge graph reasoning, optimizing path search through heuristic methods. In addition, reinforcement learning techniques are also used to dynamically search for optimal reasoning paths. The advantage of such methods is that they can flexibly handle various complex queries, but the disadvantage is that the computational overhead is high, especially inefficient when searching large graphs and long paths. In addition, the performance of such methods on sparse graphs is also limited.
[0009] (3) Embedding-based reasoning
[0010] This type of method embeds entities and relations into a low-dimensional vector space and performs reasoning through vector operations. For example, the TransE model represents entities and relations as vectors and uses vector addition for reasoning. Query2box handles complex queries with uncertainty by designing hyper-rectangular boxes. In addition, there are some studies that embed entities and relations based on Beta distribution and geometric models. The advantage of this type of method is that it is highly scalable and can adapt to large-scale knowledge graphs. However, a common shortcoming of existing methods is that they ignore the rich attribute information in the knowledge graph, especially spatiotemporal attributes, which are crucial to understanding the relationship between entities.
[0011] In terms of attribute embedding, some studies have attempted to incorporate attribute information into knowledge graph embedding. For example, TransEA improves the reasoning performance of inter-entity relations by combining discrete relations and continuous numerical attributes through a joint embedding framework. AEKE proposes an entity attribute embedding framework for error perception to reduce incorrect reasoning. KGFA enhances the performance of recommendation systems through attribute embedding mechanisms. These studies provide ideas for using attribute information for knowledge graph reasoning, but attribute information has not yet been systematically applied to multi-hop reasoning tasks.
[0012] Existing methods have the following defects: Existing methods ignore the rich attribute information in the knowledge graph, especially the spatiotemporal attributes. Insufficient reasoning efficiency and accuracy, especially in large-scale graphs and complex query scenarios. Ignoring attribute information: Most of the existing knowledge graph multi-hop reasoning methods do not fully utilize the rich attribute information in the knowledge graph (such as spatiotemporal attributes), resulting in a lack of complete characterization of entity semantics during reasoning, affecting the accuracy of reasoning. Insufficient reasoning efficiency and accuracy: Path search-based methods have high computational overhead, especially in large-scale graphs and complex queries; while embedding-based methods are highly scalable, they are limited in reasoning accuracy due to the lack of support for attribute information. Summary of the invention
[0013] In order to solve the above technical problems, the present invention proposes a knowledge graph multi-hop reasoning method for attribute fusion. The specific technical solution is as follows:
[0014] Step 1: Define attribute-oriented knowledge graph and multi-hop reasoning; knowledge graph is used to structuredly store and represent various objective fact entities and entity attributes; multi-hop reasoning is used to explore semantic paths in knowledge graph through multi-hop logical reasoning, across multiple entities and relationships between entities, to solve problems;
[0015] Step 2: Build the AMR-KG architecture to realize the organic combination of entity attributes and multi-hop reasoning, and integrate attributes into the knowledge graph and multi-hop reasoning process.
[0016] The present invention also provides a knowledge graph multi-hop reasoning device for attribute fusion, comprising:
[0017] Define modules, define attribute-oriented knowledge graphs and multi-hop reasoning; knowledge graphs are used to structuredly store and represent various objective fact entities and entity attributes; multi-hop reasoning is used to explore semantic paths in knowledge graphs through multi-hop logical reasoning, across multiple entities and relationships between entities, to solve problems;
[0018] AMR-KG architecture,Build the AMR-KG architecture to realize the organic combination of entity attributes and multi-hop reasoning, and integrate attributes into the knowledge graph and multi-hop reasoning process.
[0019] The present invention also provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned knowledge graph multi-hop reasoning method for attribute fusion.
[0020] The present invention also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the above-mentioned knowledge graph multi-hop reasoning method for attribute fusion.
[0021] The present invention has the following beneficial effects:
[0022] (1) Make full use of attribute information
[0023] Most existing technologies ignore the rich attribute information in knowledge graphs, especially spatiotemporal attributes, which are crucial for understanding entity relationships. This paper integrates attribute information into entity embedding through the Entity Attribute Message Passing Network (EAMN) and graph attention mechanism, enriching the semantic representation of entities and significantly improving the accuracy of multi-hop reasoning.
[0024] (2) Providing a new reasoning framework
[0025] The existing technology has shortcomings in processing attribute-rich knowledge graphs, and the present invention proposes a multi-hop reasoning framework (AMR-KG) for attribute fusion, which systematically introduces attribute information into multi-hop reasoning tasks, opens up new ideas and methods for attribute-rich knowledge graph reasoning, and has stronger adaptability and scalability. By introducing attribute information and attention mechanism, the present invention can better capture the complex relationship between entities, especially in attribute-rich knowledge graphs, and significantly enhances the model's ability to understand complex logical query problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 This is the structural diagram of the knowledge graph multi-hop reasoning method for attribute fusion. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in each embodiment of the present invention described below can be combined with each other as long as they do not conflict with each other. To achieve the above-mentioned purpose, the present invention adopts the following technical scheme.
[0028] like Figure 1 As shown, the present invention proposes a flow chart of a knowledge graph multi-hop reasoning method for attribute fusion, which includes the following steps:
[0029] Step 1: Define attribute-oriented knowledge graph and multi-hop reasoning; knowledge graph is used to structuredly store and represent various objective fact entities and entity attributes; multi-hop reasoning is used to explore semantic paths in knowledge graph through multi-hop logical reasoning, across multiple entities and relationships between entities, to solve problems;
[0030] Definition 1 Knowledge Graph: Knowledge Graph ,in Represents a collection of entities, Represents a set of relations, Represents a collection of attributes. Represents a set of attribute values. The knowledge graph is stored in the form of entity triples. and attribute triples composition.
[0031] Definition 2 Multi-hop reasoning: Define the sample of multi-hop reasoning as a triple structure , which represents a problem The answer, the correct answer Positive Sample and wrong answers Negative samples In addition, the problem It consists of first-order predicate logic, including intersection (∧), disjunction (∨), existential quantification, ), negation (¬). Question q consists of multiple logical operations, and the goal is to find a target entity As a question The answer.
[0032] Step 2: Build the AMR-KG architecture to realize the organic combination of entity attributes and multi-hop reasoning, and integrate attributes into the knowledge graph and multi-hop reasoning process.
[0033] In order to introduce attributes to answer multi-hop reasoning questions, we build the AMR-KG architecture, such as Figure 1 As shown in the figure. The AMR-KG architecture includes the knowledge graph induction part, the sample production part, the question embedding part, the entity embedding and matching part; among them, the knowledge graph induction part records the transitive relationship of multi-hop reasoning in the knowledge graph, such as Figure 1 As shown in (a) in the figure, the sample production part produces positive and negative samples for the entities in the knowledge graph. The positive samples are obtained by positive sampling of the entities in the knowledge graph. This process is called positive sampling. The negative samples are obtained by replacing the entities in the knowledge graph. This process is called negative sampling. Figure 1 As shown in (b) in the question embedding part, the aggregated attributes related to the entity are embedded, such as Figure 1 As shown in (c) in the figure, and finally matched with the entity embedding to calculate the KL divergence, Figure 1 The knowledge graph in (a) queries questions according to various considered structures and queries questions according to the logic instantiated by these structures. Figure 1 In (b), the sampling part uses logical query questions and answers instantiated with various structures as positive samples. At the same time, a dynamic rejection sampling model is designed for negative sample generation. The question embedding part includes an entity attribute message passing network and a question sequence network (QSN). Figure 1 As shown in (c) in the figure, the entity attribute message passing network is used to fuse entity-related attributes. Figure 1 As shown in (c) in the figure, the question sequence network (QSN) embeds the entity attribute fusion results. Figure 1(d) in the figure is the entity embedding matching part. The entity embedding vector obtained through sample learning is matched with the question embedding vector output by the question sequence network through KL divergence calculation to measure the matching degree. Finally, the entity embedding vector and the question embedding vector are used to generate distribution and compare the KL divergence matching process. It is expected that the closer the distribution generated by the positive samples is, the better, and the greater the distribution difference between the negative samples is, the better.
[0034] The dynamic rejection sampling model is used to generate more challenging negative samples and improve the model's ability to distinguish. The quality of the samples largely determines the training effect. Unlike knowledge graph completion, the sampling process of multi-hop reasoning is much more complicated. It includes generating questions by instantiating the query structure. , perform a KG traversal to find the answer And negative answers , the loss calculation of the learning process of the dynamic rejection sampling model is as follows:
[0035] ,
[0036] in, represents the loss function, Represents the parameters, Represents the correct answer, Indicates a wrong answer. represents the parameters of the question embedding network, Parameters representing entity embeddings, is the sigmoid function, represents the number of elements in the set. The loss is calculated by minimizing the distance between the question embedding and the answer and the distance between the maximization problem and the negative samples It consists of two parts. γ is a hyperparameter used to adjust the distance scale. According to experience, positive samples can be obtained through graph traversal, but there must be multiple negative samples compared to positive samples to be given to the network for learning. The learning process requires positive sampling and negative sampling.
[0037] In order to obtain more efficient negative samples in multi-hop reasoning, a dynamic rejection sampling model is proposed to replace the random entity negative sampling in the traditional method. Simply put, the candidate distribution or acceptance criteria are continuously adjusted according to the current sampling results during the sampling process. Specifically, while recording the content of the question, the upper-level types corresponding to the entities mentioned in the question are also recorded. The negative sampling of a question is divided into two parts. Under the upper-level type of the recorded question, a set of entities with the same type as the recorded type is sampled as negative samples. The more entities of the same type, the greater the proportion of this part of the sampling points; the other part is completely random sampling. In this way, more entities of the same type that the model is prone to make mistakes are obtained as negative sample learning to improve the accuracy of the model.
[0038] The question embedding part is implemented through the entity attribute messaging network (EAMN). The question is composed of multiple entities. These entities will fuse attribute information for subsequent learning. Graph neural network and attention mechanism are used to integrate attribute information into entities to enrich semantic representation.
[0039] Attribute information uses the message passing mechanism. The process of question embedding can be divided into two steps: message passing and state update, as shown in the following formula. Assume an entity The current state entity embedding vector is , the updated status is , The attribute value set is , the attribute information transmitted is the result of attribute state aggregation :
[0040] ,
[0041] ,
[0042] in, It is composed of a learnable matrix and an activation function, which is used to determine the proportion of state updates. Since entities are usually associated with different attributes under the semantics of different problems, the present invention designs an attention mechanism transfer framework Used to learn the impact of different attributes, the specific calculation is as follows:
[0043] ,
[0044] ,
[0045] in, represents the activation function, Represents the learnable parameter weight matrix. Representing Entity The attribute value of The attention coefficient is calculated by performing softmax normalization on the attribute attention scores of each entity. and are index values, indicating traversal, and · represents vector dot product calculation. After iteration, the final entity embedding vector is obtained. By introducing the attention-based attribute message passing network, the semantics implied in the attributes are proportionally utilized, and richer feature representations are introduced for subsequent multi-hop reasoning.
[0046] The entity with aggregated attribute information is embedded in the whole learning through the question sequence network (QSN). After the question sequence network (QSN) is learned through GRU and attention mechanism, it is matched with the entity embedding result using KL divergence.
[0047] The question sequence network embeds the entity attribute fusion result after the fusion of attributes, that is, the entity embedding vector, to generate a question embedding vector representing the question, including:
[0048] The problem Expands into a sequence of triple questions:
[0049] ,
[0050] in, The length of the problem sequence represented by GRU is used to capture the sequence dependency, and the final length is The question embedding vector of the question sequence is represented as:
[0051] ,
[0052] in, is the output of the reset gate, σ is the sigmoid activation function, , , is a trainable parameter, It is Entities The entity embedding vector of is the hidden state of the embedding vector of the previous question in the question sequence, is the state of the hidden layer, , , is a trainable parameter, ⊙ represents element-wise multiplication, is the hyperbolic tangent activation function, is the output of the update gate, , , is a trainable parameter.
[0053] The calculation of KL divergence is as follows: first, the entity embedding vector and the question embedding vector are represented as probability distributions by converting the embedding vectors into probability distributions through the softmax function;
[0054] and are entity embedding vectors and the question embedding vector The probability distribution of is expressed as:
[0055] ,
[0056] ,
[0057] in, and are the i-th component of the entity embedding and question embedding vectors respectively; and are the jth components of the entity embedding and question embedding vectors respectively;
[0058] calculate and The calculation formula of KL divergence is:
[0059] .
[0060] Then the KL divergence between them is calculated to measure the similarity between the entity and the question. The smaller the KL divergence, the more relevant the entity and the question are. This process involves the representation of probability distribution, the calculation of KL divergence, and the matching of entity and question.
[0061] The present invention also provides a knowledge graph multi-hop reasoning device for attribute fusion, comprising:
[0062] A knowledge graph multi-hop reasoning device for attribute fusion, comprising:
[0063] Define modules, define attribute-oriented knowledge graphs and multi-hop reasoning; knowledge graphs are used to structuredly store and represent various objective fact entities and entity attributes; multi-hop reasoning is used to explore semantic paths in knowledge graphs through multi-hop logical reasoning, across multiple entities and relationships between entities, to solve problems;
[0064] AMR-KG architecture,Build the AMR-KG architecture to realize the organic combination of entity attributes and multi-hop reasoning, and integrate attributes into the knowledge graph and multi-hop reasoning process.
[0065] The present invention also provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned knowledge graph multi-hop reasoning method for attribute fusion.
[0066] The present invention also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the above-mentioned knowledge graph multi-hop reasoning method for attribute fusion.
Claims
1. A knowledge graph multi-hop reasoning method for attribute fusion, characterized in that: The following steps are involved: Step 1: Define attribute-oriented knowledge graph and multi-hop reasoning; knowledge graph is used to structuredly store and represent various objective fact entities and entity attributes; multi-hop reasoning is used to explore semantic paths in knowledge graph through multi-hop logical reasoning, across multiple entities and relationships between entities, to solve problems; Step 2: Build the AMR-KG architecture to realize the organic combination of entity attributes and multi-hop reasoning, and integrate attributes into the knowledge graph and multi-hop reasoning process.
2. According to claim 1, a knowledge graph multi-hop reasoning method for attribute fusion is characterized in that: Defining the Knowledge Graph ,in Represents a collection of entities, Represents a set of relations, Represents a collection of attributes. Represents a set of attribute values. The knowledge graph is stored in the form of entity triples. and attribute triples composition.
3. The knowledge graph multi-hop reasoning method for attribute fusion according to claim 2 is characterized in that: Define the sample of multi-hop reasoning as a triple structure , which represents a problem The answer, the correct answer Positive Sample and wrong answers Negative samples ;question It consists of several first-order predicate logic functions, including intersection, union, existence, and negation; The goal is to find a target entity As a question The answer.
4. The knowledge graph multi-hop reasoning method for attribute fusion according to claim 3 is characterized in that: The AMR-KG architecture includes a knowledge graph induction part, a sample production part, a question embedding part, an entity embedding part, and matching. The knowledge graph induction part records the entities in the knowledge graph and the relationships between entities. The sample production part produces positive and negative samples for the entities in the knowledge graph. The positive samples are obtained by positive sampling of the entities in the knowledge graph, and the negative samples are obtained by replacing the entities in the knowledge graph. The question embedding part aggregates and embeds the relevant attributes of the entity. The entity embedding part calculates the KL divergence with the question embedding part and matches them.
5. The knowledge graph multi-hop reasoning method for attribute fusion according to claim 4 is characterized in that: A dynamic rejection sampling model is used for negative sample generation.
6. The knowledge graph multi-hop reasoning method for attribute fusion according to claim 4 is characterized in that: The question embedding part includes an entity attribute message passing network and a question sequence network. The entity attribute message passing network is used to fuse entity-related attributes to obtain the entity attribute fusion result, namely the entity embedding vector. The question sequence network embeds the entity attribute fusion result, namely the entity embedding vector, to generate a question embedding vector representing the problem.
7. The knowledge graph multi-hop reasoning method for attribute fusion according to claim 5 is characterized in that: The loss calculation of the learning process of the dynamic rejection sampling model is as follows: , in, represents the loss function, Represents the parameters, Represents the correct answer, Indicates a wrong answer. Represents the parameters of the question embedding part, Parameters representing the embedding part of the entity, is the sigmoid function, It represents the number of elements in the set, and γ is a hyperparameter used to adjust the distance scale.
8. The knowledge graph multi-hop reasoning method for attribute fusion according to claim 6 is characterized in that: Problems in entity attribute message passing networks By multiple entities The multiple entities are associated Subsequent learning is performed by integrating attributes; attributes are transmitted using a message passing mechanism, and the problem embedding process is divided into two steps: message passing and state updating, as shown in the following formula: The entity embedding vector of the current state is , the entity embedding vector of the updated state is ,entity The attribute value set is , the attribute passed is the result of attribute state aggregation : , , in, Composed of a learnable matrix and activation function, the attention mechanism transfer framework Used to learn the impact of different attributes, the specific calculation is as follows: , , in, represents the activation function, represents the learnable parameter weight matrix, Representing Entity The attribute value of Calculation of attention coefficient, and are index values, indicating traversal, and · represents vector dot product calculation. The entity finally obtained after iteration The entity embedding vector is .
9. The knowledge graph multi-hop reasoning method for attribute fusion according to claim 8 is characterized in that: The question sequence network embeds the entity attribute fusion result after the fusion of attributes, that is, the entity embedding vector, to generate a question embedding vector representing the question, including: The problem Expands into a sequence of triple questions: , in, The length of the problem sequence represented by GRU is used to capture the sequence dependency, and the final length is The question embedding vector of the question sequence is represented as: , in, is the output of the reset gate, σ is the sigmoid activation function, , , is a trainable parameter, It is Entities The entity embedding vector of is the hidden state of the embedding vector of the previous question in the question sequence, is the state of the hidden layer, , , is a trainable parameter, ⊙ represents element-wise multiplication, is the hyperbolic tangent activation function, is the output of the update gate, , , is a trainable parameter.
10. The knowledge graph multi-hop reasoning method for attribute fusion according to claim 9 is characterized in that: The calculation of KL divergence is as follows: first, the entity embedding vector and the question embedding vector are represented as probability distributions by converting the embedding vectors into probability distributions through the softmax function; and are entity embedding vectors and the question embedding vector The probability distribution of is expressed as: , , in, and are the i-th component of the entity embedding and question embedding vectors respectively; and are the j-th components of the entity embedding and question embedding vectors respectively; calculate and The calculation formula of KL divergence is: 。 11. A knowledge graph multi-hop reasoning device for attribute fusion, characterized in that: include: Define modules, define attribute-oriented knowledge graphs and multi-hop reasoning; Knowledge graphs are used to structure the storage and representation of various objective fact entities and their attributes; Multi-hop reasoning is used to explore semantic paths in the knowledge graph through multi-hop logical reasoning across multiple entities and relationships between entities to solve problems; AMR-KG architecture,Build the AMR-KG architecture to realize the organic combination of entity attributes and multi-hop reasoning, and integrate attributes into the knowledge graph and multi-hop reasoning process.
12. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the knowledge graph multi-hop reasoning method for attribute fusion as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: Executable instructions are stored thereon, which, when executed by a processor, enable the processor to implement the knowledge graph multi-hop reasoning method for attribute fusion as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Multi-hop question and answer-oriented multi-path reasoning method based on knowledge graph question and answer
CN115293151A
Knowledge graph multi-hop question and answer method based on reinforcement learning path reasoning
CN115640410A
Complex question multi-hop intelligent question answering method based on knowledge graph representation learning
CN115757715A
Question and answer method for improving time sequence knowledge graph based on auxiliary supervision signal
CN117435715A
Multi-hop time sequence knowledge graph question and answer method and system
CN117829298A