A method for implementing federated learning based on client knowledge distillation
By performing knowledge distillation on the client and updating the local model using model parameters of other clients, the problem of communication burden and slow convergence speed of the classic federated learning method under multi-institutional data sets is solved, and a more efficient federated learning process is achieved.
Patent Information
- Application Number
- CN202111410414.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2024-09-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Classic federated learning methods require multiple communication rounds to achieve expected performance when facing multi-institutional data sets, resulting in the need to exchange more data between the server and the client, resulting in communication burden and slow convergence.
Perform knowledge distillation on the client, use model parameters of other clients to extract knowledge information, and update local model parameters through KL divergence and loss functions to reduce the number of communication rounds and improve model performance.
Without reducing model performance, it reduces the number of communication rounds required for federated learning, improves the efficiency of multi-institutional data joint modeling, directly improves the performance of the client's local model, and reduces the time required for joint modeling. time.
Smart Images

Figure CN113947214B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of federated learning, and in particular to a method for implementing federated learning based on client knowledge distillation. Background Art
[0002] With the further development of big data technology, data privacy and security have become a hot issue worldwide. In 2018, the internationally renowned social media "Facebook" was punished by local authorities for allowing a data analysis company to collect a large amount of data for user group analysis without the user's permission, causing Facebook's stock to plummet and triggering large-scale protests. In May 2018, the European Union passed the General Data Protection Regulation (GDPR) to regain citizens and residents' control over personal data and simplify unified regulations within the EU for international business. Relevant departments in my country are also about to introduce relevant laws such as the "Personal Information Protection Law" and the "Data Security Law" to ensure that citizens have control over their personal information. The introduction of these laws and regulations has raised users' requirements for data security and privacy to a new level, making it more difficult to collect and use users' private data.
[0003] In addition to the difficulty of collecting users' personal data, due to competition and privacy protection issues among various industries, it is no longer realistic to centralize the independent data distributed in various institutions into a complete data set and use this integrated data set to build and train models. Since it is impossible to centrally use widely distributed data, these isolated data are called data islands. Faced with data islands, how to safely and legally use widely distributed data for joint modeling has become a key link in the implementation of artificial intelligence systems.
[0004] In order to solve this data island problem, many research institutions have proposed various methods to indirectly access data islands. The federated learning method proposed by McMahan et al. attempts to solve the problem of using decentralized data for joint modeling under privacy protection. The cross-device federated learning method proposed by Google uses the input method saved by users on mobile devices around the world to learn word prediction models while protecting user privacy. Sheller et al. regard the medical data of multiple institutions as multiple data islands and use the federated learning method to obtain the semantic segmentation model after joint modeling. The core steps of these methods are as follows: first, the client logs in to the server, then the server selects a subset of clients that can run training in the current communication round, and then the server sends the latest global model parameters of the current communication round to each selected client, and then each selected client uses its own local privacy data to train in parallel to obtain new model parameters and send them back to the server, and finally the server performs weighted average on the model parameters sent back by the selected clients and updates the global model parameters. Figure 1 Schematic diagram showing the workflow of the classic federated learning approach.
[0005] This federated learning approach makes it possible to conduct joint modeling across data silos, but the classic federated learning method requires multiple rounds of communication to achieve the expected performance when facing multi-institutional data sets. At the same time, more rounds of communication mean that more data needs to be exchanged between the server and the client, resulting in a greater communication burden. Therefore, one of the goals of the federated learning method is to improve the convergence speed of the model and reduce the number of communication rounds without sacrificing the performance of the global model. Summary of the invention
[0006] The present invention overcomes the shortcomings of existing federated learning methods when facing data from multiple institutions (an institution is regarded as a client participating in federated learning training), and implements a federated learning method that performs knowledge distillation on the client side, which utilizes the models sent by other clients in the previous communication round and extracts the knowledge information contained therein to improve the local model of the client side. The present invention reduces the number of communication rounds required for federated learning modeling without reducing the performance of the model, and improves the efficiency of joint modeling using multi-institutional data.
[0007] The core parts of the present invention are the server and the client, and the server includes the following steps:
[0008] Step 1: The client connects to the server. Once the number of connected clients meets the requirement, the learning process begins. Set the current communication round variable to t and the initial communication round to t=0.
[0009] Step 2: The connected client uploads the initial parameters of the local model to the server, and the server saves it as a parameter set. i Represents the parameters sent by client i to the server.
[0010] Step 3: The server sends a parameter set Θ to each client t ={θ0,θ 1 ,…,θ K} represents the parameter set in the tth communication round, where K is the number of clients; increments the current communication round t=t+1.
[0011] Each client receives the parameter set sent by the server excluding the target client. Then run in parallel, the steps are:
[0012] S1: Client k receives the parameter set sent by the server Then use local data X i Get the value f(X) output by its local model i θ k ).
[0013] S2: The client uses the parameter set sent by the server and combines it with local data to obtain the same number of distributions as the parameter set E k (X i ,t), which is defined as:
[0014]
[0015] S3: The client uses KL divergence (Kullback-Leibler Divergence) D KL (p||q) measures the similarity of distributions p and q. In the present invention, KL divergence is used to measure the similarity between the predicted distribution and the average distribution, which is defined as:
[0016]
[0017] Where σ is the activation function. The loss function As the first part of the loss function for the client k population, reducing the KL divergence helps transfer the other client data information implied in the parameter set to the current client.
[0018] S4: The client calculates the task-related loss, and the task loss is regarded as the second part of the overall loss function. For semantic segmentation tasks, the Dice coefficient of the predicted distribution and the data label is calculated as the task loss, while for classification tasks, the cross entropy loss function is used.
[0019] S5: The client reduces the loss function to update the parameters θ of the local model k .
[0020] S6: The client updates the model parameters θ k Send back to the server.
[0021] After all clients have sent their model parameters, the server will re-update the parameter set Θ t-1 : Replace the old parameters corresponding to the client with the new parameters.
[0022] Step 4: If the maximum number of communication rounds has been reached, the training is completed, otherwise it will continue to step 3.
[0023] The beneficial effects of the present invention are as follows: The method for implementing federated learning based on client knowledge distillation provided by the present invention utilizes the information contained in the model parameters sent by the client to the server, and utilizes it when the client performs local training, thereby improving the performance of the client's local model, effectively reducing the number of communication rounds required for the federated learning method, and speeding up the training process; the knowledge distillation technology is used to migrate the above information to the local model, and the models from different clients are regarded as teacher models and the local model of the client is regarded as the student model to perform the information migration process. Compared with traditional federated learning that improves the performance of the global model on each client by aggregating models on the server, the client directly improves the performance of the local model by using local knowledge distillation. This method of directly updating the local model further reduces the time required for joint modeling, while improving the performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 This is a workflow diagram of the classic federated learning method;
[0026] Figure 2 This is the federated learning implementation method of the present invention;
[0027] Figure 3 It is a schematic diagram of the server sending a parameter set to the client;
[0028] Figure 4 This is a schematic diagram of the client performing local knowledge distillation;
[0029] Figure 5 It is a schematic diagram of an application example of this method in financial risk control. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. The technical solutions provided by the embodiments of the present invention are described in detail below in conjunction with the drawings.
[0031] Figure 1 This is a workflow diagram of the classic federated learning method. One of the goals of federated learning is to establish a universal global model that can perform well on all clients. Therefore, the global model needs to be able to use the information extracted from the client using its own data. How to use the client's data information has been widely studied in traditional centralized learning methods, one of which is knowledge distillation technology. In knowledge distillation technology, there are two types of models, namely teacher models with huge parameters and student models with relatively few parameters. The goal is to use the teacher model with strong representation ability to transfer the knowledge information contained in it to the student model, so that the latter can show performance similar to the former with a smaller model parameter amount. In the present invention, each client will use the parameter information of other clients obtained from the server to migrate the knowledge contained therein to the local model before performing local calculations, so as to improve the performance of the local model.
[0032] The present invention provides a new implementation method of federated learning, which is used to solve the problem of slow convergence of federated learning methods when training based on cross-island multi-institutional data sets (for example: more communication rounds are required). In the present invention, the client will obtain the model sent by other clients to the server from the server, and regard it as the teacher model, and then use knowledge distillation to migrate the information contained in it to the local model. In order to help users better understand the purpose and workflow of the present invention, the technical details of the present invention will be explained in conjunction with the accompanying drawings. Figure 2 In the example, there are K clients and their local models. In the initial stage, they need to transmit the models to the server, and the server will save the model parameters of these clients as a set. Assuming that the current task is an image semantic segmentation task, there is image data X in the local data of client k. i And the corresponding label data Y i , saved in D k When the client is training, it will start from D k Reading data in the tag pair The models used by the clients are of the same structure. Each client has an independent local model with parameters θ k .
[0033] Step 1: The server receives the initialization parameters from the client and saves them in Θ0. t = 0;
[0034] Step 2: t = t + 1, at this time the server sends the parameter set of other clients except client k to client k Process Figure 3 The clients will run training in parallel, and the following updates the local model θ for any client k k Steps:
[0035] S1: Dataset D based on the current client k k Get data-label pair (X i ,Y i ), where i represents the index of the data
[0036] S2: After the client receives the parameter set sent by the server, it will calculate two loss functions. Figure 3 , the steps are as follows:
[0037] A: Based on X i Get the predicted label output f(X) of the current client local model i θ k );
[0038] B: Based on X i And use formula (1) to get the average output E of other client models k (X i ,t), σ is the Softmax activation function;
[0039] C: Calculate KL divergence L using formula (2) d , as part of the overall loss function L;
[0040] D: The loss function of the second part is the task loss function L task In image segmentation tasks, the Dice coefficient is often used as the loss, which is defined as follows:
[0041]
[0042] E: Define the overall loss function as:
[0043] L=αL task +(1-α)L d (4)
[0044] Where α is the weight factor of the loss function.
[0045] F: Use the loss function to update the client's local model θ k , as shown below:
[0046]
[0047] Where η is the learning rate.
[0048] S3: Loop through steps A to F until i = |D k |;
[0049] S4: When client k completes training, the new θ k Send back to the server;
[0050] Step 3: When the server receives the new parameter θ from the client k k Then, replace Θ t-1 Old θ k When all client parameters are received and updated t-1 After that, jump to step 2.
[0051] Take financial risk control based on horizontal federated learning as an example. Financial institutions face the problem of insufficient samples in anti-fraud scenarios. We can apply horizontal federated learning in anti-fraud scenarios between banks. Therefore, the present invention provides a federated learning implementation method that can build high-quality financial risk control models between banks and under the premise of protecting user privacy. For example, Bank A has transaction data and anti-fraud data of users in one region, while Bank B has transaction data and anti-fraud data of users in another region. In order to optimize the anti-fraud models of both parties while protecting bank data privacy, this method can be used for cross-bank modeling. The working process is as follows: Figure 5 As shown in the figure. Legend: ① Bank A / B obtains the latest model of Bank B / A saved on the server, ② uses local data for training and updates the local model. ③ Uploads the latest model parameters to the server.
[0052] Unlike traditional federated learning algorithms that build a universal global model by weighted averaging model parameters on the server, the method described in the present invention performs knowledge distillation on the client to improve the performance of the model locally. Through feedback from examples, the method described in the present invention effectively improves the efficiency of model learning and reduces the number of communication rounds required for joint modeling using multi-institutional data without reducing model performance.
[0053] The embodiment of the present invention further provides a storage medium, in which a computer program is stored, and when the computer program is executed by a processor, some or all of the steps in each embodiment of the method for implementing federated learning based on client knowledge distillation provided by the present invention are implemented. The storage medium may be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0054] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention or some parts of the embodiments.
[0055] The above-described embodiments of the present invention do not limit the protection scope of the present invention.
Claims
1. A method for implementing federated learning based on client knowledge distillation, characterized in that: include: The server sends a model parameter set to each client at the beginning of a new communication round, wherein the model parameter set is formed according to the model parameters submitted to the server by all clients in the previous communication round; When each client receives the model parameter set sent by the server, it starts the local model parameter training of the current communication round. The local model is a model stored locally on the client. When training the local model parameters, the feature information from other clients is migrated to the local model. When the client completes the training of the current communication round, it sends the parameters of the local model to the server; After waiting for all clients to send back new model parameters, the server generates a new set based on the new model parameters for training in the next communication round; At the beginning of a new communication round, the server sends a set of model parameters to each client, including: Before the new communication round t begins, the server uses the formula Send to each client k a model parameter consisting of the model parameters sent to the server by other clients in the previous communication round (t-1) Among them, θ k is the model sent by client k to the server in the (t-1) communication round, Θ t-1 is the set of model parameters sent by all clients to the server after the last communication round (t-1); When each client receives the model parameter set sent by the server, it starts the local model parameter training of the current communication round, including: Any client k in communication round t, after receiving the model parameter set sent by the server, will define the feature information E from other clients k (X i ,t) are as follows: Where N is the number of all clients, X i is the data sample owned by client k, f(X i θ k ) is the predicted distribution output by the local model; When training local model parameters, migrating feature information from other clients to the local model includes: In any client k in communication round t, the feature information E from other clients is defined k (X i ,t) migrate to the local model parameters θ k In the example, we can get the similarity between the predicted distribution and the average distribution using the KL divergence metric: Among them, σ is the activation function, D KL is the KL divergence, and the loss function is As part of the loss function for the client k population.
2. The method according to claim 1, characterized in that When the client completes the training of the current communication round, the parameters of the local model sent to the server include: Any client k in communication round t will send the updated parameter θ to the server k .
3. The method according to claim 2, characterized in that After waiting for all clients to send back new model parameters, the server generates a new set based on the new model parameters for training in the next communication round, including: The server sends the parameter set {θ 1 ,θ 2 ,…,θ N } respectively replace Θ t-1 , and start the training of the next communication round, where θ i Represents the parameters sent by client i to the server.
Citation Information
Patent Citations
Communication preprocessing method, client and server
CN106790168A
Intelligent bank user interaction system
CN111899735A
Training method of personalized model of distillation-based semi-supervised federated learning
CN113205863A
System and methods for privacy preserving cross-site federated learning
US20210272014A1
