Knowledge graph completion method, device, equipment and medium
Through distributed federated learning and preset technology, the knowledge graph completion method is optimized, and the problems of data privacy leakage and inefficiency in the centralized method are solved, achieving efficient and secure dynamic completion of knowledge graphs.
Patent Information
- Application Number
- CN202510822411.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-19
AI Technical Summary
In the prior art, the centralized knowledge graph completion method has the risk of data privacy leakage and cannot meet privacy compliance requirements. It is inefficient due to repeated full training, making it difficult to adapt to high-frequency data updates and dynamic completion.
The distributed federated learning method is adopted to monitor and encrypt the training of new knowledge graph data through edge servers in real time, and then aggregate and decrypt the coordination server and send it to the central server. It combines preset confrontation regularization items and comparison learning technology to complete and update it to realize data privacy protection and efficient incremental training.
It achieves efficient completion of knowledge graphs while protecting data privacy, avoids full training, improves completion efficiency and enhances model robustness, breaking the data silo problem.
Smart Images

Figure CN120598014A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge graph technology, and in particular to a knowledge graph completion method, device, equipment and medium. Background Art
[0002] Knowledge graphs can capture the complex relationships between things and provide powerful tools for information retrieval, data analysis, and decision support. Among them, the knowledge graph needs to be completed due to missing triples, missing entities, and expanded relationship types. The traditional centralized knowledge graph completion method maps entities and relationships into a vector space and predicts potential relationships through vector operations. However, data privacy is becoming increasingly important nowadays. Centralized methods need to aggregate data from multiple parties and rely on centralized data aggregation, which is prone to leaking sensitive information, cannot meet privacy compliance requirements, and face data privacy barriers when collaborating across institutions. In addition, because the knowledge graph needs to continuously integrate new entities / relationships, traditional methods need to repeat full-scale training, which is difficult to adapt to high-frequency data updates, cannot dynamically absorb new triples, require periodic global training, and have high computational overhead.
[0003] In summary, how to optimize the knowledge graph completion method to solve data privacy and island problems, as well as the inefficiency caused by repeated full training, are technical problems that need to be solved urgently. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a knowledge graph completion method, apparatus, device, and medium that can optimize the knowledge graph completion method to solve data privacy and island issues, as well as the inefficiency caused by repeated full training. The specific solution is as follows:
[0005] In a first aspect, the present application provides a knowledge graph completion method, which is applied to a knowledge graph completion system, wherein the knowledge graph completion system includes several edge servers, a coordination server, and a central server, wherein the coordination server is used to connect the several edge servers and the central server; wherein the method includes:
[0006] The plurality of edge servers monitor their respective local knowledge graphs in real time, and after detecting newly added knowledge graph data, locally train the newly added knowledge graph data using a preset graph neural network and an objective function, so as to encrypt the obtained training results and obtain corresponding encrypted training results; wherein the objective function includes a preset adversarial regularization term;
[0007] Obtaining the encrypted training results corresponding to each of the edge servers through the coordination server, and after aggregating the encrypted training results, decrypting the aggregated training results using a preset decryption method, and merging the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server;
[0008] The plaintext incremental data sent by the coordination server is obtained through the central server, the new entities in the plaintext incremental data are aligned based on the preset comparative learning technology, and the current global knowledge graph is completed and updated through the aligned plaintext incremental data.
[0009] Optionally, before monitoring the respective local knowledge graphs in real time by the plurality of edge servers, the method further includes:
[0010] Generate a corresponding key pair based on a preset homomorphic encryption algorithm through the coordination server;
[0011] Splitting the private key in the key pair into a first preset number of private key shards, and distributing the first preset number of private key shards to the plurality of edge servers; wherein the first preset number is consistent with the number of edge servers;
[0012] Accordingly, the obtained training result is encrypted to obtain the corresponding encrypted training result, including:
[0013] The training result is encrypted using the public key in the key pair to obtain a corresponding encrypted training result.
[0014] Optionally, decrypting the aggregated training results using a preset decryption method, and merging the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server includes:
[0015] Sending decryption requests containing the aggregated training results to a second preset number of edge servers, respectively, so that upon receiving the decryption requests, the edge servers use the corresponding private key shards to calculate target decryption results of the aggregated training results; wherein the second preset number is not greater than the first preset number; and the target decryption results are decryption results corresponding to the private key shards;
[0016] Obtaining the target decryption results calculated by the second preset number of edge servers;
[0017] The second preset number of target decryption results are merged by a preset interpolation algorithm to decrypt and obtain plaintext incremental data, and the plaintext incremental data is sent to the central server.
[0018] Optionally, the locally training the newly added knowledge graph data using a preset graph neural network and an objective function includes:
[0019] Constructing the preset adversarial regularization term based on the gradient obtained after training the newly added knowledge graph based on the preset graph neural network, and constructing the objective function using the preset adversarial regularization term and the preset loss function;
[0020] Constructing the newly added knowledge graph as a positive sample based on a preset triple format; the preset triple format includes a head entity, a tail entity, and a relationship between the head entity and the tail entity;
[0021] Performing a replacement operation on the head entity or the tail entity in the positive sample to obtain a replaced sample as a negative sample;
[0022] Locally, the optimization goal is to minimize the preset adversarial regularization term, and the Euclidean distance difference between the positive sample and the negative sample is compared through the preset loss function, so as to use the preset graph neural network and the objective function to train the newly added knowledge graph data; the preset graph neural network includes two convolutional layers.
[0023] Optionally, aggregating the plurality of encrypted training results includes:
[0024] Determine a time decay adjustment factor based on the change in the amount of historical new data within a preset time period, and determine the data age corresponding to the encrypted training result; the data age is the time interval from the generation of the new data corresponding to the encrypted training result to the participation in training;
[0025] Determining a time decay weight corresponding to the encrypted training result using the time decay adjustment factor and the data age;
[0026] Determine the amount of newly added data for the edge server corresponding to the encrypted training result, and determine the total amount of newly added data for the plurality of edge servers;
[0027] Determine the proportion of new data corresponding to the encrypted training result according to the amount of new data added this time and the total amount of new data added this time;
[0028] The participant weight of the corresponding edge server is calculated based on the time decay weight and the proportion of the new data, so as to aggregate a plurality of the encrypted training results according to the participant weight.
[0029] Optionally, the aligning the newly added entities in the plaintext incremental data based on a preset contrastive learning technology includes:
[0030] Determining the entity name of the newly added entity in the plaintext incremental data;
[0031] Calculating the cosine similarity between the entity names using a preset language model, and comparing the cosine similarity with a preset cosine similarity threshold to obtain a corresponding comparison result;
[0032] Determining corresponding target new entity pairs from the new entities based on the comparison results; the target new entity pairs are new entity pairs whose cosine similarity of entity names is higher than the preset cosine similarity threshold;
[0033] Using the target newly added entity pairs to construct corresponding positive sample pairs;
[0034] Randomly selecting entity pairs from different data sources in the plaintext incremental data to determine negative sample pairs;
[0035] The corresponding contrast loss is calculated using the positive sample pair, the negative sample pair, and a preset contrast loss function, so as to perform an alignment operation on the newly added entities in the plaintext incremental data according to the contrast loss.
[0036] Optionally, after completing and updating the current global knowledge graph using the aligned plaintext incremental data, the method further includes:
[0037] After the central server receives the target query instruction, it determines the corresponding knowledge reasoning result from the completed and updated global knowledge graph based on the target query instruction;
[0038] Feedback on the knowledge inference result is performed for the target query instruction, and a corresponding query log is recorded for this query, and the query log is fed back to the plurality of edge servers so that the plurality of edge servers can optimize the knowledge graph monitoring strategy based on the query log.
[0039] In a second aspect, the present application provides a knowledge graph completion device, which is applied to a knowledge graph completion system. The knowledge graph completion system includes several edge servers, a coordination server, and a central server. The coordination server is used to connect the several edge servers and the central server. The device includes:
[0040] A knowledge graph data training module is configured to monitor the local knowledge graphs of the plurality of edge servers in real time, and upon detecting newly added knowledge graph data, locally train the newly added knowledge graph data using a preset graph neural network and an objective function, thereby encrypting the obtained training results to obtain corresponding encrypted training results; wherein the objective function includes a preset adversarial regularization term;
[0041] a training result decryption module, configured to obtain the encrypted training results corresponding to each of the plurality of edge servers through the coordination server, decrypt the aggregated training results using a preset decryption method after aggregating the plurality of encrypted training results, and merge the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server;
[0042] The knowledge graph completion module is used to obtain the plaintext incremental data sent by the coordination server through the central server, align the new entities in the plaintext incremental data based on the preset comparative learning technology, and complete and update the current global knowledge graph through the aligned plaintext incremental data.
[0043] In a third aspect, the present application provides an electronic device, comprising:
[0044] Memory, used to store computer programs;
[0045] A processor is used to execute the computer program to implement the aforementioned knowledge graph completion method.
[0046] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned knowledge graph completion method is implemented.
[0047] In this application, the several edge servers monitor their respective local knowledge graphs in real time, and after monitoring the newly added knowledge graph data, they use a preset graph neural network and objective function to train the newly added knowledge graph data locally to encrypt the obtained training results and obtain corresponding encrypted training results; wherein, the objective function includes a preset adversarial regularization term; the coordination server obtains the corresponding encrypted training results from the several edge servers, and after aggregating several of the encrypted training results, decrypts the aggregated training results using a preset decryption method, and merges the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server; the central server obtains the plaintext incremental data sent by the coordination server, aligns the new entities in the plaintext incremental data based on a preset comparative learning technology, and completes and updates the current global knowledge graph through the aligned plaintext incremental data. As can be seen from the above, the present application monitors the local knowledge graphs of each of the edge servers in real time through several edge servers, and after monitoring the newly added knowledge graph data, locally uses the preset graph neural network and objective function to train the newly added knowledge graph data to obtain the encrypted training results after encrypting the training results, obtains the encrypted training results corresponding to each of the edge servers through the coordination server, and decrypts the aggregated training results after aggregation using the preset decryption method, and merges the decrypted training results through the preset interpolation algorithm, so that the central server obtains the obtained plaintext incremental data, aligns the new entities in the plaintext incremental data based on the preset comparative learning technology, and completes and updates the current global knowledge graph through the aligned plaintext incremental data. In this way, through the above process of this application, a distributed federated learning method is used for model training, and there is no need for the participants corresponding to each edge server to share the original data, thereby achieving data privacy protection; the preset graph neural network is used to train only the newly added knowledge graph data, avoiding global retraining and improving the completion efficiency; a preset adversarial regularization term is added during the training process to prevent toxic data from disturbing the model, thereby improving the robustness of the model, and then optimizing the knowledge graph completion method to solve data privacy and island problems, as well as the inefficiency caused by repeated full training. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0049] Figure 1 A flow chart of a knowledge graph completion method disclosed in this application;
[0050] Figure 2 This is a flow chart of a knowledge graph completion method disclosed in this application;
[0051] Figure 3 This is a schematic diagram of the structure of a knowledge graph completion device disclosed in this application;
[0052] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0053] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0054] The knowledge graph needs to be completed due to reasons such as missing triples, missing entities, and expanded relationship types. Traditional centralized knowledge graph completion methods map entities and relationships into vector spaces and predict potential associations through vector operations. However, data privacy is becoming increasingly important nowadays. Centralized methods need to aggregate data from multiple parties and rely on centralized data aggregation, which can easily leak sensitive information and fail to meet privacy compliance requirements. They also face data privacy barriers when collaborating across institutions. In addition, because the knowledge graph needs to continuously integrate new entities / relationships, traditional methods require repeated full-scale training, are difficult to adapt to high-frequency data updates, cannot dynamically absorb new triples, require periodic global training, and have high computational overhead.
[0055] In order to overcome the above technical problems, this application provides a knowledge graph completion method to optimize the knowledge graph completion method to solve data privacy and island problems, as well as the inefficiency caused by repeated full training.
[0056] See also Figure 1 As shown, an embodiment of the present invention discloses a knowledge graph completion method, which is applied to a knowledge graph completion system. The knowledge graph completion system includes several edge servers, a coordination server, and a central server. The coordination server is used to connect the several edge servers and the central server. The method includes:
[0057] Step S11: Monitor the local knowledge graphs of each of the edge servers in real time through the edge servers, and after monitoring the newly added knowledge graph data, train the newly added knowledge graph data locally using a preset graph neural network and objective function to encrypt the obtained training results to obtain corresponding encrypted training results; wherein, the objective function includes a preset adversarial regularization term.
[0058] In this embodiment, the several edge servers in the knowledge graph completion system monitor their respective local knowledge graphs in real time, and after monitoring the newly added knowledge graph data, the preset graph neural network and objective function are used to train the newly added knowledge graph locally to encrypt the obtained training results and obtain the corresponding encrypted training results. Among them, the knowledge graph can be a medical industry knowledge graph or a manufacturing industry knowledge graph; the newly added knowledge graph data can be newly added triples, such as device sensor data, medical records, etc.; the objective function contains a preset adversarial regularization term; the preset graph neural network is a lightweight small graph convolutional neural network designed for newly added data, which only contains 2 layers of convolution and uses channel pruning technology to reduce the number of parameters. It only updates the entity and relationship embeddings of the affected subgraph to avoid full calculation. It can be understood that in order to facilitate subsequent training operations, after monitoring the newly added knowledge graph data, this embodiment can also perform pre-processing operations such as filtering noise and standardizing the format.
[0059] It should be noted that the knowledge graph completion system of this embodiment includes several edge servers, coordination servers and central servers, which correspond to the edge layer, coordination layer and global layer. Among them, the several edge servers are deployed locally at each participant such as hospitals and factories, and are responsible for capturing new knowledge graph data in real time and performing lightweight knowledge graph incremental training as edge nodes; the coordination server is responsible for aggregating multi-party updates and dynamically allocating weights as a central coordination node; the central server is used to store and maintain the global knowledge graph and provide a unified query and reasoning interface. Figure 2Shown is a flow chart of a knowledge graph completion method provided by this application. A knowledge graph is a model for representing information and data, which can describe entities and their relationships through nodes and edges, and usually expresses information by triples. Knowledge graph completion refers to the automatic identification and filling of missing entities, relationships or attributes in a knowledge graph through technical means to improve its completeness and quality. Among them, the completion content may include: missing triples: predicting relationships between entities that are not clearly recorded, such as completing (Einstein, proposed, relativity); entity completion: adding entities that are missing from the graph, such as adding "quantum entanglement" as a new entity; relationship type expansion: identifying new relationship types to enrich semantics, such as defining a "collaborative research and development" relationship. When the knowledge graph needs to be completed, it is first trained locally through the several edge servers, and then the gradient aggregation operation is performed through the coordination server. The central server uses the aggregated gradient to update the global knowledge graph, and adjusts the global knowledge graph through the preset comparative learning technology to obtain an updated global knowledge graph. At the same time, the updated global knowledge graph parameters are distributed to the several edge servers so that the several edge servers can perform the next round of federated training.
[0060] It should be pointed out that in order to constrain the trained model to be insensitive to disturbances in the newly added data, this embodiment can include the preset adversarial regularization term in the objective function. Therefore, the processing flow of locally training the newly added knowledge graph data using the preset graph neural network and the objective function is as follows: constructing the preset adversarial regularization term based on the gradient obtained after training the newly added knowledge graph based on the preset graph neural network, and constructing the objective function using the preset adversarial regularization term and the preset loss function; constructing the newly added knowledge graph as a positive sample based on the preset triple format; the preset triple format includes a head entity, a tail entity, and the relationship between the head entity and the tail entity; performing a replacement operation on the head entity or the tail entity in the positive sample to use the replaced sample as a negative sample; locally minimizing the preset adversarial regularization term as the optimization goal, comparing the Euclidean distance difference between the positive sample and the negative sample through the preset loss function, so as to train the newly added knowledge graph data using the preset graph neural network and the objective function; the preset graph neural network includes two convolutional layers. Among them, the preset triple format refers to the basic structure of the knowledge graph, including entities and relationships, in the form of (head entity, relationship, tail entity), usually abbreviated as (h, r, t); the entity is the core component of the knowledge graph, referring to concrete or abstract things in the real world, such as people, places, events, etc.; the relationship is a link connecting two or more entities, forming a meaningful information network, indicating a certain connection between them, such as "friend", "located", etc. In addition, the preset triple format can also include attributes of information used to describe entity characteristics, such as a person's name, date of birth, etc., which can provide a more detailed description of the entity and can be modeled into the triple in a manner similar to a relationship for unified processing. That is, determine the gradient obtained after the preset graph neural network is trained on the newly added knowledge graph, and construct the preset adversarial regularization term based on the gradient, wherein the expression formula of the preset adversarial regularization term can be specifically:
[0061] ;
[0062] in, The preset adversarial regularization term is used to measure the sensitivity of the model to input data perturbations; is the gradient, where For input data, For input data The gradient operator represents the sensitivity of the model output to changes in the input. Input data to the model The output of ; E is the expected value, which is the expected value calculated based on all samples in the current training batch. Then, the objective function is constructed using the preset adversarial regularization term and the preset loss function, wherein the expression formula of the objective function can be specifically:
[0063] ;
[0064] in, The preset loss function is the loss function of the model on the core task (i.e., knowledge graph completion), which aims to optimize the model's prediction ability for entities, relations, and triples; is a preset hyperparameter with a value range of 0.1-0.5. The final value can be determined through experiments. The expression formula of the preset loss function can be specifically:
[0065] ;
[0066] in, Represents all positive sample triplets A collection of Represents all negative sample triplets The set can be obtained by replacing the head entity or tail entity of the positive sample, for example, replacing "Einstein" with "Newton"; is the embedding vector; It is a margin hyperparameter, usually set to 1, which is used to control the discrimination between positive and negative samples; express The square of the norm is used to calculate the square of the Euclidean distance between two vectors. The preset loss function compares the distance difference between the positive sample and the negative sample, and uses the max(0,∙) operation to ensure that a non-zero loss is generated only when the negative sample is closer than the positive sample, thereby promoting the model to learn better vector representations of entities and relationships. Therefore, in order to train the newly added knowledge graph data, this embodiment needs to construct the newly added knowledge graph as a positive sample based on the preset triple format, and replace the head entity or tail entity in the positive sample to use the replaced sample as a negative sample, and then locally minimize the preset adversarial regularization term as the optimization goal, constraining the output of the model to be insensitive to input changes, thereby improving robustness, and comparing the Euclidean distance difference between the positive sample and the negative sample through the preset loss function to train the newly added knowledge graph data using the preset graph neural network and the objective function.
[0067] It should be further noted that, in order to enhance data privacy during model training, this embodiment can introduce a privacy protection mechanism, specifically combining homomorphic encryption technology with threshold decryption technology to prevent gradient backpropagation or intermediate data leakage, thereby protecting data privacy. Therefore, the processing flow before the multiple edge servers monitor their respective local knowledge graphs in real time is as follows: the coordination server generates a corresponding key pair based on a preset homomorphic encryption algorithm; splits the private key in the key pair into a first preset number of private key shards, and distributes the first preset number of private key shards to the multiple edge servers; wherein the first preset number is consistent with the number of servers in the multiple edge servers, and the preset homomorphic encryption algorithm includes but is not limited to the Paillier encryption algorithm, the RSA encryption algorithm, etc. That is, first, in the initialization phase, the coordination server generates a corresponding key pair based on a preset homomorphic encryption algorithm, splits the private key therein into a number of private key shards consistent with the number of servers in the multiple edge servers, and distributes them to the multiple edge servers, i.e., each participant. Accordingly, the processing flow for encrypting the training results is as follows: the training results are encrypted using the public key in the key pair to obtain the corresponding encrypted training results. That is, the training results trained by each edge server are encrypted using the public key in the key pair to obtain encrypted training results. In this way, when the knowledge graph needs to be completed, the edge server of each participant updates the local knowledge graph through incremental learning, updating only the model part related to the newly added data, thus avoiding full computation. Based on several edge servers, coordination servers, and central servers, a federated learning approach is used for model training, allowing multiple participants to collaborate on model training without sharing the original data, thereby breaking the data silo problem while protecting data privacy. Including a preset adversarial regularization term in the objective function of the training model can constrain the trained model to be insensitive to perturbations in the newly added data, enhance the robustness of the model, and perform more stably in scenarios such as the Industrial Internet of Things. The use of the max(0,∙) operation in the constructed preset loss function ensures that a non-zero loss is generated only when the negative sample is closer than the positive sample, which can promote the model to learn better vector representations of entities and relationships. The use of homomorphic encryption technology in the model training process can enhance data privacy protection during model training, and at the same time, combined with threshold decryption technology, it can prevent gradient backpropagation or intermediate data leakage.
[0068] Step S12: Obtain the encrypted training results corresponding to each of the edge servers through the coordination server, and after aggregating the encrypted training results, decrypt the aggregated training results using a preset decryption method, and merge the decrypted training results through a preset interpolation algorithm to send the obtained plaintext incremental data to the central server.
[0069] In this embodiment, the coordination server obtains the encrypted training results corresponding to each of the edge servers, aggregates the encrypted training results to obtain an aggregated training result, decrypts the aggregated training result using a preset decryption method, and merges the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server. The preset decryption method can be a threshold decryption technology.
[0070] It should be noted that the processing flow of aggregating several of the encrypted training results is as follows: determining a time decay adjustment factor based on the change in the amount of historical new data within a preset time period, and determining the data age corresponding to the encrypted training result; the data age is the time interval from the generation of the new data corresponding to the encrypted training result to the participation in training; using the time decay adjustment factor and the data age to determine the time decay weight corresponding to the encrypted training result; determining the amount of new data of the edge server corresponding to the encrypted training result, and determining the total amount of new data of the several edge servers; determining the proportion of new data corresponding to the encrypted training result based on the amount of new data and the total amount of new data; calculating the participant weight of the corresponding edge server based on the time decay weight and the proportion of new data, so as to aggregate several of the encrypted training results according to the participant weight. That is, this embodiment calculates the participant weight based on data freshness, that is, the time decay weight, and contribution, that is, the proportion of new data, so as to weight based on the participant weight, and then fuse the encrypted local model update. Among them, the calculation formula of the time decay weight can be specifically:
[0071] ;
[0072] in, The time decay weight represents the weight assigned to a participant's newly added data during federation aggregation, and is used to quantify the contribution of the data to the global model update. The time decay adjustment factor, that is, the adjustment factor that controls the decay speed of the weight over time, is a predefined hyperparameter. A sliding window mechanism can be introduced to automatically adjust according to the change in the amount of new data in the past period of time. For example, if the amount of data surges recently, reduce To give priority to new data; t is the data age, which represents the time interval from the generation of new data to the participation in federated training. Therefore, this embodiment first determines the time decay adjustment factor based on the change in the amount of historical new data within a preset time period, and determines the data age of the encrypted training result, so as to use the time decay adjustment factor and the data age to determine the corresponding time decay weight. In addition, the calculation formula for the proportion of new data can be specifically:
[0073] ;
[0074] in, is the contribution weight, that is, the proportion of new data, which represents the proportion of the new data of the i-th participant in all participants, and is used to quantify the contribution of the participant to the global model update. The sum is 1; represents the number of new knowledge triples added by the i-th participant in this incremental training cycle; Represents the total amount of new data added by all participants. Therefore, after determining the time decay weight, this embodiment determines the amount of new data added by the edge server corresponding to the encrypted training result, as well as the total amount of new data added by the multiple edge servers. Based on the amount of new data added and the total amount of new data added, the corresponding new data percentage is determined. Furthermore, based on the time decay weight and the new data percentage, the participant weight of the corresponding edge server is calculated, and the multiple encrypted training results are aggregated according to the participant weight.
[0075] It should be further pointed out that the processing flow for decrypting and merging the aggregated training results to send the obtained plaintext incremental data to the central server is as follows: sending decryption requests containing the aggregated training results to a second preset number of edge servers respectively, so that after receiving the decryption request, the edge server uses the corresponding private key shard to calculate the target decryption result of the aggregated training result; wherein the second preset number is not greater than the first preset number; the target decryption result is the decryption result corresponding to the private key shard; obtaining the target decryption result calculated by the second preset number of edge servers; merging the second preset number of target decryption results through a preset interpolation algorithm to decrypt and obtain the plaintext incremental data, and sending the plaintext incremental data to the central server. That is, after obtaining the aggregated training results, target edge servers whose number is no greater than the total number of servers are determined from the plurality of edge servers, and decryption requests containing the aggregated training results are sent to the target edge servers respectively, so that the target edge servers use the private key shards they hold to calculate the partial target decryption results of the aggregated training results. The coordination server obtains the target decryption results calculated by it from the target edge servers, and merges them through a preset interpolation algorithm to obtain plaintext incremental data, and sends it to the central server so that the central server can update the global knowledge graph. In this way, this embodiment calculates the participant weights based on the time decay weights and the proportion of new data, and performs the aggregation operation of the encrypted training results based on the participant weights. The time decay weights can fairly distribute the model update weights, while encouraging the contribution of high-quality data and promoting the continuous optimization of the global knowledge graph. The proportion of new data can dynamically focus on high-value new data, thereby improving the efficiency and accuracy of model updates. After obtaining the aggregated training results, they are decrypted and merged through the threshold decryption technology, which can effectively prevent the occurrence of gradient backpropagation or intermediate data leakage.
[0076] Step S13: Obtain the plaintext incremental data sent by the coordination server through the central server, align the new entities in the plaintext incremental data based on the preset comparative learning technology, and complete and update the current global knowledge graph through the aligned plaintext incremental data.
[0077] In this embodiment, the plaintext incremental data sent by the coordination server is obtained through the central server, and the newly added entities in the plaintext incremental data are aligned using a preset comparative learning technology, so as to complete and update the current global knowledge graph using the aligned plaintext incremental data.
[0078] It should be pointed out that since the data sources in the plaintext incremental data are different, in order to ensure the consistency of entity representation between knowledge graphs from different sources, the central server of this embodiment needs to perform alignment operations on the new entities therein after obtaining the plaintext incremental data. The processing flow is as follows: determine the entity names of the new entities in the plaintext incremental data; use a preset language model to calculate the cosine similarity between the entity names, and compare the cosine similarity with the preset cosine similarity threshold to obtain a corresponding comparison result; based on the comparison result, determine a corresponding number of target new entity pairs from the new entities; the target new entity pairs are new entity pairs whose cosine similarity of the entity names is higher than the preset cosine similarity threshold; use the several target new entity pairs to construct corresponding positive sample pairs; randomly select entity pairs from different data sources in the plaintext incremental data to determine negative sample pairs; calculate the corresponding contrast loss through the positive sample pairs, the negative sample pairs and the preset contrast loss function, so as to perform alignment operations on the new entities in the plaintext incremental data according to the contrast loss. The positive sample pair is two samples with different representations of the same concept, that is, two entities representing the same or very similar concepts; the negative sample pair is an entity pair with different semantic meanings. In other words, each participant jointly constructs anchor entity pairs based on local new data, such as the gene mutation of hospital A and the DNA variation of hospital B, and aligns the embedding space through comparative learning. Specifically, the entity names of the newly added entities in the plaintext incremental data are first determined, and the cosine similarity between the entity names is calculated using a preset language model. The cosine similarity between the entity names is compared with a preset cosine similarity threshold such as 0.8 to determine the target newly added entity pairs whose cosine similarity between the entity names is higher than the preset cosine similarity threshold, and construct them as positive sample pairs. At the same time, based on the negative sampling strategy of the graph structure, entity pairs are randomly selected from different data sources in the plaintext incremental data, that is, from unconnected subgraphs, to determine negative sample pairs to ensure semantic independence, so as to help the model distinguish different concepts. Subsequently, the corresponding contrast loss is calculated using the positive sample pairs, the negative sample pairs, and the preset contrast loss function to perform alignment operations on the newly added entities in the plaintext incremental data according to the contrast loss. Among them, the calculation formula of the preset contrast loss function can be specifically:
[0079] ;
[0080] in, is the similarity score of the positive sample pair, is the similarity score of the negative sample pair, is the temperature coefficient. It is obtained by cosine similarity, and its calculation formula can be specifically:
[0081] ;
[0082] in, and It is the embedding vector obtained by inputting the preset graph neural network into the positive sample pair. The calculation of is the same as above. The preset contrastive loss function aims to minimize the distance between pairs of positive examples while maximizing the distance between pairs of negative examples. This helps adjust entity embeddings so that similar entities are closer in the embedding space and dissimilar entities are farther apart, thereby optimizing relevant parameters and completing and updating the global knowledge graph.
[0083] It should be further noted that after completing and updating the current global knowledge graph, this embodiment can continuously optimize based on the query reasoning results of the global knowledge graph. The processing flow is as follows: after the central server receives a target query instruction, it determines the corresponding knowledge reasoning results from the completed and updated global knowledge graph based on the target query instruction; feedback is provided on the knowledge reasoning results for the target query instruction, and a corresponding query log is recorded for this query, and the query log is fed back to the edge servers so that the edge servers can optimize the knowledge graph monitoring strategy based on the query log. That is, after the central server receives a target query instruction initiated by a user, such as "common failure modes of device A", it determines the corresponding knowledge reasoning results from the completed and updated global knowledge graph based on the target query instruction, and feeds the knowledge reasoning results back to the user for this target query instruction; at the same time, it records the corresponding query log for this query and feeds it back to the edge servers so that the edge servers can optimize the knowledge graph monitoring strategy based on the query log. For example, the central server can determine the related devices with high frequency queries based on the query log so as to prioritize the monitoring of the related devices with high frequency queries. In this way, after obtaining the plaintext incremental data, this embodiment uses the preset contrastive learning technology to align the newly added entities therein to ensure the consistency of entity representation between knowledge graphs from different sources; by minimizing the distance between positive sample pairs and maximizing the distance between negative sample pairs through the preset contrast loss function, it helps to adjust the entity embedding so that similar entities are closer in the embedding space, while dissimilar entities are farther away, thereby ensuring the consistency of entities; in the actual use of the global knowledge graph, the query log is recorded and fed back so as to optimize the knowledge graph monitoring strategy based on the query log and improve the adaptability and training efficiency of the model training method.
[0084] As can be seen from the above, the embodiment of the present application monitors the local knowledge graphs of each of the edge servers in real time through several edge servers, and after monitoring the newly added knowledge graph data, locally uses the preset graph neural network and objective function to train the newly added knowledge graph data to obtain the encrypted training results after encrypting the training results, obtains the encrypted training results corresponding to each of the edge servers through the coordination server, and decrypts the aggregated training results after aggregation using the preset decryption method, and merges the decrypted training results through the preset interpolation algorithm, so that the central server obtains the obtained plaintext incremental data, aligns the new entities in the plaintext incremental data based on the preset comparative learning technology, and completes and updates the current global knowledge graph through the aligned plaintext incremental data.In this way, through the above process of the embodiment of the present application, on the one hand, when the knowledge graph needs to be completed, the edge server of each participant updates the local knowledge graph through the incremental learning method, and only updates the model part related to the newly added data, which can avoid full calculation; on the other hand, based on several edge servers, coordination servers and central servers, the model training is carried out in a federated learning manner, which can allow multiple participants to collaborate on training models without sharing the original data, thereby breaking the data island problem while protecting data privacy; on the other hand, the preset adversarial regularization term is included in the objective function of the training model, which can constrain the training The trained model is insensitive to the disturbance in the new data, which enhances the robustness of the model and performs more stably in scenarios such as the Industrial Internet of Things. On the one hand, the use of the max(0,∙) operation in the preset loss function ensures that non-zero loss is generated only when the negative sample is closer than the positive sample, which can promote the model to learn better vector representations of entities and relationships. On the other hand, the use of homomorphic encryption technology in the model training process can enhance the privacy protection of data during the model training process, and at the same time combine the threshold decryption technology to prevent gradient backpropagation or intermediate data leakage. On the other hand, the weight of the participants is calculated based on the time decay weight and the proportion of new data, so as to The encrypted training results are re-aggregated. Time-decayed weights can fairly distribute model update weights, incentivize high-quality data contributions, and promote continuous optimization of the global knowledge graph. The proportion of new data can dynamically focus on high-value new data, improving the efficiency and accuracy of model updates. After obtaining the aggregated training results, they are decrypted and merged using threshold decryption technology, which can effectively prevent gradient backpropagation or intermediate data leakage. After obtaining the plaintext incremental data, the newly added entities are aligned using a preset contrastive learning technology to ensure consistency in entity representation across knowledge graphs from different sources. A preset contrastive loss function is used to minimize the distance between positive sample pairs and maximize the distance between negative sample pairs, which helps adjust entity embeddings so that similar entities are closer in the embedding space and dissimilar entities are farther apart, ensuring entity consistency. During the actual use of the global knowledge graph, query logs are recorded and fed back to optimize the knowledge graph monitoring strategy based on the query logs, improve the adaptability and training efficiency of the model training method, and further optimize the knowledge graph completion method to address data privacy and island issues, as well as the inefficiency caused by repeated full training.
[0085] Accordingly, see Figure 3As shown, the embodiment of the present application also provides a knowledge graph completion device, which is applied to a knowledge graph completion system. The knowledge graph completion system includes several edge servers, a coordination server, and a central server. The coordination server is used to connect the several edge servers and the central server; wherein the device includes:
[0086] The knowledge graph data training module 11 is configured to monitor the local knowledge graphs of the respective edge servers in real time, and after detecting newly added knowledge graph data, locally train the newly added knowledge graph data using a preset graph neural network and an objective function, thereby encrypting the obtained training results to obtain corresponding encrypted training results; wherein the objective function includes a preset adversarial regularization term;
[0087] A training result decryption module 12 is configured to obtain the encrypted training results corresponding to each of the edge servers through the coordination server, and after aggregating the encrypted training results, decrypt the aggregated training results using a preset decryption method, and merge the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server;
[0088] The knowledge graph completion module 13 is used to obtain the plaintext incremental data sent by the coordination server through the central server, align the new entities in the plaintext incremental data based on the preset comparative learning technology, and complete and update the current global knowledge graph through the aligned plaintext incremental data.
[0089] As can be seen from the above, the embodiment of the present application monitors the local knowledge graphs of each of the edge servers in real time through several edge servers, and after monitoring the newly added knowledge graph data, locally uses the preset graph neural network and objective function to train the newly added knowledge graph data to obtain the encrypted training results after encrypting the training results, obtains the encrypted training results corresponding to each of the edge servers through the coordination server, and decrypts the aggregated training results after aggregation using the preset decryption method, and merges the decrypted training results through the preset interpolation algorithm, so that the central server obtains the obtained plaintext incremental data, aligns the new entities in the plaintext incremental data based on the preset comparative learning technology, and completes and updates the current global knowledge graph through the aligned plaintext incremental data. In this way, through the above process of the embodiment of the present application, a distributed federated learning method is used for model training, and there is no need for the participants corresponding to each edge server to share the original data, thereby achieving data privacy protection; the preset graph neural network is used to train only the newly added knowledge graph data, avoiding global retraining and improving the completion efficiency; a preset adversarial regularization term is added during the training process to prevent toxic data from disturbing the model, thereby improving the robustness of the model, and then optimizing the knowledge graph completion method to solve data privacy and island problems, as well as the inefficiency caused by repeated full training.
[0090] In some specific implementations, the knowledge graph completion device may further include:
[0091] A key pair generation unit, configured to generate a corresponding key pair based on a preset homomorphic encryption algorithm through the coordination server;
[0092] a shard distribution unit, configured to split the private key in the key pair into a first preset number of private key shards, and distribute the first preset number of private key shards to the plurality of edge servers; wherein the first preset number is consistent with the number of edge servers;
[0093] Accordingly, the knowledge graph data training module 11 may specifically include:
[0094] The result encryption unit is used to encrypt the training result obtained by using the public key in the key pair to obtain the corresponding encrypted training result.
[0095] In some specific implementations, the training result decryption module 12 may specifically include:
[0096] a request sending unit, configured to send decryption requests containing the aggregated training results to a second preset number of edge servers, respectively, so that the edge servers, after receiving the decryption requests, calculate target decryption results of the aggregated training results using the corresponding private key shards; wherein the second preset number is not greater than the first preset number; and the target decryption results are decryption results corresponding to the private key shards;
[0097] A result obtaining unit, configured to obtain the target decryption results calculated by the second preset number of edge servers;
[0098] A result merging unit is used to merge the second preset number of target decryption results through a preset interpolation algorithm to decrypt and obtain plaintext incremental data, and send the plaintext incremental data to the central server.
[0099] In some specific implementations, the knowledge graph data training module 11 may specifically include:
[0100] A function construction unit, configured to construct the preset adversarial regularization term based on the gradient obtained after training the newly added knowledge graph using a preset graph neural network, and to construct an objective function using the preset adversarial regularization term and a preset loss function;
[0101] A positive sample construction unit, configured to construct the newly added knowledge graph as a positive sample based on a preset triple format; the preset triple format includes a head entity, a tail entity, and a relationship between the head entity and the tail entity;
[0102] An entity replacement unit, configured to replace the head entity or the tail entity in the positive sample, so as to use the obtained replaced sample as a negative sample;
[0103] A difference comparison unit is used to locally compare the Euclidean distance difference between the positive sample and the negative sample with the preset loss function with the goal of minimizing the preset adversarial regularization term, so as to train the newly added knowledge graph data using the preset graph neural network and the objective function; the preset graph neural network includes two convolutional layers.
[0104] In some specific implementations, the training result decryption module 12 may specifically include:
[0105] an age determination unit, configured to determine a time decay adjustment factor based on a change in the amount of historical newly added data within a preset time period, and determine the data age corresponding to the encrypted training result; the data age being the time interval between the generation of the newly added data corresponding to the encrypted training result and the participation in training;
[0106] a weight determination unit, configured to determine a time decay weight corresponding to the encrypted training result using the time decay adjustment factor and the data age;
[0107] A data volume determination unit, configured to determine the amount of newly added data of the edge server corresponding to the encrypted training result, and determine the total amount of newly added data of the plurality of edge servers;
[0108] A proportion determining unit, configured to determine a proportion of new data corresponding to the encrypted training result according to the amount of new data added this time and the total amount of new data added this time;
[0109] A weight calculation unit is used to calculate the participant weight of the corresponding edge server based on the time decay weight and the proportion of the new data, so as to aggregate a number of the encrypted training results according to the participant weight.
[0110] In some specific implementations, the knowledge graph completion module 13 may specifically include:
[0111] a name determination unit, configured to determine an entity name of a newly added entity in the plaintext incremental data;
[0112] A threshold comparison unit, configured to calculate the cosine similarity between each of the entity names using a preset language model, and compare the cosine similarity with a preset cosine similarity threshold to obtain a corresponding comparison result;
[0113] an entity pair determining unit, configured to determine a corresponding plurality of target new entity pairs from the new entities based on the comparison result; the target new entity pairs being new entity pairs whose cosine similarity of entity names is higher than a preset cosine similarity threshold;
[0114] A positive sample pair construction unit, configured to construct corresponding positive sample pairs using the plurality of target newly added entity pairs;
[0115] an entity pair selection unit, configured to randomly select entity pairs from different data sources in the plaintext incremental data to determine negative sample pairs;
[0116] A loss calculation unit is used to calculate the corresponding contrast loss through the positive sample pair, the negative sample pair and a preset contrast loss function, so as to align the newly added entities in the plaintext incremental data according to the contrast loss.
[0117] In some specific implementations, the knowledge graph completion device may further include:
[0118] A result determination unit is configured to determine, after the central server receives the target query instruction, a corresponding knowledge reasoning result from the completed and updated global knowledge graph based on the target query instruction;
[0119] A log feedback unit is used to provide feedback on the knowledge inference result for the target query instruction, record the corresponding query log for this query, and feed back the query log to the several edge servers so that the several edge servers can optimize the knowledge graph monitoring strategy based on the query log.
[0120] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be considered as any limitation on the scope of use of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the knowledge graph completion method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0121] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0122] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0123] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of completing the knowledge graph completion method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 may further include a computer program capable of completing other specific tasks.
[0124] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned knowledge graph completion method. For the specific steps of this method, please refer to the corresponding content disclosed in the aforementioned embodiments and will not be repeated here.
[0125] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0126] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0127] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0128] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0129] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A knowledge graph completion method, characterized in that: Applied to a knowledge graph completion system, the knowledge graph completion system includes several edge servers, a coordination server, and a central server, the coordination server is used to connect the several edge servers and the central server; wherein the method includes: The plurality of edge servers monitor their respective local knowledge graphs in real time, and after detecting newly added knowledge graph data, locally train the newly added knowledge graph data using a preset graph neural network and an objective function, so as to encrypt the obtained training results and obtain corresponding encrypted training results; wherein the objective function includes a preset adversarial regularization term; Obtaining the encrypted training results corresponding to each of the edge servers through the coordination server, and after aggregating the encrypted training results, decrypting the aggregated training results using a preset decryption method, and merging the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server; The plaintext incremental data sent by the coordination server is obtained through the central server, the new entities in the plaintext incremental data are aligned based on the preset comparative learning technology, and the current global knowledge graph is completed and updated through the aligned plaintext incremental data.
2. The knowledge graph completion method according to claim 1, characterized in that: Before the real-time monitoring of the local knowledge graphs by the plurality of edge servers, the method further includes: Generate a corresponding key pair based on a preset homomorphic encryption algorithm through the coordination server; Splitting the private key in the key pair into a first preset number of private key shards, and distributing the first preset number of private key shards to the plurality of edge servers; wherein the first preset number is consistent with the number of edge servers; Accordingly, the obtained training result is encrypted to obtain the corresponding encrypted training result, including: The training result is encrypted using the public key in the key pair to obtain a corresponding encrypted training result.
3. The knowledge graph completion method according to claim 2, characterized in that: Decrypting the aggregated training results using a preset decryption method, and merging the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server, includes: Sending decryption requests containing the aggregated training results to a second preset number of edge servers, respectively, so that upon receiving the decryption requests, the edge servers use the corresponding private key shards to calculate target decryption results of the aggregated training results; wherein the second preset number is not greater than the first preset number; and the target decryption results are decryption results corresponding to the private key shards; Obtaining the target decryption results calculated by the second preset number of edge servers; The second preset number of target decryption results are merged by a preset interpolation algorithm to decrypt and obtain plaintext incremental data, and the plaintext incremental data is sent to the central server.
4. The knowledge graph completion method according to claim 1, characterized in that: The locally training the newly added knowledge graph data using a preset graph neural network and an objective function includes: Constructing the preset adversarial regularization term based on the gradient obtained after training the newly added knowledge graph based on the preset graph neural network, and constructing the objective function using the preset adversarial regularization term and the preset loss function; Constructing the newly added knowledge graph as a positive sample based on a preset triple format; the preset triple format includes a head entity, a tail entity, and a relationship between the head entity and the tail entity; Performing a replacement operation on the head entity or the tail entity in the positive sample to obtain a replaced sample as a negative sample; Locally, the optimization goal is to minimize the preset adversarial regularization term, and the Euclidean distance difference between the positive sample and the negative sample is compared through the preset loss function, so as to use the preset graph neural network and the objective function to train the newly added knowledge graph data; the preset graph neural network includes two convolutional layers.
5. The knowledge graph completion method according to claim 1, characterized in that: The aggregating the encrypted training results includes: Determine a time decay adjustment factor based on the change in the amount of historical new data within a preset time period, and determine the data age corresponding to the encrypted training result; the data age is the time interval from the generation of the new data corresponding to the encrypted training result to the participation in training; Determining a time decay weight corresponding to the encrypted training result using the time decay adjustment factor and the data age; Determine the amount of newly added data for the edge server corresponding to the encrypted training result, and determine the total amount of newly added data for the plurality of edge servers; Determine the proportion of new data corresponding to the encrypted training result according to the amount of new data added this time and the total amount of new data added this time; The participant weight of the corresponding edge server is calculated based on the time decay weight and the proportion of the new data, so as to aggregate a plurality of the encrypted training results according to the participant weight.
6. The knowledge graph completion method according to claim 1, characterized in that: The aligning operation on the newly added entities in the plaintext incremental data based on the preset contrastive learning technology includes: Determining the entity name of the newly added entity in the plaintext incremental data; Calculating the cosine similarity between the entity names using a preset language model, and comparing the cosine similarity with a preset cosine similarity threshold to obtain a corresponding comparison result; Determining corresponding target new entity pairs from the new entities based on the comparison results; the target new entity pairs are new entity pairs whose cosine similarity of entity names is higher than the preset cosine similarity threshold; Using the target newly added entity pairs to construct corresponding positive sample pairs; Randomly selecting entity pairs from different data sources in the plaintext incremental data to determine negative sample pairs; The corresponding contrast loss is calculated using the positive sample pair, the negative sample pair, and a preset contrast loss function, so as to perform an alignment operation on the newly added entities in the plaintext incremental data according to the contrast loss.
7. The knowledge graph completion method according to any one of claims 1 to 6, characterized in that: After completing and updating the current global knowledge graph using the aligned plaintext incremental data, the method further includes: After the central server receives the target query instruction, it determines the corresponding knowledge reasoning result from the completed and updated global knowledge graph based on the target query instruction; Feedback on the knowledge inference result is performed for the target query instruction, and a corresponding query log is recorded for this query, and the query log is fed back to the plurality of edge servers so that the plurality of edge servers can optimize the knowledge graph monitoring strategy based on the query log.
8. A knowledge graph completion device, characterized in that: Applied to a knowledge graph completion system, the knowledge graph completion system includes several edge servers, a coordination server, and a central server, the coordination server is used to connect the several edge servers and the central server; wherein the device includes: A knowledge graph data training module is configured to monitor the local knowledge graphs of the plurality of edge servers in real time, and upon detecting newly added knowledge graph data, locally train the newly added knowledge graph data using a preset graph neural network and an objective function, thereby encrypting the obtained training results to obtain corresponding encrypted training results; wherein the objective function includes a preset adversarial regularization term; a training result decryption module, configured to obtain the encrypted training results corresponding to each of the plurality of edge servers through the coordination server, decrypt the aggregated training results using a preset decryption method after aggregating the plurality of encrypted training results, and merge the decrypted training results using a preset interpolation algorithm to send the obtained plaintext incremental data to the central server; The knowledge graph completion module is used to obtain the plaintext incremental data sent by the coordination server through the central server, align the new entities in the plaintext incremental data based on the preset comparative learning technology, and complete and update the current global knowledge graph through the aligned plaintext incremental data.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the knowledge graph completion method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, it implements the knowledge graph completion method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Knowledge graph completion method based on pre-training language model
CN117891957A
Data asset identification and risk early warning system and method based on financial knowledge graph and large language model
CN118247057A
Multi-party knowledge graph embedding method based on federal learning
CN119940502A
Risk prediction method and apparatus, and device and storage medium
WO2023065545A1