Federal learning model parameter updating method, system and device
By receiving the client's model parameters in federated learning and performing clustering processing, identifying and updating the model parameters of the exception client, the global model performance degradation caused by the exception client is solved, and the accuracy of federated learning is improved.
Patent Information
- Application Number
- CN202510061950.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-02-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In federated learning, the inability to promptly remove the wrong model parameters of the exception client, resulting in a decline in the performance of the global model, thereby reducing the accuracy of federated learning.
By receiving local model parameters sent by the client, clustering is performed, and the model parameters of the abnormal client are identified and updated to ensure the quality of the global model.
Effectively remove the impact of abnormal clients, improve the accuracy of federated learning and system stability.
Smart Images

Figure CN119539031A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and specifically, to a method, system, and device for updating model parameters of federated learning. Background Art
[0002] With the rapid development of network communication technology, personal information can be easily collected, transmitted and used by various intelligent terminal devices. If the platform is not well supervised, personal privacy information can be easily leaked. For enterprises, once certain business secrets are leaked, they will lose the advantage in the game with competitors, and then cause huge human and financial losses to the enterprise.
[0003] Federated learning is a distributed machine learning model. During model training, the client uses local data to train the model locally and passes the trained model parameters to the central server. Since the data does not need to leave the local client, it can protect the privacy of the data. However, in federated learning, there are often some abnormal clients, and the model parameters trained by abnormal clients are wrong. If the wrong model parameters trained by these abnormal clients cannot be removed in time, the performance of the global model in the system will be reduced due to the wrong model parameters of the abnormal clients, resulting in problems such as reduced accuracy of federated learning.
[0004] There is currently no effective solution to the above problems. Summary of the invention
[0005] The embodiments of the present application provide a method, system and device for updating model parameters of federated learning, so as to at least solve the problem in the related art that the accuracy of federated learning is low due to the inability to eliminate erroneous model parameters transmitted by abnormal clients.
[0006] According to an embodiment of the present application, a method for updating model parameters of federated learning is provided, comprising: in the case of updating the j-th round of model parameters for federated learning, receiving local model parameters sent by N clients, and obtaining N groups of local model parameters for the j-th round, wherein the N groups of local model parameters for the j-th round correspond to the N clients one-to-one, and each group of local model parameters for the j-th round is a parameter obtained by training a neural network model using the global model parameters of the j-1th round or the cluster center model parameters of the j-1th round and the local data of the client, j and N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the j-1th round of federated learning, and when j=1, The global model parameters of the 0th round are the preset initial global model parameters, and the cluster center model parameters of the 0th round are the model parameters obtained by the client using the initial global model parameters and the local data to train the neural network model; the N groups of local model parameters of the jth round are clustered by K cluster center model parameters of the j-1th round to obtain K cluster clusters, wherein K is an integer greater than or equal to 1, and the cluster cluster includes one or more groups of local model parameters of the jth round; the K cluster clusters are updated according to the distance between each group of local model parameters of the jth round in the cluster cluster and the cluster center model parameters of the j-1th round to obtain the updated K cluster clusters, and the K cluster center model parameters of the jth round and the global model parameters of the jth round are obtained through the updated K cluster clusters.
[0007] In an exemplary embodiment, the K cluster clusters are updated according to the distance between the local model parameters of the j-th round of each group in the cluster cluster and the cluster center model parameters of the j-1-th round to obtain the updated K cluster clusters, including: determining the distance between the local model parameters of the j-th round of each group and the cluster center model parameters of the j-1-th round of the cluster cluster to which it belongs, to obtain N distance values; determining the maximum n0 distance values among the N distance values, wherein n0 is a preset value and n0 is an integer greater than or equal to 1; and updating the K cluster clusters according to the relationship between each distance value in the n0 distance values and the distance threshold to obtain the updated K cluster clusters.
[0008] In an exemplary embodiment, according to the relationship between each distance value among n0 distance values and the distance threshold, K cluster clusters are updated to obtain updated K cluster clusters, including: determining the distance value greater than or equal to the distance threshold among the n0 distance values as the target distance value; when the local model parameters of the j-th round of the i-th group belong to the first cluster cluster, and the local model parameters of the j-th round of the i-th group and the cluster center model parameters of the j-1-th round of the first cluster cluster are the target distance, determining the local model parameters of the j-th round of the i-th group as abnormal parameters, and determining the client of the local model parameters of the j-th round of the i-th group as an abnormal client; deleting the local model parameters of the j-th round of the i-th group in the first cluster cluster to obtain the updated first cluster cluster.
[0009] In an exemplary embodiment, before updating the K clusters according to the relationship between each distance value in the n0 distance values and the distance threshold, the method further includes: obtaining the distance threshold by the following formula: :
[0010]
[0011] in, is the default value. is the total number of said clients, is the abnormal parameter value of the local model parameter of the i-th group and the j-1th round obtained when the model parameter of the federated learning is updated in the j-1th round. In the case where the local model parameter of the i-th group and the j-1th round is an abnormal parameter, The value of is 1, otherwise The value of is 0, is the parameter value of the local model parameter of the i-th group in the j-1th round belonging to the k-th cluster when the j-1th round model parameter of the federated learning is updated. In the case where the local model parameter of the i-th group in the j-1th round belongs to the k-th cluster, The value of is 1, otherwise it is 0. is the local model parameter of the jth round in the i-th group, is the cluster center model parameter of the j-1th round of the kth cluster, is the Euclidean norm.
[0012] In an exemplary embodiment, K cluster center model parameters of the j-th round are obtained through the updated K cluster clusters, including: performing the following operations on each of the updated K cluster clusters, and taking the cluster cluster that performs the following operations as the current cluster cluster: determining the cluster center model parameters of the j-th round of the current cluster cluster by taking the mean of the local model parameters of the j-th round of each group included in the current cluster cluster.
[0013] In an exemplary embodiment, the method further includes: determining the mean of K cluster center model parameters of the j-th round as the global model parameter of the j-th round.
[0014] In an exemplary embodiment, after obtaining K j-th round cluster center model parameters and j-th round global model parameters through the updated K cluster clusters, the method further includes: in the presence of a j+1-th round model parameter update for federated learning and a newly added first client in the j+1-th round model parameter update, sending the j-th round global model parameters to the first client, so that the first client uses the j-th round global model parameters and the first client's local data to train the neural network model of the first client.
[0015] In an exemplary embodiment, the method further includes: using the global model parameters of the j-th round as the model parameters of the neural network model of the first client to obtain the first neural network model of the first client; iteratively training the first neural network model, and when the first neural network model meets a preset first convergence condition, the first client ends the training of the first neural network model, and determines the model parameters of the first neural network at the end of the training as the local model parameters of the j+1-th round of the first client; wherein the first convergence condition includes that the function value between the loss value of the first neural network model and the penalty value of the first neural network model reaches a first preset threshold.
[0016] In an exemplary embodiment, after obtaining K j-th round cluster center model parameters and j-th round global model parameters through the updated K cluster clusters, the method further includes: in the presence of a j+1-th round model parameter update for federated learning and the j-th round local model parameters of the second client belong to the second cluster cluster, the j-th round cluster center model parameters of the second cluster cluster are sent to the second client, so that the second client uses the j-th round cluster center model parameters and the local data of the second client to train the neural network model of the second client, wherein the second client is any one of the N clients.
[0017] In an exemplary embodiment, the method further includes: using the cluster center model parameters of the j-th round of the second cluster cluster as the model parameters of the neural network model of the second client to obtain the second neural network model of the second client; iteratively training the second neural network model, and when the second neural network model meets a preset second convergence condition, the second client ends the training of the second neural network model, and determines the model parameters of the second neural network at the end of the training as the local model parameters of the j+1-th round of the second client; wherein the second convergence condition includes that the function value between the loss value of the second neural network model and the penalty value of the second neural network model reaches a second preset threshold.
[0018] In an exemplary embodiment, the method further includes: when the j-th round of model parameter update for federated learning satisfies at least one of the following conditions, ending the model parameter update for the federated learning: the target average distance value for the j-th round of model parameter update is less than or equal to a preset threshold, wherein the target average distance value is the average value of the distance between the j-th round local model parameters of the N groups and the j-th round cluster center model parameters of the cluster cluster to which they belong; the number of rounds of the model parameter update for the federated learning reaches a preset round number threshold.
[0019] According to another embodiment of the present application, a model parameter updating system for federated learning is provided, comprising: a central server, for receiving local model parameters sent by N clients in the case of performing a j-th round of model parameter updating on federated learning, and obtaining N groups of local model parameters for the j-th round, wherein the N groups of local model parameters for the j-th round correspond to the N clients one by one, and each group of local model parameters for the j-th round is a global model parameter of the j-1th round or a cluster center model parameter of the j-1th round used by the corresponding client, and the local data of the client is used for the neural network model The parameters obtained by training the neural network model are as follows: j, N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the j-1th round of the federated learning, and when j=1, the global model parameters of the 0th round are the preset initial global model parameters, and the cluster center model parameters of the 0th round are the model parameters obtained by the client using the initial global model parameters and the local data to train the neural network model; through the K cluster center model parameters of the j-1th round The N groups of local model parameters of the jth round are clustered to obtain K clusters, wherein K is an integer greater than or equal to 1, and the clusters include one or more groups of local model parameters of the jth round; the K clusters are updated according to the distance between each group of local model parameters of the jth round in the clusters and the cluster center model parameters of the j-1th round to obtain updated K clusters, and K cluster center model parameters of the jth round and the global model parameters of the jth round are obtained through the updated K clusters; the second client is used to receive the central server In the case of the cluster center model parameters of the j-th round of the second clustering cluster sent by the server, the cluster center model parameters of the j-th round of the second clustering cluster are used as the model parameters of the neural network model to obtain the second neural network model, and the second neural network model is iteratively trained; when the second neural network model meets a preset second convergence condition, the training of the second neural network model is terminated, and the model parameters of the second neural network at the end of the training are determined as the local model parameters of the j+1-th round, wherein the N clients include the second client.
[0020] In an exemplary embodiment, the system also includes: a first client, which is a newly added client in the j+1th round of model parameter update of the federated learning, and is used to, upon receiving the global model parameters of the jth round sent by the central server, use the global model parameters of the jth round as model parameters of the neural network model, obtain the first neural network model, and iteratively train the first neural network model; when the first neural network model meets a preset first convergence condition, end the training of the first neural network model, and determine the model parameters of the first neural network at the end of the training as the local model parameters of the j+1th round.
[0021] According to another embodiment of the present application, a model parameter updating device for federated learning is provided, comprising: a receiving module, for receiving local model parameters sent by N clients when updating the model parameters of the federated learning for the jth round, and obtaining N groups of local model parameters of the jth round, wherein the N groups of local model parameters of the jth round correspond one-to-one to the N clients, and each group of local model parameters of the jth round is a parameter obtained by the corresponding client using the global model parameters of the j-1th round or the cluster center model parameters of the j-1th round, and the local data of the client to train the neural network model, j and N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the federated learning for the j-1th round, and when j=1, the 0th round The global model parameters are preset initial global model parameters, and the cluster center model parameters of the 0th round are model parameters obtained by the client using the initial global model parameters and the local data to train the neural network model; a clustering module is used to cluster the N groups of local model parameters of the jth round through K cluster center model parameters of the j-1th round to obtain K cluster clusters, wherein K is an integer greater than or equal to 1, and the cluster clusters include one or more groups of local model parameters of the jth round; an updating module is used to update the K cluster clusters according to the distance between each group of local model parameters of the jth round in the cluster clusters and the cluster center model parameters of the j-1th round to obtain the updated K cluster clusters, and obtain the K cluster center model parameters of the jth round and the global model parameters of the jth round through the updated K cluster clusters.
[0022] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0023] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0024] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0025] Through the present application, when updating the model parameters of the j-th round of federated learning, N groups of local model parameters of the j-th round are received, the local model parameters of the j-th round are clustered according to the cluster center model parameters of the j-1-th round to obtain multiple cluster clusters, and the cluster clusters are updated according to the distance between each local model parameter of the j-th round in the cluster cluster and the cluster center model parameters of the j-1-th round to obtain updated cluster clusters, thereby obtaining the cluster center model parameters of the j-th round and the global model parameters of the j-th round.
[0026] Since the clustering results can be adjusted according to the distance between the client model parameters and the cluster center model parameters in each round of updates, the misclassification of a single clustering is avoided, so that even if the client is misclassified, it can be corrected in the subsequent clustering process, thereby effectively removing the abnormal client model and preventing the abnormal client from affecting the aggregation model. Therefore, the problem of low accuracy of federated learning due to the inability to remove the erroneous model parameters transmitted by abnormal clients in related technologies can be solved, thereby achieving the effect of improving the accuracy of federated learning. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a hardware structure block diagram of a server device of a method for updating model parameters of federated learning according to an embodiment of the present application;
[0028] Figure 2 is a flowchart of a method for updating model parameters of federated learning according to an embodiment of the present application;
[0029] Figure 3 is a flowchart of the federated learning model training according to an embodiment of the present application;
[0030] Figure 4 It is a structural block diagram of a model parameter updating device for federated learning according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to better understand the embodiments of the present invention, some terms in this application are explained below:
[0032] Federated Learning: Federated Learning was first proposed by Google in 2016 to solve the problem of local model update for Android phone users. Federated Learning is essentially a distributed machine learning technology, which aims to achieve joint modeling while ensuring data privacy, security, and legal compliance.
[0033] KMOR (k-means with outlier removal) algorithm: This algorithm is an improvement of the k-means clustering algorithm. It adds an additional "cluster center" to place outliers, making it capable of outlier detection. Compared with existing outlier detection algorithms, the KMOR algorithm can naturally separate outliers from normal points during the clustering process.
[0034] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0036] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a method for updating model parameters of a federated learning in an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor NCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the server device may also include a transmission device 106 and an input / output device 108 for communication functions. A person skilled in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0037] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the model parameter update method of federated learning in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0038] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0039] In this embodiment, a method for updating model parameters of federated learning is provided. Figure 2 is a flow chart of a method for updating model parameters of federated learning according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0040] Step S202, in the case of updating the model parameters of the j-th round of federated learning, receiving local model parameters sent by N clients, and obtaining N groups of local model parameters of the j-th round, wherein the N groups of local model parameters of the j-th round correspond to the N clients one by one, and each group of the local model parameters of the j-th round is the parameters obtained by the corresponding client using the global model parameters of the j-1th round or the cluster center model parameters of the j-1th round, and the local data of the client to train the neural network model, j and N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the j-1th round of the federated learning, and in the case of j=1, the global model parameters of the 0th round are the preset initial global model parameters, and the cluster center model parameters of the 0th round are the model parameters obtained by the client using the initial global model parameters and the local data to train the neural network model;
[0041] The above local model parameters may be model parameters of a model deployed on the client in federated learning, and the model may be a machine learning model, a neural network model, etc.; the above j-th round local model parameters may be model parameters obtained by training the client's neural network model when the federated learning performs the j-1-th round model parameter update, and the model parameters may be represented by a vector, wherein the local model parameters of each client are a set of local model parameters, and each set of model parameter vectors includes one or more parameters, for example The cluster center model parameters can be the cluster center of each cluster cluster after the central server clusters the local model parameters of all clients, wherein each cluster center parameter can be represented by a vector, and each cluster center parameter vector includes one or more parameters, such as .
[0042] The above-mentioned global model parameters may be model parameters of a model trained jointly by all clients, and the model is trained on a central server, wherein the central server may update the global model parameters by aggregating the local model parameters of all clients; the above-mentioned global model parameters of the j-1th round and the cluster center model parameters of the j-1th round may be the global model parameters and cluster center model parameters obtained after the j-1th round model parameter update in the federated learning, wherein the global model parameters of the 0th round may be preset initial global model parameters, which may be any model parameters, and the cluster center model parameters of the 0th round are model parameters obtained by the client using local data to train a neural network model whose model parameters are the initial global model parameters.
[0043] Step S204, clustering the N groups of local model parameters of the jth round by using the K cluster center model parameters of the j-1th round to obtain K cluster clusters, wherein K is an integer greater than or equal to 1, and the cluster clusters include one or more groups of local model parameters of the jth round;
[0044] The above clusters may be clustering results obtained by the central server after clustering and analyzing the local model parameters of all clients, wherein each cluster includes one or more local model parameters.
[0045] Optionally, the following operations may be performed on the local model parameters of N clients, and the local model parameters of the client performing the following operations are determined as the local model parameters of the current client: the distance between the local model parameters of the current client and each cluster center model parameter is calculated, and the cluster cluster corresponding to the cluster center model parameter with the smallest distance from the local model parameter of the current client is determined as the cluster cluster of the local model parameters of the current client; wherein, the initial cluster center model parameters of the K cluster clusters may be any K model parameters of the local model parameters of all clients, and K may be any integer greater than or equal to 1, which may be specifically set according to actual conditions.
[0046] Optionally, a preliminary membership matrix V can be obtained based on the K clusters N×K , where each row in the matrix represents a local model parameter of a client, and each column in the matrix represents a cluster center model parameter of a cluster. Each element can be determined by the following formula:
[0047]
[0048] In the formula, is the element in the preliminary membership matrix, It means to minimize the distance between the local model parameters of client i and the cluster center model parameters of cluster k. It indicates that the cluster center model parameters closest to the local model parameters of client i are the cluster center model parameters of cluster k. Through the preliminary membership matrix, the cluster center model parameters closest to the local model parameters of each client can be clearly guided.
[0049] Step S206, updating the K clustering clusters according to the distance between the local model parameters of the j-th round of each group in the clustering cluster and the clustering center model parameters of the j-1-th round, obtaining the updated K clustering clusters, and obtaining the K clustering center model parameters of the j-th round and the global model parameters of the j-th round through the updated K clustering clusters.
[0050] Optionally, the K cluster clusters are updated according to the distance between the local model parameters of the j-th round of each group in the cluster cluster and the cluster center model parameters of the j-1-th round to obtain the updated K cluster clusters, including: determining the distance between the local model parameters of the j-th round of each group and the cluster center model parameters of the j-1-th round of the cluster cluster to which it belongs, to obtain N distance values; determining the maximum n0 distance values among the N distance values, wherein n0 is a preset value and n0 is an integer greater than or equal to 1; and updating the K cluster clusters according to the relationship between each distance value in the n0 distance values and the distance threshold to obtain the updated K cluster clusters.
[0051] The above-mentioned preset value n0 can be any data set according to actual conditions. For example, n0 can be set to the number of abnormal clients, or one tenth of the total number of all clients, etc. n0 can be used to limit the number of abnormal clients among all clients; according to the distance value between the local model parameters of the N clients and the cluster center model parameters of the clustering clusters to which they belong, the largest n0 distance values are selected from the calculated N distance values, and the selected n0 distance values are compared with the distance threshold, so as to determine the abnormal clients among the N clients, and update the K clustering clusters according to the abnormal clients to obtain the updated K clustering clusters. By adjusting the clustering results again in each training, even if the client is misclassified, it can be corrected in the subsequent clustering process, avoiding the problem of reduced global model accuracy caused by misclassification of a single clustering, thereby achieving the ability to automatically remove abnormal clients, thereby achieving the purpose of improving the accuracy of federated learning.
[0052] Optionally, the membership matrix U can be obtained based on the updated K clusters N×K+1 , the elements of this matrix . Each row in the matrix represents a client, each column in the matrix represents a cluster, the K+1th column represents an abnormal client cluster, and the elements in the matrix must meet the following conditions:
[0053]
[0054] In the formula, is the element in the membership matrix, Indicates that client i belongs to cluster k. Through the membership matrix, we can clearly guide the cluster corresponding to each client.
[0055] Optionally, K cluster center model parameters of the j-th round are obtained through the updated K cluster clusters, including: performing the following operations on each of the updated K cluster clusters, and taking the cluster cluster that performs the following operations as the current cluster cluster: determining the cluster center model parameters of the j-th round of the current cluster cluster by taking the mean of the local model parameters of the j-th round of each group included in the current cluster cluster.
[0056] Specifically, the cluster center model parameters of the jth round of the current cluster cluster are calculated by the following formula:
[0057]
[0058] in, is the cluster center model parameter of the jth round, is the membership matrix U N×K+1 The elements in are the local model parameters of the jth round in the ith group (or the local model parameters of the jth round in the ith client).
[0059] Optionally, the method further includes: determining the mean of K cluster center model parameters of the j-th round as the global model parameter of the j-th round.
[0060] Specifically, the global model parameters of the jth round of the current cluster are calculated by the following formula:
[0061]
[0062] in, is the global model parameter of the jth round, are the cluster center model parameters of the j-th round.
[0063] Through the above steps, when the j-th round model parameters of federated learning are updated, N groups of local model parameters of the j-th round are received, the local model parameters of the j-th round are clustered according to the cluster center model parameters of the j-1-th round to obtain multiple cluster clusters, and the cluster clusters are updated according to the distance between each local model parameter of the j-th round in the cluster cluster and the cluster center model parameters of the j-1-th round to obtain updated cluster clusters, thereby obtaining the cluster center model parameters of the j-th round and the global model parameters of the j-th round.
[0064] Since the clustering results can be adjusted according to the distance between the client model parameters and the cluster center model parameters in each round of updates, misclassification of single clustering is avoided. Even if the client is misclassified, it can be corrected in the subsequent clustering process, so that the abnormal client model can be effectively removed, so that the abnormal client cannot affect the aggregation model. This solves the problem of low accuracy of federated learning due to the inability to eliminate the erroneous model parameters transmitted by abnormal clients in related technologies, thereby improving the accuracy of federated learning.
[0065] The execution subject of the above steps may be a server, a terminal, etc., but is not limited thereto.
[0066] As an optional implementation, according to the relationship between each distance value among n0 distance values and the distance threshold, K cluster clusters are updated to obtain updated K cluster clusters, including: determining the distance value among the n0 distance values that is greater than or equal to the distance threshold as the target distance value; when the local model parameters of the j-th round of the i-th group belong to the first cluster cluster, and the local model parameters of the j-th round of the i-th group and the cluster center model parameters of the j-1-th round of the first cluster cluster are the target distance, the local model parameters of the j-th round of the i-th group are determined as abnormal parameters, and the client of the local model parameters of the j-th round of the i-th group is determined as an abnormal client; deleting the local model parameters of the j-th round of the i-th group in the first cluster cluster to obtain the updated first cluster cluster.
[0067] The above abnormal clients may be abnormal clients generated by data poisoning attacks, which may be caused by client abnormalities or attacker injections. Since the attacker cannot control the local training process of the client, there will be significant differences between the local model parameters obtained by abnormal client training and those obtained by normal client training. Therefore, the abnormal clients can be separated, identified and excluded through the clustering process, effectively preventing the impact of abnormal clients on the federated learning system and ensuring the accuracy and security of model training. At the same time, by monitoring and analyzing the behavior data of the client, abnormal behavior can be discovered in time and corresponding preventive measures can be taken to ensure the stable operation of the federated learning system.
[0068] As an optional implementation, before updating the K clusters according to the relationship between each distance value in the n0 distance values and the distance threshold, the method further includes: obtaining the distance threshold by the following formula: :
[0069]
[0070] in, is the default value. is the total number of said clients, is the abnormal parameter value of the local model parameter of the i-th group and the j-1th round obtained when the model parameter of the federated learning is updated in the j-1th round. In the case where the local model parameter of the i-th group and the j-1th round is an abnormal parameter, The value of is 1, otherwise The value of is 0, is the parameter value of the local model parameter of the i-th group in the j-1th round belonging to the k-th cluster when the j-1th round model parameter of the federated learning is updated. In the case where the local model parameter of the i-th group in the j-1th round belongs to the k-th cluster, The value of is 1, otherwise it is 0. is the local model parameter of the jth round in the i-th group, is the cluster center model parameter of the j-1th round of the kth cluster, is the Euclidean norm.
[0071] It should be noted that the above preset value can be set randomly or according to the value of n0. For example, when n0 is set to the number of abnormal clients, the preset value Can be set to 1. When n0 is set to one tenth of the total number of clients (i.e. n0=0.1N), the default value It can be set to 3 to capture abnormal clients. The distance threshold is determined based on the Euclidean distance between the local model parameters and the cluster center model parameters, and the abnormal client is judged based on the distance threshold. This can effectively detect the deviation or abnormality of the local model parameters, and timely discover and handle abnormal situations to ensure the accuracy and stability of the model.
[0072] As an optional implementation, after obtaining K j-th round cluster center model parameters and j-th round global model parameters through the updated K cluster clusters, the method further includes: in the presence of a j+1-th round model parameter update for federated learning and a newly added first client in the j+1-th round model parameter update, sending the j-th round global model parameters to the first client, so that the first client uses the j-th round global model parameters and the local data of the first client to train the neural network model of the first client.
[0073] By continuously maintaining the global model parameters and using them as the initial values for the next round of training for the newly joined clients, model training can be performed on the newly joined clients, which can help the newly joined clients converge to the optimal solution faster and effectively reduce the risk of overfitting of the model on the new clients, thereby improving training efficiency and generalization ability. At the same time, it can ensure that the models trained by the newly joined clients are consistent with those of other clients to avoid inconsistencies.
[0074] As an optional implementation, the method further includes: using the global model parameters of the j-th round as the model parameters of the neural network model of the first client to obtain the first neural network model of the first client; iteratively training the first neural network model, and when the first neural network model meets a preset first convergence condition, the first client ends the training of the first neural network model, and determines the model parameters of the first neural network at the end of the training as the local model parameters of the j+1-th round of the first client; wherein the first convergence condition includes that the function value between the loss value of the first neural network model and the penalty value of the first neural network model reaches a first preset threshold.
[0075] The first convergence condition may be a convergence condition of the first neural network model during iterative training, and the convergence condition may be that the value of the objective function obtained during iterative training reaches a minimum value (i.e., a first preset threshold), or is less than or equal to a preset threshold. Optionally, the first preset threshold may be obtained by the following formula: :
[0076]
[0077] in, is the value of the objective function, is the weight value of the i-th client, where , express The number of data points in , is the loss function of the ith client, For its local data, is the local model parameter of the ith client, is the distance between the local model parameters of the ith client and its corresponding clustering model parameters, is the total number of said clients, is a hyperparameter used to control and It should be noted that in order to facilitate calculation, You can calculate it by taking the square of its value.
[0078] Optionally, determining the model parameters of the first neural network at the end of training as the local model parameters of the first client in the j+1th round includes updating the local model parameters of the j+1th round by the following formula:
[0079]
[0080] in, is the local model parameter of the j+1th round, are the local model parameters of round j, Each round of local update is from local data A small batch of data randomly selected from is the step size of local model training, is the objective function of the first neural network model.
[0081] As an optional implementation, after obtaining K j-th round cluster center model parameters and j-th round global model parameters through the updated K cluster clusters, the method also includes: in the presence of a j+1-th round model parameter update for federated learning, and the j-th round local model parameters of the second client belong to the second cluster cluster, the j-th round cluster center model parameters of the second cluster cluster are sent to the second client, so that the second client uses the j-th round cluster center model parameters and the local data of the second client to train the neural network model of the second client, wherein the second client is any one of the N clients.
[0082] Optionally, cluster center model parameters can be assigned to the second client according to the preliminary membership matrix, that is, whether it is a normal client classified into the kth (1≤k≤K) class or a client classified into the K+1th class (i.e., classified as an abnormal client), the cluster center closest to its local model parameters is used as the initial value of its next round of local training model parameters. By using the closest cluster center as the initial value, it can converge to the global optimal solution faster, reduce training time and improve the generalization ability of the model. At the same time, for abnormal clients, using the closest cluster center model parameters as the initial value for the next round of training can help the model adapt to the data distribution of abnormal clients faster, thereby improving the performance of the overall model.
[0083] In addition, even if a client is classified as an abnormal client, the cluster center closest to it has a certain reference value for it. Therefore, by training the client with the nearest cluster center as the initial value of the abnormal client, it can prevent the client from being mistakenly classified as an abnormal client due to insufficient training, and subsequent correction can be performed, thereby ensuring the security of the system and improving the stability of the system.
[0084] As an optional implementation, the method also includes: using the cluster center model parameters of the j-th round of the second cluster cluster as the model parameters of the neural network model of the second client to obtain the second neural network model of the second client; iteratively training the second neural network model, and when the second neural network model meets a preset second convergence condition, the second client ends the training of the second neural network model, and determines the model parameters of the second neural network at the end of the training as the local model parameters of the j+1-th round of the second client; wherein the second convergence condition includes that the function value between the loss value of the second neural network model and the penalty value of the second neural network model reaches a second preset threshold.
[0085] For the specific implementation, please refer to the first client training method mentioned above.
[0086] As an optional implementation, the method also includes: when the j-th round of model parameter update for federated learning satisfies at least one of the following conditions, ending the model parameter update for the federated learning: the target average distance value for the j-th round of model parameter update is less than or equal to a preset threshold, wherein the target average distance value is the average value of the distance between the j-th round local model parameters of the N groups and the j-th round cluster center model parameters of the cluster cluster to which they belong; the number of rounds of the model parameter update for the federated learning reaches a preset round number threshold.
[0087] Optionally, the target average distance value of the j-th round of model parameter update can be calculated by the following formula: :
[0088]
[0089]
[0090] In the formula, is the distance between the local model parameters of the ith client and its corresponding clustering model parameters, is the total number of said clients, is the distance threshold, is the abnormal parameter value of the i-th group of local model parameters. In the case where the i-th group of local model parameters is an abnormal parameter, The value of is 1, otherwise The value of is 0, is the parameter value of the i-th group of local model parameters belonging to the k-th cluster. In the case where the i-th group of local model parameters belongs to the k-th cluster, The value of is 1, otherwise it is 0. n0 is a preset value used to limit the number of abnormal clients among all clients.
[0091] As an optional implementation, Figure 3 is a flowchart of the federated learning model training according to an embodiment of the present application, such as Figure 3 The specific process is as follows:
[0092] Step S1: The central server establishes a global parameter model and sets the initial values of the global model parameters. , and send it to each (N) client;
[0093] Step S2: The client uses local data to As the initial value for local training, assume that the i-th client trains the local model parameters , and send it to the central server;
[0094] Step S3: The central server randomly selects K local model parameters as cluster center model parameters ;
[0095] Step S4, the central server sets the initial value of the membership matrix U:
[0096] If the index of the cluster center model parameter closest to the local model parameter of the i-th client is , then set the elements of the membership matrix and ;
[0097] Step S5: The central server calculates the distance between the local model parameters of each client and the model parameters of each cluster center, determines the cluster center model parameters closest to the local model parameters of each client, and sets the preliminary membership matrix V accordingly:
[0098] If the index of the cluster center model parameter closest to the local model parameter of the i-th client is , then set the elements of the preliminary membership matrix and ;
[0099] Step S6: The central server calculates the distance threshold , and reset the membership matrix U:
[0100] Let the local model parameters of the i-th client be the model parameters of the cluster center closest to it (the The distance value of the cluster center model is , take the largest of the N calculated distance values The distance value and Compare. Assume that the distance between the local model parameters of the i-th client and the model parameters of the nearest cluster center is the largest The maximum distance value, and , then reset the membership and , that is, set the client as an abnormal client; otherwise, set and ;
[0101] Step S7: The central server updates the cluster center model parameters of the corresponding cluster using the average value in each cluster. , and average the updated cluster center model parameters to obtain , which is used as a global model parameter;
[0102] Step S8: The central server calculates the target average distance value , and set the cluster center model parameters According to the preliminary membership matrix Send to the corresponding client, and send the global model parameters to the newly joined client;
[0103] Step S9: Each client uses the cluster center model parameters or global model parameters sent by the central server for local training. The i-th client obtains the local model parameters. and send it to the central server.
[0104] Repeat steps S5-S9 in the above process until the number of iterations reaches the requirement or Convergence (specifically, it can be determined in step S8), at which point each client obtains the cluster center model parameters sent by the central server as the model parameters of the neural network model of the client.
[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, 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 RON / RAN, a disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0106] In this embodiment, a model parameter updating system for federated learning is also provided, and the system includes: a central server, which is used to receive local model parameters sent by N clients when updating the model parameters of the federated learning for the jth round, and obtain N groups of local model parameters for the jth round, wherein the N groups of local model parameters for the jth round correspond to the N clients one by one, and each group of local model parameters for the jth round is the global model parameters of the j-1th round or the cluster center model parameters of the j-1th round used by the corresponding client, and the local data of the client to update the neural network model. The parameters obtained by training in rounds, j and N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the j-1th round of the federated learning, and in the case of j=1, the global model parameters of the 0th round are the preset initial global model parameters, and the cluster center model parameters of the 0th round are the model parameters obtained by the client using the initial global model parameters and the local data to train the neural network model; through the K pairs of the cluster center model parameters of the j-1th round The N groups of local model parameters of the jth round are clustered to obtain K clusters, wherein K is an integer greater than or equal to 1, and the clusters include one or more groups of local model parameters of the jth round; the K clusters are updated according to the distance between the local model parameters of the jth round of each group in the cluster and the cluster center model parameters of the j-1th round to obtain the updated K clusters, and the K cluster center model parameters of the jth round and the global model parameters of the jth round are obtained through the updated K clusters; the second client is used to, when receiving the cluster center model parameters of the jth round of the second cluster sent by the central server, use the cluster center model parameters of the jth round of the second cluster as the model parameters of the neural network model, obtain the second neural network model, and iteratively train the second neural network model; when the second neural network model meets the preset second convergence condition, end the training of the second neural network model, and determine the model parameters of the second neural network at the end of the training as the local model parameters of the j+1th round, wherein the N clients include the second client.
[0107] In an exemplary embodiment, the system also includes a first client, which is a newly added client in the j+1th round of model parameter update of the federated learning, and is used to, upon receiving the global model parameters of the jth round sent by the central server, use the global model parameters of the jth round as model parameters of the neural network model, obtain the first neural network model, and iteratively train the first neural network model; when the first neural network model meets a preset first convergence condition, terminate the training of the first neural network model, and determine the model parameters of the first neural network at the end of the training as the local model parameters of the j+1th round.
[0108] In this embodiment, a model parameter updating device for federated learning is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0109] Figure 4 is a structural block diagram of a model parameter updating device for federated learning according to an embodiment of the present application, such as Figure 4As shown, the device includes: a receiving module 402, which is used to receive local model parameters sent by N clients when updating the model parameters of the j-th round of federated learning, and obtain N groups of local model parameters of the j-th round, wherein the N groups of local model parameters of the j-th round correspond to the N clients one by one, and each group of local model parameters of the j-th round is a parameter obtained by training the neural network model using the global model parameters of the j-1th round or the cluster center model parameters of the j-1th round and the local data of the client, j and N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the j-1th round of federated learning, and when j=1, the global model parameters of the 0th round are the preset initial global Model parameters, the cluster center model parameters of the 0th round are model parameters obtained by the client using the initial global model parameters and the local data to train the neural network model; a clustering module 404, used to cluster the N groups of local model parameters of the jth round through K cluster center model parameters of the j-1th round to obtain K cluster clusters, wherein K is an integer greater than or equal to 1, and the cluster cluster includes one or more groups of local model parameters of the jth round; an updating module 406, used to update the K cluster clusters according to the distance between each group of local model parameters of the jth round in the cluster cluster and the cluster center model parameters of the j-1th round to obtain the updated K cluster clusters, and obtain the K cluster center model parameters of the jth round and the global model parameters of the jth round through the updated K cluster clusters.
[0110] In an exemplary embodiment, the device is also used to determine the distance between each group of local model parameters of the j-th round and the cluster center model parameters of the j-1-th round of the cluster cluster to which it belongs, to obtain N distance values; determine the maximum n0 distance values among the N distance values, wherein n0 is a preset value and n0 is an integer greater than or equal to 1; and update the K cluster clusters according to the relationship between each distance value among the n0 distance values and the distance threshold to obtain the updated K cluster clusters.
[0111] In an exemplary embodiment, the device is also used to determine the distance value greater than or equal to the distance threshold among the n0 distance values as the target distance value; when the local model parameters of the j-th round of the i-th group belong to the first clustering cluster, and the local model parameters of the j-th round of the i-th group and the clustering center model parameters of the j-1-th round of the first clustering cluster are the target distance, the local model parameters of the j-th round of the i-th group are determined as abnormal parameters, and the client of the local model parameters of the j-th round of the i-th group is determined as an abnormal client; the local model parameters of the j-th round of the i-th group in the first clustering cluster are deleted to obtain the updated first clustering cluster.
[0112] In an exemplary embodiment, the device is further configured to obtain the distance threshold by the following formula: :
[0113]
[0114] in, is the default value. is the total number of said clients, is the abnormal parameter value of the local model parameter of the i-th group and the j-1th round obtained when the model parameter of the federated learning is updated in the j-1th round. In the case where the local model parameter of the i-th group and the j-1th round is an abnormal parameter, The value of is 1, otherwise The value of is 0, is the parameter value of the local model parameter of the i-th group in the j-1th round belonging to the k-th cluster when the j-1th round model parameter of the federated learning is updated. In the case where the local model parameter of the i-th group in the j-1th round belongs to the k-th cluster, The value of is 1, otherwise it is 0. is the local model parameter of the jth round in the i-th group, is the cluster center model parameter of the j-1th round of the kth cluster, is the Euclidean norm.
[0115] In an exemplary embodiment, the device is also used to perform the following operations on each of the K updated clusters, and the cluster cluster that performs the following operations is used as the current cluster cluster: the mean of the local model parameters of the jth round of each group included in the current cluster cluster is used to determine the cluster center model parameters of the jth round of the current cluster cluster.
[0116] In an exemplary embodiment, the apparatus is further configured to determine the mean of K j-th round cluster center model parameters as the j-th round global model parameter.
[0117] In an exemplary embodiment, the device is also used to send the global model parameters of the jth round to the first client when there is a j+1th round of model parameter update for federated learning and there is a newly joined first client in the j+1th round of model parameter update, so that the first client uses the global model parameters of the jth round and the local data of the first client to train the neural network model of the first client.
[0118] In an exemplary embodiment, the first client is also used to use the global model parameters of the j-th round as the model parameters of the neural network model of the first client to obtain the first neural network model of the first client; iteratively train the first neural network model, and when the first neural network model meets a preset first convergence condition, the first client ends the training of the first neural network model, and determines the model parameters of the first neural network at the end of the training as the local model parameters of the j+1-th round of the first client; wherein the first convergence condition includes that the function value between the loss value of the first neural network model and the penalty value of the first neural network model reaches a first preset threshold.
[0119] In an exemplary embodiment, the device is also used to send the cluster center model parameters of the jth round of the second clustering cluster to the second client when there is a j+1th round model parameter update for federated learning and the local model parameters of the second client in the jth round belong to the second clustering cluster, so that the second client uses the cluster center model parameters of the jth round and the local data of the second client to train the neural network model of the second client, wherein the second client is any one of the N clients.
[0120] In an exemplary embodiment, the second client is also used to use the cluster center model parameters of the j-th round of the second cluster cluster as the model parameters of the neural network model of the second client to obtain the second neural network model of the second client; iteratively train the second neural network model, and when the second neural network model meets a preset second convergence condition, the second client ends the training of the second neural network model, and determines the model parameters of the second neural network at the end of the training as the local model parameters of the j+1-th round of the second client; wherein the second convergence condition includes that the function value between the loss value of the second neural network model and the penalty value of the second neural network model reaches a second preset threshold.
[0121] In an exemplary embodiment, the device is also used to terminate the model parameter update of the federated learning when the j-th round of model parameter update of the federated learning satisfies at least one of the following conditions: the target average distance value of the model parameter update in the j-th round is less than or equal to a preset threshold, wherein the target average distance value is the average value of the distance between the N groups of local model parameters in the j-th round and the cluster center model parameters in the j-th round of the cluster cluster to which they belong; the number of rounds of the model parameter update for the federated learning reaches a preset round number threshold.
[0122] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0123] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0124] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (RON), a random access memory (RAN), a mobile hard disk, a magnetic disk or an optical disk.
[0125] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0126] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0127] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0128] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0129] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0130] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for updating model parameters of federated learning, characterized in that: include: In the case of updating the model parameters of the j-th round of federated learning, local model parameters sent by N clients are received to obtain N groups of local model parameters of the j-th round, wherein the N groups of local model parameters of the j-th round correspond to the N clients one by one, and each group of local model parameters of the j-th round is a parameter obtained by the corresponding client using the global model parameters of the j-1th round or the cluster center model parameters of the j-1th round and the local data of the client to train the neural network model, j and N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the j-1th round of federated learning, and when j=1, the global model parameters of the 0th round are preset initial global model parameters, and the cluster center model parameters of the 0th round are model parameters obtained by the client using the initial global model parameters and the local data to train the neural network model; Clustering N groups of local model parameters of the j-th round by using K cluster center model parameters of the j-1-th round to obtain K cluster clusters, wherein K is an integer greater than or equal to 1, and the cluster clusters include one or more groups of local model parameters of the j-th round; The K cluster clusters are updated according to the distance between the local model parameters of the j-th round in each group of the cluster clusters and the cluster center model parameters of the j-1-th round to obtain the updated K cluster clusters, and the K cluster center model parameters of the j-th round and the global model parameters of the j-th round are obtained through the updated K cluster clusters.
2. The method according to claim 1, characterized in that The updating of the K clusters according to the distance between the local model parameters of the j-th round in each group of the clusters and the cluster center model parameters of the j-1-th round to obtain the updated K clusters includes: Determine the distance between the j-th round local model parameters of each group and the j-1-th round cluster center model parameters of the cluster cluster to which it belongs, and obtain N distance values; Determine the largest n among the N distance values 0 distance values, where n 0 is the default value, n 0 is an integer greater than or equal to 1; According to n 0 The K clusters are updated based on the relationship between each distance value in the distance values and the distance threshold, so as to obtain the updated K clusters.
3. The method according to claim 2, characterized in that According to n 0 The K clusters are updated based on the relationship between each distance value in the distance values and the distance threshold, to obtain the updated K clusters, including: The n 0 The distance value greater than or equal to the distance threshold among the distance values is determined as the target distance value; In the case where the local model parameters of the j-th round of the i-th group belong to the first clustering cluster, and the local model parameters of the j-th round of the i-th group and the cluster center model parameters of the j-1-th round of the first clustering cluster are the target distance, the local model parameters of the j-th round of the i-th group are determined as abnormal parameters, and the client of the local model parameters of the j-th round of the i-th group is determined as an abnormal client; The local model parameters of the i-th group and the j-th round in the first cluster are deleted to obtain an updated first cluster.
4. The method according to claim 3, characterized in that According to n 0 The method further comprises: The distance threshold is obtained by the following formula : ; in, is the default value. is the total number of said clients, is the abnormal parameter value of the local model parameter of the i-th group and the j-1th round obtained when the model parameter of the federated learning is updated in the j-1th round. In the case where the local model parameter of the i-th group and the j-1th round is an abnormal parameter, The value of is 1, otherwise The value of is 0, is the parameter value of the local model parameter of the i-th group in the j-1th round belonging to the k-th cluster when the j-1th round model parameter of the federated learning is updated. In the case where the local model parameter of the i-th group in the j-1th round belongs to the k-th cluster, The value of is 1, otherwise it is 0. is the local model parameter of the jth round in the i-th group, is the cluster center model parameter of the j-1th round of the kth cluster, is the Euclidean norm.
5. The method according to claim 1, characterized in that K cluster center model parameters of the jth round are obtained through the updated K cluster clusters, including: The following operations are performed on each of the updated K clusters, and the cluster that performs the following operations is used as the current cluster: The cluster center model parameters of the jth round of the current cluster are determined by taking the mean values of the local model parameters of the jth round of each group included in the current cluster.
6. The method according to claim 1 or 5, characterized in that: The method further comprises: The mean values of the K cluster center model parameters of the j-th round are determined as the global model parameters of the j-th round.
7. The method according to claim 1, characterized in that After obtaining K j-th round cluster center model parameters and j-th round global model parameters through the updated K cluster clusters, the method further includes: When there is a j+1th round of model parameter update for federated learning and there is a newly joined first client in the j+1th round of model parameter update, the global model parameters of the jth round are sent to the first client, so that the first client uses the global model parameters of the jth round and the local data of the first client to train the neural network model of the first client.
8. The method according to claim 7, characterized in that The method further comprises: Using the global model parameters of the j-th round as model parameters of the neural network model of the first client to obtain a first neural network model of the first client; Iteratively training the first neural network model, when the first neural network model satisfies a preset first convergence condition, the first client ends the training of the first neural network model, and determines the model parameters of the first neural network at the end of the training as the local model parameters of the first client in the j+1th round; The first convergence condition includes that a function value between a loss value of the first neural network model and a penalty value of the first neural network model reaches a first preset threshold.
9. The method according to claim 1, characterized in that: After obtaining K j-th round cluster center model parameters and j-th round global model parameters through the updated K cluster clusters, the method further includes: When there is a j+1th round of model parameter update for federated learning and the jth round local model parameters of the second client belong to the second clustering cluster, the jth round cluster center model parameters of the second clustering cluster are sent to the second client, so that the second client uses the jth round cluster center model parameters and the local data of the second client to train the neural network model of the second client, wherein the second client is any one of the N clients.
10. The method according to claim 9, characterized in that The method further comprises: Using the cluster center model parameters of the jth round of the second cluster as the model parameters of the neural network model of the second client, to obtain the second neural network model of the second client; Iteratively train the second neural network model. When the second neural network model satisfies a preset second convergence condition, the second client ends the training of the second neural network model, and determines the model parameters of the second neural network at the end of the training as the local model parameters of the second client in the j+1th round; The second convergence condition includes that a function value between a loss value of the second neural network model and a penalty value of the second neural network model reaches a second preset threshold.
11. The method according to claim 9, characterized in that The method further comprises: When the j-th round of model parameter update for federated learning satisfies at least one of the following conditions, the model parameter update for the federated learning is terminated: The target average distance value of the j-th round model parameter update is less than or equal to a preset threshold, wherein the target average distance value is the average value of the distances between the j-th round local model parameters of the N groups and the j-th round cluster center model parameters of the cluster cluster to which they belong; The number of rounds of updating the model parameters of the federated learning reaches a preset round threshold.
12. A model parameter updating system for federated learning, characterized in that: include: A central server is used to receive local model parameters sent by N clients when updating the model parameters of the j-th round of federated learning, and obtain N groups of local model parameters of the j-th round, wherein the N groups of local model parameters of the j-th round correspond to the N clients one by one, and each group of local model parameters of the j-th round is a parameter obtained by the corresponding client using the global model parameters of the j-1th round or the cluster center model parameters of the j-1th round, and the local data of the client to train the neural network model, j, N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the j-1th round of federated learning, and when j=1, the global model parameters of the 0th round are preset The initial global model parameters of the 0th round, the cluster center model parameters of the 0th round are the model parameters obtained by the client training the neural network model using the initial global model parameters and the local data; clustering the N groups of local model parameters of the jth round through the K cluster center model parameters of the j-1th round to obtain K cluster clusters, wherein K is an integer greater than or equal to 1, and the cluster clusters include one or more groups of local model parameters of the jth round; updating the K cluster clusters according to the distance between each group of local model parameters of the jth round in the cluster clusters and the cluster center model parameters of the j-1th round to obtain the updated K cluster clusters, and obtaining the K cluster center model parameters of the jth round and the global model parameters of the jth round through the updated K cluster clusters; The second client is used for, upon receiving the cluster center model parameters of the j-th round of the second clustering cluster sent by the central server, using the cluster center model parameters of the j-th round of the second clustering cluster as model parameters of the neural network model to obtain a second neural network model, and iteratively training the second neural network model; when the second neural network model meets a preset second convergence condition, ending the training of the second neural network model, and determining the model parameters of the second neural network at the end of the training as local model parameters of the j+1-th round, wherein the N clients include the second client.
13. The system according to claim 12, characterized in that The system further comprises: A first client, wherein the first client is a newly added client in the j+1th round of model parameter update of the federated learning, and is used for, upon receiving the global model parameters of the jth round sent by the central server, using the global model parameters of the jth round as model parameters of the neural network model, obtaining a first neural network model, and iteratively training the first neural network model; when the first neural network model satisfies a preset first convergence condition, terminating the training of the first neural network model, and determining the model parameters of the first neural network at the end of the training as local model parameters of the j+1th round.
14. A model parameter updating device for federated learning, characterized in that: include: A receiving module, used for receiving local model parameters sent by N clients when updating the model parameters of the j-th round of federated learning, and obtaining N groups of local model parameters of the j-th round, wherein the N groups of local model parameters of the j-th round correspond to the N clients one by one, and each group of local model parameters of the j-th round is a parameter obtained by the corresponding client using the global model parameters of the j-1th round or the cluster center model parameters of the j-1th round, and the local data of the client to train the neural network model, j and N are integers greater than or equal to 1, the global model parameters of the j-1th round and the cluster center model parameters of the j-1th round are model parameters obtained by updating the model parameters of the j-1th round of federated learning, and when j=1, the global model parameters of the 0th round are preset initial global model parameters, and the cluster center model parameters of the 0th round are model parameters obtained by the client using the initial global model parameters and the local data to train the neural network model; A clustering module, used for clustering the N groups of local model parameters of the jth round by using K cluster center model parameters of the j-1th round to obtain K cluster clusters, wherein K is an integer greater than or equal to 1, and the cluster clusters include one or more groups of local model parameters of the jth round; An updating module is used to update the K clustering clusters according to the distance between the local model parameters of the j-th round of each group in the clustering cluster and the clustering center model parameters of the j-1-th round, to obtain the updated K clustering clusters, and obtain K clustering center model parameters of the j-th round and the global model parameters of the j-th round through the updated K clustering clusters.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 11 when executed by a processor.
16. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 11 are implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Unsupervised federal learning poisoning defense method based on high-dimensional space clustering
CN116738270A
Personalized federal learning method and device with privacy protection and medium
CN117094382A
Abnormality monitoring method and device
CN117196065A
Self-adaptive clustering federal learning method with differential privacy
CN117634594A
Cited By
Data poisoning identification method and device for computing power scheduling model training
CN119988898A
A data poisoning identification method and device for computing power scheduling model training
CN119988898B