Time sequence knowledge graph reasoning method fusing mixed expert and cross-branch contrast learning

Through the dual-branch timing modeling architecture combined with RGCN and RGT, the problem of insufficient long-term dependence fusion and graph structure analysis in the timing knowledge graph is solved, and efficient modeling and prediction of complex timing systems is achieved.

CN120449999APending Publication Date: 2025-08-08SHANDONG UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510615168.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

The existing time-series knowledge graph inference methods have significant limitations in dealing with long-term dependencies among entities, making it difficult to achieve adaptive fusion of long-term and short-term time dependencies, and the deep analysis ability of graph structures is insufficient, so it is impossible to effectively capture the dynamic changes of complex timing systems.

Method used

Using a dual-branch timing modeling architecture, combining relational graph convolutional network (RGCN) and relation-aware Transformer (RGT), we capture short-term dynamics and long-term trends through a dynamic hybrid expert system and a cross-branch comparison learning module to achieve explicit decoupling and adaptive fusion of graph topological features and time dependencies.

Benefits of technology

It significantly improves the accuracy and robustness of timing modeling, can capture mutation events and periodic changes more accurately, and enhances the modeling ability of complex timing models. It is especially suitable for event warning in the fields of operation and maintenance monitoring, financial risk control and supply chain management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120449999A_ABST
    Figure CN120449999A_ABST
Patent Text Reader

Abstract

The invention relates to a time sequence knowledge graph reasoning method fusing mixed expert and cross-branch contrast learning. The method comprises the following steps: inputting a historical time sequence knowledge graph into a trained time sequence knowledge graph reasoning model for time sequence knowledge graph reasoning; wherein the time sequence mapping knowledge domain inference model comprises a double-branch time sequence modeling architecture, a dynamic hybrid expert system, a cross-branch contrast learning module and a decoding scoring module; respectively capturing dynamic change in a short period and a long-term evolution rule of an entity in the whole time span through a double-branch time sequence modeling architecture; structural features are extracted through a dynamic hybrid expert system, and cross-timestamp relation dependency is mined; mutual information between local and global time sequence views is maximized through a cross-branch contrast learning module, and fusion and learning of different levels of time sequence features are promoted; and the decoding scoring module is used for time sequence knowledge graph reasoning. According to the method, the modeling precision of the sudden change event and the periodic change is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of artificial intelligence and knowledge graph technology, and specifically relates to a temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning, which is used to solve problems such as insufficient modeling of long-term dependency relationships in temporal knowledge graphs and insufficient long-term and short-term information mining. Background Art

[0002] In early research, scholars attempted to migrate static knowledge graph completion (KGC) models to temporal knowledge graph completion (TKGC) tasks, primarily by introducing time constraints or temporal embeddings. However, these methods can only capture relatively superficial temporal information, and their generalization capabilities are limited by their inability to effectively generalize to "invisible" timestamps outside the dataset. Although graph neural networks excel in capturing the complex semantics of entities and relationships, existing KGC models based on graph neural networks are primarily designed for static environments, and their convolutional operations generally ignore temporal information, resulting in poor performance in TKGC tasks. To improve the performance of TKGC models, it is necessary to further combine the temporal dimension with graph structure modeling to capture the evolution of dynamic relationships.

[0003] Recent research on temporal knowledge graph completion has not fully explored historical sequences. The RE-GCN method learns entity representations that contain evolutionary laws by modeling recent temporal subgraph sequences. EvoKG proposes a recurrent event modeling framework that aims to capture the local structure and temporal dynamics of temporal knowledge graphs. It should be pointed out that due to the inherent gradient vanishing and explosion problems and computational complexity limitations of recurrent neural networks, these methods find it difficult to effectively utilize long-range historical facts. Although HGLS attempts to model temporal dependencies by constructing a dual architecture at the subgraph level and the global graph level, and LogCL uses an entity-aware attention mechanism to integrate recent and global historical facts, existing methods still find it difficult to effectively capture long-range temporal dependencies.

[0004] Existing temporal knowledge graph reasoning methods have the following defects: Current time series modeling methods have significant limitations when dealing with long-term dependencies between entities. While most models employ recursive sequence architectures to capture temporal dynamics, this implicit history encoding mechanism can lead to the decay of critical long-term information. Existing methods struggle to effectively model causal relationships spanning two decades, especially when the time span between entities is large. This information decay is particularly pronounced.

[0005] Existing methods fail to adaptively integrate long-term and short-term temporal dependencies. The importance of these two types of temporal features varies across scenarios: some entity relationships are highly sensitive to long-term trends spanning several years (e.g., geopolitical evolution), while others are primarily driven by recent interactions (e.g., short-term market fluctuations). Current models lack a mechanism to dynamically adjust the weights of these two types, making it difficult to accurately capture the evolution of relationships across different spatial and temporal scales.

[0006] Existing technologies lack the ability to deeply analyze instantaneous graph structures. The topological features embedded in each time slice carry crucial dynamic information, but traditional methods often simplify this information into a static adjacency matrix. This representation ignores the complex nature of graph structure evolution over time. Especially when dealing with high-order relational networks, it struggles to capture the underlying patterns of nonlinear interactions between nodes and the evolution of dynamic communities. This multi-dimensional representational deficiency significantly limits the model's ability to interpret and predict complex temporal systems.

[0007] Current temporal knowledge graph (TKG) reasoning technology faces three core challenges: temporal modeling is limited to local windows or global statistical features, failing to balance short-term dynamic responses with long-term evolutionary trends; the implicit coupling between graph structural features and cross-timestamp relational dependencies has not been effectively decoupled; and multimodal information fusion relies on a shallow feature splicing strategy and lacks a hierarchical semantic alignment mechanism. To address this, this study proposes a temporal knowledge graph reasoning method (DualBranch-TKG) that integrates hybrid experts with cross-branch comparative learning. This method overcomes these bottlenecks through three innovations: first, it constructs a dual-granularity temporal modeling architecture, employing local branches to capture the fine-grained dynamics of high-frequency interactions while simultaneously modeling low-frequency but profound long-term evolutionary patterns through a global branch; second, it designs a hybrid expert-driven structure-relation dual-channel encoder to explicitly decouple and adaptively fuse graph topological features and temporal dependencies; and finally, it introduces a temporal-aware cross-branch comparative learning method that significantly improves the model's reasoning robustness in noisy data and sparse scenarios through a dual-path representation mutual regularization mechanism. This architecture systematically addresses the limitations of traditional methods in timing coverage, feature decoupling, and modal interaction through multi-dimensional collaborative optimization. Summary of the Invention

[0008] In response to the shortcomings of the existing technology, the present invention provides a temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning; This paper uses dual-branch time series modeling to collaboratively capture short-term dynamic evolution and long-term trend laws, combines the complementary advantages of the relational graph convolutional network (RGCN) and the relation-aware Graph Transformer (RGT), and introduces a cross-view comparative learning module to significantly improve the accuracy and robustness of time series reasoning.

[0009] Explanation of terms: 1. Temporal Knowledge Graph: Assume E and R Represents a set of entities and relationships, a quad Indicates time t When the subject entity and object entities The relationship between In time t All the four-tuples that appear constitute a knowledge graph Temporal Knowledge Graph (TKG) is defined as a knowledge graph sequence, where different timestamps, i.e. In this invention, the local historical sampling sequence of TKG is defined as }, the global history sampling sequence of TKG is defined as .generally, N Compare n Much bigger, K is a uniformly sampled parameter.

[0010] 2. Temporal Knowledge Graph Reasoning: In this paper, TKG reasoning refers to entity prediction. The entity prediction task aims to predict the given knowledge graph sequence Missing object entity or The missing subject entity.

[0011] 3. RGCN: Relational graph convolutional network (abbreviated as RGCN).

[0012] 4. RGT: Relation-aware Graph Transformer (abbreviated as RGT).

[0013] The technical invention adopted in the present invention is: A temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning, including: Input the historical temporal knowledge graph into the trained temporal knowledge graph reasoning model to perform temporal knowledge graph reasoning; Among them, the temporal knowledge graph reasoning model includes a dual-branch temporal modeling architecture, a dynamic hybrid expert system, a cross-branch comparative learning module, and a decoding and scoring module; A dual-branch temporal modeling architecture is used to capture short-term dynamic changes and the long-term evolution of entities over the entire time span; a dynamic hybrid expert system is used to extract structural features and mine relational dependencies across timestamps; a cross-branch comparative learning module is used to maximize the mutual information between local and global temporal views, promoting the fusion and learning of temporal features at different levels; and a decoding scoring module is used for temporal knowledge graph reasoning.

[0014] Preferably, according to the present invention, the dual-branch timing modeling architecture includes a local branch and a global branch; The local branch uses a sliding window mechanism to extract recent historical subgraphs; The global branch focuses on the evolution pattern of entities over a long time span by uniformly sampling the entire time series from the initial moment to the current moment.

[0015] According to the preferred embodiment of the present invention, the global branch samples key time points from the entire time axis; the local branch randomly samples and uses a random function to perform random sampling on the temporal knowledge graph. Perform random sampling, and the global sequence after sampling is }, the length is the local branch parameter k; Both local branches and global branches are based on temporal knowledge graphs is the input; Both local and global branches use dynamic hybrid expert systems to aggregate entities and relationships in the knowledge graph at each moment, and then 、 Integrate historical hidden states; Finally, the local branch outputs the hidden state of the entity at time t+1, which is the entity embedding and the relation hidden state, i.e. relation embedding ; The global branch outputs the hidden state of the entity at time t+1, which is the entity embedding and the relation hidden state, i.e. relation embedding ; are the local and global query embeddings of the target entity o at time t+1.

[0016] More preferably, the local branch adopts a sliding window mechanism to extract recent historical subgraphs and capture short-term dynamic patterns; including: In local branches, short-term dynamic patterns are captured by modeling semantic dependencies between concurrent facts; consider capturing semantic dependencies between concurrent facts to obtain each knowledge graph Each node Embedding; specifically, the time series knowledge graph is divided into multiple local time windows according to the time window parameter m, each timestamp has a corresponding local historical sampling sequence of local sampling, the local historical sampling sequence is ordered according to time, and the knowledge graph at each moment is modeled and embedded by a dynamic hybrid expert system. Each subgraph The nodes are modeled to get the embedding vector ;in, ; Use gated recurrent unit GRU according to the knowledge graph The latest timestamp of each entity s and relation r is encoded, and the entities and relations are divided into two GRU modules: and , and Each has independent parameters and learns the dynamic evolution characteristics of entities and relations respectively; The temporal evolution of each entity s is Modeling; given entity s at timestamp t, the embedding vector is , and the hidden state at timestamp t , the update process is: in, As the hidden state of the local branch at time stamp t+1, It is a GRU module dedicated to entity representation learning; By considering the entity hidden state representation at time stamp t To further obtain the short-term and long-term information of the relationship r connecting the entity pairs in the knowledge graph: in, is the hidden state of relation r at timestamp t, It is a GRU module dedicated to relational representation learning, used to update ; yes Updated relation representation, including historical timing information; Indicates the timestamp t Connect to a specific relationship r All entities, pass and Perform mean pooling operation to obtain the feature representation of the relationship r at timestamp t.

[0017] Further preferably, the global branch focuses on the evolution pattern of the entity over a long time span by uniformly sampling the entire time series from the initial moment to the current moment; including: The temporal evolution of each entity s is Modeling; given entity s at timestamp t, the embedding vector is , and the hidden state at timestamp t , the update process is: in, As the hidden state of the local branch at time stamp t+1, It is a GRU module dedicated to entity representation learning; By considering the entity hidden state representation at time stamp t To further obtain the short-term and long-term information of the relationship r connecting the entity pairs in the knowledge graph: in, is the hidden state of relation r at timestamp t, It is a GRU module dedicated to relational representation learning, used to update ; yes Updated relation representation, including historical timing information; Indicates the timestamp t Connect to a specific relationship r All entities, pass and Perform mean pooling operation to obtain the feature representation of the relationship r at timestamp t.

[0018] Preferably, according to the present invention, the dynamic hybrid expert system adopts a bottom-up hierarchical architecture, including an input layer, a first fully connected layer, a dual expert module, a dynamic gating network, a second fully connected layer and an entity embedding output layer, and the dual expert module includes RGCN and RGT; the temporal knowledge graph data is first feature extracted through the first fully connected layer, and then diverted to RGCN and RGT for parallel processing; RGCN uses a graph propagation mechanism to capture dependencies in complex network structures; RGT identifies and evaluates relationships and their importance within a specific time point; the processed features are fused through a dynamic gating network, and the dynamic gating network dynamically adjusts the weights of the dual expert module output according to the data characteristics, and finally generates entity embedding after the second fully connected layer.

[0019] According to the present invention, preferably, both the local branch and the global branch include a dynamic hybrid expert system; Knowledge graph at a given time t , where the occurrence of a fact indicates that an entity has significant semantic relevance with its neighboring entities; RGCN is used to model the semantic dependency between neighboring entities and generate node embeddings; the forward propagation formula of RGCN is defined as: Where n is the total number of layers in RGCN, Represents the knowledge graph at time t Zhongyuan Entity The neighbor set of and are trainable parameters, which are used for the trainable parameters of aggregation structure and self-loop features respectively; is the relation embedding of the lth layer, express The number of neighbors, Represents the LeakyReLU activation function; For the target entity In the hidden state of layer l, For the target entity In the hidden state of layer l; by stacking multiple layers of RGCN, capturing the timestamp 𝑡 Multi-hop semantic associations between entities and output entity embedding , l Indicates the number of layers; After stacking n layers of RGCN, the final node embedding Output as an expert ; RGT aggregates the structural information of entities in the snapshot sequence through the self-attention mechanism; for the source entity and the target entity , whose hidden state is initialized to the initial embedding, and its hidden state is updated through the message passing framework; the entity is updated through the following steps: The source entity The hidden state of and side relations Splicing to generate query vector ; Computing Attention: Building the Bond Matrix Sum Matrix ,in Is the current source entity Query message The number of sets; for each message, use as the query, the query matrix is , by stacking the source entities All edge relationships The collection is used as the input of multi-head attention; Entity in RGT l Hidden state of the layer The definition is as follows: Among them, n is the total number of layers of RGT, MHA represents the multi-head attention mechanism, LN is layer normalization, and FFN is the feedforward neural network; After stacking n layers of RGT, the final node embedding Output as an expert .

[0020] According to a preferred embodiment of the present invention, in the dynamic hybrid expert system, the adaptive fusion of RGCN and RGT outputs is achieved through a dynamic routing mechanism. The specific implementation process is as follows: (1) Routing probability calculation: set up is the intermediate hidden state of expert e, , n is the number of layers of RGCN and RGT respectively, given the expert output and , routing probability Calculated as follows: in, is the cosine similarity function, including, for With RGCN expert output The matching degree, for Output with RGT Expert Matching degree, routing probability The calculation of is based on the similarity of the output state to the expert output; (2) Dynamic fusion output: According to the routing probability The calculation formula is used to calculate the activation probability of RGCN and RGT respectively. , ,The final output is obtained by weighted fusion of expert outputs: in, Right now is the final output of the dynamic hybrid expert system, , , and are the outputs of RGCN and RGT respectively.

[0021] According to the preferred embodiment of the present invention, in the cross-branch contrastive learning module, the entity embedding and relationship embedding generated by the local branch are spliced into As an anchor point, the entity embedding and relation embedding generated by the local branch are concatenated into is considered as an enhanced encoding process; at the same time t, the local and global representations of the same query at timestamp t are used as positive pairs, i.e. , the local and global representations of different queries serve as negative pairs, i.e. ,in, Represents The concatenated entity embedding and relation embedding vectors generated by the non-corresponding global branch; the supervised contrast loss at timestamp t The calculation of is as follows: in, and Represents the mini-batch and timestamp as the query set respectively t The number of queries at , τ is the temperature parameter, express and Dot product similarity in feature space, express and all candidate global representations Dot product similarity in feature space.

[0022] According to a preferred embodiment of the present invention, in the decoding scoring module, the entity prediction task is regarded as a multi-class classification task, and ConvTransE is used to perform entity prediction at timestamp t+1; the entity prediction score of ConvTransE is as follows: in, is the Sigmod activation function, For time t+1 The query embedding of the target entity o, and Source entities s and relationships r In time t+1 It includes dynamic representation of global and local information, It is a self-tuning parameter that is automatically adjusted through the MRR reward mechanism. When the validation set MRR increases, the λ value of the local branch is increased. When the validation set MRR decreases, the λ value of the local branch is reduced to balance the contribution of global and local information. The learning objective of entity prediction uses the following loss function to promote the learning of relation embeddings: in, Is the timestamp t+1 A collection of facts; Combined entity prediction loss function and the supervised contrast loss at timestamp t , the total loss function of the temporal knowledge graph reasoning model is: in, and are two learnable dynamic parameters used to coordinate the weights of the two types of losses.

[0023] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the steps of the temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning.

[0024] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning.

[0025] The beneficial effects of the present invention are: 1. Improving time series modeling capabilities: This invention constructs a multi-scale time series representation system through a dual-branch architecture to enhance time series modeling capabilities. The local branch uses a sliding window mechanism to extract recent dynamic subgraph sequences and capture high-frequency interaction patterns between entities. The global branch generates time series snapshots covering the entire time span through uniform time interval sampling to model the gradual evolution of entity states. The dual-path features are fused through a dynamic weight allocation mechanism, enabling the model to collaboratively analyze short-term fluctuations and long-term trends. Experiments show that this design significantly improves the modeling accuracy of sudden events and periodic changes (MRR increased by 3.3% on the ICEWS14 dataset), effectively making up for the inadequate capture of complex time series patterns by traditional single-view models.

[0026] 2. Enhanced Feature Collaborative Modeling: To address the heterogeneity of structural features and relational dependencies, this paper designs a dynamic hybrid expert system mechanism to achieve specialized modeling and dynamic fusion. The RGCN expert uses relational graph convolution operations to perform relationship-specific information propagation within entity neighborhoods, enhancing local topological structure modeling. The RGT expert uses a multi-head self-attention mechanism to identify and evaluate relationships and their importance within specific time points, making it particularly suitable for handling complex fine-grained interactions and decoupling heterogeneous relationships. The dual expert system implements dynamic parameter allocation through a gating network (e.g., a learnable weight matrix), enabling the model to automatically adjust the contribution weights of the RGCN and RGT experts based on input features. Experimental results demonstrate that this design enhances the model's ability to parse heterogeneous relationships in complex relationship prediction tasks (improving the Hits@1 metric by 1.2% on the ICEWS05-15 dataset).

[0027] 3. Optimizing information fusion mechanism: This paper proposes a cross-view contrastive learning framework to achieve deep feature fusion through a triple mechanism: first, a shared nonlinear projection layer (such as a multi-layer perceptron) is used to align the representation space of the fine-grained dynamic features of the local branch with the macro-evolutionary features of the global branch, eliminating the cross-branch semantic gap; second, based on the noise contrastive estimation (NCE) loss function, the mutual information of cross-branch features is maximized to strengthen the correlation between local dynamic patterns and global evolutionary laws; finally, through an adaptive redundant filtering mechanism, the attention weights generated by gradient backpropagation are used to dynamically generate binary masks to block cross-branch redundant information and retain differentiated semantic features (such as the correlation pattern between local fluctuations of emergencies and long-term trends).

[0028] 4. Broad Applicability: Targeting typical tail entity prediction tasks (h, r, ?, t) in time-series knowledge graphs, this invention innovatively integrates dynamic spatiotemporal modeling with graph comparative learning mechanisms. This approach effectively handles complex scenarios where entity relationships in knowledge graphs evolve over time, effectively addressing the limitations of traditional methods in modeling time-series information. In key areas such as operations monitoring, financial risk control, and supply chain management, this invention constructs a multidimensional event prediction model by extracting and modeling spatiotemporal features from time-series knowledge graphs. This model accurately captures underlying patterns in events, enabling early warning of complex events such as system failures, market fluctuations, and credit risks, providing predictive support for decision-making. At the natural language understanding level, this invention uses semantic parsing technology to map user queries into the semantic space of the knowledge graph and integrates it with an intent recognition engine to achieve multi-granular semantic representation. Furthermore, this invention deeply integrates the knowledge graph completion process and utilizes a dynamic relational reasoning mechanism to generate structured answers, significantly improving the semantic understanding and cross-time-series knowledge association capabilities of question-answering systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1Schematic diagram of the structure of the temporal knowledge graph reasoning model of the present invention; Figure 2 Schematic diagram of the structure of the hybrid expert feature fusion system of the present invention; Figure 3 The present invention is for the local branch sliding window parameter m Analysis charts of the evaluation index model in MRR, Hits@1, Hits@3 and Hits@10; Figure 4 The present invention is for global branch parameters k Analysis chart of the evaluation indicator model in MRR, Hits@1, Hits@3 and Hits@10. DETAILED DESCRIPTION

[0030] The present invention will be further defined below with reference to the accompanying drawings and embodiments, but is not limited thereto.

[0031] Example 1 A temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning, including: Input the historical temporal knowledge graph into the trained temporal knowledge graph reasoning model to perform temporal knowledge graph reasoning; Among them, Figure 1 As shown in the figure, the temporal knowledge graph reasoning model includes a dual-branch temporal modeling architecture, a dynamic hybrid expert system, a cross-branch comparative learning module, and a decoding and scoring module; A dual-branch temporal modeling architecture is used to capture short-term dynamic changes and the long-term evolution of entities over the entire time span; a dynamic hybrid expert system is used to extract structural features and mine relational dependencies across timestamps; a cross-branch comparative learning module is used to maximize the mutual information between local and global temporal views, promoting the fusion and learning of temporal features at different levels; and a decoding scoring module is used for temporal knowledge graph reasoning.

[0032] Example 2 The difference between the temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning described in Example 1 is that: The dual-branch timing modeling architecture includes local branches and global branches; The local branch uses a sliding window mechanism to focus on extracting recent historical subgraphs. This approach can keenly capture short-term dynamic patterns and rapidly changing trends, providing the model with immediate, up-to-date information input. This approach is particularly suitable for applications that require a quick response to short-term fluctuations, such as predicting possible risk events in the short term.

[0033] Global branching: Complementing local branching, global branching focuses on the evolution of entities over long time spans by uniformly sampling the entire time series from the initial moment to the current moment. This allows the model to identify long-term trends and development patterns spanning months or even years, thus supporting the understanding of deep temporal dependencies.

[0034] To model the long-term evolution of relationships, the global branch samples key time points from the entire timeline (rather than a local window); the local branch randomly samples and uses a random function to perform random sampling on the temporal knowledge graph. Perform random sampling, and the global sequence after sampling is }, with a length equal to the local branch parameter k.

[0035] Both local branches and global branches are based on temporal knowledge graphs is the input; Both local and global branches use dynamic hybrid expert systems to aggregate entities and relationships in the knowledge graph at each moment, and then 、 Integrate historical hidden states; Finally, the local branch outputs the hidden state of the entity at time t+1, which is the entity embedding and the relation hidden state, i.e. relation embedding ; The global branch outputs the hidden state of the entity at time t+1, which is the entity embedding and the relation hidden state, i.e. relation embedding ; are the local and global query embeddings of the target entity o at time t+1.

[0036] The local branch uses a sliding window mechanism to extract recent historical subgraphs and capture short-term dynamic patterns; this includes: In the local branch, short-term dynamic patterns are captured by modeling the semantic dependencies between concurrent facts (i.e., events that occur at the same time or are closely related); recent facts often show strong semantic associations between entities and adjacent entities. Therefore, this paper first considers capturing the semantic dependencies between concurrent facts to obtain each knowledge graph. Each node Specifically, the time series knowledge graph is divided into multiple local time windows according to the time window parameter m. Each timestamp has a corresponding local historical sampling sequence of local sampling. For example, the local historical sampling sequence of local sampling at time t is The local historical sampling sequence is ordered by time, and the knowledge graph at each moment is modeled and embedded in the dynamic hybrid expert system. The nodes are modeled to get the embedding vector ;in, In order to capture the evolution information of entities and relationships, the present invention uses the gated recurrent unit GRU (GRU) according to the knowledge graph The latest timestamp of each entity s and relation r is encoded, and the entities and relations are divided into two GRU modules: and , and Each has independent parameters and learns the dynamic evolution characteristics of entities and relations respectively;

[0037] The temporal evolution of each entity s is Modeling; given entity s at timestamp t, the embedding vector is , and the hidden state at timestamp t , the update process is: in, As the hidden state of the local branch at time stamp t+1, It is a GRU module dedicated to entity representation learning; Similar to entity representation learning, we can consider the entity hidden state representation at time stamp t To further obtain the short-term and long-term information of the relationship r connecting the entity pairs in the knowledge graph: in, is the hidden state of relation r at timestamp t, It is a GRU module dedicated to relational representation learning, used to update ; yes Updated relation representation, including historical timing information; Indicates the timestamp t Connect to a specific relationship r All entities, pass and Perform mean pooling operation to obtain the feature representation of the relationship r at timestamp t.

[0038] The global branch focuses on the evolution pattern of entities over a long time span by uniformly sampling the entire time series from the initial moment to the current moment; it includes: The temporal evolution of each entity s is Modeling; given entity s at timestamp t, the embedding vector is , and the hidden state at timestamp t , the update process is: in, As the hidden state of the local branch at time stamp t+1, It is a GRU module dedicated to entity representation learning; Similar to entity representation learning, we can consider the entity hidden state representation at time stamp t To further obtain the short-term and long-term information of the relationship r connecting the entity pairs in the knowledge graph: in, is the hidden state of relation r at timestamp t, It is a GRU module dedicated to relational representation learning, used to update ; yes Updated relation representation, including historical timing information; Indicates the timestamp t Connect to a specific relationship r All entities, pass and Perform mean pooling operation to obtain the feature representation of the relationship r at timestamp t.

[0039] To more effectively extract structural features and mine cross-timestamp dependency relationships, the dynamic Mixture of Experts (MoE) system includes RGCN and RGT. RGCN leverages graph propagation to capture dependencies within complex network structures, providing powerful foundational modeling capabilities. RGT, on the other hand, excels at identifying and evaluating relationships and their importance within specific time points, making it particularly well-suited for handling complex, fine-grained interactions and decoupling heterogeneous relationships. The combination of these two approaches helps achieve the complementary integration of deep-level features, providing richer and more accurate representations for temporal knowledge graph reasoning.

[0040] like Figure 2 As shown, the dynamic hybrid expert system adopts a bottom-up layered architecture, including an input layer, a first fully connected layer, a dual-expert module, a dynamic gating network, a second fully connected layer, and an entity embedding output layer. The dual-expert module includes RGCN and RGT. The temporal knowledge graph data first undergoes feature extraction through the first fully connected layer and is then shunted to RGCN and RGT for parallel processing. RGCN utilizes a graph propagation mechanism to capture dependencies in complex network structures. RGT identifies and evaluates relationships and their importance within specific time points. The processed features are fused through a dynamic gating network, which dynamically adjusts the weights of the dual-expert module outputs based on data characteristics, ultimately generating entity embeddings after passing through the second fully connected layer. Through modular design and an adaptive gating mechanism, this module achieves efficient processing of joint temporal relationship modeling and multi-model collaboration.

[0041] In addition, to further enhance the robustness and accuracy of time series representation, this method also introduces a cross-branch contrastive learning module. By maximizing the mutual information between local and global time series views, the cross-branch contrastive learning module effectively promotes the fusion and learning of time series features at different levels, thereby enhancing the model's sensitivity to subtle changes. Doing so not only improves the model's sensitivity to subtle changes in time series, but also enhances its stability in the face of data noise and incomplete information, making the final representation of time series knowledge more comprehensive, accurate, and reliable. This approach provides strong support for handling highly dynamic and complex time dependencies, especially in areas that require in-depth understanding and prediction of complex system behavior.

[0042] The dual-branch temporal modeling architecture aims to encode entity and relation embeddings in the constructed unified graph and output two sets of representations from local and global perspectives. Because the local branch and the global branch each focus on the semantic dependencies between entities and temporal dependencies at different time scales, different learning strategies are designed for these two branches to fully exploit their respective characteristics.

[0043] Both local and global branches include dynamic hybrid expert systems; Knowledge graph at a given time t , where the occurrence of a fact indicates that an entity has significant semantic relevance with its neighboring entities; RGCN is used to model the semantic dependency between neighboring entities and generate node embeddings; the forward propagation formula of RGCN is defined as: Where n is the total number of layers in RGCN, Represents the knowledge graph at time t Zhongyuan Entity The neighbor set of and are trainable parameters, which are used for the trainable parameters of aggregation structure and self-loop features respectively; is the relation embedding of the lth layer, express The number of neighbors, Represents the LeakyReLU activation function; For the target entity In the hidden state (node embedding) at layer l, For the target entity (Right now The hidden state of the adjacent nodes) in the lth layer; by stacking multiple layers of RGCN, capturing the timestamp 𝑡 Multi-hop semantic associations between entities and output entity embedding ,l Indicates the number of layers; After stacking n layers of RGCN, the final node embedding Output as an expert ; RGT (Relation-aware Transformer) aggregates the structural information of entities in the snapshot sequence through the self-attention mechanism; for the source entity and the target entity , whose hidden state is initialized to the initial embedding, and its hidden state is updated through the message passing framework; the entity is updated through the following steps: The source entity The hidden state of and side relations Splicing to generate query vector ; Computing Attention: Building the Bond Matrix Sum Matrix ,in Is the current source entity Query message The number of sets; for each message, use as the query, the query matrix is , by stacking the source entities All edge relationships The collection is used as the input of multi-head attention; Entity in RGT l Hidden state of the layer The definition is as follows: Where n is the total number of layers in RGT, MHA stands for multi-head attention mechanism, LN stands for layer normalization, and FFN stands for feed-forward neural network. After stacking n layers of RGT, the final node embedding Output as an expert .

[0044] This paper proposes a gated network architecture based on trainable units that adaptively fuses the outputs of multiple expert modules through a probability-based dynamic routing mechanism. In a dynamic hybrid expert system, the dynamic routing mechanism enables adaptive fusion of the RGCN and RGT outputs, thereby more comprehensively capturing the nonlinear correlation between input and output. The specific implementation process is as follows:

[0045] (1) Routing probability calculation: (RGCN Expert): A module based on the Relational Graph Convolutional Network (RGCN), which is good at capturing local topological structure features. The output is recorded as , represents the hidden state of the i-th layer, where .

[0046] (RGT Expert): A module based on the Relational Graph Transformer, which is good at modeling global spatiotemporal dependencies. The output is recorded as , represents the hidden state of the i-th layer, where .

[0047] set up is the intermediate hidden state of expert e, , n is the number of layers of RGCN and RGT respectively, given the expert output and , routing probability Calculated as follows: in, is the cosine similarity function, including, for Output with RGCN experts The matching degree, for Output with RGT Expert Matching degree, routing probability The calculation of is based on the similarity of the output state to the expert output; (2) Dynamic fusion output: According to the routing probability The calculation formula is used to calculate the activation probability of RGCN and RGT respectively. , ,The final output is obtained by weighted fusion of expert outputs: in, Right now is the final output of the dynamic hybrid expert system, , , and These are the outputs of RGCN and RGT, respectively. This mechanism balances local structural features with global relationship patterns through dynamic weight allocation, improving the model’s robustness to time series data.

[0048] To enhance the robustness of the local and global encoders and filter out noise interference, this paper proposes a local-global query comparison module. This module maximizes the mutual information between local and global temporal views through contrastive learning, ensuring that the local and global representations of the same query are highly aligned in the semantic space, while the representations of different queries are effectively separated.

[0049] In the cross-branch contrastive learning module, the entity embedding and relation embedding generated by the local branch are concatenated into As an anchor point, the entity embedding and relation embedding generated by the local branch are concatenated into is considered as an enhanced encoding process; at the same time t, the local and global representations of the same query at timestamp t are used as positive pairs, i.e. , the local and global representations of different queries serve as negative pairs, i.e. ,in, Represents The concatenated entity embedding and relation embedding vectors generated by the non-corresponding global branch; the supervised contrast loss at timestamp t The calculation of is as follows: in, and Represents the mini-batch and timestamp as the query set respectively t The number of queries at (including positive and negative pairs), τ is the temperature parameter, express and Dot product similarity in feature space, express and all candidate global representations Dot product similarity in feature space.

[0050] In the decoding and scoring module, we treat the entity prediction task as a multi-class classification task and use ConvTransE as the scoring function. ConvTransE has shown excellent performance in temporal knowledge graph (TKG) reasoning tasks. In this work, we use ConvTransE to perform entity prediction at timestamp t+1; the entity prediction scores of ConvTransE are as follows:

[0051] in, is the Sigmod activation function, For time t+1 The query embedding of the target entity o, and They are the source entities respectively s and the relationships r at time t+1 include dynamic representations of global and local information, is a self-regulating parameter, which is automatically adjusted through the reward mechanism of the MRR (Mean Reciprocal Rank) metric. When the MRR of the validation set increases, the λ value of the local branch is increased; when the MRR of the validation set decreases, the λ value of the local branch is decreased to balance the contributions of global and local information; The learning objective of entity prediction uses the following loss function to promote the learning of relationship embeddings: where is the time stamp t+1 of the set of facts; Combined with the entity prediction loss function and the supervised contrastive loss at time stamp t The total loss function of the temporal knowledge graph reasoning model is: where and are two learnable dynamic parameters used to coordinate the weights of the two types of losses.

[0052] The present invention proposes a temporal knowledge graph reasoning method that combines a mixture of experts and cross-branch contrastive learning, aiming to predict future missing entities by locally and globally dual-branch modeling of historical information. The specific process is as follows:

[0053] First, initial embedding representations are generated for all entities and relationships, and then each time step is iteratively processed starting from the initial time (until the termination time T). For the current time t, the starting point t1 of the local time window is defined as t - m (m is the preset window size), and each valid historical snapshot within the time window [t - m, t] is processed in a loop (t1 needs to satisfy 0 < t1 < t). The local knowledge graph structure information is aggregated through formulas (4)-(11), and the local evolution law is learned based on formulas (1)-(3). At the same time, k time points are randomly selected within the entire historical range [0, t] for global modeling. Similarly, the global knowledge graph structure information is aggregated using formulas (4)-(11), and the long-term temporal evolution pattern is learned by applying formulas (1)-(3).

[0054] Subsequently, the multi-task loss function including contrastive learning is calculated, and entity prediction is performed on the query triple After replacing the candidate entity and calculating the matching score, the possible entity list is output in descending order.

[0055] Finally, update t = t + 1 and continue processing the next time step until all time steps are predicted. This method uses a dual-branch architecture to simultaneously capture local dynamic changes and global evolution trends of knowledge, combines a hybrid expert mechanism to enhance feature expression capabilities, and uses contrastive learning to optimize the representation space, ultimately achieving more accurate temporal knowledge completion.

[0056] To evaluate the effectiveness of the algorithm, we use the following five benchmark TKG datasets for evaluation: The ICEWS dataset series is based on the Integrated Crisis Early Warning System (ICEWS), an event-driven database developed with funding from the U.S. Department of Defense's Advanced Research Projects Agency (DARPA). The dataset covers international events, including political conflicts, military actions, and diplomatic relations. Each entry is a four-tuple consisting of (subject, relation, object, timestamp), such as (Police_(Australia), Host_a_visit, Women_(Australia), 2014-01-01). ICEWS14 covers the entire year of 2014 with a 24-hour granularity. ICEWS14s is a variant of ICEWS14, repartitioning the original data into a training set (70%), a validation set (15%), and a test set (15%). ICEWS05-15 covers the period from January 2005 to December 2015, containing over 460,000 events and capturing the long-term evolution of interstate cooperation and conflict. The time granularity remains 24 hours, but the time span is significantly increased.

[0057] The GDELT dataset is derived from the Global Database of Events, Language, and Tone (GDELT), based on real-time monitoring of global news media. It has a time granularity of 15 minutes and covers 20 event types (such as protests, military mobilizations, and economic sanctions). Each entry is a four-tuple consisting of (subject, relation, object, and timestamp).

[0058] Wiki is derived from the Wikidata open knowledge base and constructed through structured extraction of historical facts. It has a time granularity of one year and covers a wide range of fields, including biographical data, institutional changes, and technological development. The datasets include multilingual entities and cross-cultural connections.

[0059] The statistics of the above five benchmark TKG datasets are shown in Table 1 below.

[0060] Table 1 Evaluation Metrics: This paper adopts two metrics that are widely used to evaluate the effectiveness of TKG reasoning methods: Mean Reciprocal Ranking (MRR) is the average of the last positions of the true results for all queries in the ranking. It is calculated using the following formula:

[0061] Among them, S is the set of test triples, |S| is the number of test triples, rank i It is i The link prediction ranking of triples is calculated. The larger the index is, the better the model performance is.

[0062] Hits@k indicates that the real entity appears first k The ratio of candidate results. Use the following formula to calculate:

[0063] Among them, S is the set of test triples, |S| is the number of test triples, rank i It is i Link prediction ranking of triples, Is the indicator function (if the condition is true, the function value is 1, otherwise it is 0). Generally, choose k Equal to 1, 3, and 10. The larger the index is, the better the model performance is.

[0064] Baseline methods include the following two categories: 1) Temporal knowledge graph reasoning methods based on interpolation: including but not limited to TTransE and DE-SimplE; 2) Extrapolation-based temporal knowledge graph reasoning methods: including RE-NET, CyGNet, TANGO, xERTE, RE-GCN, TITer, CEN, HiSMatch, and Re-Temp.

[0065] The experimental results are shown in Table 2 and Table 3: Table 2 Table 3 Finally, the temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch contrastive learning outperforms other models in accuracy on the ICEWS14, ICEWS14s, ICEWS05-15, and GDELT datasets, and partially outperforms other models on the WIKI dataset.

[0066] This paper aims to evaluate the impact of specific components on the model's extrapolation performance by conducting a series of ablation experiments on three datasets. To this end, the paper uses the following four experiments to verify the superiority of the method:

[0067] 1) Two-branch structure validity experiment In order to verify the effectiveness of the dual-branch method, the present invention divides the groups into the following three types: There are only local branches and the contrastive learning module is removed, denoted as "Base-Global".

[0068] There is only a global branch and the contrastive learning module is removed, denoted as "Base-Local".

[0069] There are global and local branches, and the contrastive learning module is removed, denoted as "Dual-Branch".

[0070] Table 4 shows the model groups that verify the validity of the two-branch structure; Table 4 This paper compares the performance of three different experimental groups on three independent datasets. The main evaluation metrics used include: MRR, Hits@1, Hits@3, and Hits@10. The experimental results are shown in Table 5 below:

[0071] Table 5 Experimental results show that "DualBranch" (including both local and global branches) outperforms branches containing only a single type of branch (Base-Global and Base-Local) on all tested datasets. This demonstrates that short-term information (local branches) and long-term information (global branches) complement each other, helping to improve the overall performance of the model.

[0072] 2) Hybrid Expert System Effectiveness Experiment The present invention is a hybrid expert system effectiveness, and the groups are divided into the following three types: The two branches only use RGCN and remove the contrastive learning module, denoted as “RGCN Only”.

[0073] The two branches only use RGT and remove the contrastive learning module, denoted as “RGT Only”.

[0074] The two branches use the hybrid structure of RGCN and RGT, and remove the contrastive learning module, which is expressed as "Hybrid (RGCN+RGT)".

[0075] Table 6 shows the model groups used to verify the effectiveness of the hybrid expert system; Table 6 This paper compares the performance of three different experimental groups on three independent datasets. The main evaluation metrics used include: MRR, Hits@1, Hits@3, and Hits@10. The experimental results are shown in Table 7 below:

[0076] Table 7 Comparing the three configurations of "RGCN Only," "RGT Only," and "Hybrid (RGCN + RGT)," the hybrid expert system (i.e., Hybrid (RGCN + RGT)) demonstrated superior performance in most cases. This demonstrates that combining structural features (captured by RGCN) and relational dynamics (processed by RGT) can more comprehensively understand complex data patterns, thereby improving prediction accuracy.

[0077] 0) Experiment on the effectiveness of cross-branch comparative learning module In order to verify the effectiveness of the cross-branch comparative learning module, the present invention divides the groups into the following two types: The contrast learning module is removed from the architecture of the present invention, which is expressed as "w / o Contrast".

[0078] The contrast learning module is retained in the architecture of the present invention, which is expressed as "w / Contrast".

[0079] Table 8 below shows the model groups used to validate the cross-branch contrastive learning module. Table 8 This paper compares the performance of two different experimental groups on three independent datasets. The main evaluation metrics used include: MRR, Hits@1, Hits@3, and Hits@10. The experimental results are shown in Table 9 below:

[0080] Table 9 After adding the contrastive learning module, the model's various indicators on the three benchmark datasets showed varying degrees of improvement in most cases. This shows that the contrastive learning mechanism helps enhance the model's learning ability, especially in distinguishing different information sources.

[0081] 4) Component combination effect effectiveness experiment In order to verify the effectiveness of component combinations, the present invention divides the groups into the following four categories: There are only local branches and no comparative learning module. The hybrid expert system only has RGCN, which is denoted as "Baseline".

[0082] There are only local branches and no contrastive learning module. The hybrid expert system is RGCN+RGT, which is expressed as "Enhanced-Local".

[0083] The hybrid expert system with only a global branch and no contrastive learning module is RGCN+RGT, which has no contrastive learning module and is denoted as "Enhanced-Global". The complete model is denoted as "Full Model".

[0084] Table 10 below shows the model groups used to verify the component combination effect: Table 10 This paper compares the performance of four different experimental groups on three independent datasets. The main evaluation metrics used include: MRR, Hits@1, Hits@3, and Hits@10. The experimental results are shown in Table 11 below:

[0085] Table 11 The "Full Model" outperformed all sub-models, demonstrating the potential of each component working together. It not only integrates the advantages of local and global information, but also leverages the capabilities of hybrid expert systems and further optimizes the model's performance through contrastive learning.

[0086] To study the effectiveness of DualBranch-TKG, we selected three different ICEWS14 queries from the dataset on October 31, 2014. The results are the top 5 answers output by DualBranch-TKG and Re-Temp, as shown in Table 12 below: Table 12 Taking the query "Member_of_Parliament_(India), Express_intent_to_cooperate,?,2014-10-31" as an example, Re-Temp is susceptible to path dependencies on historically high-frequency entities (such as "Iranian Foreign Minister" and "France") during entity reasoning due to local information limitations and short-range structural dependencies. DualBranch-TKG, on the other hand, leverages a dual-branch architecture and a hybrid expert system to capture dynamic changes and implicit connections. Experiments demonstrate that the DualBranch-TKG model demonstrates greater practical value in dynamic and complex scenarios such as international relations analysis and policy deduction, effectively addressing the challenges posed by the sparsity and dynamic evolution of time series data.

[0087] 5. Hyperparameter Analysis In order to comprehensively analyze the effectiveness and impact of hyperparameters in DualBranch-TKG, the present invention conducts extensive experiments, respectively adjusting the local branch sliding window size m and global branch parameters k Performance on the ICEWS14 dataset. Figure 3 As shown, the highest point is a solid mark.

[0088] Local branch sliding window parameters m :The experimental results are as follows Figure 3 As shown, when m =3, the model achieved the best or near-best performance in multiple indicators such as MRR, Hits@1, Hits@3, and Hits@10. Specifically, m =3, MRR reaches 0.4982, Hits@1 reaches 0.3923, and Hits@10 reaches 0.7072, which are significantly better than other parameter configurations. m When >3, the model performance degrades, indicating that an excessively long sliding window may introduce noise and affect the timing modeling capability of local branches.

[0089] Global branch parameters k : Global branch parameters k The experimental results of Figure 4 As shown, k The change in has relatively little effect on the model performance, but k =6 for the best overall performance.

[0090] Example 3 A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the steps of the temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning as described in Example 1 or 2.

[0091] Example 4 A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the temporal knowledge graph reasoning method for integrating hybrid experts and cross-branch comparative learning as described in Example 1 or 2.

Claims

1. A temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning, characterized by: include: Input the historical temporal knowledge graph into the trained temporal knowledge graph reasoning model to perform temporal knowledge graph reasoning; Among them, the temporal knowledge graph reasoning model includes a dual-branch temporal modeling architecture, a dynamic hybrid expert system, a cross-branch comparative learning module, and a decoding and scoring module; A dual-branch temporal modeling architecture is used to capture short-term dynamic changes and the long-term evolution of entities over the entire time span; a dynamic hybrid expert system is used to extract structural features and mine relational dependencies across timestamps; a cross-branch comparative learning module is used to maximize the mutual information between local and global temporal views, promoting the fusion and learning of temporal features at different levels; and a decoding scoring module is used for temporal knowledge graph reasoning.

2. The temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning according to claim 1 is characterized in that: The dual-branch timing modeling architecture includes local branches and global branches; The local branch uses a sliding window mechanism to extract recent historical subgraphs; The global branch focuses on the evolution pattern of entities over a long time span by uniformly sampling the entire time series from the initial moment to the current moment; Further preferably, the global branch samples key time points from the entire time axis; the local branch randomly samples and uses a random function to generate the time series knowledge graph. Perform random sampling, and the global sequence after sampling is }, the length is the local branch parameter k; Both local branches and global branches are based on temporal knowledge graphs is the input; Both local and global branches use dynamic hybrid expert systems to aggregate entities and relationships in the knowledge graph at each moment, and then 、 Integrate historical hidden states; Finally, the local branch outputs the hidden state of the entity at time t+1, which is the entity embedding and the relation hidden state, i.e. relation embedding ; The global branch outputs the hidden state of the entity at time t+1, which is the entity embedding and the relation hidden state, i.e. relation embedding ; are the local and global query embeddings of the target entity o at time t+1; More preferably, the local branch adopts a sliding window mechanism to extract recent historical subgraphs and capture short-term dynamic patterns; including: In local branches, short-term dynamic patterns are captured by modeling semantic dependencies between concurrent facts; consider capturing semantic dependencies between concurrent facts to obtain each knowledge graph Each node Embedding; specifically, the time series knowledge graph is divided into multiple local time windows according to the time window parameter m, each timestamp has a corresponding local historical sampling sequence of local sampling, the local historical sampling sequence is ordered according to time, and the knowledge graph at each moment is modeled and embedded by a dynamic hybrid expert system. Each subgraph The nodes are modeled to get the embedding vector ;in, ; Use gated recurrent unit GRU according to the knowledge graph The latest timestamp of each entity s and relation r is encoded, and the entities and relations are divided into two GRU modules: and , and Each has independent parameters and learns the dynamic evolution characteristics of entities and relations respectively; The temporal evolution of each entity s is Modeling; given entity s at timestamp t, the embedding vector is , and the hidden state at timestamp t , the update process is: ; in, As the hidden state of the local branch at time stamp t+1, It is a GRU module dedicated to entity representation learning; By considering the entity hidden state representation at time stamp t To further obtain the short-term and long-term information of the relationship r connecting the entity pairs in the knowledge graph: ; ; in, is the hidden state of relation r at timestamp t, It is a GRU module dedicated to relational representation learning, used to update ; yes Updated relation representation, including historical timing information; Indicates the timestamp t Connect to a specific relationship r All entities, pass and Perform mean pooling operation to obtain the feature representation of the relationship r at timestamp t.

3. The temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning according to claim 2 is characterized in that: The global branch focuses on the evolution pattern of entities over a long time span by uniformly sampling the entire time series from the initial moment to the current moment; it includes: The temporal evolution of each entity s is Modeling; given entity s at timestamp t, the embedding vector is , and the hidden state at timestamp t , the update process is: ; in, As the hidden state of the local branch at time stamp t+1, It is a GRU module dedicated to entity representation learning; By considering the entity hidden state representation at time stamp t To further obtain the short-term and long-term information of the relationship r connecting the entity pairs in the knowledge graph: ; ; in, is the hidden state of relation r at timestamp t, It is a GRU module dedicated to relational representation learning, used to update ; yes Updated relation representation, including historical timing information; Indicates the timestamp t Connect to a specific relationship r All entities, pass and Perform mean pooling operation to obtain the feature representation of the relationship r at timestamp t.

4. The temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning according to claim 1 is characterized in that: The dynamic hybrid expert system adopts a bottom-up hierarchical architecture, including an input layer, a first fully connected layer, a dual expert module, a dynamic gating network, a second fully connected layer, and an entity embedding output layer. The dual expert module includes RGCN and RGT. The temporal knowledge graph data is first extracted through the first fully connected layer and then diverted to RGCN and RGT for parallel processing. RGCN uses the graph propagation mechanism to capture dependencies in complex network structures. RGT identifies and evaluates relationships and their importance within a specific time point. The processed features are fused through a dynamic gating network, which dynamically adjusts the weights of the dual expert module output according to the data characteristics, and finally generates entity embedding after the second fully connected layer.

5. The temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning according to claim 4 is characterized in that: Both local and global branches include dynamic hybrid expert systems; Knowledge graph at a given time t , where the occurrence of a fact indicates that an entity has significant semantic relevance with its neighboring entities; RGCN is used to model the semantic dependency between neighboring entities and generate node embeddings; the forward propagation formula of RGCN is defined as: ; Where n is the total number of layers in RGCN, Represents the knowledge graph at time t Zhongyuan Entity The neighbor set of and are trainable parameters, which are used for the trainable parameters of aggregation structure and self-loop features respectively; is the relation embedding of the lth layer, express The number of neighbors, Represents the LeakyReLU activation function; For the target entity In the hidden state of layer l, For the target entity In the hidden state of layer l; by stacking multiple layers of RGCN, capturing the timestamp 𝑡 Multi-hop semantic associations between entities and output entity embedding , l Indicates the number of layers; After stacking n layers of RGCN, the final node embedding Output as an expert ; RGT aggregates the structural information of entities in the snapshot sequence through the self-attention mechanism; for the source entity and the target entity , whose hidden state is initialized to the initial embedding, and its hidden state is updated through the message passing framework; the entity is updated through the following steps: The source entity The hidden state of and side relations Splicing to generate query vector ; Computing Attention: Building the Bond Matrix Sum Matrix ,in Is the current source entity Query message The number of sets; for each message, use as the query, the query matrix is , by stacking the source entities All edge relationships The collection is used as the input of multi-head attention; Entity in RGT l Hidden state of the layer The definition is as follows: ; Among them, n is the total number of layers of RGT, MHA represents the multi-head attention mechanism, LN is layer normalization, and FFN is the feedforward neural network; After stacking n layers of RGT, the final node embedding Output as an expert .

6. The temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning according to claim 4 is characterized in that: In the dynamic hybrid expert system, the adaptive fusion of RGCN and RGT outputs is achieved through a dynamic routing mechanism. The specific implementation process is as follows: (1) Routing probability calculation: set up is the intermediate hidden state of expert e, , n is the number of layers of RGCN and RGT respectively, given the expert output and , routing probability Calculated as follows: ; ; ; ; ; ; in, is the cosine similarity function, including, for With RGCN expert output The matching degree, for Output with RGT Expert Matching degree, routing probability The calculation of is based on the similarity of the output state to the expert output; (2) Dynamic fusion output: According to the routing probability The calculation formula is used to calculate the activation probability of RGCN and RGT respectively. , ,The final output is obtained by weighted fusion of expert outputs: ; in, Right now is the final output of the dynamic hybrid expert system, , , and are the outputs of RGCN and RGT respectively.

7. The temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning according to claim 1 is characterized in that: In the cross-branch contrastive learning module, the entity embedding and relation embedding generated by the local branch are concatenated into As an anchor point, the entity embedding and relation embedding generated by the local branch are concatenated into is considered as an enhanced encoding process; at the same time t, the local and global representations of the same query at timestamp t are used as positive pairs, i.e. , the local and global representations of different queries serve as negative pairs, i.e. ,in, Represents The concatenated entity embedding and relation embedding vectors generated by the non-corresponding global branch; the supervised contrast loss at timestamp t The calculation of is as follows: ; in, and Represents the mini-batch and timestamp as the query set respectively t The number of queries at , τ is the temperature parameter, express and Dot product similarity in feature space, express and all candidate global representations Dot product similarity in feature space.

8. A temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning according to any one of claims 1 to 7, characterized in that: In the decoding and scoring module, the entity prediction task is regarded as a multi-class classification task, and ConvTransE is used to perform entity prediction at timestamp t+1; the entity prediction scores of ConvTransE are as follows: ; ; ; in, is the Sigmod activation function, For time t+1 The query embedding of the target entity o, and Source entities s and relationships r In time t+1 It includes dynamic representation of global and local information, It is a self-tuning parameter that is automatically adjusted through the MRR reward mechanism. When the validation set MRR increases, the λ value of the local branch is increased. When the validation set MRR decreases, the λ value of the local branch is reduced to balance the contribution of global and local information. The learning objective of entity prediction uses the following loss function to promote the learning of relation embeddings: ; in, Is the timestamp t+1 A collection of facts; Combined entity prediction loss function and the supervised contrast loss at timestamp t , the total loss function of the temporal knowledge graph reasoning model is: ; in, and are two learnable dynamic parameters used to coordinate the weights of the two types of losses.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the temporal knowledge graph reasoning method that integrates hybrid experts and cross-branch comparative learning as described in any one of claims 1-8 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the temporal knowledge graph reasoning method integrating hybrid experts and cross-branch comparative learning as described in any one of claims 1 to 8 are implemented.

Citation Information

Cited By

  • Multi-scene electric quantity load prediction method and system based on hybrid expert model

    CN121172755A

  • Real-time detection method for DNS (Domain Name Server) tunnel attack of LSTM-Transform mixed architecture

    CN121585472A