Knowledge graph representation learning optimization method, device and readable storage medium
Through the federated learning architecture, the knowledge graph data is inferred and expanded on the server side, and cross-end training samples are generated, which solves the issues of privacy and data integrity in knowledge graph representation learning between multiple enterprises, and achieves better model training. performance and privacy protection.
Patent Information
- Application Number
- CN202010621827.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-01
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-07-01
AI Technical Summary
It is difficult to realize knowledge graph representation learning between multiple enterprises without leaking privacy with existing technology, especially in vertical fields where the privacy and incompleteness of knowledge graphs lead to poor model training results.
Through the federated learning architecture, each data end performs knowledge reasoning and data expansion on the server side, generates cross-end training samples, and updates the model locally to avoid directly transmitting private data and realize joint training of the model.
Without leaking private data, the amount of training data is expanded, the effect of the knowledge graph representation learning model is improved, and the privacy security of each data end is guaranteed.
Smart Images

Figure CN111767411B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a knowledge graph representation learning optimization method, device and readable storage medium. Background Art
[0002] Big data has brought unprecedented opportunities and development to deep learning. Deep learning relies on big data training and often achieves good results. However, deep learning often has limitations in terms of utilizing the a priori nature of knowledge. The knowledge graph is a semantic network used to represent knowledge. It expresses entities, concepts, and the semantic associations between them. Combining knowledge graphs with deep learning is a direction that combines the a priori nature of knowledge with the association of data. Among them, knowledge graph label learning is an important sub-direction, that is, studying how to represent discrete symbolic representations of knowledge with continuous numerical values.
[0003] There are currently many representation learning methods, such as distance-based learning methods, translation-based representation learning methods, etc. These methods require a large amount of knowledge graph data to train a good knowledge graph representation learning model. However, in real scenarios, few companies can have a relatively complete knowledge graph that covers a wide range of fields, and some vertical knowledge graphs are often private and cannot be shared. This results in each company being able to train only through its own knowledge graph, and the trained models are often not very effective. How to jointly conduct representation learning of knowledge graphs without leaking privacy is a pain point. Summary of the invention
[0004] The main purpose of the present invention is to provide a knowledge graph representation learning optimization method, device and readable storage medium, aiming to solve the problem of how to jointly perform knowledge graph representation learning without leaking privacy.
[0005] To achieve the above object, the present invention provides a knowledge graph representation learning optimization method, which is applied to a data end participating in federated learning. The federated learning architecture also includes other data ends participating in federated learning. The method includes the following steps:
[0006] Determine a training sample set from the local knowledge graph dataset;
[0007] Based on the training sample set, the local knowledge graph representation learning model is federated learned in conjunction with each of the other data ends to obtain a target knowledge graph representation learning model, wherein each of the other data ends participates in the federated learning based on the training sample set determined in its own local knowledge graph data set.
[0008] Optionally, each data terminal participating in the federated learning is respectively connected to the server in communication, and the step of determining the training sample set from the local knowledge graph data set includes:
[0009] Send the local knowledge graph dataset to the server, so that after receiving the knowledge graph dataset sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and distributes each element in the extended triple data to the corresponding data end according to the data source of the element;
[0010] Some elements in the extended triple data received from the server are used as cross-end training samples, the triple data contained in the local knowledge graph data set is used as local training samples, and the cross-end training samples and the local training samples are used as training sample sets.
[0011] Optionally, the step of sending the local knowledge graph dataset to the server so that after receiving the knowledge graph dataset sent by each data terminal, the server performs knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and distributing each element in the extended triple data to the corresponding data terminal according to the data source of the element includes:
[0012] After encrypting each entity element in the local knowledge graph data set, the knowledge graph data set is sent to the server, so that after receiving the knowledge graph data set sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data, and distributes the relationship elements and encrypted entity elements in the extended triple data to the corresponding data end according to the data source of the elements;
[0013] The step of using some elements in the extended triplet data received from the server as cross-end training samples comprises:
[0014] Receiving the relationship elements and partially encrypted entity elements in the extended triple data sent by the server;
[0015] The partially encrypted entity elements are decrypted to obtain partial entity elements, and the relationship elements and the partial entity elements are used as cross-end training samples.
[0016] Optionally, the step of performing federated learning on the knowledge graph representation learning model to be trained based on the training sample set in conjunction with each of the other data terminals to obtain a target knowledge graph representation learning model includes:
[0017] A training sample batch participating in a new round of federated learning is selected from the training sample set, and each element of each triple data in the training sample batch is input into the local knowledge graph representation learning model to obtain a vector representation corresponding to each element;
[0018] Sending each of the vector representations to the server end, so that the server end calculates the loss corresponding to each triple data in the training sample batch of each of the data ends based on each of the vector representations received from the data ends, and distributes the loss to the data ends where the corresponding triple data are located;
[0019] updating the local knowledge graph representation learning model according to the loss received from the server, and detecting whether the federated learning stop condition is met;
[0020] If it is detected that the federated learning stop condition is met, the federated learning is stopped and the updated local knowledge graph representation learning model is used as the target knowledge graph representation learning model;
[0021] If it is detected that the federated learning stopping condition is not met, the step of selecting a batch of training samples participating in a new round of federated learning from the training sample set is performed again based on the updated local knowledge graph representation learning model.
[0022] To achieve the above object, the present invention also provides a knowledge graph representation learning optimization method, which is applied to a server participating in federated learning, and the server is communicatively connected with each data terminal participating in federated learning, and the method comprises the following steps:
[0023] Sending a new round of federated learning instructions to each of the data terminals, so that the data terminals determine the sub-training sample batches participating in the new round of federated learning based on the instructions, and inputting each element of each triple data in the sub-training sample batch into the local knowledge graph representation learning model to obtain the vector representation corresponding to each element;
[0024] Receiving each vector representation sent by each of the data terminals, calculating the loss corresponding to each triple data in the training sample batch of each of the data terminals based on each of the vector representations, and distributing the loss to the data terminals where the corresponding triple data is located, so that the data terminals can update the local knowledge graph representation learning model according to the loss received from the server;
[0025] When it is detected that the federated learning stop condition is met, a stop federated learning instruction is sent to each of the data terminals, so that the data terminals use the updated local knowledge graph representation learning model as the target knowledge graph representation learning model;
[0026] When it is detected that the federated learning stopping condition is not met, the step is executed again based on the updated local knowledge graph representation learning model: a new round of federated learning instructions is sent to each of the data terminals.
[0027] Optionally, the method further comprises:
[0028] Before the federated learning starts, receiving the local knowledge graph datasets sent by each of the data terminals;
[0029] Perform knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and use the extended triple data and the triple data contained in each knowledge graph dataset as training sample sets;
[0030] The step of sending a new round of federated learning instructions to each of the data terminals includes:
[0031] Randomly selecting a total training sample batch for a new round of federated learning from the training sample set, and dividing the total training sample batch into sub-training sample batches corresponding to each data end based on the data source of each triple data in the total training sample batch;
[0032] A new round of federated learning instructions is sent to each of the data ends, wherein the new round of federated learning instructions carries a sub-training sample batch corresponding to the data end.
[0033] Optionally, the step of receiving each vector representation sent by each data end, calculating the loss corresponding to each triple data in the training sample batch of each data end based on each vector representation, and distributing the loss to the data end where the corresponding triple data is located so that the data end updates the local knowledge graph representation learning model according to the loss received from the server end includes:
[0034] Receiving each encrypted vector representation sent by each of the data terminals;
[0035] Calculating encryption losses corresponding to each triplet of data in a training sample batch at each data end based on each of the encrypted vector representations;
[0036] The encrypted loss is distributed to the data end where the corresponding triple data is located, so that the data end decrypts the encrypted loss received from the server end, and updates the local knowledge graph representation learning model based on the decryption result.
[0037] To achieve the above-mentioned objectives, the present invention also provides a knowledge graph representation learning optimization device, which includes: a memory, a processor, and a knowledge graph representation learning optimization program stored on the memory and executable on the processor, and when the knowledge graph representation learning optimization program is executed by the processor, the steps of the knowledge graph representation learning optimization method described above are implemented.
[0038] In addition, to achieve the above-mentioned objectives, the present invention also proposes a computer-readable storage medium, on which a knowledge graph representation learning optimization program is stored, and when the knowledge graph representation learning optimization program is executed by a processor, the steps of the knowledge graph representation learning optimization method as described above are implemented.
[0039] In the present invention, each data terminal determines a training sample set from a local knowledge graph data set, and uses each training sample set to participate in federated learning to obtain a target knowledge graph representation learning model. In the federated learning process, each data terminal does not transmit its own knowledge graph data set to each other, but jointly trains the knowledge graph representation learning model by transmitting the intermediate results in the model training process, so the privacy data in each knowledge graph data set is not leaked to each other. Because the knowledge graph representation learning model is trained by combining the knowledge graph data sets of each data terminal, the amount of training data used to train the model is expanded, so that compared with the model trained with the data of a single data terminal, the model trained in the present invention has a better knowledge graph representation effect. That is, in the present invention, the knowledge graph representation model is trained by combining the knowledge graph data sets of each data terminal, which improves the knowledge graph representation effect of the model while ensuring the privacy security of the knowledge graph data sets of each data terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of the structure of the hardware operating environment involved in the embodiment of the present invention;
[0041] Figure 2 It is a flow chart of the first embodiment of the knowledge graph representation learning optimization method of the present invention;
[0042] Figure 3 A loss function formula of a knowledge graph representation learning model involved in various embodiments of the present invention;
[0043] Figure 4 A flowchart of a data-side joint training knowledge graph representation learning model involved in various embodiments of the present invention.
[0044] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0046] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.
[0047] It should be noted that the knowledge graph representation learning optimization device in the embodiment of the present invention can be a smart phone, a personal computer, a server and other devices, and no specific limitation is made here.
[0048] like Figure 1 As shown, the knowledge graph represents that the learning optimization device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0049] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation on the knowledge graph representation learning optimization device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0050] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a knowledge graph representation learning optimization program. Among them, the operating system is a program that manages and controls the hardware and software resources of the device, and supports the operation of the knowledge graph representation learning optimization program and other software or programs.
[0051] when Figure 1 When the device shown is a data end participating in federated learning, the user interface 1003 is mainly used to communicate data with the client; the network interface 1004 is mainly used to establish a communication connection with the server and other data ends participating in federated learning; the processor 1001 can be used to call the knowledge graph representation learning optimization program stored in the memory 1005, and perform the following operations:
[0052] Determine a training sample set from the local knowledge graph dataset;
[0053] Based on the training sample set, the local knowledge graph representation learning model is federated learned in conjunction with each of the other data ends to obtain a target knowledge graph representation learning model, wherein each of the other data ends participates in the federated learning based on the training sample set determined in its own local knowledge graph data set.
[0054] Furthermore, each data terminal participating in the federated learning is respectively connected to the server in communication, and the step of determining the training sample set from the local knowledge graph data set includes:
[0055] Send the local knowledge graph dataset to the server, so that after receiving the knowledge graph dataset sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and distributes each element in the extended triple data to the corresponding data end according to the data source of the element;
[0056] Some elements in the extended triple data received from the server are used as cross-end training samples, the triple data contained in the local knowledge graph data set is used as local training samples, and the cross-end training samples and the local training samples are used as training sample sets.
[0057] Furthermore, the step of sending the local knowledge graph dataset to the server so that the server can perform knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data after receiving the knowledge graph dataset sent by each data terminal, and distributing each element in the extended triple data to the corresponding data terminal according to the data source of the element includes:
[0058] After encrypting each entity element in the local knowledge graph data set, the knowledge graph data set is sent to the server, so that after receiving the knowledge graph data set sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data, and distributes the relationship elements and encrypted entity elements in the extended triple data to the corresponding data end according to the data source of the elements;
[0059] The step of using some elements in the extended triplet data received from the server as cross-end training samples comprises:
[0060] Receiving the relationship elements and partially encrypted entity elements in the extended triple data sent by the server;
[0061] The partially encrypted entity elements are decrypted to obtain partial entity elements, and the relationship elements and the partial entity elements are used as cross-end training samples.
[0062] Furthermore, the step of performing federated learning on the knowledge graph representation learning model to be trained based on the training sample set in conjunction with each of the other data terminals to obtain a target knowledge graph representation learning model includes:
[0063] A training sample batch participating in a new round of federated learning is selected from the training sample set, and each element of each triple data in the training sample batch is input into the local knowledge graph representation learning model to obtain a vector representation corresponding to each element;
[0064] Sending each of the vector representations to the server end, so that the server end calculates the loss corresponding to each triple data in the training sample batch of each of the data ends based on each of the vector representations received from the data ends, and distributes the loss to the data ends where the corresponding triple data are located;
[0065] updating the local knowledge graph representation learning model according to the loss received from the server, and detecting whether the federated learning stop condition is met;
[0066] If it is detected that the federated learning stop condition is met, the federated learning is stopped and the updated local knowledge graph representation learning model is used as the target knowledge graph representation learning model;
[0067] If it is detected that the federated learning stopping condition is not met, the step of selecting a batch of training samples participating in a new round of federated learning from the training sample set is performed again based on the updated local knowledge graph representation learning model.
[0068] when Figure 1 When the device shown is a server participating in federated learning, the user interface 1003 is mainly used to communicate data with the client; the network interface 1004 is mainly used to establish a communication connection with each data terminal participating in federated learning; the processor 1001 can be used to call the knowledge graph representation learning optimization program stored in the memory 1005, and perform the following operations:
[0069] Sending a new round of federated learning instructions to each of the data terminals, so that the data terminals determine the sub-training sample batches participating in the new round of federated learning based on the instructions, and inputting each element of each triple data in the sub-training sample batch into the local knowledge graph representation learning model to obtain the vector representation corresponding to each element;
[0070] Receiving each vector representation sent by each of the data terminals, calculating the loss corresponding to each triple data in the training sample batch of each of the data terminals based on each of the vector representations, and distributing the loss to the data terminals where the corresponding triple data is located, so that the data terminals can update the local knowledge graph representation learning model according to the loss received from the server;
[0071] When it is detected that the federated learning stop condition is met, a stop federated learning instruction is sent to each of the data terminals, so that the data terminals use the updated local knowledge graph representation learning model as the target knowledge graph representation learning model;
[0072] When it is detected that the federated learning stopping condition is not met, the step is executed again based on the updated local knowledge graph representation learning model: a new round of federated learning instructions is sent to each of the data terminals.
[0073] Furthermore, the processor 1001 may also be used to call the knowledge graph representation learning optimization program stored in the memory 1005 to perform the following operations:
[0074] Before the federated learning starts, receiving the local knowledge graph datasets sent by each of the data terminals;
[0075] Perform knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and use the extended triple data and the triple data contained in each knowledge graph dataset as training sample sets;
[0076] The step of sending a new round of federated learning instructions to each of the data terminals includes:
[0077] Randomly selecting a total training sample batch for a new round of federated learning from the training sample set, and dividing the total training sample batch into sub-training sample batches corresponding to each data end based on the data source of each triple data in the total training sample batch;
[0078] A new round of federated learning instructions is sent to each of the data ends, wherein the new round of federated learning instructions carries a sub-training sample batch corresponding to the data end.
[0079] Furthermore, the step of receiving each vector representation sent by each data end, calculating the loss corresponding to each triple data in the training sample batch of each data end based on each vector representation, and distributing the loss to the data end where the corresponding triple data is located so that the data end updates the local knowledge graph representation learning model according to the loss received from the server end includes:
[0080] Receiving each encrypted vector representation sent by each of the data terminals;
[0081] Calculating encryption losses corresponding to each triplet of data in a training sample batch at each data end based on each of the encrypted vector representations;
[0082] The encrypted loss is distributed to the data end where the corresponding triple data is located, so that the data end decrypts the encrypted loss received from the server end, and updates the local knowledge graph representation learning model based on the decryption result.
[0083] Based on the above structure, various embodiments of the knowledge graph representation learning optimization method are proposed.
[0084] Reference Figure 2 , Figure 2 This is a flowchart of the first embodiment of the knowledge graph representation learning optimization method of the present invention. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than here.
[0085] The first embodiment of the knowledge graph representation learning optimization method of the present invention is applied to the data end participating in federated learning, and the federated learning architecture also includes other data ends participating in federated learning. The data ends and service ends involved in each embodiment can be devices such as smart phones, personal computers, and servers. In this embodiment, the knowledge graph representation learning optimization method includes:
[0086] Step S10, determining a training sample set from a local knowledge graph dataset;
[0087] In this embodiment, each data terminal has its own knowledge graph dataset. Specifically, each data terminal may store the knowledge graph dataset locally, or the data terminal may obtain the knowledge graph dataset from other trusted parties. The specific data in the knowledge graph dataset of each data terminal is different. For example, different data terminals are deployed in different enterprises, and each knowledge graph dataset may come from different business scenarios. Data terminal A is deployed in a bank, and its knowledge graph dataset is built based on the bank's credit business data. Data terminal B is deployed in a social software operating company, and its knowledge graph dataset is built based on user social data.
[0088] The knowledge graph is intended to describe various entities or concepts and their relationships in the real world. It constitutes a huge semantic network graph. Nodes represent entities or concepts, and edges are composed of attributes or relationships. In this embodiment, each node and edge is collectively referred to as an element in the knowledge graph, so the knowledge graph data set includes specific data corresponding to each element in the knowledge graph. The organizational structure of various types of data in the knowledge graph data set in the storage space is not limited in this embodiment. Based on the relationship between points and edges in the knowledge graph, the logical organization form of elements in the knowledge graph can be embodied in triples. The triple corresponds to two nodes in the graph and the edge between the two nodes. The basic form of the triple mainly includes (entity 1-relationship-entity 2) and (entity-attribute-attribute value). Then, correspondingly, multiple triple data can be extracted from the knowledge graph data set. For example, (Zhang San, sister, Li Si) is a triple data in the form of (entity 1-relationship-entity 2), and (Zhang San, occupation, singer) is a triple data in the form of (entity-attribute-attribute value).
[0089] The knowledge graph dataset of a single data end may not meet the data volume required for sufficient model training, or the knowledge graph dataset of a single data end may be relatively simple in terms of knowledge types. Therefore, the effect of training the knowledge graph representation model based on the knowledge graph dataset of a single data end may not be good. In order to expand the data volume of training data and enrich the types of training data, in this embodiment, the knowledge graph datasets of each data end can be combined to train the knowledge graph representation learning model.
[0090] The knowledge graph representation learning model is used to convert the elements represented by discrete data in the knowledge graph into continuous numerical vector representations. The low-dimensional dense vector representation obtained based on the conversion can be combined with complex models such as deep learning models to solve specific problems in specific fields. For example, in anti-fraud application scenarios, the possibility of user fraud can be analyzed and predicted based on the social relationships depicted by the knowledge graph. The vector representation obtained based on the knowledge graph representation learning conversion is more conducive to the use of complex models such as deep learning models for analysis and prediction.
[0091] Specifically, each data terminal can set up an initial knowledge graph representation learning model to be trained locally, that is, a local knowledge graph representation learning model (hereinafter referred to as a local model). Each data terminal can build a model structure of a local model based on the same representation learning method. Then, the local models of each data terminal can be exactly the same in model structure, or there can be some differences, which are not limited here. The representation learning method can be any of the existing knowledge graph representation learning methods, such as a distance-based representation learning method and a translation-based representation learning method, which are not limited here. If the server is involved in the joint modeling process of each data terminal, the server can also build the initial model and then send the initial model to each data terminal.
[0092] The data end can determine a training sample set from the local knowledge graph dataset for training the local model. Specifically, the data end can extract each triple data from the local knowledge graph dataset, use each triple data as a training sample, and combine multiple training samples into a training sample set.
[0093] Step S20, based on the training sample set, jointly with each of the other data ends, the local knowledge graph representation learning model is federated learned to obtain the target knowledge graph representation learning model, wherein each of the other data ends participates in the federated learning based on the training sample set determined in its own local knowledge graph data set.
[0094] After determining the training sample set, the data end conducts federated learning on the local knowledge graph representation learning model based on the training sample set in conjunction with other data ends to obtain the target knowledge graph representation learning model. That is, each data end uses its own training samples to participate in federated learning, trains its own local model, and finally obtains the target knowledge graph representation learning model. Among them, the mode of joint federated learning by each data end can be the existing horizontal federated learning mode.
[0095] Specifically, in the horizontal federated learning mode, each data terminal is connected to the server terminal in communication, wherein the server terminal can be a third party independent of each data terminal, or a data terminal with credibility among each data terminal. A round of federated learning process can be: the data terminal first uses the training sample set to locally train the local model to obtain a local model update, wherein the local model update can be the gradient value of each model parameter or the updated model parameter; each data terminal sends its own local model update to the server terminal, and the server terminal performs a federated average of the local model updates of each data terminal to obtain a global model update, and sends the global model update to each data terminal. Specifically, the server terminal averages the gradient values sent by each data terminal, or averages the updated model parameters sent by each data terminal; after receiving the global model update, the data terminal updates the local model based on the global model update to obtain an updated local model. Specifically, the data terminal uses the global gradient value to update the parameters of the local model, or uses the global model parameters as the updated parameters of the local model.
[0096] It should be noted that the process of local training at each data end can adopt the existing training methods of knowledge graph representation learning models, such as distance-based representation learning methods and translation-based representation learning methods, which will not be described in detail here.
[0097] After multiple rounds of federated learning, when the server detects that the federated learning stop condition is met, it can send a stop instruction to each data end, and each data end uses the currently updated local model as the target knowledge graph representation learning model according to the stop instruction. Among them, the federated learning stop condition can be detecting model convergence, or detecting that the federated learning round is greater than a maximum round, or detecting that the federated learning duration is greater than a maximum duration.
[0098] In this embodiment, each data terminal determines a training sample set from a local knowledge graph data set, and uses each training sample set to participate in federated learning to obtain a target knowledge graph representation learning model. In the federated learning process, each data terminal does not transmit its own knowledge graph data set to each other, but jointly trains the knowledge graph representation learning model by transmitting the intermediate results in the model training process, so the privacy data in each knowledge graph data set is not leaked to each other. Because the knowledge graph representation learning model is trained by combining the knowledge graph data sets of each data terminal, the amount of training data used to train the model is expanded, so that the model trained in this embodiment has a better knowledge graph representation effect than the model trained with data from a single data terminal. That is, in this embodiment, the knowledge graph representation model is trained by combining the knowledge graph data sets of each data terminal, which improves the knowledge graph representation effect of the model while ensuring the privacy security of the knowledge graph data sets of each data terminal.
[0099] Further, based on the above first embodiment, a second embodiment of the knowledge graph representation learning optimization method of the present invention is proposed. In this embodiment, each data terminal participating in the federated learning is respectively connected to the server for communication. In step S10, the step of determining the training sample set from the local knowledge graph data set includes:
[0100] Step S101, sending the local knowledge graph dataset to the server, so that after receiving the knowledge graph dataset sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and distributes each element in the extended triple data to the corresponding data end according to the data source of the element;
[0101] In this embodiment, the local knowledge graph dataset of the data end can be a knowledge graph dataset that has been expanded after knowledge reasoning. The knowledge graph datasets of each data end are constructed independently of each other and have not undergone knowledge reasoning. In order to further expand the knowledge in the knowledge graph, each data end can send the local knowledge graph dataset to a trusted server end, and the server end will perform knowledge reasoning on the knowledge graph dataset of each data end, and mine hidden knowledge based on the correlation between the data of each data set to expand the data volume of the model training data. Among them, the server end can be a trusted third-party server end independent of each data end, or a data end with credibility among each data end can serve as the server end.
[0102] Specifically, after receiving the knowledge graph data sets sent by each data end, the server can perform knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data. Among them, the server can first align the triple data in each knowledge graph data set; the alignment operation can be to align multiple triple data containing the same entity element in different knowledge graph data sets; for example, the data set of data end 1 contains a triple data (A, daughter, C), and the data set of data end 2 contains a triple data (B, daughter, C). Both of these triple data contain the entity element C, so the two triple data are aligned; then, knowledge reasoning is performed based on the aligned multiple triple data to obtain extended triple data. The knowledge reasoning method can adopt the knowledge reasoning method in the existing knowledge graph construction method, which will not be described in detail here; for example, for the above two triple data (A, daughter, C) and (B, daughter, C), the extended triple data (A, sister, B) can be inferred.
[0103] The extended triple data can be used as a training sample, but the extended triple data cannot be sent to all data terminals because the data terminals may infer the triple data of other data terminals based on the extended triple data. For example, if data terminal 1 obtains the extended triple data (A, sister, B), it may infer (B, daughter, C) in data terminal 2 based on (A, sister, B) and the local (A, daughter, C).
[0104] Therefore, in this embodiment, the server can send the elements in the extended triple data to the corresponding data end according to the source of the element, that is, the element is sent to the data end from which the element comes. The extended triple data is inferred from at least two data ends, and the two entity elements are respectively from two different data ends. For example, A and B in the above extended triple data (A, sister, B) are entity elements, A comes from data end 1, and B comes from data end 2; the relationship element is inferred, and it can be considered that the relationship element comes from one of the data ends, or it can be considered that the relationship element comes from both data ends. For example, "sister" in the above extended triple data (A, sister, B) is a relationship element, which can be considered to come from data end 1 or 2, or it can be considered to come from data end 1 and 2, whichever one is better. For example, when the server chooses to determine that the relationship elements come from two data ends, for the extended triple data (A, sister, B), the server can send the entity element A and the relationship element "sister" to data end 1, and send the entity element B and the relationship element "sister" to data end 2.
[0105] It can be understood that the server sends some elements in the extended triplet data to one data end and some elements to another data end, and the elements received by the two data ends are combined to form the extended triplet data.
[0106] Furthermore, the server sends triple data to inform each data end which triple data is expanded after knowledge reasoning. Then, in order to facilitate the subsequent use of the extended triple data training model, the server can number the extended triple data and the triple data in each knowledge graph data set. When sending the extended triple data, the server can also send the numbers of each triple data, so that the server and the data end can align the training samples by numbering during joint training.
[0107] In step S102, some elements in the extended triple data received from the server are used as cross-end training samples, the triple data contained in the local knowledge graph data set are used as local training samples, and the cross-end training samples and the local training samples are used as training sample sets.
[0108] The data end receives some elements in the extended triple data sent by the server end. The data end uses some elements in the received extended triple data as cross-end training samples, that is, it only has part of a complete training sample, and the other part is in another data end, so it is called a cross-end training sample. And the triple data contained in the local knowledge graph data set is used as a local training sample. It can be understood that there is at least one extended triple data obtained by the knowledge reasoning of the server end, that is, there may be multiple triple data in the knowledge graph data set of the data end. There are also multiple triple data. One triple data corresponds to one training sample, and the data end finally obtains multiple cross-end training samples and multiple local training samples. The data end uses the cross-end training samples and local training samples as the training sample set, that is, the training sample set contains multiple cross-end training samples and multiple local training samples.
[0109] Furthermore, when the data end uses a training sample set containing cross-end training samples to conduct federated learning with other data ends, the horizontal federated learning mode can be used for the local training sample part; the traditional vertical federated learning mode can be used for the cross-end training sample part, that is, it can be regarded as that the two data ends each have a part of the data of a training sample, and the two parties need to use the other party's part of the data when calculating their respective losses and gradients. In order to avoid privacy leakage caused by direct data transmission, both parties can use their own part of the data to calculate an intermediate result, and pass this intermediate result to the other party, so that the other party can calculate the loss and gradient based on this intermediate result, and then update the model parameters according to the gradient. The specific vertical federated learning process can be based on the principle of the above-mentioned vertical federated learning mode, with reference to the traditional vertical federated learning mode, and will not be described in detail here.
[0110] In this embodiment, each data terminal sends its own knowledge graph data set to a trusted server, and the server performs knowledge reasoning based on each knowledge graph data set to mine hidden knowledge between different knowledge graph data sets, that is, extended triple data, to achieve cross-terminal knowledge reasoning without leaking privacy between data terminals. The extended triple data is sent to each data terminal through the server, so that each data terminal can jointly use the extended triple data to train the knowledge graph representation learning model, expand the data volume of the model training data, and thus improve the knowledge graph representation learning effect of the model. In addition, the server sends the elements in the extended triple data to the corresponding data terminal according to their source, which prevents the data terminal from obtaining the privacy data of other data terminals, and further guarantees the privacy security of the data terminal in the joint modeling process.
[0111] Furthermore, in some application scenarios, the third-party server may not have credibility or it may be impossible to find a feasible third-party server. In this scenario, in order to ensure that the private data of the data end will not be leaked to each other or to the server, in one embodiment, step S101 includes:
[0112] Step S1011, after encrypting each entity element in the local knowledge graph data set, the knowledge graph data set is sent to the server, so that after receiving the knowledge graph data set sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data, and distributes the relationship elements and encrypted entity elements in the extended triple data to the corresponding data end according to the data source of the elements;
[0113] The data end can encrypt each entity element in the local knowledge graph dataset. Specifically, the knowledge graph dataset contains data of each element, and the data end encrypts the entity elements therein. The encryption can use a commonly used encryption algorithm, which is not limited here. After the data end encrypts the entity elements, it sends the knowledge graph dataset to the server end, that is, the entity elements in the dataset sent to the server end are in an encrypted state.
[0114] After receiving the knowledge graph datasets sent by each data terminal, the server performs knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data. It can be understood that the encrypted results of two identical entity elements are also the same, so when the server aligns the knowledge graph datasets of each data terminal according to the entity elements, it will not be affected by the encryption, and since the relationship elements are not encrypted, it will not affect the server's knowledge reasoning based on the relationship elements. In the extended triple data obtained by the server, the relationship elements are in plain text, and the entity elements are still encrypted. The server distributes each element to the corresponding data terminal according to the data source of the elements in the extended triple data, that is, it distributes the relationship elements and encrypted entity elements to the corresponding data terminal according to their data sources.
[0115] The step of using some elements in the extended triplet data received from the server as cross-end training samples in step S102 includes:
[0116] Step S1021, receiving the relationship element and part of the encrypted entity element in the extended triple data sent by the server;
[0117] Step S1022: decrypt the partially encrypted entity elements to obtain partial entity elements, and use the relationship elements and the partial entity elements as cross-end training samples.
[0118] The data end receives the relationship element and the partially encrypted entity element in the extended triple data sent by the server end, wherein the partially encrypted entity element refers to the encrypted state of one of the two entity elements in the extended triple data.
[0119] The data end decrypts some of the encrypted entity elements to obtain some entity elements. Specifically, the data end may use a decryption algorithm corresponding to the encryption algorithm used when encrypting the entity elements to perform decryption. After obtaining the some entity elements, the data end uses the relationship elements and some entity elements as cross-end training samples.
[0120] It is understandable that the entity elements in the knowledge graph dataset are generally private data, and the relationship between entity elements is also private data. The entity elements in the knowledge graph dataset received by the server are encrypted, so the privacy of the entity elements of each data end is not leaked to the server; and although the relationship elements are in plain text, the server cannot know the relationship between entity elements based on the encrypted entity elements; and by keeping the relationship data in plain text and passing it to the server, the knowledge reasoning process of the server will not be affected.
[0121] Further, based on the above-mentioned first and / or second embodiments, a third embodiment of the knowledge graph representation learning optimization method of the present invention is proposed. In this embodiment, the step S20 includes:
[0122] Step S201, selecting a training sample batch participating in a new round of federated learning from the training sample set, inputting each element of each triple data in the training sample batch into the local knowledge graph representation learning model, and obtaining a vector representation corresponding to each element;
[0123] Since the training sample set on the data end may include local training samples (all the triple data corresponding to the training samples are local) and may also include cross-end training samples (some elements of the triple data corresponding to the training samples are local, and some elements are on the other data end), in order to combine the two types of training samples from each data end to model the joint knowledge graph representation learning model, in this embodiment, utilizing the characteristics of the knowledge graph representation learning model, a federated learning model that is different from both the traditional horizontal federated learning model and the traditional vertical federated learning model is proposed.
[0124] Specifically, after the data end determines the training sample set from the local knowledge graph dataset, at the beginning of a new round of federated learning, the data end can select a training sample batch from the training sample set to participate in the new round of federated learning, where the amount of data in the training sample batch is smaller than the amount of data in the training sample set.
[0125] Specifically, each data terminal may randomly select some training samples from its own training sample set as a training sample batch; or when the server has a total training sample set consisting of the training sample sets of each data terminal, the server may randomly select some training samples from the total training sample set as a total training sample batch, and send each training sample in the total training sample batch to the corresponding data terminal according to the source of these training samples, or send the number of the training sample to each corresponding data terminal, and the data terminal determines the training sample batch participating in a new round of federated learning from the local training sample set according to the acquired training samples or numbers.
[0126] For example, based on the second embodiment, the knowledge graph data set and the extended triple data of each data end are recorded in the server end. At the beginning of each round of federated learning, the server end can randomly select a batch of triple data from the triple data and extended triple data in each knowledge graph data set as the total training sample batch, and send the numbers of these triple data to the corresponding data end according to the source of the triple data. For the extended triple data, the number of the extended triple data is sent to the two data ends, that is, the two data ends that use some elements of the extended triple data as cross-end training samples. After receiving the number, the data end searches for the corresponding training sample from the training sample set according to the number, which may include both local training samples and cross-end training samples.
[0127] After determining the training sample batch, the data end inputs each element of each triple data in the training sample batch into the local knowledge graph representation learning model to obtain the vector representation corresponding to each element. Among them, the input data of the knowledge graph representation learning model is the element in the knowledge graph, and the output data is the vector representation of the element. The element can be various elements in the knowledge graph, that is, the elements in the triple data are input into the model separately, and it is not required that the triple data are all in the same data end. Using this feature, when the training sample batch includes cross-end training samples, the data end can input some elements of the triple data included in the cross-end training sample into the local model separately, and the other data end having another part of the elements of the triple data inputs the other part of the elements into the local model of the data end. Using this feature, the data end can input the elements in each triple data into the local model separately to obtain the vector representation of each element. For two triple data with the same element, the same element only needs to be input once.
[0128] Step S202, sending each of the vector representations to the server, so that the server can calculate the loss corresponding to each triple data in the training sample batch of each data end based on each of the vector representations received from each data end, and distribute the loss to the data end where the corresponding triple data is located;
[0129] After obtaining the vector representation of each element contained in the training sample batch, the data end can send each vector representation to the server. In the scenario where the server is not a trusted party, the data end can also encrypt each vector representation and send the encrypted vector representation to the server. The encryption algorithm can use homomorphic encryption. The characteristic of the homomorphic encryption algorithm is to process the encrypted data to obtain an output, and decrypt this output. The result is the same as the output result obtained by processing the unencrypted original data in the same way.
[0130] After receiving the vector representations sent by each data end, the server can calculate the loss of each vector representation in units of triple data, that is, each triple data corresponds to a loss. Specifically, the loss function of the knowledge graph representation learning model is calculated in units of triples, for example, Figure 3 The following is the loss function corresponding to the translation-based representation learning method, where L is the total loss, (sub i ,rel i ,rel i ) is a triple data, i is the label of the triple data, s i Is the subject sub i The vector representation of r i It is a relationship i The vector representation of o i is the object obj i . For the triple data corresponding to the cross-end training sample, the vector representations corresponding to the elements of the triple data come from two different data ends. The server can calculate the loss corresponding to the triple data based on the vector representations of the elements of the triple data received from the two data ends. When both data ends have the relationship element in the triple data, the server can average the vector representations of the relationship element received from the two data ends, and use the average result as the final vector representation of the relationship element. For example, a triple data is (A, sister, B), data end 1 has the entity element A and the relationship element "sister", and data end 2 has the entity element B and the relationship element "sister"; data end 1 sends the vector representation of A and the vector representation of "sister" to the server, and data end 2 sends the vector representation of B and the vector representation of "sister" to the server; the server averages the two vector representations corresponding to "sister" to obtain the final vector representation of "sister", and then calculates the loss corresponding to the triple data based on the vector representations of A, "sister" and B.
[0131] The server sends the loss to the data end where the triplet data corresponding to the loss is located. For the local training sample of the data end, the server sends the loss corresponding to the local training sample to the data end, and for the cross-end training sample, the server sends the loss corresponding to the cross-end training sample to the two data ends.
[0132] When the data end uses cross-end training samples to train the local model, it needs to use another part of the elements in the triplet data corresponding to the cross-end training samples to calculate the loss, and then update the model according to the loss. Therefore, in this embodiment, the server receives the vector representation sent by each data end, calculates the loss based on the vector representation and sends it down, thereby avoiding direct transmission of triplet data between data ends, thereby avoiding privacy leakage between data ends.
[0133] Step S203, updating the local knowledge graph representation learning model according to the loss received from the server, and detecting whether the federated learning stop condition is met;
[0134] After the data end receives the loss sent by the server, it can update the local model based on the loss. Specifically, the data end can calculate the gradients corresponding to the various model parameters of the local model according to the chain rule based on the loss, and then update the various model parameters of the local model according to the gradient, thereby updating the local model. Among them, the specific process of calculating the gradient based on the loss and updating the model parameters based on the gradient can refer to the chain rule and gradient descent algorithm in the existing machine learning model training method, which will not be described in detail here.
[0135] After updating the local model, the data end can detect whether the federated learning stop condition is met. Specifically, each data end can detect whether the federated learning stop condition is met, wherein the federated learning stop condition can be detecting that the local model converges, or detecting that the federated learning round is greater than a maximum round, or detecting that the federated learning duration is greater than a maximum duration. The server can also detect whether the federated learning stop condition is met. If the federated learning stop condition is met, a stop instruction is sent to the data end; if the data end receives a stop instruction, it is determined that the federated learning stop condition is met, and if the stop instruction is not received, it is determined that the federated learning stop condition is not met. The federated learning stop condition of the server can be detecting that the total loss is less than a preset threshold, or detecting that the federated learning round is greater than a maximum round, or detecting that the federated learning duration is greater than a maximum duration.
[0136] Step S204: if it is detected that the federated learning stop condition is met, the federated learning is stopped and the updated local knowledge graph representation learning model is used as the target knowledge graph representation learning model;
[0137] Step S205, if it is detected that the federated learning stopping condition is not met, then based on the updated local knowledge graph representation learning model, the step of selecting a batch of training samples participating in a new round of federated learning from the training sample set is executed again.
[0138] If the data end detects that the federated learning stop condition is met, the federated learning is stopped, and the currently updated local model is used as the target knowledge graph representation learning model. If the data end detects that the federated learning stop condition is not met, based on the currently updated local model, a training sample batch for the next round of federated learning is selected from the training sample set to continue the next round of federated learning.
[0139] It should be noted that if the vector representation received by the server is homomorphically encrypted, then based on the principle of homomorphic encryption, the loss calculated based on the encrypted vector representation is also encrypted. The server sends the encrypted loss to the data end, and then the data end decrypts the encrypted loss to obtain the plaintext loss, and then the model can be updated according to the loss. During the whole process, the encrypted vector representation obtained by the server will not leak the private data of the data end to the server, ensuring the privacy security of the knowledge graph data on the data end.
[0140] Different from the traditional horizontal federated learning mode, each data end sends the model parameters or gradients to the server end, and the server end performs the federated averaging. Different from the traditional vertical federated learning, each data end can only use user-aligned samples (cross-end training samples) for vertical federation, and each data end sends the intermediate results for calculating the gradient to each other. In this embodiment, the server end calculates the loss corresponding to each triple data in the training sample batch of each data end, and sends the loss to the data end where the corresponding triple data is located, so that each data end can update the parameters of its local model according to the loss. Based on this method, the data end can simultaneously include both local training samples and cross-end training samples in the training sample batch to participate in federated learning. In this embodiment, each data end uses its own knowledge graph data set to jointly train the knowledge graph representation learning model, expand the amount of training data for the knowledge graph representation learning model, thereby improving the knowledge graph representation effect of the model, and realizes that when the triple data is in different data ends, the triple data can also be used to participate in the training of the knowledge graph representation learning model, further expanding the amount of training data.
[0141] Further, based on the first, second and / or third embodiments above, a fourth embodiment of the knowledge graph representation learning optimization method of the present invention is proposed. In this embodiment, the method is applied to a server participating in federated learning, and the server is connected to each data terminal participating in federated learning. The method includes:
[0142] Step A10, sending a new round of federated learning instructions to each of the data terminals, so that the data terminals determine the sub-training sample batches participating in the new round of federated learning based on the instructions, and inputting each element of each triple data in the sub-training sample batch into the local knowledge graph representation learning model to obtain the vector representation corresponding to each element;
[0143] Since the training sample set on the data end may include local training samples (all the triple data corresponding to the training samples are local) and may also include cross-end training samples (some elements of the triple data corresponding to the training samples are local, and some elements are on the other data end), in order to combine the two types of training samples from each data end to model the joint knowledge graph representation learning model, in this embodiment, utilizing the characteristics of the knowledge graph representation learning model, a federated learning model that is different from both the traditional horizontal federated learning model and the traditional vertical federated learning model is proposed.
[0144] Specifically, at the beginning of a new round of federated learning, the server can send a new round of federated learning instructions to each data end. After receiving the new round of federated learning instructions, each data end determines the sub-training sample batch participating in the new round of federated learning according to the instructions. Specifically, the data end can determine the training sample set from the local knowledge graph data set, and select the sub-training sample batch for participating in the new round of federated learning from the training sample set, wherein the amount of data in the sub-training sample batch is less than the amount of data in the training sample set.
[0145] Specifically, each data terminal may randomly select some training samples from its own training sample set as a sub-training sample batch; or when the server has a total training sample set consisting of the training sample sets of each data terminal, the server may randomly select some training samples from the total training sample set as the total training sample batch, and send each training sample in the total training sample batch to the corresponding data terminal according to the source of these training samples, or send the number of the training sample to each corresponding data terminal, and the data terminal determines the sub-training sample batch participating in the new round of federated learning from the local training sample set according to the acquired training samples or numbers.
[0146] After determining the training sample batch, the data end inputs each element of each triple data in the training sample batch into the local knowledge graph representation learning model to obtain the vector representation corresponding to each element. Among them, the input data of the knowledge graph representation learning model is the element in the knowledge graph, and the output data is the vector representation of the element. The element can be various elements in the knowledge graph, that is, the elements in the triple data are input into the model separately, and it is not required that the triple data are all in the same data end. Using this feature, when the training sample batch includes cross-end training samples, the data end can input some elements of the triple data included in the cross-end training sample into the local model separately, and the other data end having another part of the elements of the triple data inputs the other part of the elements into the local model of the data end. Using this feature, the data end can input the elements in each triple data into the local model separately to obtain the vector representation of each element. For two triple data with the same element, the same element only needs to be input once.
[0147] After obtaining the vector representation of each element contained in the training sample batch, the data end can send each vector representation to the server.
[0148] Step A20, receiving each vector representation sent by each data end, calculating the loss corresponding to each triple data in the training sample batch of each data end based on each vector representation, and distributing the loss to the data end where the corresponding triple data is located, so that the data end updates the local knowledge graph representation learning model according to the loss received from the server end;
[0149] After receiving the vector representations sent by each data end, the server can calculate the loss of each vector representation in units of triple data, that is, each triple data corresponds to a loss. Specifically, the loss function of the knowledge graph representation learning model is calculated in units of triples. For the triple data corresponding to the cross-end training samples, the vector representations corresponding to the elements of the triple data come from two different data ends. The server can calculate the loss corresponding to the triple data based on the vector representations of the elements of the triple data received from the two data ends. When two data ends have a relationship element in the triple data, the server can average the vector representations of the relationship element received from the two data ends, and use the average result as the final vector representation of the relationship element. For example, a triple data is (A, sister, B), data end 1 has entity element A and relationship element "sister", data end 2 has entity element B and relationship element "sister"; data end 1 sends the vector representation of A and the vector representation of "sister" to the server, data end 2 sends the vector representation of B and the vector representation of "sister" to the server; the server averages the two vector representations corresponding to "sister" to obtain the final vector representation of "sister", and then calculates the loss corresponding to the triple data based on the vector representations of A, "sister" and B.
[0150] The server sends the loss to the data end where the triplet data corresponding to the loss is located. For the local training sample of the data end, the server sends the loss corresponding to the local training sample to the data end, and for the cross-end training sample, the server sends the loss corresponding to the cross-end training sample to the two data ends.
[0151] When the data end uses cross-end training samples to train the local model, it needs to use another part of the elements in the triplet data corresponding to the cross-end training samples to calculate the loss, and then update the model according to the loss. Therefore, in this embodiment, the server receives the vector representation sent by each data end, calculates the loss based on the vector representation and sends it down, thereby avoiding direct transmission of triplet data between data ends, thereby avoiding privacy leakage between data ends.
[0152] After sending the loss, the server can detect whether the federated learning stopping condition is met. The federated learning stopping condition can be detecting that the total loss is less than a preset threshold, or detecting that the federated learning round is greater than a maximum round, or detecting that the federated learning duration is greater than a maximum duration.
[0153] After the data end receives the loss sent by the server, it can update the local model based on the loss. Specifically, the data end can calculate the gradients corresponding to the various model parameters of the local model according to the chain rule based on the loss, and then update the various model parameters of the local model according to the gradient, thereby updating the local model. Among them, the specific process of calculating the gradient based on the loss and updating the model parameters based on the gradient can refer to the chain rule and gradient descent algorithm in the existing machine learning model training method, which will not be described in detail here.
[0154] Step A30, when it is detected that the federated learning stop condition is met, a stop federated learning instruction is sent to each of the data terminals, so that the data terminals use the updated local knowledge graph representation learning model as the target knowledge graph representation learning model;
[0155] Step A40, when it is detected that the federated learning stop condition is not met, the step is executed again based on the updated local knowledge graph representation learning model: a new round of federated learning instructions is sent to each of the data terminals.
[0156] When the server detects that the conditions for stopping federated learning are met, it can send a stop federated learning instruction to the data end. After receiving the stop instruction, the data end stops federated learning and uses the currently updated local model as the target knowledge graph representation learning model.
[0157] When the server detects that the non-federated learning stopping conditions are met, it can send a new round of federated learning instructions to the data end again, so that the data end can select sub-training sample batches participating in the next round of federated learning from the training sample set based on the currently updated local model and continue the next round of federated learning.
[0158] Different from the traditional horizontal federated learning mode, each data end sends the model parameters or gradients to the server end, and the server end performs the federated averaging. Different from the traditional vertical federated learning, each data end can only use user-aligned samples (cross-end training samples) for vertical federation, and each data end sends the intermediate results for calculating the gradient to each other. In this embodiment, the server end calculates the loss corresponding to each triple data in the training sample batch of each data end, and sends the loss to the data end where the corresponding triple data is located, so that each data end can update the parameters of its local model according to the loss. Based on this method, the data end can simultaneously include both local training samples and cross-end training samples in the training sample batch to participate in federated learning. In this embodiment, each data end uses its own knowledge graph data set to jointly train the knowledge graph representation learning model, expand the amount of training data for the knowledge graph representation learning model, thereby improving the knowledge graph representation effect of the model, and realizes that when the triple data is in different data ends, the triple data can also be used to participate in the training of the knowledge graph representation learning model, further expanding the amount of training data. Moreover, during the joint knowledge graph representation learning process, the knowledge graph datasets are not directly transmitted between the data ends. Instead, the losses are transmitted through the server, thus avoiding privacy leakage between the data ends.
[0159] Furthermore, in one embodiment, the method further comprises:
[0160] Step A50, before the federated learning starts, receiving the local knowledge graph datasets sent by each of the data terminals;
[0161] In this embodiment, the local knowledge graph dataset of the data end can be a knowledge graph dataset that has been expanded after knowledge reasoning. The knowledge graph datasets of each data end are constructed independently of each other and have not undergone knowledge reasoning. In order to further expand the knowledge in the knowledge graph, each data end can send the local knowledge graph dataset to a trusted server end, and the server end performs knowledge reasoning on the knowledge graph dataset of each data end, and mines hidden knowledge based on the correlation between the data of each data set to expand the data volume of the model training data. Among them, the server end can be a trusted third-party server end independent of each data end, or it can be a data end with credibility among each data end.
[0162] Step A60, performing knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data, and using the extended triple data and the triple data contained in each knowledge graph data set as a training sample set;
[0163] Specifically, after receiving the knowledge graph data sets sent by each data end, the server can perform knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data. Among them, the server can first align the triple data in each knowledge graph data set; the alignment operation can be to align multiple triple data containing the same entity element in different knowledge graph data sets; for example, the data set of data end 1 contains a triple data (A, daughter, C), and the data set of data end 2 contains a triple data (B, daughter, C). Both of these triple data contain the entity element C, so the two triple data are aligned; then, knowledge reasoning is performed based on the aligned multiple triple data to obtain extended triple data. The knowledge reasoning method can adopt the knowledge reasoning method in the existing knowledge graph construction method, which will not be described in detail here; for example, for the above two triple data (A, daughter, C) and (B, daughter, C), the extended triple data (A, sister, B) can be inferred.
[0164] After the server obtains the extended triple data through inference, it can use the extended triple data and the triple data contained in each knowledge graph data set as a training sample set. Specifically, each training sample is used as a training sample in the training sample set, which is the entire training data set constructed based on the knowledge graph data set of each data end.
[0165] In step A10, the step of sending a new round of federated learning instructions to each of the data terminals includes:
[0166] Step A101, randomly selecting a total training sample batch for a new round of federated learning from the training sample set, and dividing the total training sample batch into sub-training sample batches corresponding to each data end based on the data source of each triple data in the total training sample batch;
[0167] At the beginning of each new round of federated learning, the server can randomly select some training samples from the training sample set as the total training sample batch. The triple data in the total training sample batch comes from different data terminals. The server can divide the total training sample batch into sub-training sample batches corresponding to each data terminal according to the data source of the triple data.
[0168] For extended triple data, the extended triple data cannot be sent to all data terminals, because the data terminals may infer the triple data of other data terminals based on the extended triple data. For example, if data terminal 1 obtains the extended triple data (A, sister, B), it may infer (B, daughter, C) in data terminal 2 based on (A, sister, B) and the local (A, daughter, C).
[0169] Therefore, in this embodiment, the server can divide the elements in the extended triple data into corresponding data terminals according to the source of the elements, that is, the element is divided into the sub-training sample batch corresponding to the data terminal from which the element comes. The extended triple data is inferred from at least two data terminals, and the two entity elements are respectively from two different data terminals. For example, A and B in the above extended triple data (A, sister, B) are entity elements, A comes from data terminal 1, and B comes from data terminal 2; the relationship element is inferred, and it can be considered that the relationship element comes from one of the data terminals, or it can be considered that the relationship element comes from two data terminals. For example, "sister" in the above extended triple data (A, sister, B) is a relationship element, which can be considered to come from data terminal 1 or 2, or it can be considered to come from data terminal 1 and 2, whichever one is better. For example, when the server chooses to determine that the relationship elements come from two data ends, for the extended triple data (A, sister, B), the server can take the entity element A and the relationship element "sister" as a cross-end training sample, and divide it into the sub-training sample batch corresponding to data end 1, and take the entity element B and the relationship element "sister" as a cross-end training sample, and divide it into the sub-training sample batch corresponding to data end 2.
[0170] Step A102, sending a new round of federated learning instructions to each of the data ends, wherein the new round of federated learning instructions carries a sub-training sample batch corresponding to the data end.
[0171] After dividing the sub-training sample batches for each data end, the server sends a new round of federated learning instructions to each data end, and the instructions carry the sub-training sample batches corresponding to the target data end.
[0172] Furthermore, the server can number the extended triple data and the triple data in each knowledge graph data set. When sending out sub-training sample batches, the server can also send out the numbers of each triple data so that the training samples can be aligned by numbering during joint training between the server and the data end.
[0173] In this embodiment, each data terminal sends its own knowledge graph data set to a trusted server, and the server performs knowledge reasoning based on each knowledge graph data set to mine hidden knowledge between different knowledge graph data sets, that is, extended triple data, to achieve cross-terminal knowledge reasoning without leaking privacy between data terminals. The extended triple data is sent to each data terminal through the server, so that each data terminal can jointly use the extended triple data to train the knowledge graph representation learning model, expand the data volume of the model training data, and thus improve the knowledge graph representation learning effect of the model. In addition, the server sends the elements in the extended triple data to the corresponding data terminal according to their source, which prevents the data terminal from obtaining the privacy data of other data terminals, and further guarantees the privacy security of the data terminal in the joint modeling process.
[0174] Furthermore, in some application scenarios, the third-party server may not have credibility or it may be impossible to find a feasible third-party server. In this scenario, in order to ensure that the privacy data of the data end will not be leaked to each other or to the server, in one embodiment, the data end may encrypt each entity element in the local knowledge graph data set. Specifically, the knowledge graph data set contains data of each element, and the data end encrypts the entity elements therein. The encryption may use a commonly used encryption algorithm, which is not limited here. After the data end encrypts the entity elements, it sends the knowledge graph data set to the server, that is, the entity elements in the data set sent to the server are in an encrypted state.
[0175] After receiving the knowledge graph datasets sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data. It can be understood that the encrypted results of two identical entity elements are also the same, so when the server aligns the knowledge graph datasets of each data end according to the entity elements, it will not be affected by encryption, and since the relationship elements are not encrypted, it will not affect the server's knowledge reasoning based on the relationship elements. In the extended triple data obtained by the server, the relationship elements are in plain text, and the entity elements are still encrypted.
[0176] After receiving the sub-training sample batch sent by the server, the data end decrypts the encrypted entity elements in the training sample batch to obtain the entity elements in the plain text state. Specifically, the data end can use the decryption algorithm corresponding to the encryption algorithm used when encrypting the entity elements for decryption.
[0177] It is understandable that the entity elements in the knowledge graph dataset are generally private data, and the relationship between entity elements is also private data. The entity elements in the knowledge graph dataset received by the server are encrypted, so the privacy of the entity elements of each data end is not leaked to the server; and although the relationship elements are in plain text, the server cannot know the relationship between entity elements based on the encrypted entity elements; and by keeping the relationship data in plain text and passing it to the server, the knowledge reasoning process of the server will not be affected.
[0178] Furthermore, in one embodiment, the step A20 includes:
[0179] Step A201, receiving each encrypted vector representation sent by each of the data terminals;
[0180] In the scenario where the server is not a trusted party, the data end can encrypt each vector representation and send the encrypted vector representation to the server. The encryption algorithm can use homomorphic encryption. The characteristic of the homomorphic encryption algorithm is to process the encrypted data to obtain an output, and decrypt this output. The result is the same as the output obtained by processing the unencrypted original data in the same way.
[0181] The server receives each encrypted vector representation sent by each data end.
[0182] Step A202, calculating the encryption loss corresponding to each triplet data in the training sample batch of each data end based on each of the encrypted vector representations;
[0183] Step A203, distributes the encryption loss to the data end where the corresponding triple data is located, so that the data end decrypts the encryption loss received from the server end, and updates the local knowledge graph representation learning model based on the decryption result.
[0184] If the vector representation received by the server is homomorphically encrypted, then based on the principle of homomorphic encryption, the loss calculated based on the encrypted vector representation is also encrypted. The server sends the encrypted loss to the data end, and then the data end decrypts the encrypted loss to obtain the plaintext loss, and then the model can be updated based on the loss. During the whole process, the encrypted vector representation obtained by the server will not leak the private data of the data end to the server, ensuring the privacy security of the knowledge graph data on the data end.
[0185] In one embodiment, each client and server can be configured as follows: Figure 4The process shown jointly performs knowledge graph representation learning model training. Each client encrypts the entity elements in the local knowledge graph dataset (corresponding to the entity ID in the graph), and sends the relationship elements and the encrypted entity elements to the server; the server performs knowledge reasoning based on the elements sent by each client, and builds a training sample set based on the original triple data of each client and the triple data obtained by reasoning; the server selects multiple training samples from the training sample set as training sample batches, and sends the training sample batches to each client; after the client decrypts the sent training sample batches, it inputs each element in the training sample batches into the local knowledge graph representation learning model to obtain a vector representation, which is encrypted and sent to the server; the server calculates the encryption loss based on the encrypted vector representation and sends the encryption loss to each client; after each client decrypts the encryption loss, it uses the decryption result to update the local knowledge graph representation learning model; after detecting that the local knowledge graph representation learning model has converged, the training process ends; if it is detected that the local knowledge graph representation learning model has not converged, the server selects multiple training samples from the training sample set as training sample batches, and sends the training sample batches to each client to enter a new round of cycles.
[0186] This embodiment solution can solve the problems of data silos and data privacy in knowledge graph representation learning, so that multiple parties can achieve joint training of knowledge graph representation learning without leaking their own data privacy, and obtain a more powerful knowledge graph representation.
[0187] In addition, an embodiment of the present invention further proposes a knowledge graph representation learning optimization device, which is deployed on a data end participating in federated learning. The federated learning architecture also includes other data ends participating in federated learning. The device includes:
[0188] A determination module, used to determine a training sample set from a local knowledge graph dataset;
[0189] A federated learning module is used to perform federated learning on the local knowledge graph representation learning model based on the training sample set in conjunction with each of the other data ends to obtain a target knowledge graph representation learning model, wherein each of the other data ends participates in federated learning based on the training sample set determined in its own local knowledge graph data set.
[0190] Furthermore, each data terminal participating in the federated learning is respectively connected to the server in communication, and the determination module includes:
[0191] A first sending unit is used to send a local knowledge graph data set to the server end, so that after receiving the knowledge graph data set sent by each data end, the server end performs knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data, and distributes each element in the extended triple data to the corresponding data end according to the data source of the element;
[0192] The first receiving unit is used to use some elements in the extended triple data received from the server as cross-end training samples, use the triple data contained in the local knowledge graph data set as local training samples, and use the cross-end training samples and the local training samples as a training sample set.
[0193] Furthermore, the first sending unit includes:
[0194] An encryption subunit is used to encrypt each entity element in the local knowledge graph data set and then send the knowledge graph data set to the server, so that after receiving the knowledge graph data set sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data, and distributes the relationship elements and encrypted entity elements in the extended triple data to the corresponding data end according to the data source of the elements;
[0195] The first receiving unit comprises:
[0196] A receiving subunit, configured to receive the relationship elements and partially encrypted entity elements in the extended triple data sent by the server;
[0197] The decryption subunit is used to decrypt the partially encrypted entity elements to obtain partial entity elements, and use the relationship elements and the partial entity elements as cross-end training samples.
[0198] Furthermore, the federated learning module includes:
[0199] A first selection unit is used to select a training sample batch participating in a new round of federated learning from the training sample set, and input each element of each triple data in the training sample batch into the local knowledge graph representation learning model to obtain a vector representation corresponding to each element;
[0200] A second sending unit is used to send each of the vector representations to the server, so that the server calculates the loss corresponding to each triple data in the training sample batch of each data end based on each of the vector representations received from each data end, and distributes the loss to the data end where the corresponding triple data is located;
[0201] An updating unit, configured to update the local knowledge graph representation learning model according to the loss received from the server, and detect whether a federated learning stop condition is met;
[0202] A stopping unit, configured to stop the federated learning and use the updated local knowledge graph representation learning model as the target knowledge graph representation learning model if it is detected that the federated learning stopping condition is met;
[0203] A loop unit is used to, if it is detected that the federated learning stopping condition is not met, represent the learning model based on the updated local knowledge graph and then execute the step of selecting a batch of training samples participating in a new round of federated learning from the training sample set.
[0204] In addition, an embodiment of the present invention further proposes a knowledge graph representation learning optimization device, which is deployed on a server participating in federated learning, and the server is communicatively connected with each data terminal participating in federated learning, and the device includes:
[0205] A sending module, used to send a new round of federated learning instructions to each of the data terminals, so that the data terminals determine the sub-training sample batches participating in the new round of federated learning based on the instructions, and input each element of each triple data in the sub-training sample batch into the local knowledge graph representation learning model to obtain the vector representation corresponding to each element;
[0206] A receiving module, used to receive each vector representation sent by each data end, calculate the loss corresponding to each triple data in the training sample batch of each data end based on each vector representation, and distribute the loss to the data end where the corresponding triple data is located, so that the data end updates the local knowledge graph representation learning model according to the loss received from the server end;
[0207] A stop module, used for sending a stop federated learning instruction to each of the data terminals when it is detected that the federated learning stop condition is met, so that the data terminal uses the updated local knowledge graph representation learning model as the target knowledge graph representation learning model;
[0208] A loop module is used to execute the steps again based on the updated local knowledge graph representation learning model when it is detected that the federated learning stop condition is not met: sending a new round of federated learning instructions to each of the data terminals.
[0209] Furthermore, the receiving module is also used to receive the local knowledge graph data sets sent by each of the data terminals before the federated learning starts;
[0210] The device also includes:
[0211] A knowledge reasoning module, used for performing knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data, and using the extended triple data and the triple data contained in each knowledge graph data set as a training sample set;
[0212] The sending module comprises:
[0213] A second selection unit is used to randomly select a total training sample batch for a new round of federated learning from the training sample set, and divide the total training sample batch into sub-training sample batches corresponding to each data end based on the data source of each triple data in the total training sample batch;
[0214] The third sending unit is used to send a new round of federated learning instructions to each of the data ends, wherein the new round of federated learning instructions carries a sub-training sample batch corresponding to the data end.
[0215] Furthermore, the receiving module includes:
[0216] A second receiving unit, configured to receive each encrypted vector representation sent by each of the data terminals;
[0217] A calculation unit, configured to calculate, based on each of the encrypted vector representations, an encryption loss corresponding to each triplet of data in a training sample batch of each data terminal;
[0218] The fourth sending unit is used to distribute the encryption loss to the data end where the corresponding triple data is located, so that the data end can decrypt the encryption loss received from the server end and update the local knowledge graph representation learning model based on the decryption result.
[0219] The expanded content of the specific implementation method of the knowledge graph representation learning optimization device of the present invention is basically the same as the various embodiments of the above-mentioned knowledge graph representation learning optimization method, and will not be repeated here.
[0220] In addition, an embodiment of the present invention also proposes a computer-readable storage medium, on which a knowledge graph representation learning optimization program is stored. When the knowledge graph representation learning optimization program is executed by a processor, the steps of the knowledge graph representation learning optimization method described below are implemented.
[0221] The various embodiments of the knowledge graph representation learning optimization device and computer-readable storage medium of the present invention can all refer to the various embodiments of the knowledge graph representation learning optimization method of the present invention, and will not be repeated here.
[0222] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0223] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0224] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the embodiments of the present invention.
[0225] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A knowledge graph representation learning optimization method, characterized in that: The method is applied to a data end participating in federated learning, and the federated learning architecture also includes other data ends participating in federated learning. The method includes the following steps: Determine a training sample set from the local knowledge graph dataset; Based on the training sample set, each of the other data ends performs federated learning on the local knowledge graph representation learning model to obtain a target knowledge graph representation learning model, wherein each of the other data ends participates in the federated learning based on the training sample set determined in the respective local knowledge graph data set; Each data terminal participating in federated learning is connected to the server terminal for communication. The step of determining the training sample set from the local knowledge graph data set includes: Send the local knowledge graph dataset to the server, so that after receiving the knowledge graph dataset sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and distributes each element in the extended triple data to the corresponding data end according to the data source of the element; Some elements in the extended triple data received from the server are used as cross-end training samples, the triple data contained in the local knowledge graph data set is used as local training samples, and the cross-end training samples and the local training samples are used as training sample sets.
2. The knowledge graph representation learning optimization method according to claim 1, characterized in that: The step of sending the local knowledge graph dataset to the server end so that the server end, after receiving the knowledge graph dataset sent by each data end, performs knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and distributes each element in the extended triple data to the corresponding data end according to the data source of the element includes: After encrypting each entity element in the local knowledge graph data set, the knowledge graph data set is sent to the server, so that after receiving the knowledge graph data set sent by each data end, the server performs knowledge reasoning on the triple data contained in each knowledge graph data set to obtain extended triple data, and distributes the relationship elements and encrypted entity elements in the extended triple data to the corresponding data end according to the data source of the elements; The step of using some elements in the extended triplet data received from the server as cross-end training samples includes: Receiving the relationship elements and partially encrypted entity elements in the extended triple data sent by the server; The partially encrypted entity elements are decrypted to obtain partial entity elements, and the relationship elements and the partial entity elements are used as cross-end training samples.
3. The knowledge graph representation learning optimization method according to any one of claims 1 to 2, characterized in that: The step of performing federated learning on the knowledge graph representation learning model to be trained based on the training sample set in conjunction with each of the other data terminals to obtain a target knowledge graph representation learning model comprises: A training sample batch participating in a new round of federated learning is selected from the training sample set, and each element of each triple data in the training sample batch is input into the local knowledge graph representation learning model to obtain a vector representation corresponding to each element; Sending each of the vector representations to the server end, so that the server end calculates the loss corresponding to each triple data in the training sample batch of each of the data ends based on each of the vector representations received from the data ends, and distributes the loss to the data ends where the corresponding triple data are located; updating the local knowledge graph representation learning model according to the loss received from the server, and detecting whether the federated learning stop condition is met; If it is detected that the federated learning stop condition is met, the federated learning is stopped and the updated local knowledge graph representation learning model is used as the target knowledge graph representation learning model; If it is detected that the federated learning stopping condition is not met, the step of selecting a batch of training samples participating in a new round of federated learning from the training sample set is performed again based on the updated local knowledge graph representation learning model.
4. A knowledge graph representation learning optimization method, characterized in that: The method is applied to a server participating in federated learning, the server being communicatively connected to each data terminal participating in federated learning, and the method comprises the following steps: Sending a new round of federated learning instructions to each of the data terminals, so that the data terminals determine the sub-training sample batches participating in the new round of federated learning based on the instructions, and inputting each element of each triple data in the sub-training sample batch into the local knowledge graph representation learning model to obtain the vector representation corresponding to each element, wherein the sub-training sample batch includes some elements in the extended triple data, and the extended triple data is obtained by the server end through knowledge reasoning on the triple data contained in the local knowledge graph data set received from each of the data terminals, and the server end distributes each element in the extended triple data to the corresponding data terminal according to the data source of the element; Receiving each vector representation sent by each of the data terminals, calculating the loss corresponding to each triple data in the training sample batch of each of the data terminals based on each of the vector representations, and distributing the loss to the data terminals where the corresponding triple data is located, so that the data terminals can update the local knowledge graph representation learning model according to the loss received from the server; When it is detected that the federated learning stop condition is met, a stop federated learning instruction is sent to each of the data terminals, so that the data terminals use the updated local knowledge graph representation learning model as the target knowledge graph representation learning model; When it is detected that the federated learning stopping condition is not met, the step is executed again based on the updated local knowledge graph representation learning model: a new round of federated learning instructions is sent to each of the data terminals.
5. The knowledge graph representation learning optimization method according to claim 4, characterized in that: The method further comprises: Before the federated learning starts, receiving the local knowledge graph datasets sent by each of the data terminals; Perform knowledge reasoning on the triple data contained in each knowledge graph dataset to obtain extended triple data, and use the extended triple data and the triple data contained in each knowledge graph dataset as training sample sets; The step of sending a new round of federated learning instructions to each of the data terminals includes: Randomly selecting a total training sample batch for a new round of federated learning from the training sample set, and dividing the total training sample batch into sub-training sample batches corresponding to each data end based on the data source of each triple data in the total training sample batch; A new round of federated learning instructions is sent to each of the data ends, wherein the new round of federated learning instructions carries a sub-training sample batch corresponding to the data end.
6. The knowledge graph representation learning optimization method according to any one of claims 4 to 5, characterized in that: The step of receiving each vector representation sent by each data end, calculating the loss corresponding to each triple data in the training sample batch of each data end based on each vector representation, and distributing the loss to the data end where the corresponding triple data is located so that the data end updates the local knowledge graph representation learning model according to the loss received from the server end includes: Receiving each encrypted vector representation sent by each of the data terminals; Calculating encryption losses corresponding to each triplet of data in a training sample batch at each data end based on each of the encrypted vector representations; The encrypted loss is distributed to the data end where the corresponding triple data is located, so that the data end decrypts the encrypted loss received from the server end, and updates the local knowledge graph representation learning model based on the decryption result.
7. A knowledge graph representation learning optimization device, characterized in that: The knowledge graph representation learning optimization device includes: a memory, a processor, and a knowledge graph representation learning optimization program stored on the memory and capable of running on the processor. When the knowledge graph representation learning optimization program is executed by the processor, the steps of the knowledge graph representation learning optimization method as described in any one of claims 1 to 3 are implemented.
8. A knowledge graph representation learning optimization device, characterized in that: The knowledge graph representation learning optimization device includes: a memory, a processor, and a knowledge graph representation learning optimization program stored on the memory and capable of running on the processor. When the knowledge graph representation learning optimization program is executed by the processor, it implements the steps of the knowledge graph representation learning optimization method as described in any one of claims 4 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a knowledge graph representation learning optimization program, which, when executed by a processor, implements the steps of the knowledge graph representation learning optimization method as described in any one of claims 1 to 6.
