Quaternion modeling method for time sequence knowledge graph completion
By designing information exchange module, context disambiguation module and neighborhood relationship attention module in the timing knowledge graph, cross-spatial information exchange and unambiguous feature extraction of entities, relationships and timestamps, solving the problem of time stamp expression in the prior art The problem of insufficient utilization of limited and quadruple information improves the completion performance of the knowledge graph.
Patent Information
- Application Number
- CN202411339929.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-21
- Publication Date
- 2025-01-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing time sequence knowledge graph completion method integrates timestamp information directly or indirectly into entities or relationships, limiting the expressive ability of timestamps, underutilizing the neighborhood information of quadruples, and lacking an effective disambiguation mechanism, resulting in The completion effect is not good.
A quadruple modeling method is designed to realize cross-spatial information exchange between entities, relationships and timestamps through the information exchange module. Combining the context disambiguation module and the neighborhood relationship attention module, we obtain the unambiguous feature representation and global features. The entity to be completed is output using a fourth-order tensor decomposition decoder.
Improve the completion performance of the timing knowledge graph, solve the problems of time stamp expression limitation and semantic loss, enhance the disambiguation ability of multi-sense entities and relationships, fully explore the neighborhood information of quadruples, and improve the completion Effect.
Smart Images

Figure CN119312889A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a quadruple modeling method for completing a temporal knowledge graph, which is a method for completing an incomplete temporal knowledge graph and belongs to the intersection of engineering application and information science. Background Art
[0002] Knowledge graph is a carrier that can store and process information. It constructs human knowledge into a large-scale graph database in a structured way. However, knowledge in the real world is time-limited. Due to this temporal attribute, temporal knowledge graph (TKG) has received widespread attention in recent years. Its core component is a quadruple (h, r, o, t), which contains timestamp information in addition to triple entities and relationships. Therefore, TKG emphasizes the time sensitivity of knowledge. As events develop, TKG will be updated regularly to provide valuable time-related information for research. The existing mainstream temporal knowledge graph completion methods mainly include language model-based methods, graph embedding-based methods, attention mechanism-based methods, logical rule-based methods, and hybrid model-based methods.
[0003] Language model-based methods mainly rely on natural language processing technology to complete the information in the time-series knowledge graph. These methods usually use pre-trained language models, such as BERT and GPT, to generate and understand entities and relations in time-series text, and use the model's contextual understanding ability to predict missing entities. However, these methods require a large amount of training data and computing resources, and the inference results of the language model may be affected by bias and noise in the training data.
[0004] Graph embedding-based methods usually associate timestamps with entities or relations in the temporal knowledge graph and map them to a low-dimensional vector space. The accuracy of embedding is improved by optimizing the objective function to predict missing entities. However, directly integrating timestamp information into relations or entities severely limits the expressive power of timestamp information, making it difficult for the model to capture the complex interactions between entities, relations, and timestamps, which in turn affects the completion effect.
[0005] Attention-based methods usually use attention mechanisms to build neural networks in temporal knowledge graph completion, such as the Transformer model, which completes entities by weighted fusion of entities and relations within a time step. However, most existing methods tend to focus more on obtaining the representation vector of the entity and use the original representation vector of the relationship. This makes it difficult for the model to capture the changes in relationships over time. However, these methods also require high computational overhead and may face performance bottlenecks in large-scale graphs.
[0006] Logical rule-based methods rely on predefined logical rules or reasoning engines to complete temporal knowledge graphs. These methods usually set a series of logical rules or constraints (such as domain knowledge rules, causal relationships, etc.), and then apply reasoning mechanisms to infer missing information. For example, using rule reasoning engines (such as OWL, SPARQL, etc.). However, its disadvantage is that the design and maintenance of rules are relatively complex, and the coverage of rules is limited, which may not be able to handle all completion tasks.
[0007] Hybrid model-based methods combine multiple completion techniques to improve overall performance. These methods usually combine techniques such as graph embedding, attention mechanism, and logical rules to achieve temporal knowledge graph completion by comprehensively considering graph structure, contextual information, and rule constraints. Specific practices include using graph embedding to capture structural information, combining attention mechanism to handle temporal dynamics, and using logical rules for completion. However, these methods usually require high computing resources, high model complexity, and may face challenges in model interpretability and tuning.
[0008] In early research, most of these methods directly or indirectly integrated timestamps into entities or relations, transforming the four-tuple completion problem into a three-tuple completion problem, which severely limited the expressive power of timestamp information. In addition, existing models fail to fully consider the role of four-tuple neighborhood information in completion, and lack effective disambiguation mechanisms when facing multi-semantic entities and relations, which ultimately leads to poor model completion results. Summary of the invention
[0009] Purpose of the invention: To address some problems existing in traditional methods for completing time-series knowledge graphs: First, existing models usually integrate timestamp information directly or indirectly into entities or relationships, which severely limits the expressive power of timestamp information. Second, the neighborhood information of quadruple is not mined sufficiently. The previous attention mechanism based on the neighborhood of relationships did not independently model the timestamps, but directly embedded the timestamps into the relationship space. Since entities, relationships, and timestamps are in different semantic spaces, the direct embedding method often leads to insufficient information exchange and semantic loss problems. Third, most existing methods lack an effective disambiguation mechanism. When faced with semantically rich entities and relationships, it is often difficult to determine the optimal feature representation suitable for the current quadruple. For example, apples not only represent fruits, but also have the meaning of brands and companies. The disambiguation mechanism is to allow the model to accurately identify the meaning of apples representing companies in (Apple, CEO, Jobs, 1978). The purpose of the present invention is to provide a quadruple modeling method for completing time-series knowledge graphs, which is used to solve these problems existing in current methods for completing time-series knowledge graphs.
[0010] Technical solution: To achieve the above objectives, the present invention proposes a quadruple modeling method for temporal knowledge graph completion.
[0011] This method designs an information exchange module to realize the information exchange between entities, relations and timestamps in different spaces. On this basis, a context disambiguation module and a neighborhood relationship attention module are constructed respectively. The context disambiguation module is used to learn unambiguous feature representations that match the current quadruple in multi-semantic entities or relations; the neighborhood relationship attention module is used to fully mine the neighborhood information of the quadruple, and combine the unambiguous feature representation of the relationship in the context disambiguation module to generate a global feature representation of the relationship that integrates the neighborhood information. Then, multiple information exchange modules are stacked to fully exchange information between quadruple entities, relations and timestamps. Finally, a fourth-order tensor decomposition decoder is introduced to decode the entity, relationship and timestamp information, and output the entity to be completed. Its specific technical solution includes the following steps:
[0012] Step 1: Quadruple feature extraction.
[0013] First, the primary feature representations of entities, relations, and timestamps in their respective spaces are obtained through the Embedding layer. Secondly, an information exchange module is designed to ensure that entities, relations, and timestamps in different spaces can exchange information effectively. Finally, based on the information exchange module, a context disambiguation module and a neighborhood relationship attention module are designed to generate unambiguous feature representations of entities, global feature representations of relations, and enhanced feature representations of timestamps.
[0014] (1) Primary feature extraction: Since the information in the time series knowledge graph is usually presented in text form, in deep learning models, a common processing method is to first map these text information into discrete numerical labels. For example, different entities, relationships, or timestamps are encoded as values such as 1, 2, 3, and 4. Then, these numerical labels are input into the Embedding layer, and the high-dimensional discrete values are converted into low-dimensional, dense vectors through a lookup table to obtain the primary feature representation in their respective spaces;
[0015] (2) Unambiguous feature extraction: An entity usually includes multiple semantics. For example, apple includes multiple meanings such as fruit, brand, and company. Therefore, in the field of knowledge graph completion, semantically rich entities or relationships often introduce ambiguity, which makes it difficult for the model to learn the optimal feature representation. Therefore, we design a contextual disambiguation module to input the primary feature representation of entities, relationships, and timestamps into the contextual disambiguation module to obtain unambiguous entity feature representations, relationship feature representations, and enhanced timestamp feature representations that match the current quadruple;
[0016] (3) Global feature extraction: Since neighborhood information is very useful for inferring the missing parts of temporal facts, and the previous temporal knowledge graph completion model based on tensor decomposition independently models each quadruple, only captures the local dependencies of the relationship and ignores the global nature of the relationship embedding, it is important to use neighborhood information to obtain the global feature representation of the relationship. To this end, we design a neighborhood relationship attention module to learn the neighborhood features of the relationship, and at the same time combine the unambiguous feature representation of the relationship from the context disambiguation module to obtain the global feature representation of the relationship through weighted fusion.
[0017] Step 2: Quadruple feature interaction.
[0018] This process mainly introduces an information exchange module, which iteratively transfers the unambiguous feature representation of entities, the global feature representation of relationships, and the enhanced feature representation of timestamps to a series of information exchange modules to achieve full information exchange between entities, relationships, and timestamps.
[0019] (1) Information fusion: The unambiguous feature representation of the entity, the global feature representation of the relationship, and the enhanced feature representation of the timestamp are further extracted through a 3×3 convolutional layer and the activation function ReLU. Then, a spatial attention mechanism is introduced to explore the importance of each part of the entity, relationship, and timestamp feature space, and the three are integrated into a shared variable.
[0020] (2) Information deconstruction: Similar to the inverse process of information fusion, we also introduce spatial attention to redistribute the information in shared variables back to entities, relations, and timestamps, and introduce residual connections to further supplement the primary features lost in the information extraction process.
[0021] (3) Information exchange: We repeat the process of information integration and information deconstruction many times to conduct full information exchange in the entity, relationship and timestamp space.
[0022] Step 3: Decode to obtain the entity to be completed.
[0023] (1) A missing quadruple is randomly extracted, and the feature representation of entity, relation and timestamp is learned using the above method. Finally, a fourth-order tensor decomposition decoder is used to obtain the completion result of the missing quadruple.
[0024] Beneficial effects: The present invention aims at the problem of completing the temporal knowledge graph, and proposes a quadruple modeling method for completing the temporal knowledge graph. This method independently obtains primary feature representations in the entity, relationship and timestamp semantic spaces, and designs an information exchange module to realize the effective exchange of cross-space information. It solves the problem of limited expression of temporal information and semantic loss caused by directly integrating timestamps into entities or relationships in traditional methods. In addition, in view of the lack of effective disambiguation mechanism and insufficient mining of quadruple neighborhood information in existing methods, the present invention respectively designs a contextual disambiguation module and a neighborhood relationship attention module. In the field of temporal knowledge graphs, it solves the polysemy disambiguation of entities and relationships for the first time, and fully mines the quadruple neighborhood information, thereby improving the completion performance of the temporal knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 Comparison chart between the traditional TKGC method (top) and our proposed TKGC method (bottom).
[0026] Figure 2 This is the framework diagram of our proposed method. It includes three main modules. They are context disambiguation module (CDM), neighborhood relation attention module (NRM) and cross-domain information exchange module (DIX). It is worth noting that the cross-domain information exchange module (DIX) consists of multiple information communication modules (IDM), which can more fully realize cross-space information exchange and ensure the integrity of semantic information.
[0027] Figure 3 The following is the architecture diagram of the contextual disambiguation module. It includes two parts (a) and (b). Part (a) reveals the potential complex semantics of each pair of entities and relations from multiple different aspects. Part (b) not only uses the IDM module to interact between entities and relations to generate entity and relationship embeddings corresponding to the current tuple situation, but also uses the self-attention mechanism to mine the intrinsic correlation between the multi-semantics of entities and relations, and finally generates unambiguous entity and relationship embeddings that match the current quadruple.
[0028] Figure 4 The following is the architecture diagram of the neighborhood relation attention module. It includes three parts: (a), (b) and (c). (a) The IDM module is used to obtain the embedding of relations and relation chains in the current tuple context, (b) the neighborhood embedding of relations is generated based on the multi-head attention mechanism, and (c) the global embedding of relations is obtained by integrating the neighborhood embedding of relations with the unambiguous embedding of relations. DETAILED DESCRIPTION
[0029] The present invention will be further described below in conjunction with the accompanying drawings.
[0030] The present invention is a four-tuple modeling method for time series knowledge graph completion. Figure 1As shown in Figure 2, the TKGC method we designed based on the information exchange module independently models the timestamp, which is very different from the traditional method that integrates the timestamp information into entities or relationships. Figure 3 The contextual disambiguation module and neighborhood relationship attention module in the quadruple are used to solve the problems of ambiguity resolution and quadruple neighborhood information mining. Specifically, we first obtain the primary feature representations of entities, relations and timestamps in their respective semantic spaces, and then obtain the unambiguous feature representations of entities and relations in the current tuple through the contextual disambiguation module. At the same time, we use the attention mechanism through the neighborhood relationship attention module to fully mine the neighborhood information of the quadruple and obtain the global feature representation of the relationship that integrates the neighborhood information. After that, the cross-domain information exchange module is used to realize the full exchange of information between entities, relations and timestamps, and finally the fourth-order tensor decomposition decoder outputs the entities that need to be completed. A quadruple modeling method for temporal knowledge graph completion mainly includes four parts: 1) information exchange module; 2) contextual disambiguation module; 3) neighborhood relationship attention module; 4) fourth-order tensor decomposition decoder. The specific architecture of the model is shown in the attached. Figure 3 , the specific implementation steps are as follows.
[0031] 1. Quadruple feature extraction
[0032] (1) Primary feature extraction
[0033] Assume that the given entity h, relation r and timestamp t represent high-dimensional unique hot index vectors and Then we use formula (1) to learn the feature representation of timestamp t and the rich semantic feature representation of entity h and relation r respectively.
[0034]
[0035] in are the embedding matrices of timestamp, entity h and relation r, respectively. m and n represent the number of semantics that need to be learned for entity and relation. ei and r ej They are the feature representations corresponding to multiple hidden semantics of entity h and relation r respectively.
[0036] (2) Unambiguous semantic feature extraction
[0037] We then input multiple semantic representations of entities and relations into the feature enhancement network defined in the following formula (2) to obtain entity and relationship enhanced feature representations.
[0038]
[0039] Among them, f 1×1Represents a cross-channel fused convolution layer with a convolution kernel of 1×1. Represents a splicing operation, represents the activation function ReLU, BN represents the batch normalization operation, W1, b1 and W2, b2 represent the fully connected layer weight matrix and bias term respectively.
[0040] We then designed an information exchange module consisting of information fusion of formula (3) and information deconstruction of formula (4) to achieve cross-space information exchange of entities, relations and timestamps, and obtain entity feature representations that match the current quadruple. and relational feature representation
[0041]
[0042] Among them, · represents element multiplication, σ represents the activation function Sigmoid, and + represents the addition operation. Finally, in order to capture the intrinsic connection between entity and relation multi-semantics, we define the self-attention mechanism shown in formula (5), and finally obtain the unambiguous entity feature representation and relational feature representation
[0043]
[0044] In formula (5), σ represents the activation function Sigmoid, A h and A r are the attention maps for entities and relations respectively, · represents element-wise multiplication, represents the concatenation operation, BN represents the batch normalization operation, represents the activation function ReLU, φ(·) indicates that the SumPool operation can adaptively fuse multi-feature representations into enhanced entity features and relationship features, where the window size K1 is a hyperparameter.
[0045] For convenience, we simplify formula (3) and formula (4) into formula (6).
[0046]
[0047] (3) Global feature extraction
[0048] Taking the completion of f = (h, r, ?, t) as an example, we will add all the relations r of h i Clustering as main chain C s , r i ∈C s , C s Represented as a high-dimensional one-hot index vector Then we use formula (7) to get its embedded representation.
[0049]
[0050] in For chain C s The embedding matrix, r ie A feature representation representing each relationship in the chain.
[0051] Then, we use the IDM module of formula (6) to embed the h, r, t in the tuple to be completed into h e , r e , t e and h corresponds to the relationship feature representation r in the chain ie Cross-space information exchange is performed, and the process is defined by formula (8).
[0052]
[0053] Afterwards, we mine each relation r through the attention mechanism shown in formula (9) i ∈C s To improve the expressiveness of the model, we further introduce the multi-head attention mechanism shown in formula (10) to explore more complex hidden associations between relations.
[0054]
[0055] in, represents the splicing result of H heads, W o is the linear transformation matrix used to fuse the feature information of multiple heads, LN(·) is the layer normalization operation, and Dropout(·) is the Dropout function. and is the linear transformation matrix, v(·) represents the activation function Gelu, and LN(·) is the layer normalization operation.
[0056] Finally, according to formula (11), we adopt and The weighted sum of is used as the global feature representation of the relationship.
[0057]
[0058] 2. Quadruple feature interaction
[0059] In order to facilitate the information exchange between entities, relations, and timestamps, we propose an information exchange module (IDM) as shown in formula (6). On this basis, we further construct a cross-domain information exchange module (DIX) composed of multiple IDMs. The entity, relation, and timestamp features are iteratively transferred to a series of IDM modules according to formula (12) to learn the entity relation and timestamp A more advanced feature representation
[0060]
[0061] Where N represents the number of IDM modules.
[0062] 3. Decode to obtain the entity to be completed
[0063] High-level feature representation of entities, relations, and timestamps output by the DIX module and We input it into the fourth-order tensor decomposition decoder shown in formula (13) to predict the entity to be completed.
[0064]
[0065] Among them, φ(·) represents the Sumpool operation, and the window size K2 is a hyperparameter. are linear transformation matrices, · represents element multiplication, t e It is the primary feature representation of time.
[0066] We use the inner product operation to measure the similarity of tensors and define the score function as formula (14).
[0067]
[0068] Where ⊙ represents the inner product operation.
[0069] 4. Model Training
[0070] Since we introduce the dataset expansion strategy, we generate (o, r -1 , h, t), so the completion problem of f = (?, r, o, t) can be transformed into f = (o, r -1 ,? ,t) completion problem. Then for the two task types of temporal knowledge graph f = (h, r,?,t) and f = (o,r -1 ,? ,t), we use log-softmax loss to train the proposed method, and in order to avoid the overfitting problem, we introduce N3 regularization and cosine similarity based temporal regularization operations. Therefore, a basic multi-class loss for a four-tuple (h, r, o, t) can be defined as formula (15).
[0071]
[0072] where λ w represents the regularization weight, λ t represents the coefficient of temporal regularization.
Claims
1. A quadruple modeling method for temporal knowledge graph completion, the main features of which include the following steps: (1) Quadruple feature extraction: First, the primary feature representations of entities, relations, and timestamps in their respective spaces are obtained through the Embedding layer; Secondly, an information exchange module is designed to ensure that entities, relations and timestamps in different spaces can exchange information effectively. Finally, a context disambiguation module and a neighborhood relation attention module are designed based on the information exchange module to generate unambiguous feature representations of entities, global feature representations of relations and enhanced feature representations of timestamps. (2) Quadruple feature interaction: This process mainly introduces the information exchange module in step (1), iteratively transfers the unambiguous feature representation of entities, the global feature representation of relations, and the enhanced feature representation of timestamps to a series of information exchange modules, thus achieving sufficient information exchange between entities, relations, and timestamps. (3) Decoding to obtain the entity to be completed: randomly extract a missing quadruple, use step (1) to obtain the unambiguous feature representation of the entity, the global feature representation of the relationship, and the enhanced feature representation of the timestamp, and use step (2) to achieve sufficient information exchange between them. Finally, use the fourth-order tensor decomposition decoder to obtain the completion result of the missing quadruple.
2. According to claim 1, a quadruple modeling method for temporal knowledge graph completion is characterized in that: Step (1) is four-tuple feature extraction, and its implementation method includes: (1-1) Use the Embedding layer to embed the entities, relations, and timestamps of the quadruple to obtain the primary feature representation in their respective semantic spaces; (1-2) Inputting the primary feature representations of entities, relations and timestamps into the context disambiguation module to obtain unambiguous entity feature representations, relationship feature representations and enhanced timestamp feature representations that match the current quadruple; (1-3) The primary feature representations of entities, relations and timestamps in (1-1) are simultaneously input into the neighborhood relation attention module, the neighborhood information is integrated into the relation, and the neighborhood feature representation of the relation is obtained; (1-4) The neighborhood feature representation of the relationship in (1-3) is combined with the unambiguous feature representation of the relationship in (1-2) to obtain a global feature representation of the relationship.
3. According to claim 1, a quadruple modeling method for temporal knowledge graph completion is characterized in that: Step (2) is the interaction of four-tuple features, and its implementation method includes: (2-1) The unambiguous feature representation of the entity, the global feature representation of the relationship, and the enhanced feature representation of the timestamp are further extracted through a 3×3 convolutional layer and an activation function ReLU. Then, a spatial attention mechanism is introduced to mine the importance of each part of the entity, relationship, and timestamp feature space, and the three are integrated into a shared variable. (2-2) Similar to the inverse process of (2-1), spatial attention is introduced to redistribute the information in the shared variables back to entities, relations and timestamps, and residual connections are introduced to further supplement the primary features lost in the information extraction process; (2-3) Repeat the processes of (2-1) and (2-2) to exchange information in the space of entities, relations and timestamps.
4. According to claim 1, a quadruple modeling method for temporal knowledge graph completion is characterized in that: Step (3) is decoding to obtain the entity to be completed, and its implementation method includes: (3-1) For each missing quadruple, use the above method to obtain the feature representation corresponding to each part; (3-2) Use the fourth-order tensor decomposition decoder to output the missing quadruple completion result and use the cross entropy loss function for training; (3-3) After training, the optimal model is obtained and used to predict the missing entities of the quadruple.