CN-121998049-A - Dynamic knowledge graph updating method based on cross attention, model training method and equipment
Abstract
The application provides a dynamic knowledge graph updating method based on cross attention, a model training method and equipment, wherein the updating method comprises the following steps: and inputting the four-element data and the historical knowledge graph of the current time slice into a model, generating structural time sequence data through influencing modeling, and generating initial characteristics by fusing local association information and random initialization information of a new entity. And then, constructing propagation information according to the new entity characteristics and the historical entity characteristics by the model, and extracting static period information by combining the historical accumulated time sequence signals. And finally, the entity characteristics to be updated are interacted with the propagation information through a cross attention mechanism and are fused with the period information, so that updated entity characteristics are generated. The application can achieve the semantic alignment of the new knowledge of the knowledge graph and the history period, effectively avoid catastrophic forgetting, effectively improve the updating efficiency and reliability of the knowledge graph and reduce the resource occupancy rate of the computing equipment.
Inventors
- LI YAWEN
- QIU XIAOTIAN
- XUE ZHE
- YE GUANHUA
Assignees
- 北京邮电大学
Dates
- Publication Date
- 20260508
- Application Date
- 20251205
Claims (10)
- 1. The dynamic knowledge graph updating method based on the cross attention is characterized by comprising the following steps of: Inputting four-tuple data of a current time slice corresponding to a continuous time sequence knowledge graph flow and a historical knowledge graph corresponding to the current time slice into a dynamic knowledge graph updating model to enable the dynamic knowledge graph updating model to execute, wherein the four-tuple data are subjected to influence modeling to generate structural time sequence data containing new entity information, initial characteristics of the new entity are generated by fusing local association information and random initialization information of the new entity based on the structural time sequence data, entity propagation information is built according to the initial characteristics of the new entity and associated historical entity characteristics, static period information representing a periodic evolution mode is extracted based on time sequence signals which are accumulated in a history and are generated in the previous time slice by the dynamic knowledge graph updating model, entity characteristics to be updated are obtained from the historical knowledge graph, the entity characteristics to be updated are interacted with the entity propagation information through a cross attention mechanism, and interaction results are fused with the static period information to generate updated entity characteristics; And updating the dynamic knowledge graph based on the updated entity characteristics, and outputting the updated dynamic knowledge graph as a historical knowledge graph corresponding to the next time slice.
- 2. The method for updating a dynamic knowledge graph based on cross-attention according to claim 1, wherein the dynamic knowledge graph updating model comprises: The data processing module is configured to perform influence modeling on the four-tuple data of the current time slice, and generate structured time sequence data containing new entity information; the new entity initializing module is configured to generate initial characteristics of the new entity by fusing local association information and random initializing information of the new entity based on the structured time sequence data; The propagation information preprocessing module is configured to construct entity propagation information according to the initial characteristics of the new entity and the associated historical entity characteristics; the historical information updating module is configured to extract static period information representing a periodic evolution mode based on a time sequence signal which is accumulated in a historical mode and generated by the dynamic knowledge graph updating model in a previous time slice; And the cross attention updating layer is configured to acquire entity features to be updated from the historical knowledge graph, interact the entity features to be updated with the entity propagation information through a cross attention mechanism, and fuse interaction results with the static period information to generate updated entity features.
- 3. The method for updating a dynamic knowledge graph based on cross-attention according to claim 2, wherein the data processing module is specifically configured to: performing instant influence modeling on the four-tuple data of the current time slice, and extracting direct association four-tuple characteristics of a new entity; Based on the historical knowledge graph, extracting indirect association information generated by the new entity on a downstream entity in a history window through an association entity of the new entity by a relation graph convolution network RGCN, and aggregating the indirect association information to obtain indirect association characteristics; And fusing the direct association quadruple characteristic and the indirect association characteristic to generate the structured time sequence data.
- 4. The method for updating a dynamic knowledge graph based on cross-attention according to claim 2, wherein the new entity initialization module is specifically configured to: Based on the new entity and the object entities related to the new entity in the current time slice, extracting all history entities connected with the object entities through history relations from the history knowledge graph, and constructing a local subgraph by taking the new entity, the object entities and the history entities as nodes and taking the relation among the new entity, the object entities and the history entities as sides; Performing multi-hop relation feature aggregation on the local subgraphs based on a relation graph convolution network RGCN to generate entity features based on historical context; The historical context-based entity signature is enhanced with a random initialization vector as random initialization information to generate an initial signature of the new entity.
- 5. The method for updating a dynamic knowledge graph based on cross-attention according to claim 2, wherein the propagation information preprocessing module is specifically configured to: constructing a direct propagation message and an indirect propagation message based on the initial characteristics of the new entity, the associated historical entity characteristics and the relationship characteristics thereof obtained from the historical knowledge graph, wherein the direct propagation message is used for representing the influence of the new entity on the direct associated entity; integrating the direct propagation message with the indirect propagation message to generate entity propagation information.
- 6. The method for updating a dynamic knowledge graph based on cross-attention according to claim 2, wherein the history information updating module is specifically configured to: sampling a dynamic local subgraph by taking the relation of the inactive entity as a center, and generating a time sequence signal unit of a current time slice based on the dynamic local subgraph; Storing the time sequence signal unit of the current time step into a periodic mode buffer memory, and forming a history time sequence serving as the time sequence signal together with a history signal; reading the historical time sequence signal sequence from the periodic pattern buffer, carrying out frequency domain transformation on the historical time sequence signal sequence, selecting a target periodic pattern based on the energy intensity of a frequency component, and rearranging signals in the historical time sequence signal sequence according to the length corresponding to the target periodic pattern to obtain rearranged two-dimensional signals; And carrying out convolution operation on the rearranged two-dimensional signal structure to output static period information representing a periodic evolution mode.
- 7. The method for updating a dynamic knowledge graph based on cross-attention according to claim 2, wherein the cross-attention updating layer is specifically configured to: Acquiring entity characteristics to be updated from the historical knowledge graph, and splicing the entity characteristics to be updated with the entity propagation information to form an input matrix; Performing self-attention calculation on the input matrix to obtain a self-attention calculation result; Extracting first partial data associated with the entity characteristics to be updated from the self-attention calculation result, generating a secondary key vector based on the first partial data, taking the rest partial data except the first partial data in the self-attention calculation result as query, and carrying out cross-attention calculation with the secondary key vector to obtain a cross-attention calculation result; And carrying out weighted fusion on the cross attention calculation result and the static period information, and generating the updated entity characteristics after layer normalization processing.
- 8. The dynamic knowledge graph updating model training method is characterized by comprising the following steps of: Acquiring a training data set, wherein the training data set comprises four-tuple data of a plurality of time slices of a continuous time sequence knowledge-graph flow and corresponding historical knowledge-graphs thereof; Sequentially inputting the four-element data of each time slice in the training data set and the corresponding historical knowledge graph into a dynamic knowledge graph update model so that the dynamic knowledge graph update model respectively generates updated entity characteristics for each time slice; calculating a contrast learning loss based on the updated entity characteristics and a preset label corresponding to each time slice; according to the contrast learning loss, the parameters of the dynamic knowledge graph updating model are optimized end to end through a back propagation algorithm, and the dynamic knowledge graph updating model which is used for executing the dynamic knowledge graph updating method based on the cross attention as claimed in any one of claims 1 to 7 after training is obtained.
- 9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the cross-attention based dynamic knowledge graph update method of any one of claims 1 to 7 and/or implements the dynamic knowledge graph update model training method of claim 8 when executing the computer program.
- 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the cross-attention based dynamic knowledge graph update method of any one of claims 1 to 7 and/or implements the dynamic knowledge graph update model training method of claim 8.
Description
Dynamic knowledge graph updating method based on cross attention, model training method and equipment Technical Field The application relates to the technical field of knowledge graph processing, in particular to a dynamic knowledge graph updating method based on cross attention, a model training method and a model training device. Background The Knowledge Graph (KGs) is a core technical support in the industrial field and is widely applied to scenes such as search engines, recommendation systems, enterprise data management, industrial Internet of things (IIoT), intelligent manufacturing, supply chain optimization and the like, and the real-time dynamic updating capability directly determines the decision validity and the business adaptability of the system. The traditional knowledge graph uses static triples (e, r, o) to represent the entity and the relation, so that the time dependence of the data can not be captured, while the time sequence knowledge graph (TKGs) introduces the time dimension through the quadruples (e, r, o, t). In order to effectively improve the real-time requirements of continuous flow application scenes such as the industrial Internet of things (IIoT), intelligent manufacturing and supply chain management, dynamic updating of even time-series knowledge maps is required. However, the existing time sequence knowledge graph dynamic updating method has a large limitation that new entities (such as newly-added equipment and unknown sensors) frequently appear, the existing method is difficult to initialize the characteristics by using the associated information of the existing entities, and serious cold start problems exist (the newly-added entities in the dynamic knowledge graph have difficulty in generating effective characteristic representation due to lack of historical interaction information). The data are in a common periodic mode (such as equipment maintenance period, seasonal supply chain demand fluctuation and production process circulation), and the existing method cannot effectively capture the long-term evolution trends, so that the characteristic representation of an inactive entity is outdated. And the existing graph neural network (such as GCN and RGCN) is mainly designed for static graphs, the full graph is required to be retrained when new data are updated, the calculation cost is extremely high, and the real-time requirements of a plurality of application scenes can not be met. Therefore, designing a dynamic knowledge graph updating method which supports continuous flow scenes, solves the cold start problem, captures a periodic mode and is efficient becomes a key requirement of intelligent system landing. Disclosure of Invention In view of this, embodiments of the present application provide a method for updating a dynamic knowledge graph based on cross-attention, a method for training a model, and an apparatus for training a model, so as to eliminate or improve one or more drawbacks existing in the prior art. One aspect of the present application provides a method for updating a dynamic knowledge graph based on cross attention, comprising: Inputting four-tuple data of a current time slice corresponding to a continuous time sequence knowledge graph flow and a historical knowledge graph corresponding to the current time slice into a dynamic knowledge graph updating model to enable the dynamic knowledge graph updating model to execute, wherein the four-tuple data are subjected to influence modeling to generate structural time sequence data containing new entity information, initial characteristics of the new entity are generated by fusing local association information and random initialization information of the new entity based on the structural time sequence data, entity propagation information is built according to the initial characteristics of the new entity and associated historical entity characteristics, static period information representing a periodic evolution mode is extracted based on time sequence signals which are accumulated in a history and are generated in the previous time slice by the dynamic knowledge graph updating model, entity characteristics to be updated are obtained from the historical knowledge graph, the entity characteristics to be updated are interacted with the entity propagation information through a cross attention mechanism, and interaction results are fused with the static period information to generate updated entity characteristics; And updating the dynamic knowledge graph based on the updated entity characteristics, and outputting the updated dynamic knowledge graph as a historical knowledge graph corresponding to the next time slice. In some embodiments of the present application, the dynamic knowledge-graph update model includes: The data processing module is configured to perform influence modeling on the four-tuple data of the current time slice, and generate structured time sequence data containing new entity information; the new