A power equipment knowledge graph completion method and system based on a Mamba-GPT model

By using the Mamba-GPT model and a prior knowledge injection mechanism specific to power equipment, the problems of low knowledge acquisition efficiency and insufficient integration of domain knowledge in the construction of knowledge graphs for power equipment inspection are solved. This enables efficient and accurate knowledge graph completion and dynamic updates, thereby improving the intelligent decision support capability of equipment inspection.

CN119128166BActive Publication Date: 2025-12-05ELECTRIC POWER RES INST OF GUANGXI POWER GRID CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411030988.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2025-12-05
Estimated Expiration
2044-07-30

AI Technical Summary

Technical Problem

Existing methods for constructing knowledge graphs for power equipment inspection suffer from low knowledge acquisition efficiency, insufficient integration of domain knowledge, and low efficiency when handling long sequences and complex relationships.

Method used

By employing the Mamba-GPT model combined with a prior knowledge injection mechanism specific to power equipment, the knowledge graph of power equipment inspection is completed through phased dynamic updates. Leveraging the efficient sequence processing capabilities of Mamba blocks and the powerful language understanding capabilities of the GPT model, positional encoding and consistency constraints are introduced to optimize the knowledge graph completion process.

Benefits of technology

It improves the accuracy and interpretability of the knowledge graph for power equipment inspection, enhances the application value of the knowledge graph in fault diagnosis and maintenance decision-making, and realizes efficient knowledge graph completion and dynamic updating.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119128166B_ABST
    Figure CN119128166B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on Mamba-GPT model's electric power equipment knowledge graph completion method and system, it is related to electric power equipment inspection technical field, including: collection electric power equipment inspection related data and pre-processing, according to the data of electric power equipment inspection related after pre-processing constructs electric power equipment inspection knowledge graph, and text information in knowledge graph is encoded;Mamba-GPT model is constructed, priori knowledge injection mechanism dedicated to electric power equipment is introduced, and the selection mechanism of Mamba block is optimized;Text information in the encoded knowledge graph is input into Mamba-GPT model, the electric power equipment inspection knowledge graph is completed, and the electric power equipment inspection knowledge graph after completion is output.The application not only improves the integrity and accuracy of electric power equipment inspection knowledge graph, but also enhances the application value of knowledge graph in equipment fault diagnosis, maintenance decision and knowledge management.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of power equipment inspection, in particular to a power equipment knowledge graph completion method and system based on a Mamba-GPT model. BACKGROUND

[0002] In recent years, with the rapid development of artificial intelligence technology, large language models have made significant progress in natural language processing. Among them, the GPT (Generative Pre-trained Transformer) model based on the Transformer architecture has attracted much attention due to its powerful language understanding and generation capabilities. However, traditional GPT models have high computational complexity and large memory consumption when processing long sequence inputs. To solve these problems, the Mamba block has emerged, which greatly improves the efficiency and performance of the model by introducing innovative mechanisms such as the selective state space model (S4) and structured state space sequence (SSM). At the same time, knowledge graphs, as a structured knowledge representation method, play an increasingly important role in professional fields such as power equipment inspection. Knowledge graphs not only effectively organize and manage complex domain knowledge, but also provide strong support for intelligent decision-making and fault diagnosis.

[0003] However, existing methods for constructing power equipment inspection knowledge graphs still have some shortcomings. First, traditional knowledge graph construction processes often rely on manual annotation and expert knowledge, which not only consumes time and effort, but also makes it difficult to ensure the comprehensiveness and timeliness of the knowledge. Second, existing knowledge graph completion methods are mostly based on shallow neural networks or traditional machine learning algorithms, making it difficult to fully utilize the semantic understanding capabilities of large-scale pre-trained language models. Third, in professional fields such as power equipment inspection, how to effectively integrate domain-specific prior knowledge to improve the accuracy and explainability of knowledge graph completion remains a pressing problem. Finally, existing methods often face challenges such as low efficiency and limited reasoning capabilities when dealing with long sequence and complex relationship knowledge graphs.

[0004] Currently, there are still problems such as low knowledge acquisition efficiency, insufficient domain knowledge integration, and limited reasoning capabilities in the field of power equipment inspection knowledge graph completion. The present application proposes a power equipment knowledge graph completion method based on the Mamba-GPT model, aiming to solve the above problems. This method belongs to the technical fields of artificial intelligence and knowledge engineering, combining the efficient sequence processing capabilities of the Mamba block with the powerful language understanding capabilities of the GPT model, while introducing a prior knowledge injection mechanism specific to power equipment, achieving efficient and accurate completion of power equipment inspection knowledge graphs. SUMMARY

[0005] In view of the problems of low knowledge acquisition efficiency, insufficient domain knowledge fusion, and low efficiency in processing long sequences and complex relationships in the existing power equipment inspection knowledge graph construction and completion methods, the present application is proposed.

[0006] Therefore, the technical problem solved by the present application is to introduce the Mamba-GPT model and the prior knowledge injection mechanism dedicated to power equipment, improve the understanding ability of the model for domain knowledge and the long sequence processing efficiency, and dynamically update the completed power equipment inspection knowledge graph in stages, so that the system updates the knowledge graph in time to adapt to different application scenarios and update requirements according to different time scales and the new and old degree of data.

[0007] To solve the above technical problems, the present application provides the following technical scheme: a power equipment knowledge graph completion method based on a Mamba-GPT model, comprising collecting and preprocessing power equipment inspection related data, constructing a power equipment inspection knowledge graph according to the preprocessed power equipment inspection related data, and encoding the text information in the knowledge graph; constructing a Mamba-GPT model, introducing a prior knowledge injection mechanism dedicated to power equipment, and optimizing the selection mechanism of the Mamba block; inputting the encoded text information in the knowledge graph into the Mamba-GPT model, completing the power equipment inspection knowledge graph, and dynamically updating the completed power equipment inspection knowledge graph in stages and outputting.

[0008] As a preferred scheme of the power equipment knowledge graph completion method based on the Mamba-GPT model of the present application, wherein: constructing the power equipment inspection knowledge graph and encoding the text information in the knowledge graph comprises defining entities, the entities including power equipment, components, fault types, maintenance operations, and establishing relationships between entities to form triples; converting the triples into text sequences and distinguishing different types of entities and relationships by marking; generating word vectors using the Word2Vec algorithm; performing position encoding according to the position of the word vector in the text sequence, and taking the position encoding as input.

[0009] As a preferred scheme of the power equipment knowledge graph completion method based on the Mamba-GPT model of the present application, wherein: generating word vectors using the Word2Vec algorithm comprises, in the Skip-Gram model, predicting the context words through a given center word, and the loss function of the Skip-Gram model is calculated as follows:

[0010]

[0011] wherein L represents the loss function, N represents the length of the text sequence, k represents the window size, j is a summation variable without actual physical meaning, P(w t+j |wt ) represents that the input word is w t , the probability of the word w t+j appearing;

[0012] The calculation formula of P(w t+j |w t ) is as follows:

[0013]

[0014] wherein, and respectively represent the embedding vectors of the output word and the input word, V represents the vocabulary, v w represents the embedding vector of the word w, and w represents the vocabulary.

[0015] As a preferred scheme of the power equipment knowledge graph completion method based on the Mamba-GPT model of the present application, wherein: the position encoding as input is as follows:

[0016] PE (pos2i) =sin(pos / 10000 2i / d )

[0017] PE (pos,2i+1) =cos(pos / 10000 2i / d )

[0018] wherein, PE represents the output value of the position embedding, pos represents the position of the word in the text, d represents the maximum value of the length of the word vector, and i represents the position of the text.

[0019] As a preferred scheme of the power equipment knowledge graph completion method based on the Mamba-GPT model of the present application, wherein: the Mamba-GPT model is constructed, the prior knowledge injection mechanism special for power equipment is introduced, and the selection mechanism of the Mamba block is optimized, including: constructing the Mamba-GPT model structure based on the Mamba block, establishing the relationship between the Mamba block input and the output sequence, and the calculation formula of the relationship between the Mamba block input and the output sequence is as follows:

[0020]

[0021] y t =Ch t

[0022] wherein, x t represents the t-th vector in the input sequence, h t represents the implicit state space, C are all matrices, and y tThe model output is represented as follows: A dedicated knowledge graph for the power equipment domain is constructed, incorporating knowledge graph data from related domains. Through transfer learning, the node representations and relationships of the knowledge graph are integrated into the power equipment domain's knowledge graph. A transfer learning strategy is designed to enable the knowledge graph to learn common features and patterns from other domains. A prior knowledge selection module based on dynamic attention is introduced into the input layer of the Mamba block. The node representations of the cross-domain knowledge graph obtained through transfer learning are fused with the positional encodings used as input. Consistency constraints are added to the loss function of the Mamba-GPT model, including node consistency constraints and edge consistency constraints. The formula for the node consistency constraint is as follows:

[0023]

[0024] Among them, L node This represents the loss of node consistency. v represents a node in a knowledge graph. i Nodes representing the model generation The vector representation of , Representing nodes in a knowledge graph The true vector representation of V k A set of nodes in a knowledge graph;

[0025] The formula for edge consistency constraint is as follows:

[0026]

[0027] Among them, L edge Indicates edge consistency loss. Representing the connection nodes in a knowledge graph and One edge, e ij Represents the edges generated by the model The vector representation of , Representing edges in a knowledge graph The true vector representation of E k The set of edge vectors generated for the model;

[0028] The node consistency loss and edge consistency loss are combined to form the overall knowledge consistency loss. The formula for calculating the overall knowledge consistency loss is as follows:

[0029] L consistency =λ node L node +λ edge L edge

[0030] Among them, L consistency λ represents the overall knowledge consistency loss.node denotes a weight parameter for balancing node consistency loss, λ edge denotes a weight parameter for balancing edge consistency loss, L node denotes a node consistency loss, L edge denotes an edge consistency loss; a selection mechanism is introduced in the Mamba block, so that B and C can vary with input x t and the mapping relationship can be learned, and the formula of the mapping relationship is as follows:

[0031] Δ=S Δ (x)=softplus(Linear(x t ))

[0032] C=S C (x)=Linear(x t )

[0033] B=S B (x)=Linear(x t )

[0034]

[0035] wherein Linear(.) denotes a linear function, Δ denotes a sampling interval, S Δ (x) denotes a function of input x, softplus(Linear(x)) denotes a combined function, S C (x) denotes a function of input x, S B (x) denotes a function of input x, denotes a matrix, B denotes a matrix, ΔA denotes the product of Δ and A, I denotes a unit matrix, and ΔB denotes the product of Δ and B.

[0036] softplus(x)=log(1+e x )

[0037] wherein softplus(x) denotes an activation function, and x denotes an arbitrary independent variable describing the function; the Mamba-GPT model is composed of multiple Mamba blocks.

[0038] As a preferred scheme of the power equipment knowledge graph completion method based on the Mamba-GPT model, wherein: the power equipment inspection knowledge graph is completed by inputting the preprocessed power equipment inspection related data into the Mamba-GPT model; the input text sequence is converted into a vector sequence through the multiple Mamba blocks; the vector sequence is decoded to generate the completed text information; the completed text information is converted into new knowledge graph triples to complete the knowledge graph.

[0039] As a preferred scheme of the power equipment knowledge graph completion method based on the Mamba-GPT model of the application, wherein: the stage-based dynamic updating of the completed power equipment inspection knowledge graph comprises: collecting short-term data, medium-term data and long-term data in daily inspection reports respectively, and preprocessing the collected short-term data, medium-term data and long-term data respectively; according to the preprocessed short-term data, medium-term data and long-term data, new knowledge triples are respectively generated, and loss functions are respectively calculated; the formula of the loss function in the short-term updating process is as follows:

[0040]

[0041] Wherein, L short represents the loss function used in short-term updating, T represents the total number of time points, f(·) represents the new knowledge triples generated according to the short-term prediction data x s and the current parameter θ t , y t represents the actual data point at the t time point, θ t represents the current parameter, γ represents the regularization parameter, M represents the total number of parameters θ t , θ t,j represents the jth parameter at the t time point, and θ t-1,j represents the jth parameter at the t-1 time point; the formula of the loss function in the medium-term updating process is as follows:

[0042]

[0043] Wherein, L mid represents the loss function used in medium-term updating, T represents the total number of time points, g(·) represents the new knowledge triples generated according to the medium-term prediction data x m and the current parameter θ t , y t represents the actual data point at the t time point, θ t represents the current parameter, β and λ both represent the regularization parameter, M represents the total number of parameters θ t , θ t,j represents the jth parameter at the t time point, and θ t-1,j represents the jth parameter at the t-1 time point, conflict(·) represents the conflict function, h, r, t represent the three elements of the knowledge triple respectively, and K represents the updated knowledge graph; the formula of the loss function in the long-term updating process is as follows:

[0044]

[0045] Wherein, L long represents the loss function used in long-term updating, T represents the total number of time points, h(·) represents the new knowledge triples generated according to the long-term prediction data xl and the new knowledge triple y generated by the parameter set t represents the actual data point at the t time, represents the parameter set, and both and represent regularization parameters, M represents the total number of parameters, and j represents the jth parameter, conflict(·) represents a conflict function, h, r, and t represent three elements of a knowledge triple, respectively, and K represents an updated knowledge graph; the gradient of the loss function required for updating is calculated, an optimization algorithm is used, and the parameters in the completed power equipment inspection knowledge graph are updated.

[0046] Another object of the present application is to provide a power equipment knowledge graph completion system based on a Mamba-GPT model, comprising an encoding module for collecting and preprocessing power equipment inspection related data, constructing a power equipment inspection knowledge graph according to the preprocessed power equipment inspection related data, and encoding the text information in the knowledge graph; a model construction module for constructing a Mamba-GPT model, introducing a priori knowledge injection mechanism dedicated to power equipment, and optimizing the selection mechanism of the Mamba block; a completion module for inputting the encoded text information in the knowledge graph into the Mamba-GPT model, completing the power equipment inspection knowledge graph, dynamically updating the completed power equipment inspection knowledge graph in stages, and outputting.

[0047] A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the above power equipment knowledge graph completion method based on the Mamba-GPT model when executing the computer program.

[0048] A computer readable storage medium having a computer program stored thereon, characterized in that the computer program is executed by a processor to implement the steps of the above power equipment knowledge graph completion method based on the Mamba-GPT model.

[0049] The application has the beneficial effects that the application provides a high-quality knowledge base for the power equipment inspection field through systematic data processing and knowledge graph construction. The Mamba-GPT model and the prior knowledge injection mechanism dedicated to power equipment are introduced, which significantly improves the understanding ability of the model to the field knowledge and the long sequence processing efficiency. The knowledge transfer and consistency constraint method is used to ensure the accuracy and reliability of the knowledge graph completion. The application of the multi-layer Mamba block structure realizes an efficient knowledge graph completion process. Through the synergistic effect of these steps, not only the integrity and accuracy of the power equipment inspection knowledge graph are improved, but also the application value of the knowledge graph in equipment fault diagnosis, maintenance decision and knowledge management is enhanced. The updated power equipment inspection knowledge graph is output in stages, which can update the knowledge graph in time to adapt to different application scenarios and update requirements according to different time scales and the new and old degree of data. BRIEF DESCRIPTION OF DRAWINGS

[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0051] Figure 1 The model structure of a single Mamba block;

[0052] Figure 2 The Mamba-GPT model architecture;

[0053] Figure 3 The structural diagram of the computer device. DETAILED DESCRIPTION

[0054] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0055] In the following description, many specific details are set forth in order to provide a thorough understanding of the present application, but the present application can also be implemented in other ways different from the description, and those skilled in the art can make similar generalizations without departing from the connotation of the present application, therefore the present application is not limited to the specific embodiments disclosed below.

[0056] Embodiment 1

[0057] ReferenceFigures 1-3 For an embodiment of the present application, a power equipment knowledge graph completion method based on a Mamba-GPT model is provided.

[0058] S1: Collecting power equipment inspection related data and preprocessing, constructing a power equipment inspection knowledge graph according to the preprocessed power equipment inspection related data, and encoding the text information in the knowledge graph.

[0059] Specifically, collecting power equipment inspection related data and preprocessing includes collecting text data from inspection reports, maintenance records and operation manuals, using a word segmentation tool to segment the text into words or phrases, removing irrelevant stop words, identifying and labeling entities in the text, extracting key fields, unifying the format of data from different sources and merging them into a unified database or file, and performing data cleaning.

[0060] Further, constructing a power equipment inspection knowledge graph and encoding the text information in the knowledge graph includes defining entities, including power equipment, components, fault types, maintenance operations, and establishing relationships between entities; converting triples to text sequences, designing labels to distinguish different types of entities and relationships; using Word2Vec algorithm to generate word vectors; according to the position of the word in the text sequence, position encoding is performed, and the position encoding is taken as input.

[0061] Specifically, the knowledge graph (Knowledge Graph) is a complex structured data model used to represent and organize large-scale knowledge information. Its core structure consists of nodes and edges, forming an interconnected network. Nodes represent entities, which can be specific people, places, organizations, or abstract concepts or events, and edges represent semantic relationships between entities. The basic unit of a knowledge graph is a triple (subject-relation-object). Due to the fundamental differences between the graph structure of a knowledge graph and traditional sequential text data, special data conversion and preprocessing are required to apply a knowledge graph to models based on sequence processing such as Mamba-GPT.

[0062] Further, the method of data conversion is to convert the task of completing the knowledge graph into the task of predicting the text. For the power equipment inspection knowledge graph, it includes triples: (transformer insulation fault-causes-transformer oil decomposition); (transformer oil decomposition-causes-oil chromatography change); want to get (oil chromatography change-indicates-transformer insulation fault) triple through the above two triples, need to encode the text information in the knowledge graph first.

[0063] Further, the text information in the knowledge graph is encoded, that is, Chinese text is encoded into a word vector that can be processed by a neural network. The words in the text are converted into word vectors using the Word2Vec algorithm, and Word2Vec mainly has two model structures, namely Skip-Gram and CBOW (Continuous Bag of Words). The present application uses the Skip-Gram model. In the Skip-Gram model, the goal is to predict the context words from a given center word. Specifically, for a text sequence {w1, w2, …, wT} of length T, the Skip-Gram model tries to maximize the co-occurrence probability of the center word w T and its context words w t ,…,w t-k ,…,w t+k (where k is the window size) during training. The loss function of the Skip-Gram model can be represented as:

[0064]

[0065] where L represents the loss function, N represents the length of the text sequence, k represents the window size, j is a summation variable without actual physical meaning, and P(w t+j |w t ) represents the probability of the occurrence of the word w t when the input word is w t+j .

[0066] where the calculation formula of P(w t+j |w t ) is as follows:

[0067]

[0068] where, and represent the embedding vectors of the output word and the input word, respectively, V represents the vocabulary, v w represents the embedding vector of the word w, and w represents the vocabulary.

[0069] Further, since the cost of directly calculating Softmax is high, an approximate method such as negative sampling (Negative Sampling) or hierarchical Softmax (Hierarchical Softmax) is usually used to optimize the training process.

[0070] Further, after the Word2Vec algorithm, each word in the phrase in the triple is converted into a corresponding word vector, and each input triple is converted into a vector sequence. The input multiple vector sequences are sequentially connected at the beginning and the end to form the entire input vector sequence.

[0071] Further, since the words of the text have a specific order of arrangement, not only the words are converted into vectors, but also the position information needs to be embedded into the input model, the formula of position embedding is as follows:

[0072] PE (pos2i) = sin(pos / 10000 2i / d ),

[0073] PE (pos,2i+1) = cos(pos / 10000 2i / d )

[0074] Wherein, PE represents the output value of position embedding, pos represents the position of the word in the text, d represents the maximum value of the length of the word vector, and i represents the position of the text.

[0075] Further, the position encoding and the vector sequence of the text are added to obtain the final vector sequence as the input of Mamba-GPT.

[0076] S2: Constructing Mamba-GPT model, introducing prior knowledge injection mechanism special for power equipment, optimizing the selection mechanism of Mamba block.

[0077] Specifically, the basic structure of Mamba-GPT model is Mamba block, also known as Selective State Space Modules, and its working principle is as shown in Figure 1 The working principle of Mamba block can be divided into state space model and selection mechanism, and the input of Mamba block is vector sequence, and the output is also vector sequence.

[0078] Further, Mamba block uses state space model to model the relationship between input and output sequence, and the calculation formula of the relationship between Mamba block input and output sequence is as follows:

[0079]

[0080] y t = Ch t

[0081] Wherein, x t represents the t-th vector in the input sequence, h t represents the implicit state space, which is also represented by a vector, and it can be seen from the formula that the implicit space depends on all the vectors before the t-th input vector, thus having the function of memory, C are all matrices, and y t represents the output of the model.

[0082] Further, a special knowledge graph in the field of power equipment is constructed, and knowledge graph data in related fields is introduced. Through transfer learning, the node representation and relationship of the knowledge graph are integrated into the knowledge graph in the field of power equipment.

[0083] Further, a transfer learning strategy is designed to enable the knowledge graph to learn general features and patterns from knowledge in other fields. A prior knowledge selection module based on a dynamic attention mechanism is introduced in the input layer of the Mamba block. The node representation of the cross-domain knowledge graph obtained through transfer learning is fused with the position encoding as input. Consistency constraints are added to the loss function of the Mamba-GPT model, including node consistency constraints and edge consistency constraints. The formula of the node consistency constraint is as follows:

[0084]

[0085] wherein, L node represents the node consistency loss, represents a node in the knowledge graph, v i represents the vector representation of the node generated by the model, represents the true vector representation of the node in the knowledge graph, V k is the set of nodes in the knowledge graph.

[0086] Further, the formula of the edge consistency constraint is as follows:

[0087]

[0088] wherein, L edge represents the edge consistency loss, represents an edge connecting nodes and in the knowledge graph, e ij represents the vector representation of the edge generated by the model, represents the true vector representation of the edge in the knowledge graph, E k is the set of vectors of the edges generated by the model.

[0089] Further, the node consistency loss and the edge consistency loss are combined as the overall knowledge consistency loss, and the calculation formula of the overall knowledge consistency loss is as follows:

[0090] L consistency = λ node L node + λ edge L edge

[0091] ​Among them, L consistency λ represents the overall knowledge consistency loss. node λ represents the weighting parameter used to balance the node consistency loss. edge L represents the weighting parameter used to balance the edge consistency loss. node L represents the node consistency loss. edge This represents the edge consistency loss.

[0092] Furthermore, to ensure that different inputs have varying effects on the model state, a selection mechanism is introduced in the Mamba block. Both C and C can adapt to input x t The changes are such that the mapping relationship can be learned, and the mapping relationship is expressed as:

[0093] Δ=S Δ (x) = softplus(Linear(x) t ))

[0094] C = S C (x) = Linear(x) t )

[0095] B = S B (x) = Linear(x) t )

[0096]

[0097] Where Linear(.) represents a linear function, Δ represents the sampling interval, and S Δ (x) represents Δ It is a function that takes x as input. `softplus(Linear(x))` represents a combined function. C (x) indicates that C is a function of the input x, S B (x) indicates that B is a function of the input x. Let I represent a matrix, B represent a matrix, ΔA represent the product of Δ and A, I represent the identity matrix, and ΔB represent the product of Δ and B.

[0098] softplus(x) = log(1 + e) x )

[0099] Here, softplus(x) represents the activation function, and x represents any independent variable describing the function.

[0100] S3: Input the text information in the encoded knowledge graph into the Mamba-GPT model to complete the power equipment inspection knowledge graph, dynamically update the completed power equipment inspection knowledge graph in stages, and output it.

[0101] Specifically, the process of completing the knowledge graph for power equipment inspection includes inputting the preprocessed vector sequence into the Mamba-GPT model, converting the input text sequence into a vector sequence through multiple layers of Mamba blocks, decoding the vector sequence to generate completed text information, and converting the completed text information into new knowledge graph triples to complete the knowledge graph.

[0102] Furthermore, the Mamba-GPT model consists of multiple Mamba blocks, the structure of which is shown in the attached manual. Figure 2 As shown, the input text sequence is first converted into a vector sequence by the text embedding module, then converted into an output vector sequence by multiple layers of Mamba blocks, and finally the output vector is decoded into the output text.

[0103] Furthermore, the phased and dynamically updated knowledge graph of power equipment inspection includes collecting short-term, medium-term, and long-term data from daily inspection reports, preprocessing the collected short-term, medium-term, and long-term data respectively, generating new knowledge triples based on the preprocessed short-term, medium-term, and long-term data respectively, and calculating loss functions for each.

[0104] Furthermore, the formula for the loss function during short-term updates is as follows:

[0105]

[0106] Among them, L short This represents the loss function used for short-term updates, where T represents the total number of time steps, and f(·) represents the loss function used based on short-term prediction data x. s and the current parameter θ t The generated new knowledge triple, y t Let θ represent the actual data point at time t. t The parameter θ represents the current parameter, γ represents the regularization parameter, and M represents the parameter θ. t The total number, θ t,j Let θ represent the j-th parameter at time t. t-1,j This represents the j-th parameter at time t-1;

[0107] Furthermore, the formula for the loss function during the intermediate update process is as follows:

[0108]

[0109] Among them, L mid This represents the loss function used for the interim update, where T represents the total number of time steps, and g(·) represents the loss function used based on the interim prediction data x. m and the current parameter θ t The generated new knowledge triple, y tLet θ represent the actual data point at time t. t The parameter θ represents the current parameter, β and λ represent regularization parameters, and M represents the parameter θ. t The total number, θ t,j Let θ represent the j-th parameter at time t. t-1,j Let J represent the j-th parameter at time t-1, let conflict(·) represent the conflict function, let h, r, and t represent the triplet elements of the knowledge triplet, and let K represent the updated knowledge graph.

[0110]

[0111] Among them, L long This represents the loss function used for long-term updates, where T represents the total number of time steps, and h(·) represents the loss function used based on long-term prediction data x. l The new knowledge triple y generated from the parameter set θ t Let θ represent the actual data point at time t, θ represent the parameter set, α and κ represent regularization parameters, and M represent the total number of parameters θ. j Let j represent the j-th parameter, conflict(·) represent the conflict function, h, r, and t represent the triplet elements of the knowledge triplet, and K represent the updated knowledge graph.

[0112] Furthermore, the gradient of the loss function to be used during the update is calculated, and an optimization algorithm (such as Adam) is used to update the parameters in the completed power equipment inspection knowledge graph.

[0113] In summary, the phased, dynamically updated power equipment inspection knowledge graph enables the system to update and supplement the knowledge graph in a timely manner according to different time scales and the freshness of the data. Short-term updates can promptly reflect the latest data changes and trends, ensuring that the system can respond quickly to dynamic changes. Due to the high frequency of short-term updates, it can more accurately capture subtle changes in the data, making it more accurate and convenient for immediate decision-making. It has a strong ability to handle sudden events or short-term fluctuations, and can quickly update the knowledge graph to reflect these changes, providing real-time data support. Medium-term updates can balance short-term real-time requirements with long-term stable trends. Through appropriate frequency updates, it can better manage data changes, ensuring that the system can respond to dynamic changes in a timely manner, maintaining the stability and consistency of the system, avoiding unnecessary burdens on the system due to overly frequent updates, while also adapting to rapid business changes. Long-term updates can more comprehensively analyze and understand the long-term trends of the data, helping the system predict future development directions and trends. The data and analysis results provided by long-term updates can support long-term strategy planning and decision-making, help stabilize model parameters, and reduce unnecessary updates caused by short-term fluctuations. A reasonable phased update strategy can help the system effectively manage computing resources and storage costs while ensuring data accuracy. Through phased updates, the system can achieve optimal resource utilization without sacrificing quality.

[0114] Furthermore, in order to make the Mamba-GPT model applicable to the knowledge graph completion task, the knowledge graph needs to be converted into text and fine-tuned. In order to achieve fine-tuning of the input model, a portion of the triples in the existing power equipment inspection knowledge graph are used as input, and another portion of the triples to be completed are used as labels. The model can infer the relationships between other entities based on the input, compare the output results with the labels, and feed the differences back to the model parameters to achieve fine-tuning.

[0115] Furthermore, the fine-tuned hardware and software environment configuration is shown in Table 1.

[0116] Table 1. Fine-tuning Hardware and Software Environment Configuration Table

[0117] GPU 4x NVIDIA RTX 4090 CPU 2x Intel Xeon Gold 6248R (24 cores 48 threads) Memory 256GB DDR4 Storage 4TB NVMe SSD Network 10 Gbps Ethernet Operating System Ubuntu 22.04 LTS Deep Learning Framework PyTorch 2.0.0 CUDA 11.2 cuDNN 8.1 Python 3.10 Fine-tuning Tool Pytorch Lightning

[0118] Example 2

[0119] Reference Figures 1-3 As an embodiment of the present invention, a knowledge graph completion system for power equipment based on the Mamba-GPT model is provided, comprising:

[0120] The encoding module is used to collect and preprocess data related to power equipment inspection, construct a power equipment inspection knowledge graph based on the preprocessed data, and encode the text information in the knowledge graph.

[0121] The model building module is used to build the Mamba-GPT model, introduces a prior knowledge injection mechanism specific to power equipment, and optimizes the selection mechanism of Mamba blocks.

[0122] The completion module is used to input the text information in the encoded knowledge graph into the Mamba-GPT model, complete the power equipment inspection knowledge graph, and output the completed power equipment inspection knowledge graph.

[0123] Specific limitations regarding the Mamba-GPT-based power equipment knowledge graph completion system can be found in the above section on the limitations of the Mamba-GPT-based power equipment knowledge graph completion method, and will not be repeated here. Each module in the aforementioned Mamba-GPT-based power equipment knowledge graph completion system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, so that the processor can call and execute the corresponding operations of each module.

[0124] Example 3

[0125] Reference Figure 3 This is the third embodiment of the present invention. Based on the first two embodiments, this embodiment provides a computer device, which can be a server, and its internal structure diagram can be as follows. Figure 3 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and databases. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media.

[0126] The computer device's database is used to store motion detection data. The computer device's network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in any of the above embodiments of the sparse tensor computation acceleration method.

[0127] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0128] In one embodiment, the present invention provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in any of the above embodiments of the sparse tensor operation acceleration method.

[0129] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0130] Example 4

[0131] As an embodiment of the present invention, a method for completing the knowledge graph of power equipment based on the Mamba-GPT model is provided. To verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.

[0132] Specifically, using publicly available knowledge graph datasets (FB15k-237 and WN18RR), the Mamba-GPT model is compared with several mainstream knowledge graph completion methods, including TransE, DistMult, ComplEx, and RotatE. The input to the Mamba-GPT model is a triplet (entity 1, relation, entity 2) from the knowledge graph, and the goal is to predict missing entities or relations.

[0133] Furthermore, the knowledge graph data is preprocessed to transform it into a format suitable for Mamba-GPT input. The preprocessed data is then used to train the Mamba-GPT model. The model's completion performance is evaluated on the test set, and various evaluation metrics are calculated.

[0134] Furthermore, Table 2 shows the data comparing knowledge graph completion methods based on the FB15k-237 dataset.

[0135] Table 2 Comparative data based on the FB15k-237 dataset

[0136]

[0137] Furthermore, Table 3 shows the data comparing knowledge graph completion methods based on the WN18RR dataset.

[0138] Table 3 Comparison data based on the WN18RR dataset

[0139]

[0140] In summary, the data in the table shows that this invention, relying on the Mamba-GPT model, can better complete the knowledge graph completion task.

[0141] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A power equipment knowledge graph completion method based on a Mamba-GPT model, characterized in that, The method comprises the following steps: Collect and preprocess data related to power equipment inspection, construct a power equipment inspection knowledge graph based on the preprocessed data related to power equipment inspection, and encode the text information in the knowledge graph; Construct a Mamba-GPT model, introduce a prior knowledge injection mechanism specific to power equipment, and optimize the selection mechanism of the Mamba block; The construction of the Mamba-GPT model, the introduction of the prior knowledge injection mechanism specific to power equipment, and the optimization of the selection mechanism of the Mamba block include constructing a Mamba-GPT model structure based on the Mamba block, establishing the relationship between the input and output sequences of the Mamba block, and the calculation formula of the relationship between the input and output sequences of the Mamba block is as follows: y t = Ch t where x t represents the t-th vector in the input sequence, h t represents the hidden state space, C are matrices, y t represents the model output; Construct a special knowledge graph in the field of power equipment, introduce knowledge graph data in related fields, and integrate the node representation and relationship of the knowledge graph into the knowledge graph in the field of power equipment through transfer learning; Design a transfer learning strategy to enable the knowledge graph to learn general features and patterns from knowledge in other fields; Introduce a prior knowledge selection module based on a dynamic attention mechanism in the input layer of the Mamba block; Fuse the node representation of the cross-domain knowledge graph obtained through transfer learning with the position encoding as input; Add consistency constraints to the loss function of the Mamba-GPT model, the consistency constraints include node consistency constraints and edge consistency constraints, and the formula of the node consistency constraints is as follows: wherein L node represents a node consistency loss, represents a node in the knowledge graph, v i represents a node generated by the model vector representation, represents a true vector representation of a node in the knowledge graph, V k is a set of nodes in the knowledge graph; The formula of the edge consistency constraints is as follows: wherein L edge represents edge consistency loss, represents a vector representation of an edge e ij connecting nodes and in the knowledge graph, represents a vector representation of an edge generated by the model, represents a true vector representation of an edge e in the knowledge graph, E k is a set of vectors of edges generated by the model; Combine the node consistency loss and the edge consistency loss as the overall knowledge consistency loss, and the calculation formula of the overall knowledge consistency loss is as follows: L consistency = λ node L node + λ edge L edge wherein, L consistency represents the overall knowledge consistency loss, λ node represents the weight parameter for balancing the node consistency loss, λ edge represents the weight parameter for balancing the edge consistency loss, L node represents the node consistency loss, L edge represents the edge consistency loss; The selection mechanism is introduced in the Mamba block, so that and C can change with the input x t , and the mapping relationship can be learned, and the formula of the mapping relationship is as follows: Δ = S Δ (x) = softplus(Linear(x t )) C = S C (x) = Linear(x t ) B = S B (x) = Linear(x t ) where Linear(.) denotes a linear function, Δ denotes a sampling interval, S Δ (x) denotes that Δ is a function of input x, softplus(Linear(x)) denotes a combination function, S C (x) denotes that C is a function of input x, S B (x) denotes that B is a function of input x, denotes a matrix, denotes a matrix, ΔA denotes a product of Δ and A, I denotes an identity matrix, and ΔB denotes a product of Δ and B; softplus(x) = log(1 + e x ) Where softplus(x) represents an activation function, and x represents an arbitrary independent variable describing the function; Assemble the Mamba-GPT model by multiple Mamba blocks; Input the encoded text information in the knowledge graph into the Mamba-GPT model, complete the power equipment inspection knowledge graph, and output the completed power equipment inspection knowledge graph in stages.

2. The power equipment knowledge graph completion method based on the Mamba-GPT model according to claim 1, wherein: The construction of the power equipment inspection knowledge graph and the encoding of the text information in the knowledge graph include, Define entities, including power equipment, components, fault types, and maintenance operations, and establish relationships between entities to form triples; Convert triples to text sequences and distinguish different types of entities and relationships by marking; Generate word vectors using the Word2Vec algorithm; According to the position of the word vector in the text sequence, perform position encoding and input the position encoding.

3. The power equipment knowledge graph completion method based on the Mamba-GPT model according to claim 2, characterized in that: The use of the Word2Vec algorithm to generate word vectors includes, In the Skip-Gram model, predict the context words from a given center word, and the loss function of the Skip-Gram model is calculated as follows: where L denotes the loss function, N denotes the length of the text sequence, k denotes the window size, j is a summation variable without actual physical meaning, P(w t+j |w t ) denotes the probability of the input word w t appearing when w t+j is the word. P(wi) = N(wi) / N t+j |w t ) = N(wi) / N wherein, and respectively represent the embedding vectors of output and input words, V represents a vocabulary, v w represents the embedding vector of a word w, w represents a word.

4. The power equipment knowledge graph completion method based on the Mamba-GPT model according to claim 3, characterized in that: The formula for inputting the position encoding is as follows: PE (pos2i) = sin(pos / 10000 2i / d ) PE (pos,2i+1) = cos(pos / 10000 2i / d ) Where PE represents the output value of the position embedding, pos represents the position of the word in the text, d represents the maximum value of the length of the word vector, and i represents the position of the text.

5. The power equipment knowledge graph completion method based on the Mamba-GPT model according to claim 4, characterized in that: The completion of the power equipment inspection knowledge graph includes, Inputting the data related to the inspection of the pre-processed power equipment into the Mamba-GPT model; Converting the input text sequence into a vector sequence through multiple Mamba blocks; Decoding the vector sequence to generate the completed text information; Converting the completed text information into new knowledge graph triples to complete the knowledge graph.

6. The power equipment knowledge graph completion method based on the Mamba-GPT model according to claim 5, characterized in that: The phase-by-phase dynamic updating of the completed power equipment inspection knowledge graph includes, Collecting short-term data, medium-term data and long-term data in daily inspection reports respectively, and preprocessing the collected short-term data, medium-term data and long-term data; According to the pre-processed short-term data, medium-term data and long-term data, new knowledge triples are generated, and loss functions are calculated respectively; The formula of the loss function in the short-term updating process is as follows: wherein L short represents a loss function used for short-term updating, T represents the total number of time points, f(·) represents a short-term prediction data x s and the current parameter θ t generated new knowledge triplets, y t represents the actual data point at the t time point, θ t represents the current parameter, γ represents the regularization parameter, M represents the total number of parameters θ t , θ t,j represents the jth parameter at the t time point, θ t-1,j represents the jth parameter at the t-1 time point; The formula of the loss function in the medium-term updating process is as follows: wherein, L mid represents the loss function used in the intermediate update, T represents the total number of time points, g(·) represents the intermediate prediction data x m and the current parameter θ t generated new knowledge triplets, y t represents the actual data point at the t time point, θ t represents the current parameter, β and λ both represent the regularization parameter, M represents the total number of parameters θ t , θ t,j represents the jth parameter at the t time point, θ t-1,j represents the jth parameter at the t-1 time point, conflict(·) represents the conflict function, h, r, t respectively represent the triple elements of the knowledge triplets, K represents the updated knowledge graph; The formula of the loss function in the long-term updating process is as follows: wherein L long represents a loss function used for long-term update, T represents a total number of time points, h(·) represents new knowledge triples generated according to long-term prediction data x l and a parameter set θ, y t represents an actual data point at the t time point, θ represents a parameter set, α and κ both represent regularization parameters, M represents a total number of parameters θ, θ j represents the jth parameter, conflict(·) represents a conflict function, h, r, and t respectively represent triple elements of the knowledge triples, and K represents an updated knowledge graph. Calculate the gradient of the loss function needed in the updating process, use the optimization algorithm to update the parameters in the completed power equipment inspection knowledge graph.

7. A system employing the power equipment knowledge graph completion method based on the Mamba-GPT model according to any one of claims 1-6, characterized in that, It includes: The encoding module is used to collect and preprocess the data related to the inspection of the power equipment, construct the power equipment inspection knowledge graph according to the pre-processed data related to the inspection of the power equipment, and encode the text information in the knowledge graph; The model construction module is used to construct the Mamba-GPT model, introduce the prior knowledge injection mechanism dedicated to power equipment, and optimize the selection mechanism of Mamba block; The completion module is used to input the encoded text information in the knowledge graph into the Mamba-GPT model, complete the power equipment inspection knowledge graph, and output the phase-by-phase dynamic updating of the completed power equipment inspection knowledge graph.

8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to realize the steps of the power equipment knowledge graph completion method based on the Mamba-GPT model in any one of claims 1 to 6.

9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the power equipment knowledge graph completion method based on the Mamba-GPT model in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Knowledge graph completion method based on large language model

    CN117634604A

  • Target detection method and device, equipment and medium

    CN118196398A