Federal learning method, device and system

By retraining the federated learning model on the server side and using sparse constraint and distance constraint technology, the problems of low model accuracy and large transmission delay caused by data heterogeneity are solved, and the accuracy and generalization ability of the model are improved. Reduced communication costs.

CN118709804APending Publication Date: 2024-09-27HUAWEI TECH CO LTD

Patent Information

Application Number
CN202410721399.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2021-05-25
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

In federated learning, due to the heterogeneity of data between clients and servers, models trained directly on each client have low accuracy and long transmission delays, resulting in weak model generalization capabilities.

Method used

By retraining the received model on the server side, using techniques such as sparse constraints and distance constraints, the noise and personalized features in the model are removed, the generalization ability of the model is improved, and communication costs are reduced.

Benefits of technology

It achieves higher accuracy and generalization capabilities of the model, reduces the consumption of communication resources, and improves the efficiency and effect of federated learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709804A
    Figure CN118709804A
Patent Text Reader

Abstract

The invention provides a federated learning method, device and system, which are used for retraining a received model by a server in a federated learning process to realize depersonalization processing to a certain degree so as to obtain a model with higher output precision. The method comprises the steps that firstly, a first server receives information of at least one first model sent by at least one downstream device, and the at least one downstream device can comprise other servers or clients connected to the first server; the first server trains the at least one first model to obtain at least one trained first model; and then, the first server aggregates the trained at least one first model, and updates a locally stored second model by using an aggregation result to obtain an updated second model.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202110573525.4, and the original application date is May 25, 2021. The entire contents of the original application are incorporated into this application by reference. Technical Field

[0002] The present application relates to the field of artificial intelligence, and in particular to a federated learning method, device and system. Background Art

[0003] Federated Learning is a machine learning framework proposed to address the existence of "data islands". It can effectively help all participants (clients) conduct joint training and establish shared machine learning models without sharing data resources, that is, without leaving the local training data.

[0004] In actual deployment, in order to solve the problem of long transmission delay caused by the long distance between the client and the server, an intermediate server (edge ​​server) is generally introduced between the server and the client to form a layered architecture of edge-end cloud. The edge server is closer to the client, which greatly reduces the transmission delay. However, when performing federated learning, the training data between the clients is likely to be heterogeneous data, so the model obtained by directly aggregating the models trained on each client may have low accuracy. Summary of the invention

[0005] The present application provides a federated learning method, device and system, which are used for the server to retrain the terminal model during the federated learning process to achieve a certain degree of depersonalization processing to obtain a model with higher output accuracy.

[0006] In view of this, in a first aspect, the present application provides a federated learning method, comprising: first, a first server receives information of at least one first model sent by at least one downstream device, and the at least one downstream device may include other servers or clients connected to the first server, etc.; the first server trains the at least one first model to obtain at least one trained first model; then, the first server aggregates the at least one trained first model, and updates the locally stored second model according to the aggregation result to obtain an updated second model.

[0007] Therefore, in the implementation mode of the present application, the downstream device can obtain the first model based on its own personalized data. After receiving the first model fed back by the downstream device, the server can retrain the first model, thereby achieving a certain degree of de-personalization of the first model, such as removing some noise or adapting to the model differences caused by different data distributions between various downstream devices, etc., to improve the generalization ability of the model and the output accuracy of the final model. It can be understood that the data distribution differences of the downstream devices are appropriately utilized, and while ensuring the personalization of the models of each downstream device, the features that are not conducive to fusion in each first model are removed through retraining, so that the model obtained by fusing multiple retrained first models has higher accuracy and generalization ability.

[0008] In a possible implementation, the aforementioned first server trains at least one first model to obtain at least one trained first model, which may include: the first server trains at least one first model under the constraint of a first sparse constraint condition to obtain at least one trained first model, and the first sparse constraint condition includes a constraint formed by a function for reducing parameters in the first model.

[0009] Therefore, in an embodiment of the present application, the first server can train the first model under the constraint of the first sparse constraint condition, thereby obtaining a first model with fewer trained parameters, thereby reducing the communication resources required by the first server when transmitting the first model to other devices and reducing communication costs.

[0010] In a possible implementation, the aforementioned first server trains at least one first model to obtain at least one trained first model, which may include: the first server trains at least one first model under the constraints of a first sparsity constraint and a first distance constraint to obtain at least one trained first model, and the first distance constraint includes a constraint formed by the similarity or distance between at least one first model and a second model.

[0011] Therefore, in the implementation mode of the present application, the first server can train the received first model under the sparse constraint, thereby reducing the number of parameters of the final model, reducing the communication volume of the first server and other devices transmitting the first model, and reducing the communication cost. In addition, the first server can also train the first model under the distance constraint, thereby achieving a certain degree of depersonalization of the first model, improving the generalization ability of the first model, and obtaining a model that adapts to the data distribution characteristics of the first server and downstream devices, so that a certain similarity or distance can be maintained between the first model and the second model, thereby obtaining a more accurate output model.

[0012] Optionally, the first distance constraint condition may specifically include one or more of the following: constraints formed by one or more of Euclidean distance, Minkowski distance (or Minkowski distance), Manhattan distance, Chebyshev distance, Minkowski distance, Mahalanobis distance, mutual information, cosine similarity, Pearson correlation coefficient, entropy function or inner product, etc.

[0013] In a possible implementation, the aforementioned first server trains at least one first model under the constraints of a first sparsity constraint and a first distance constraint to obtain at least one trained first model, which may include: the first server perturbs at least one first model using noise to obtain at least one updated first model; the first server trains at least one first model under the constraints of a first sparsity constraint and a first distance constraint to obtain at least one trained first model.

[0014] Therefore, in the implementation manner of the present application, a new first model can be obtained by adding noise disturbance, thereby achieving depersonalization of the first model to a certain extent through disturbance to obtain a new first model, so as to facilitate the subsequent re-training of the first model by the first server.

[0015] In a possible implementation, the aforementioned first distance constraint may also include a constraint formed by the similarity or distance between the second model and the third model. The third model is a model sent by an upstream device of the first server to the first server. The upstream device may include an edge server or a cloud server connected to the first server.

[0016] Therefore, in an implementation manner of the present application, the distance constraint may also include the similarity or distance between the second model locally stored in the server and the third model sent by the upstream device, so that the final model can combine the similarity or distance between the second model and the third model as a constraint, so that the final model can adapt to the data distribution differences between the first server and the upstream device, thereby improving the generalization ability of the final model.

[0017] In a possible implementation, the aforementioned first sparse constraint condition includes the norm of a vector or matrix of at least one first model, and the norm includes: 0 Norm, l 1 Norm, l p Norm, l 12 Norm, l p2 Norm, l 0 Continuous function after norm transformation, l 1 Continuous function after norm transformation, l p Continuous function after norm transformation, l 12Continuous function after norm transformation or l p2 Continuous function after norm transformation, p∈(0,1).

[0018] Therefore, in the implementation manner of the present application, multiple norms or variations of norms can be used to implement sparse constraints, thereby reducing the parameters in the model, reducing the communication resources required to transmit the model between devices, and reducing communication costs.

[0019] In a possible implementation, before the first server receives information of at least one first model sent by at least one downstream device, the method also includes: the first server receives a third model sent by the upstream device to the first server; and the first server updates the locally stored model according to the third model to obtain a second model.

[0020] Therefore, in the implementation manner of the present application, the first server may also receive the third model sent by the upstream device, thereby updating the local model to obtain the second model, so as to obtain a new second model.

[0021] In a possible implementation, after the first server obtains the updated second model, the method provided in the present application may further include: the first server trains the third model to obtain an updated third model, where the third model is a model sent by the upstream device to the first server.

[0022] Therefore, in the implementation mode of the present application, the first server can also receive the third model sent by the second server, thereby updating the local model to obtain the second model. Then, after obtaining the second model updated based on the first model, the third model can be trained, so that the third model can be trained based on the sparse second model, which can achieve a certain degree of depersonalization and improve the generalization ability of the model.

[0023] In a possible implementation, the aforementioned first server trains the third model to obtain an updated third model, which may include: the first server trains the third model under the constraint of a second sparse constraint condition to obtain a trained third model, and the second sparse constraint condition includes a constraint formed by a function for reducing parameters in the third model.

[0024] In an implementation manner of the present application, the first server may also train the third model under sparse constraints, thereby reducing parameters in the third model, reducing communication resources required by the first server to transmit the third model, and reducing communication costs.

[0025] In a possible implementation, the method provided in the present application may further include: the first server sends information about the trained third model to an upstream device. For example, when the trained third model meets the first preset condition, the first server may send information about the trained third model to the upstream device.

[0026] Therefore, in the implementation manner of the present application, the trained third model can be fed back to the upstream device, so that the model on the upstream device can be updated through the first server.

[0027] Optionally, the first preset condition may specifically include but is not limited to one or more of the following: the output accuracy of the third model after training exceeds a first threshold, or the average output accuracy of the third model after training exceeds a second threshold, or the number of updates of the third model reaches a preset number, etc.

[0028] In a possible implementation, the method provided in the present application may also include: the first server sends the updated second model as the new first model to at least one downstream device sending information of the updated second model, so that at least one downstream device trains the new first model. For example, if the trained third model does not meet the first preset condition, the first server may send information of the new first model to at least one downstream device.

[0029] Therefore, in an embodiment of the present application, the first server may continue to send new information of the first model to at least one downstream device, so that at least one downstream device trains the updated second model and performs the next round of iteration until a third model that meets the requirements is obtained.

[0030] In a possible implementation, after the first server obtains the updated second model, the method provided in the present application may further include: the first server sends information of the updated second model to an upstream device, so that the upstream device trains the third model according to the information of the updated second model to obtain a trained third model.

[0031] Therefore, in the implementation manner of the present application, the first server can send the updated second model to the upstream device, and the upstream device updates the third model, thereby reducing the workload of the first server.

[0032] Optionally, if the third model is trained by the upstream device, it can be determined whether the updated second model meets the convergence condition, which may include a first preset condition or a condition similar to the first preset condition, so that the current round of iteration is completed when the second model meets the convergence condition, and the third model is trained by the upstream device.

[0033] In second aspect, the present application provides a federated learning method, including: first, a first client receives information of a first model sent by a first server; the first client trains the first model under a third sparse constraint condition to obtain a trained first model, and the third sparse constraint condition includes a constraint formed by a function for reducing parameters in the first model; the first client sends information of the trained first model to the first server, so that the first server trains the locally stored first model according to the received information of the trained first model to obtain a new first model.

[0034] Therefore, in an implementation manner of the present application, after receiving the model sent by the server, the client can train the model under sparse constraints to obtain a first model with fewer parameters. Therefore, the model with fewer parameters can be fed back to the first server, thereby reducing the required communication resources and lowering communication costs.

[0035] In a possible implementation, the aforementioned first client trains the first model under the constraints of the third sparse constraint condition to obtain the trained first model, which may include: the first client trains the first model under the constraints of the third sparse constraint condition and the second distance constraint condition to obtain the trained first model, and the second distance constraint condition includes a constraint formed by the similarity or distance between the first model and a locally stored fourth model.

[0036] Therefore, in the implementation mode of the present application, in addition to adding sparse constraints, distance constraints can also be added. The distance constraints enable the client to find a personalized model that is different from the edge server model sent by the edge server and can adapt to the client's local data set, which can alleviate the difficulties in federated learning training caused by the heterogeneity of data from different clients in federated learning.

[0037] For example, a second distance constraint can be added to the loss function, and the second distance constraint can specifically include one or more of the following: Euclidean distance, Minkowski distance (or Minkowski distance), Manhattan distance, Chebyshev distance, Minkowski distance, Mahalanobis distance, mutual information, cosine similarity, Pearson correlation coefficient or entropy function, etc.

[0038] In a third aspect, an embodiment of the present application provides a federated learning device, which has the function of implementing the federated learning method of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0039] In a fourth aspect, an embodiment of the present application provides a federated learning device, which has the function of implementing the federated learning method of the second aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0040] In a fifth aspect, an embodiment of the present application provides a federated learning device, comprising: a processor and a memory, wherein the processor and the memory are interconnected via a line, and the processor calls a program code in the memory to execute the processing-related functions in the federated learning method shown in any one of the first aspects above. Optionally, the federated learning device can be a chip.

[0041] In a sixth aspect, an embodiment of the present application provides a federated learning device, comprising: a processor and a memory, wherein the processor and the memory are interconnected via a line, and the processor calls a program code in the memory to execute the processing-related function in the first method shown in any one of the second aspects above. Optionally, the federated learning device can be a chip.

[0042] In the seventh aspect, an embodiment of the present application provides a digital processing chip or chip, the chip includes a processing unit and a communication interface, the processing unit obtains program instructions through the communication interface, the program instructions are executed by the processing unit, and the processing unit is used to perform functions related to processing in any optional implementation of the first aspect or the second aspect mentioned above.

[0043] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enables the computer to execute a method in any optional implementation of the first aspect or the second aspect above.

[0044] In the ninth aspect, an embodiment of the present application provides a computer program product comprising a computer program / instructions, which, when executed by a processor, enables the processor to execute a method in any optional implementation of the first aspect or the second aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 A structural diagram of the main framework of artificial intelligence;

[0046] Figure 2 A schematic diagram of the architecture of a federated learning system provided for this application;

[0047] Figure 3 A schematic diagram of the architecture of another federated learning system provided for this application;

[0048] Figure 4 A schematic diagram of the architecture of another federated learning system provided for this application;

[0049] Figure 5 A schematic diagram of the architecture of another federated learning system provided for this application;

[0050] Figure 6 The process intention of a federated learning method provided for this application;

[0051] Figure 7 The process intent of another federated learning approach provided for this application;

[0052] Figure 8 The process intent of another federated learning approach provided for this application;

[0053] Fig. 9 The process intent of another federated learning approach provided for this application;

[0054] Fig.10 The process intent of another federated learning approach provided for this application;

[0055] Fig.11 A schematic diagram of the structure of a federated learning device provided for this application;

[0056] Fig.12 A schematic diagram of the structure of another federated learning device provided for this application;

[0057] Fig.13 A schematic diagram of the structure of a server provided for this application;

[0058] Fig.14 A schematic diagram of the structure of a client provided for this application. DETAILED DESCRIPTION

[0059] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0060] First, the overall workflow of the artificial intelligence system is described. Figure 1 , Figure 1The figure shows a structural diagram of the main framework of artificial intelligence. The following is an explanation of the above artificial intelligence theme framework from the two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has undergone a condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecology process of the system.

[0061] (1) Infrastructure

[0062] Infrastructure provides computing power support for artificial intelligence systems, enables communication with the outside world, and supports it through the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips, such as central processing units (CPU), neural-network processing units (NPU), graphics processing units (GPU), application specific integrated circuits (ASIC) or field programmable gate arrays (FPGA) and other hardware acceleration chips; the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.

[0063] (2) Data

[0064] The data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.

[0065] (3) Data processing

[0066] Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.

[0067] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.

[0068] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.

[0069] Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.

[0070] (4) General ability

[0071] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0072] (5) Smart products and industry applications

[0073] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.

[0074] The examples of this application are mainly used to train machine learning models used in various application federated learning scenarios. The trained machine learning models can be applied to the above-mentioned various application fields to achieve classification, regression or other functions. The processing objects of the trained machine learning models can be image samples, discrete data samples, text samples or voice samples, etc., which are not exhaustively listed here. Among them, the machine learning model can be specifically expressed as a neural network, a linear model or other types of machine learning models, etc. Correspondingly, the multiple modules that constitute the machine learning model can be specifically expressed as a neural network module, a current model module or modules that constitute other types of machine learning models, etc., which are not exhaustively listed here. In the subsequent embodiments, only the machine learning model expressed as a neural network is used as an example for explanation. When the machine learning model is expressed as other types other than a neural network, it can be understood by analogy, and it will not be repeated in the embodiments of this application.

[0075] The embodiments of the present application can be applied to the field of federated learning, and can train neural networks through the collaboration of clients and servers, thus involving a large number of neural network-related applications, such as neural networks trained by clients during federated learning. In order to better understand the solutions of the embodiments of the present application, the following first introduces the relevant terms and concepts of neural networks that may be involved in the embodiments of the present application.

[0076] (1) Neural Network

[0077] A neural network may be composed of neural units. A neural unit may refer to an operation unit with xs and intercept 1 as input. The output of the operation unit may be as shown in formula (1-1):

[0078]

[0079] Where s=1, 2, ...n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolution layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the characteristics of the local receptive field. The local receptive field can be an area composed of several neural units.

[0080] (2) Deep Neural Networks

[0081] A deep neural network (DNN), also known as a multi-layer neural network, can be understood as a neural network with multiple intermediate layers. According to the position of different layers, the neural network inside the DNN can be divided into three categories: input layer, intermediate layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all intermediate layers, or hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer.

[0082] Although DNN looks complicated, each layer can be expressed as a linear relationship expression: in, is the input vector, is the output vector, is the offset vector or bias parameter, w is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since DNN has many layers, the coefficient W and the offset vector The number of these parameters is also relatively large. The definitions of these parameters in DNN are as follows: Taking the coefficient w as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscripts correspond to the third layer index 2 of the output and the second layer index 4 of the input.

[0083] In summary, the coefficients from the kth neuron in the L-1th layer to the jth neuron in the Lth layer are defined as

[0084] It should be noted that the input layer does not have a W parameter. In a deep neural network, more intermediate layers allow the network to better characterize complex situations in the real world. Theoretically, the more parameters a model has, the higher its complexity and the greater its "capacity", which means it can complete more complex learning tasks. Training a deep neural network is the process of learning the weight matrix, and its ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (a weight matrix formed by many layers of vectors W).

[0085] (3) Convolutional Neural Network

[0086] Convolutional neural network (CNN) is a deep neural network with a convolutional structure. Convolutional neural network contains a feature extractor consisting of a convolution layer and a subsampling layer, which can be regarded as a filter. Convolutional layer refers to the neuron layer in the convolutional neural network that performs convolution processing on the input signal. In the convolutional layer of the convolutional neural network, a neuron can only be connected to some neurons in the adjacent layers. A convolutional layer usually contains several feature planes, each of which can be composed of some rectangularly arranged neural units. The neural units in the same feature plane share weights, and the shared weights here are convolution kernels. Shared weights can be understood as the way to extract image information is independent of position. The convolution kernel can be initialized in the form of a matrix of random size, and the convolution kernel can obtain reasonable weights through learning during the training process of the convolutional neural network. In addition, the direct benefit of shared weights is to reduce the connection between the layers of the convolutional neural network, while reducing the risk of overfitting.

[0087] (4) Loss Function

[0088] In the process of training a deep neural network, because we hope that the output of the deep neural network is as close as possible to the value we really want to predict, we can compare the predicted value of the current network with the target value we really want, and then update the weight vector of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it predict a lower value, and continue to adjust until the deep neural network can predict the target value we really want or a value very close to the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the deep neural network becomes a process of minimizing this loss as much as possible. The loss function can usually include loss functions such as squared error, cross entropy, logarithm, exponential, etc. For example, the squared error can be used as a loss function, defined as The specific loss function can be selected according to the actual application scenario.

[0089] (5) Back propagation algorithm

[0090] Neural networks can use the error back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the parameters in the initial neural network model are updated by back propagating the error loss information, so that the error loss converges. The back propagation algorithm is a back propagation movement dominated by error loss, which aims to obtain the optimal parameters of the neural network model, such as the weight matrix.

[0091] In the present application, when the client performs model training, the global model can be trained through a loss function or through a BP algorithm to obtain a trained global model.

[0092] (6) Federated learning (FL)

[0093] A distributed machine learning algorithm that uses multiple clients, such as mobile devices or edge servers, and servers to collaboratively complete model training and algorithm updates without leaving the domain to obtain a trained global model. It can be understood that in the process of machine learning, each participant can use the data of other parties for joint modeling. All parties do not need to share data resources, that is, data joint training is performed without leaving the local area to establish a shared machine learning model.

[0094] First, the federated learning system provided by this application is introduced.

[0095] See also Figure 2 , a schematic diagram of the architecture of a federated learning system provided in this application. The system (or cluster for short) may include multiple servers, which can establish connections with each other, that is, the servers can also communicate with each other. Each server can communicate with one or more clients, and the clients can be deployed in various devices, such as mobile terminals or servers, etc. Figure 2 The client 1, client 2, ..., client N-1 and client N etc. are shown in FIG.

[0096] Specifically, the servers or the servers and the clients can interact through any communication mechanism / communication standard communication network, and the communication network can be a wide area network, a local area network, a point-to-point connection, or any combination thereof. Specifically, the communication network may include a wireless network, a wired network, or a combination of a wireless network and a wired network. The wireless network includes, but is not limited to, a fifth generation mobile communication technology (5th-Generation, 5G) system, a long term evolution (long term evolution, LTE) system, a global system for mobile communication (global system for mobilecommunication, GSM) or a code division multiple access (code division multiple access, CDMA) network, a wideband code division multiple access (wideband code division multiple access, WCDMA) network, wireless fidelity (wirelessfidelity, WiFi), Bluetooth (bluetooth), Zigbee protocol (Zigbee), radio frequency identification technology (radio frequency identification, RFID), long range (Lora) wireless communication, near field communication (near fieldcommunication, NFC) in any one or more combinations. The wired network may include a fiber optic communication network or a network composed of coaxial cables, etc.

[0097] Generally, the client can be deployed in various servers or terminals. The client mentioned below may also refer to a server or terminal on which the client software program is deployed. The terminal may include a mobile terminal or a fixedly installed terminal, etc. For example, the terminal may specifically include a mobile phone, a tablet, a personal computer (PC), a smart bracelet, a speaker, a television, a smart watch or other terminals, etc.

[0098] When conducting federated learning, each server can send the model to be trained to the client that has established a connection with it. The client can train the model using the training samples stored locally and feed back the data of the trained model to the server. After receiving the trained model or models fed back by one or more clients, the server can aggregate the data of the received one or more models to obtain the aggregated data, which is equivalent to the aggregated model. After the stop condition is met, the final model can be output to complete the federated learning.

[0099] Usually, in order to solve the problem of long transmission delay caused by the long distance between the client and the server, an intermediate layer server (referred to as an edge server in this application) is generally introduced between the server and the client to form a multi-layer architecture, namely, a client-edge server-cloud server architecture, thereby reducing the transmission delay between the client and the federated learning system through the edge server.

[0100] Usually, in some common methods, the client can upload the trained client local model to the variable server for aggregation, the edge server uploads the aggregated edge server model to the cloud server, and the cloud server aggregates the received edge server models to obtain the final global model.

[0101] However, the training data between clients is usually heterogeneous. The global model obtained by simply averaging the client models does not support the personalized features of the clients, making the final global model less adaptable to the clients and having weak generalization capabilities. In addition, edge servers in different regions may have specific models. Simply averaging the edge server models to obtain a global model does not support the personalized features of edge servers. The final global model may not be applicable to every edge server and the clients connected to it. In addition, clients and servers usually communicate frequently, and each communication uploads or sends a complete model, resulting in a large amount of transmission.

[0102] Therefore, the present application provides a federated learning method that supports personalized training models of clients and personalized update models of servers, and can, to a certain extent, achieve depersonalization of other devices, thereby generalizing a global model with stronger generalization capabilities.

[0103] Specifically, the federated learning system to which the federated learning method provided in the present application can be applied may include a variety of topological relationships. For example, the federated learning system may include a two-layer or more-layer architecture. Some possible architectures are exemplarily introduced below.

[0104] 1. Two-tier architecture

[0105] like Figure 3 As shown, a structural diagram of a federated learning system provided by this application.

[0106] The federated learning system includes a two-layer architecture formed by a server and a client. The server can directly establish a connection with one or more clients.

[0107] During the federated learning process, the server sends the global model to one or more clients that have established connections with it. The client uses the locally stored training samples to train the received global model and feeds the trained global model back to the server. The server updates the locally stored global model based on the received trained global model to obtain the final global model.

[0108] Second and third-tier architecture

[0109] like Figure 4 As shown, a structural diagram of a federated learning system provided by this application.

[0110] Among them, the federated learning system includes one or more cloud servers, one or more edge servers and one or more clients, forming a three-layer architecture of cloud server-edge server-client.

[0111] In the system, one or more edge servers are connected to the cloud server, and one or more clients are connected to the edge servers.

[0112] During the federated learning process, the cloud server sends the locally stored global model to the edge server, and then the edge server sends the global model to the client connected to it. The client uses the locally stored training samples to train the received global model, and feeds the trained global model back to the edge server. The edge server updates the locally stored global model based on the received trained global model, and feeds the updated global model back to the cloud server to complete the federated learning.

[0113] 3. Architecture above three layers

[0114] like Figure 5 As shown, this is a schematic diagram of the structure of another federated learning system provided by this application.

[0115] The federated learning system includes an architecture of more than three layers, one of which includes one or more cloud services, and multiple edge servers form an architecture of two or more layers, such as one or more upstream edge servers forming a layer of architecture, each upstream edge server is connected to one or more downstream edge servers. Each edge server in the last layer of architecture formed by the edge server is connected to one or more clients, so that the client forms a layer of architecture.

[0116] In the process of federated learning, the cloud server at the top of the network sends the latest global model stored locally to the edge server at the next layer. The edge server then sends the global model to the next layer layer by layer until it is sent to the client. After receiving the global model sent by the edge server, the client uses the training samples stored locally to train the received global model and feeds back the trained global model to the edge server at the previous layer. The edge server at the previous layer then updates the locally stored global model based on the received trained global model and uploads the updated global model to the edge server at the next layer. This process is repeated until the second layer edge server uploads the updated global model to the cloud server. The cloud server updates the local global model based on the received global model to obtain the final global model and complete federated learning.

[0117] It should be noted that in this application, for each node in the federated learning architecture, the direction of data transmission to the cloud server is called upstream, and the direction of data transmission to the client is called downstream. Figure 3 As shown in , the server is the upstream node of the client, and the client is the downstream node of the server, such as Figure 4 As shown, the cloud server can be called the upstream node of the edge server, the client can be called the downstream node of the edge server, and so on.

[0118] The above is an introduction to the federated learning system provided by this application. The following is an introduction to the detailed steps performed by each device in the federated learning system. Figure 6 , a flowchart of a federated learning method provided in this application is described as follows.

[0119] 601. The first server sends a first model to a downstream device.

[0120] The first server may be the aforementioned Figure 2-Figure 5 For example, the first server may be a server in the federated learning system. Figure 2 Any one of the multiple servers shown in , or the aforementioned Figure 3 Any server in the two-tier architecture shown in Figure 4Any of the cloud servers or edge servers shown in , or Figure 5 The downstream device may be any one of the cloud servers or edge servers shown in the figure. The downstream device may be a client or an edge server of the next layer of the first server, and the number of downstream devices may be one or more. For example, if the first server establishes a connection with multiple clients, the first server may send the first model to each client.

[0121] The first model may be a model stored locally on the first server, such as a global model stored locally on a cloud server, or the first server may receive a model sent by another server and save the received model locally or update the locally stored model. Specifically, the first server may send structural parameters of the first model (such as the width, depth or convolution kernel size of the neural network) or initial weight parameters to the downstream device. Optionally, the first server may also send training configuration parameters to the downstream device, such as learning rate, number of epochs or categories in the security algorithm, so that the client that ultimately performs training can use the training configuration parameters to train the first model.

[0122] For example, when the first server is a cloud server, the first model may be a global model stored on the cloud server. For ease of distinction, the global model stored on the cloud server is referred to as a cloud-side model below.

[0123] For another example, when the first server is an edge server, the first model may be a local model stored on the edge server, or referred to as an edge server model. After the edge server receives the model sent by the upper-layer edge server or cloud server, the received model is used as the edge server model or the existing edge server model is updated to obtain a new edge server model, and the new edge server model is sent to the downstream device. It should also be noted that when the first server is an edge server and the downstream device is a client, the first server may directly send the edge server model (or referred to as the second model) to the client. When the first server is an edge server and the downstream device is a client, the first model in this step may be replaced with the edge server model.

[0124] In the embodiments of the present application, the models mentioned, such as the first model, the second model or the third model, etc., may specifically include convolutional neural networks (CNN), deep convolutional neural networks (DCNN), recurrent neural networks (RNN) and other neural networks. The model to be learned can be determined according to the actual application scenario, and the present application does not limit this.

[0125] Optionally, the first server may actively send the first model to the downstream device connected thereto, or may send the first model to the downstream device at the request of the downstream device. For example, if the downstream device is a client and the first server is an edge server, the client may send a request message to the edge server to request participation in federated learning. After receiving the request message, if the edge server confirms that the client is allowed to participate in federated learning, it may send the first model to the client. For another example, the client may send a request message to the cloud server to request participation in federated learning. After receiving the request message and confirming that the client is allowed to participate in federated learning, the cloud server may send the locally stored cloud-side model to the edge server. The edge server updates the local first model based on the received model and sends the updated first model to the client.

[0126] 602. The downstream device trains the first model.

[0127] After receiving the first model sent by the first server, the downstream device can train the first model to obtain the trained first model. Alternatively, after receiving the first model sent by the first server, the downstream device can update the locally stored model based on the received first model, such as by weighted fusion or averaging to obtain a new first model.

[0128] In one scenario, when the downstream device is an edge server, the first server may be an edge server or a cloud server in the upper layer of the edge server. After the first server sends the first model to the edge server, the edge server may update the locally stored first model based on the first model, and send the updated first model to a further downstream device, such as to a client, or to an edge server in a further layer until it is sent to the client. Finally, the client trains the first model to obtain the trained first model.

[0129] In another scenario, when the downstream device is a client, the client can use the locally stored training samples to train the first model to obtain the trained first model. For example, the client can be deployed in a mobile terminal, which can collect a large amount of data during operation. The client can use the collected data as training samples to perform personalized training on the first model to obtain a personalized model with the client.

[0130] In a possible implementation, if the downstream device is a client, the process of training the first model by the client (taking one of the first clients as an example) may specifically include: the first client receives information about the first model sent by the first server; the first client trains the first model under the constraints of a third sparse constraint condition to obtain a trained first model, and the third sparse constraint condition includes constraints formed by a function for reducing parameters in the first model; the first client sends information about the trained first model to the first server, such as weight parameters, gradient parameters, etc. of the trained model.

[0131] Therefore, in an implementation manner of the present application, the client can add sparse constraints when training the model, thereby making the trained model more sparse and reducing the parameters of the final model, so that when the model is transmitted between the client and the server, fewer parameters can be transmitted compared to the model without sparse constraints, thereby reducing the communication resources required to transmit data between the client and the server and reducing the communication load.

[0132] Optionally, the function that may be included in the third sparse constraint condition may specifically include the norm of the vector or matrix of the first model, and the norm may specifically include: 0 Norm, l 1 Norm, l p Norm, l 12 Norm, l p2 Norm, l 0 Continuous function after norm transformation, l 1 Continuous function after norm transformation, l p Continuous function after norm transformation, l 12 A continuous function after norm transformation or l p2 Continuous function after norm transformation, etc., p∈(0,1).

[0133] Optionally, the first client may train the first model under the constraints of a third sparse constraint and a second distance constraint to obtain a trained first model, wherein the second distance constraint includes a constraint formed by the similarity or distance between the first model and a locally stored fourth model.

[0134] For example, a second distance constraint can be added to the loss function, and the second distance constraint can specifically include one or more of the following: Euclidean distance, Minkowski distance (or Minkowski distance), Manhattan distance, Chebyshev distance, Minkowski distance or Mahalanobis distance, or similarity such as mutual information, cosine similarity, Pearson correlation coefficient, entropy function or inner product.

[0135] Therefore, in the implementation mode of the present application, by adding distance constraints, the client can know the difference between the locally stored model and the model sent by the server, so as to obtain a personalized model adapted to the local data distribution characteristics of the client, so that the final model can realize client personalization.

[0136] For ease of understanding, in some of the following embodiments, when the downstream device is a client, after receiving the first model, the client can update the locally stored end-side model based on the first model, such as obtaining a new end-side model and training it through replacement, weighted fusion, etc.

[0137] 603. The downstream device feeds back the trained first model to the first server.

[0138] After training the first model to obtain the trained first model, the downstream device may feed back the trained first model to the upstream device.

[0139] When the downstream device is a client, the client can directly use the locally stored training samples to train the first model to obtain the trained first model and feed it back to the first server.

[0140] When the downstream device is an edge server of the next layer of the first server, the edge server can update the locally stored first model based on the first model, and send the updated first model to a further downstream device, such as to a client, or to a further layer of edge servers until it is sent to the client. Finally, the client trains the first model to obtain the trained first model, and feeds back the trained first model to the upstream device. The upstream device can re-train the received first model to achieve the effect of retaining the personalization of the upstream device, and feed back the re-trained first model to the upstream device until it is fed back to the first server.

[0141] It should be noted that when the downstream device is an edge server, the trained model fed back by the downstream device can be called the cloud-side model or edge server model fed back by the edge server. When the downstream device is a client, the trained model fed back by the client can be called the terminal-side model. The details will not be repeated below.

[0142] 604. The first server retrains the trained first model.

[0143] After the first server receives the trained first model (directly referred to as the first model in this step to avoid redundancy) fed back by the downstream device, it can retrain the received first model to obtain the retrained first model. The number of downstream devices can be one or more. When there are multiple downstream devices, the first server can receive the trained first models fed back by multiple downstream devices respectively, and retrain the multiple trained first models to obtain multiple retrained first models.

[0144] Specifically, the downstream device can feed back the gradient parameters of the trained first model to the first server. After receiving the gradient parameters, the first server can perform model training based on the gradient parameters without using training samples, so that the server can achieve de-client personalized processing to a certain extent, and the server can adjust the first model to obtain a model with stronger generalization ability.

[0145] Specifically, the first server may retrain the received at least one first model under the first sparse constraint condition to obtain the retrained first model. The first sparse constraint condition may include a constraint formed by a function for reducing parameters in the first model. For example, when retraining the first model, a function for reducing parameters in the first model may be added to the loss function.

[0146] Optionally, the function that may be included in the first sparse constraint condition may specifically include the norm of the vector or matrix of the first model, and the norm may specifically include: 0 Norm, l 1 Norm, l p Norm, l 12 Norm, l p2 Norm, l 0 Continuous function after norm transformation, l 1 Continuous function after norm transformation, l p Continuous function after norm transformation, l 12 A continuous function after norm transformation or l p2 Continuous function after norm transformation, etc., p∈(0,1).

[0147] Therefore, in the implementation manner of the present application, the first model can be sparsely processed by adding a norm in the loss function, thereby reducing the parameters of the first model. As a result, when the first model is transmitted between the downstream device and the first server, less data needs to be transmitted compared to the non-sparse model, thereby reducing the communication resources required for transmission and improving transmission efficiency.

[0148] Optionally, the first server may also retrain the at least one first model received under the constraint of the first distance constraint condition to obtain the retrained first model. The first distance constraint condition may include the constraint formed by the similarity between the first model and the second model or the distance in the vector space, and the second model is the model stored locally by the first server. For example, a distance constraint may be added to the loss function, and the distance constraint may specifically include one or more of the following: Euclidean distance, Minkowski distance (or Minkowski distance), Manhattan distance, Chebyshev distance, Minkowski distance, Mahalanobis distance, mutual information, cosine similarity, Pearson correlation coefficient, entropy function, etc.

[0149] Therefore, in the implementation manner of the present application, the first model can also be trained in combination with the distance or similarity between the first model and the second model stored locally, so that the final trained model combines the personalized features of the upstream device and the personalized features of the local model of the first server, and has stronger generalization ability.

[0150] In an optional implementation, in order to achieve a certain degree of depersonalization of the first model and retain personalized processing to make the first model more generalizable, before the first server retrains the first model, it can use noise to perturb at least one received first model to obtain a new first model, and then train the new first model.

[0151] For ease of understanding, in the following implementation, if the first server is an edge server, the second model can be called an edge server model; if the first server is a cloud server, the second model can be called a cloud side model, which will not be repeated below.

[0152] 605. The first server aggregates at least one first model that has been retrained locally, and updates the second model.

[0153] After retraining the at least one received first model, the first server may aggregate the first models retrained locally, and update the locally stored second model based on the aggregation result to obtain an updated second model.

[0154] Specifically, the method of aggregating at least one first model may include averaging, weighted summing, or weighted fusion with a local second model, etc., which can be based on the actual application scenario, and this application does not limit the aggregation method.

[0155] Therefore, in the implementation mode of the present application, the server can retrain the received model locally, thereby personalizing the received model while retaining the data distribution characteristics of the server, so that the final model can adapt to the data distribution structure of the downstream device while also adapting to the data distribution of the server, thereby improving the generalization ability of the final model in the federated learning system. Through the hierarchical training of the client and server, the differences in the data of each client and the differences in the data distribution between each server can be fully utilized to achieve a certain degree of depersonalization and adapt to the personalized characteristics of each device to a certain extent, which is conducive to improving the output accuracy of the trained end-side model or edge server model.

[0156] In a possible implementation, if the first server is an edge server and its upper layer also has a cloud server, the above method may also include: before the first server sends the first model to the downstream device, the first server may also receive a third model (or cloud-side model) issued by the cloud server, and use the third model to update the locally stored second model or the first model. After aggregating at least one first model to obtain an updated second model, the third model may be trained to obtain an updated third model. Therefore, in the implementation of the present application, the cloud-side model issued by the cloud server may be trained by the edge server, so that the cloud-side model can integrate the personalized features of the edge server, and even if the data on each device in the federated learning system is heterogeneous, a model with strong adaptability can be obtained.

[0157] Exemplarily, after receiving the cloud-side model (i.e., the third model) sent by the cloud server, the edge server can update the local edge server model (i.e., the second model) based on the cloud-side model, and then send the local edge server model to the client. The client uses the local training samples to train the received model and feeds back the trained end-side model (i.e., the first model fed back by the client) to the edge server. The edge server can then use the trained end-side model to update the edge server model, update the locally stored cloud-side model, and feed back the updated cloud-side model to the cloud server, so that the cloud server updates the local cloud-side model based on the updated cloud-side model.

[0158] Optionally, when the first server trains the third model, the third model can be trained under the constraint of a second sparse constraint condition, where the second sparse constraint condition includes a constraint formed by a function for reducing parameters in the third model, which is similar to the aforementioned third sparse condition and will not be repeated here.

[0159] If the trained third model meets the first preset condition, the first server can send information about the trained third model to the upstream device, such as weight parameters or gradient parameters of the trained third model, so that the upstream device can have updated information about the third model.

[0160] If the trained third model does not meet the first preset condition, the first server can send the updated second model to the downstream device to complete another round of iteration to obtain the updated third model after the iteration. This is equivalent to sending the updated second model as a new first model to the downstream device so that the downstream device can train the new first model, that is, repeating steps 601-605 until a third model that meets the requirements is obtained.

[0161] Specifically, the first preset condition can be set according to the actual application scenario, such as the output accuracy of the third model after training exceeds the first threshold, or the average output accuracy of the third model after training exceeds the second threshold, or the number of updates of the third model reaches a preset number, etc., which will not be elaborated here.

[0162] Optionally, the first server may also send the updated second model information to the upstream device, so that the upstream device updates the third model according to the updated second model information, thereby reducing the workload of the first server. The specific steps of the upstream device training the third model are similar to the process of the first server training the third model, which will not be repeated here.

[0163] The above is an introduction to the process of federated learning provided by this application. The following is a more detailed description of the federated learning method provided by this application in combination with a more specific federated learning system architecture. Figure 6 , the downstream device can be replaced by the client. The overall process of the three-layer architecture or the architecture above three layers is explained as an example below.

[0164] 1. Three-tier architecture

[0165] See also Figure 7 , a flowchart of a federated learning method provided in this application is described as follows.

[0166] 701. The cloud server sends the cloud-side model to the edge server.

[0167] The cloud-side model is a global model to be trained stored on the cloud server. Specifically, the cloud server can send structural parameters (such as model width, depth or convolution kernel size, etc.), weight parameters or gradient parameters of the cloud-side model to the edge server.

[0168] If this round of iteration is the first iteration, the global model is the initialized model to be trained. If this round of iteration is not the first iteration, the cloud-side model can be updated based on the model uploaded by the edge server in the previous round of iteration.

[0169] It should be understood that if the above Figure 6 If the first server in is a cloud server, the cloud-side model, namely the aforementioned first model, can be understood as a global model stored and distributed by the cloud server.

[0170] It should also be understood that in the federated learning system provided by the present application, the number of edge servers can be one or more. If there are multiple edge servers, the cloud server can send cloud-side models to multiple edge servers respectively. In addition, the cloud service can actively send the cloud-side model to the edge server, or send the cloud-side model to each edge server at the request of the edge server. The specific adjustment can be made according to the actual application scenario, and the present application does not limit this.

[0171] 702. The edge server updates the edge server model.

[0172] The edge server updates the edge server model based on the received cloud-side model. Specifically, the locally stored edge server model may be directly replaced with the cloud-side model to obtain a new edge server model. Alternatively, the received cloud-side model and the locally stored edge server model may be aggregated, such as by averaging or weighted fusion, to obtain a new edge server model.

[0173] For example, each edge server needs to use the global model sent by the cloud server, that is, the cloud-side model w, to update its local cloud-side local model w at the beginning of each update round. i And each edge server model y i , i = 1, 2, ..., N. If the i-th edge server uses the cloud server global model w, replace the edge server model y i =w, replace the local model w on the cloud side i =w.

[0174] 703. The edge server sends the edge server model to the client.

[0175] After updating the locally stored edge server model, the edge server can send the latest edge server model to the client, so that the client receives the latest edge server model and performs training.

[0176] It should be noted that the edge server can actively send the edge server model to the client, or send the edge server model to the client at the request of the client. The specific details can be determined according to the actual application scenario, and this application does not limit this.

[0177] In one possible scenario, the edge server can save the end-side model locally. After obtaining the latest edge server model, the end-side model can be updated based on the latest edge server model, such as using the latest edge server model directly as the end-side model, or performing weighted fusion of the latest edge server model and the end-side model to obtain a new end-side model, etc. The specific adjustment can be made according to the actual application scenario. If the end-side model is saved locally on the edge server, the edge server can directly send the end-side model to the client, that is, the edge server model in this step can be replaced by the end-side model.

[0178] 704. The client trains the end-side model under the distance constraint and / or the sparsity constraint.

[0179] Among them, after receiving the edge server model sent by the edge server, the client can update the local end-side model based on the edge server model, and use the locally stored training samples to train the end-side model under distance constraints and sparsity constraints to obtain the trained end-side model.

[0180] Specifically, the sparse constraint may be a constraint formed by a third sparse constraint condition, and the sparse constraint may be used to reduce parameters in the end-side model, thereby obtaining a sparse model to reduce the amount of communication with the edge server.

[0181] For example, the number of clients can be multiple, using the received edge server model y i ,i=1,2,…,N Update each client model θ i,j ,i=1,2,…,N,j=1,2,…,J i The client then uses the locally stored training samples to further iteratively update the client-side model θ under the sparse constraint. i,j ,i=1,2,…,N,j=1,2,…,J i If expressed as

[0182]

[0183] Among them, θ i,j represents the client model of the jth client of the i-th edge server, It is the loss function on the jth client managed by the ith edge server. Its specific form can be any function used to measure the difference between the predicted value and the true value of the neural network model, such as mean square error loss and cross entropy loss. Selecting the loss function according to the actual application scenario and requirements can enable more flexible training of the neural network model.

[0184] φ ρ (θ i,j ) is the function corresponding to the sparse constraint, γ 1is a hyperparameter, which represents the weight used to adjust each constraint function. In the embodiment of the present application, the hyperparameter can take any non-negative real number. For example, when γ 1 =0, it means that the weight of the sparse constraint is 0, that is, parameter sparsity is not required during training. It is usually suitable for scenarios where the neural network model is small, the transmission communication cost is low, and the model parameter sparsity is not required.

[0185] The terms "ith", "jth", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing objects with the same attributes when describing the embodiments of the present application.

[0186] For example, if the number of parameters of the client-side model is d and the sparse constraint is φ ρ A specific form of (·) can be expressed as:

[0187]

[0188] Can also be replaced by l 0 Norm, l 1 Norm, l 0 The approximation of the norm, l 1 The approximation of the norm, l 0 and l p Mixed norm, l 1 and l p Functions such as the mixed norm can be used to guide variable sparsity.

[0189] Optionally, when training the end-side model, a distance constraint may be added, that is, the distance or similarity between the received end-side model and the locally stored end-side model (or referred to as the fourth model).

[0190] For example, the client-side model can be expressed as:

[0191]

[0192] Among them, λ 1 is a hyperparameter, which represents the weight of the distance constraint. Here, θ is used as an example. i,j and i The distance between 2 The norm is used as an example for illustrative explanation. In actual application scenarios, it can be replaced by Euclidean distance, Mahalanobis distance, mutual information, cosine similarity, inner product or norm, or any other function that measures the similarity or distance between two variables. The appropriate function can be determined according to the actual application scenario, and this application does not limit this.

[0193] For another example, the aforementioned two-norm can be replaced by the inner product, such as the end-side model can be expressed as:

[0194]

[0195] For example, after combining the distance constraint and the sparse constraint, the updated end-side model can be expressed as:

[0196]

[0197] Accordingly, the binary norm used when updating the end-side model here can also be replaced by other functions, such as the inner product. For example, updating the end-side model can be expressed as:

[0198]

[0199] In addition, when the client is training the end-side model, the end-side model can be updated by a gradient descent method, a Newton method, an adaptive moment estimation method (Adam), or other optimization algorithms that can be used in machine learning.

[0200] For example, in one implementation, the jth client managed by the i-th edge server receives the edge server model y i After that, you can choose the gradient descent optimization algorithm to update the client model θ ij ,

[0201]

[0202] Among them, η 1 is the learning rate of the gradient descent optimization algorithm or the step size of each update. After k iterations, the final personalized model θ is obtained. i,j In the actual training process, usually not all data are used to calculate You can use slicing, using a batch of data for each iteration To calculate the loss function and update the gradient value,

[0203]

[0204] Among them, Z i,j represents a data set of a certain slice (batch) in the data set stored by the jth client managed by the i-th edge server, A set of training data Z i,j =(X i,j ,Y i,j ), X i,j represents the input data for neural network training, Y i,j Represents the input data X i,j The corresponding true label.

[0205] In the implementation mode of the present application, the distance constraint enables the client to find a personalized model that is different from the edge server model sent by the edge server and is adapted to the client's local data set, which can alleviate the difficulties of federated learning training caused by the heterogeneity of data from different clients in federated learning. Sparse constraints can effectively reduce the number of non-zero parameters of the client's personalized model, thereby reducing the computing and storage pressure on the user end and reducing the communication cost between the client and the edge server.

[0206] 705. The client sends the trained end-side model to the edge server.

[0207] After training the client-side model, the client can feed back the updated information of the client-side model to the edge server. For example, each client can obtain the updated sparse client-side model θ after training. i,j ,i=1,2,…,N,j=1,2,…,J i After that, it can be uploaded to the corresponding edge server. Specifically, the weight parameters, gradient parameters, etc. of the updated end-side model can be uploaded.

[0208] 706. The edge server updates the local end-side model.

[0209] Each client uploads the updated sparse client-side model θ i,j ,i=1,2,…,N,j=1,2,…,J i To the corresponding edge servers, each edge server uses the client sparse model θ uploaded by the client i,j Calculate the corresponding edge server model y i,j .

[0210] Specifically, the edge server can retrain the received end-side model. Since the data of each client may be heterogeneous data, the models trained by each client using local data are quite different, and the effect of direct aggregation is not good. Through the method provided by the present application, the edge server can retrain the models from each client (local end-side models), while retaining the personalization of the local end-side models, and at the same time removing the differences between them to a certain extent, so that the model aggregated by the edge server is more accurate and can be generalized to more types of data, thereby improving the accuracy and generalization ability of the edge server aggregation model.

[0211] Optionally, the edge server may add sparse constraints to the received end-side model during retraining. For example, similar to the sparse constraints used in the aforementioned client-side training, it can be expressed as:

[0212]

[0213] Among them, y is a hyperparameter, representing the sparse constraint φ ρ (θ i,j )’s weight.

[0214] Optionally, in the process of re-training the edge server to the received end-side model, a distance constraint may also be added for training. The distance constraint may include the distance or similarity between the locally stored edge server model and the received end-side model, or may also include the distance or similarity between the locally stored edge server model and the cloud-side model.

[0215] For example, the i-th edge server calculates J i Local client-side model y ij It can be expressed as:

[0216]

[0217] The solution is:

[0218]

[0219] Among them, θ i,j is the sparse end-side model uploaded by the jth client managed by the edge server, w i is the current cloud-side local model stored by the edge server. It should be noted that the bi-norm here can also be replaced by other functions, such as inner product, Euclidean distance, etc., which can be adjusted according to the actual application scenario.

[0220] Optionally, before training the end-side model, a certain amount of noise may be used to train the end-side model θ i,j Perform disturbance processing to obtain a new end-side model θ i,j Then the new end-side model θ i,j Retraining is performed. Thus, a new end-side model can be obtained by means of perturbation.

[0221] Therefore, in this embodiment, the edge server can combine sparse constraints or distance constraints to retrain the sparse model uploaded by the client, so that the edge server can keep the difference between the client-side model and the edge server within an appropriate range, avoid the difference being too large or too small, and achieve a certain degree of client-side personalization processing to obtain a model with increased edge server personalization features, thereby improving the generalization ability of the model. And by reducing the parameters of the model through sparse constraints, the amount of communication transmitted between the edge server and the cloud server or between the edge server and the client is reduced, thereby reducing the communication cost.

[0222] 707. The edge server updates the edge server model.

[0223] In the obtained local end-side model y i,j After that, you can use the client-side model y i,j To update the edge server model y i .

[0224] In a possible implementation, there may be multiple end-side models y i,j , the i-th edge server uses all local models y on the client side i,j ,j=1,2,…,J i , calculate the edge server model y i ,

[0225]

[0226] Optionally, the local model on the client side can be sampled first, and then aggregated to obtain a new edge server model y i .

[0227] Therefore, in this embodiment, the personalized training of the edge server model enables different edge servers to train different networks based on the clients they manage. The edge server model may not be directly used to aggregate the global model, thereby improving the performance of the trained neural network and improving the output accuracy of the federated learning global model.

[0228] 708. The edge server updates the local cloud-side model.

[0229] After the edge server model is updated, the edge server model can be used to update the local cloud-side model.

[0230] The specific updating method may be to replace the local cloud-side model with the edge server model, or to perform weighted fusion on the edge server model and the local cloud-side model, or to update the local cloud-side model using sparse constraints and / or distance constraints, etc., which may be adjusted according to the actual application scenario.

[0231] For example, in the embodiment of the present application, the cloud-side local model w of the i-th edge server can be updated by using the gradient descent method. i , for F i,j (·) Taking the derivative with respect to w, we get:

[0232]

[0233] Therefore, the learning rate (update step size) η 2 Update w i :

[0234]

[0235] Sparse constraint φ ρ (w i) makes the number of non-zero parameters of the local model smaller and smaller, which can effectively reduce the communication cost required for each parameter transmission of the edge server. ρ (·) It is also possible to flexibly select a more appropriate sparse guidance function according to the actual scenario, such as using the group / block sparsity of the mixed norm guidance parameter, which can be adjusted according to the actual application scenario.

[0236] 709. The edge server determines whether the first preset condition is met. If so, step 710 is executed. If not, step 703 is continued.

[0237] In each round of iteration between the edge server and the client, after the edge server updates the local cloud-side model, it can determine whether the first preset condition has been met. If the first preset condition is met, the locally stored cloud-side model can be sent to the server, that is, step 710 is executed. If the first preset condition is not met, the latest edge server model obtained in step 707 can continue to be sent to the client, so that the client uses the locally stored training samples to train the latest edge server model again, that is, repeat steps 703-709.

[0238] Specifically, the first preset condition may include but is not limited to one or more of the following: the number of iterative training reaches a preset number, that is, the number of executions of steps 703-709 reaches a preset number, the output accuracy of the edge server model or the cloud side model exceeds a first threshold, the average accuracy of the edge server model or the cloud side model exceeds a second threshold, the parameter change value of the edge server model or the cloud side model between multiple iterations is less than a preset change value, etc.

[0239] Therefore, in the implementation manner of the present application, after each round of iteration meets the termination condition, the obtained local cloud-side model can be sent to the cloud server, so that the cloud server can obtain a cloud-side model with stronger generalization capability, and update the cloud-side model on the cloud server based on this. The obtained cloud-side model can adapt to the data structure or data distribution differences between various devices (such as between various clients) within the federated learning system, and has strong generalization capability.

[0240] In addition, optionally, after updating the edge server model, the edge server may not update the local cloud side model. In 709, it can be determined whether the updated edge server model meets the first preset condition. If so, the local edge server model can be sent to the cloud server, and the cloud server executes step 708.

[0241] 710. The edge server sends the local cloud-side model to the cloud server.

[0242] After the edge server determines that the updated local cloud-side model meets the first preset condition, the edge server may feed back the updated locally stored cloud-side model to the cloud server if it executes step 708. Specifically, the edge server may feed back the weight parameters, gradient parameters, etc. of the updated cloud server model to the cloud server.

[0243] 711. The cloud server updates the cloud-side model.

[0244] After receiving the cloud-side model sent by the edge server, the cloud server can use the received cloud-side model to update the locally stored cloud-side model.

[0245] Generally, if a cloud server receives only one cloud-side model uploaded by an edge server, it can use the cloud-side model to replace the locally stored cloud-side model, or perform weighted fusion on the received cloud-side model and the locally stored cloud-side model.

[0246] Several updating methods are introduced as examples below.

[0247] In one implementation, the new global model, i.e., the cloud-side model w, is the cloud-side model w uploaded by all edge servers. i The average value is:

[0248]

[0249] Optionally, the cloud server can also be obtained by weighted summing up the cloud-side local models uploaded by all edge servers:

[0250]

[0251] The weight α i It can be determined by the number of clients owned by each edge server, the size of the data set stored by the clients controlled by each edge server, the recognition accuracy of the personalized model of each edge server, or other forms, which are not limited in the embodiments of the present application.

[0252] In another implementation, when the cloud server aggregates to obtain a new global model, it can consider combining the current global model, such as expressed as:

[0253]

[0254] Among them, β>0, and its specific value can be set in advance.

[0255] In addition, the local models uploaded by each server can be sampled first and then aggregated to obtain a new global model.

[0256] Therefore, in the implementation manner of the present application, the cloud server can aggregate the received models, thereby updating the cloud-side model, that is, the global model, according to the aggregation results.

[0257] 712. The cloud server determines whether the second preset condition is met. If so, the training ends. If not, continue to execute step 701.

[0258] Among them, the second preset condition may include one or more of the following: cloud server global model convergence, edge server model convergence, client model convergence, number of cycles reaching a predetermined number of times, output accuracy of the cloud server global model reaching a certain threshold, etc.

[0259] The number of iterative training reaches a certain number, the output accuracy of the edge server model or the cloud-side model exceeds the third threshold, the average accuracy of the edge server model or the cloud-side model exceeds the fourth threshold, the parameter change value of the edge server model or the cloud-side model between multiple iterations is less than a certain change value, etc.

[0260] After training is completed, the final sparse global model w is obtained, which is applicable to the edge server model y of each edge server. i , i = 1, 2, ..., N, the client sparse model θ applicable to each client i,j ,i=1,2,…,N,j=1,2,…,J i , and has strong generalization ability.

[0261] For example, for a three-tier architecture, the overall federated learning process can be: i The number of clients and the number of parameters of the neural network model is d. In this case, the mathematical expression of the hierarchical personalized federated learning problem is as follows:

[0262]

[0263] where f 1 (·) is the distance constraint function, which can be in the form of Euclidean distance, Mahalanobis distance, mutual information, cosine similarity, norm, or any other function that measures the similarity or distance between two variables. 1 (·) has two independent variables. It should be noted that f 1 (·) can act directly on the two independent variables, or on some transformation of the two independent variables, such as transposition, translation, rotation, etc., which will not be listed here. 2 (·) is a sparse constraint function, which can be in the form of l 0 Norm, l 1 Norm, l 0 The approximation of the norm, l1 The approximation of the norm, l 0 and l p Mixed norm, l 1 and l p Any function that can be used to induce sparsity in variables, such as the mixed norm. 1 , 2 , γ 1 and γ 2 is a hyperparameter used to adjust the weights of each constraint function. In the embodiment of the present application, the hyperparameter can take any non-negative real number. For example, when γ 1 =γ 2 = 0, it means that the weight of the sparse constraint is 0, that is, parameter sparsity is not required during training. This situation can be used in scenarios where the neural network model is small, the transmission communication cost is small, and the model parameter sparsity is not required. w is the cloud side model, θ i,j is the personalized end-side model of the jth client of the i-th edge server, y i is the personalized edge server model of the i-th edge server.

[0264] It is the loss function on the jth client managed by the ith edge server. Its specific form can be any function used to measure the difference between the predicted value and the true value of the neural network model, such as mean square error loss and cross entropy loss. Selecting the loss function according to the actual application scenario and requirements can enable more flexible training of the neural network model.

[0265] In the embodiment of the present application, the distance constraint function f 1 (·) is l 2 Norm, sparse constraint function f 2 (·) is l 1 An approximate function of the norm φ ρ (·) to explain,

[0266]

[0267] Among them, x n represents the nth element of x. At this time, F ij The mathematical expression of (w) is:

[0268]

[0269] The bi-norm here can also be replaced by other functions, such as inner product or Euclidean distance, such as F after inner product i,j The mathematical expression of (w) is:

[0270]

[0271] Therefore, in the implementation manner of the present application, when updating the model, the edge server can train the model and update the model according to the learning rate or gradient parameters, so that the edge server model has more personalized characteristics of the variable server, and improves the output effect of the edge server model. Through sparse constraints and / or distance constraints, the edge server model has the personalized characteristics of the edge service, and a certain degree of client personalization is achieved, thereby improving the generalization ability of the final model. Compared with only aggregating the received model, the present application updates the edge server model by training, which can realize personalized processing of the edge server model, retain the personalized characteristics of the edge server, and enable the edge server model to adapt to more devices, thereby improving the generalization ability of the model. In addition, when the client or edge server is training the model, the sparse constraints are combined to reduce the number of parameters of the model, thereby reducing the communication resources required for transmitting the model between the client and the edge server, or between the edge server and the cloud server, thereby reducing the communication cost.

[0272] 2.3 Layers and above Architecture

[0273] See also Figure 8 , a flowchart of another federated learning method provided in this application is described as follows.

[0274] First, it should be noted that in this embodiment, the steps performed by the client are the same as those described above. Figure 7 The steps performed by the client in are similar to those in Figure 7 The steps performed by the edge server in are similar, except that Figure 8 The upstream device of the edge server shown in the figure can be replaced by the cloud server with the edge server. The similarities will not be repeated below, and some differences will be introduced.

[0275] 801. The cloud server sends the cloud-side model to the edge server K.

[0276] When performing federated learning, the cloud server sends the cloud-side model, that is, the global model stored on the cloud server, to its next-level edge server.

[0277] 802. The edge server K sends the edge server J model to the edge server J at the next layer.

[0278] After edge server K receives the cloud-side model, it can use the cloud-side model to update the local edge server J model and send the edge server J model to the next layer of edge servers. This embodiment uses the next layer of edge server J as an example for illustrative description.

[0279] 803. The edge server J sends the edge server model to the variable server I.

[0280] After edge server J receives the edge server model sent by the edge server of the upper layer, it can use the received edge server model to update the local edge server J model and send the edge server J model to the edge server of the next layer.

[0281] 804. Edge server I updates edge server I model.

[0282] After edge server I receives the model sent by the upper layer edge server, it can use the model to update the local edge server I model.

[0283] 805. Edge server I sends edge server I model to the client.

[0284] 806. The client trains the end-side model under the third sparse constraint condition.

[0285] In the embodiment of the present application, after the client receives the model sent by the lowest edge server, it can update the locally stored end-side model based on the received model, and then train the locally stored end-side model under the sparse constraint and / or distance constraint to obtain the trained end-side model. Therefore, the sparse personalized model of the client can alleviate the difficulties of federated learning training caused by the heterogeneity of data from different clients of federated learning, while reducing the communication cost required for the client to upload the model to the edge server each time.

[0286] Usually, the jth client managed by the i-th bottom-level edge server receives the model y sent by the i-th bottom-level edge server. i , update the client personalization model θ i,j .

[0287] For step 806 in the present application, reference may be made to the related description of the aforementioned step 704, which will not be repeated here.

[0288] 807. The client uploads the trained end-side model to edge server I.

[0289] After training the end-side model, the client can upload the trained end-side model to the edge server I, such as uploading the weight parameters or gradient parameters of the model.

[0290] 808. Edge server I updates the local end-side model.

[0291] 809. Edge server I updates edge server I model.

[0292] 810. Edge server I updates edge server J model.

[0293] 811. The edge server 1 determines whether the first preset condition is met. If so, execute step 805. If not, execute step 812.

[0294] Among them, steps 808 to 811 can refer to the relevant descriptions of the aforementioned steps 706 to 709, which will not be repeated here.

[0295] 812. Edge server I uploads the local cloud-side model to edge server J.

[0296] 813. Edge server J feeds back the local cloud-side model to edge server K.

[0297] 814. Edge server K updates the local end-side model.

[0298] 815. Edge server K updates edge server J model.

[0299] 816. Edge server K updates the local cloud-side model.

[0300] 817. The edge server K determines whether the third preset condition is met. If so, execute step 802; if not, execute step 818.

[0301] Among them, steps 813 to 817 can refer to the relevant descriptions of the aforementioned steps 706 to 709, which will not be repeated here.

[0302] 818. The edge server K feeds back the local cloud-side model to the cloud server.

[0303] 819. The cloud server updates the cloud-side model.

[0304] 820. The cloud server determines whether the second preset condition is met. If not, step 801 is executed. If yes, the training ends.

[0305] Among them, steps 819 to 820 can refer to the relevant descriptions of the aforementioned steps 710 to 712, which will not be repeated here.

[0306] Therefore, the federated learning method provided in the implementation mode of the present application can adapt to two-layer, three-layer or more than three-layer architectures, can adapt to more scenarios, and fully utilizes the differences in data of each client and the data distribution of each side server, which is conducive to improving the accuracy of training the back-end side / side server personalized model and the global model, and ultimately obtaining a more accurate global model. In addition, by adding sparse constraints during the training process to reduce the parameters of the model, the amount of data communicated between each device is reduced, thereby reducing the communication cost. In addition, when training the model, each device can add a distance constraint, so that while achieving a certain degree of depersonalization, it can also retain a certain degree of personalization of the side server and the client, so that the final model can adapt to the differences in data structure or data distribution between each device, and the model has better adaptability and stronger generalization ability.

[0307] To facilitate understanding, the following is a more detailed explanation of the steps performed by the edge server in an architecture with more than three layers.

[0308] The steps executed by the edge server in the middle layer can be understood as being decomposed into multiple serial execution blocks. The steps included in each execution block, that is, the steps executed by the edge server in the middle layer, are described below in an exemplary manner. Fig. 9 , a flowchart of another federated learning method provided in this application.

[0309] 901. Edge server A receives the local cloud-side model uploaded by the next-layer edge server and updates the local terminal-side model.

[0310] Edge server A manages M next-level edge servers (M>1). Edge server A first receives its local cloud-side model uploaded by the M next-level edge servers it manages, denoted as w l,i The corresponding local end-side model calculated by sparse constraints and / or distance constraints is recorded as y p,i ,i=1,2,…,M, the cloud-side model currently stored in edge server A is denoted as w.

[0311] Exemplarily, the way in which edge server A updates the local end-side model can be expressed as:

[0312]

[0313] Among them, λ 1 ,λ 2 is a hyperparameter, indicating the weight of each constraint function, ||w l,i -y p,i || 2 Used to represent w l,i and p,i The distance between 2 Norm constraint, ||w p,i -w|| 2 It can be expressed as p,i The distance between the local storage w forms l 2 Norm constraint. The norm here can also be replaced by inner product or Euclidean distance, etc., which can be adjusted according to the actual application scenario.

[0314] Of course, in addition to the above methods, other cloud-side local models uploaded by the next-level edge server can also be used. l,i The method of calculating the new neural network model will not be described in detail here.

[0315] 902. Edge server A aggregates all end-side models to obtain a new edge server model.

[0316] In the above step 901, M local terminal side models y are calculated and obtained. p,i , i = 1, 2, ..., M, the local model currently stored in edge server A is denoted as w, and the edge server model obtained by aggregating M local end-side models is denoted as y p .

[0317] There is no limitation on the specific aggregation method of edge server A aggregating all the end-side models. For example, it may be to calculate the weighted sum of each model, to calculate the mean of each model, or other similar methods.

[0318] In one implementation, the aggregation y p It can be expressed as

[0319]

[0320] In addition, the personalized local model y p,i Sampling, such as filtering out part of y p,i , and then aggregate the selected models to obtain the new edge server model y p .

[0321] Therefore, in the implementation manner of the present application, the edge server model enables different edge servers to train different networks based on the lower-level edge servers they manage, and the edge server model is not used to upload new models aggregated by upper-level edge servers, thereby improving the performance of the trained neural network and improving the recognition accuracy of the federated learning global model.

[0322] 903. Edge server A uses the edge server model to update the local cloud-side model.

[0323] When updating the local cloud-side model w of edge server A, the locally stored cloud-side model w can be updated by gradient descent, as expressed as:

[0324]

[0325] Among them, η is the learning rate in the gradient descent process, which can be a preset value or a value determined according to the actual application scenario. λ and γ are hyperparameters. Therefore, in the implementation of the present application, when the edge server updates the local end-side model, a sparse constraint can be added to reduce the parameters in the final model, thereby reducing the communication volume between the edge server and other devices and reducing the communication cost.

[0326] 904. Edge server A determines whether the stop condition is met. If so, execute step 905; if not, execute step 906.

[0327] Edge server A determines whether the stopping condition is met. The stopping condition may be that the edge server model converges, the number of cycles reaches a predetermined number, the output accuracy of the edge server model reaches a certain threshold, etc. The termination condition refers to the aforementioned first preset condition or the second preset condition, etc., which will not be repeated here.

[0328] 905. Edge server A uploads the latest local cloud-side model to the upper-layer edge server.

[0329] If the stop condition is currently met, the latest local cloud-side model can be uploaded to the upper-layer edge server so that the upper-layer edge server can use the cloud-side model to update its local cloud-side model.

[0330] 906. Edge server A sends the updated edge server model to the edge server at the next layer.

[0331] If the stop condition is not met at present, server A can continue to send the updated edge server model to the edge server of the next layer, so that the edge server of the previous layer sends the edge server model downward layer by layer, so that the downstream client can continue to train the received model.

[0332] Therefore, in the implementation manner of the present application, the edge server in the three-layer or higher architecture can interact with adjacent edge servers and train the received model through sparse constraints, thereby reducing the parameters of the model and reducing the communication cost between the edge server and the upstream device or downstream device.

[0333] In addition, see Fig.10 , a flowchart of another federated learning method provided in this application is described as follows.

[0334] 1001. Edge server A receives the local cloud-side model uploaded by the next layer edge server and aggregates it to obtain the edge server model.

[0335] Edge server A manages M next-level edge servers (M>1). Edge server A first receives its local cloud-side model uploaded by the M next-level edge servers it manages, denoted as w l,i The corresponding local end-side model calculated by sparse constraints and / or distance constraints is recorded as y p,i ,i=1,2,…,M, the cloud-side model currently stored in edge server A is denoted as w.

[0336] In one possible implementation, the way of aggregating the received cloud-side models can be expressed as:

[0337]

[0338] 1002. Edge server A determines whether the stop condition is met. If so, execute step 1003; if not, execute step 1004.

[0339] 1003. Edge server A uploads the local cloud-side model to the upper-layer edge server.

[0340] 1004. Edge server A wants to send the latest edge server model to the next layer of edge servers.

[0341] Among them, step 1002 to step 1004 are similar to the aforementioned step 904 to step 906 and will not be repeated here.

[0342] Therefore, in the implementation manner of the present application, for the edge servers in the middle layer, there is no need to update the local terminal-side model, so as to adapt to the federated learning system with a multi-layer architecture and improve the efficiency of federated learning.

[0343] The above has provided a detailed introduction to the process of the federated learning method provided in the present application. Based on the above method process, the following further introduces the device for executing the method process.

[0344] See also Fig.11 , a schematic diagram of the structure of a federated learning device provided in the present application, the federated learning device can be used to perform the above Figure 6-Figure 10 The steps performed by the server in the above method may include:

[0345] The transceiver module 1101 is used to receive information of at least one first model sent by at least one downstream device;

[0346] A training module 1102 is used to train at least one first model to obtain at least one trained first model;

[0347] Aggregation module 1103, used to aggregate at least one first model after training to obtain an aggregation result;

[0348] The updating module 1104 is used to update the locally stored second model according to the aggregation result to obtain an updated second model.

[0349] In one possible implementation, the training module 1102 is specifically used to train at least one first model under the constraint of a first sparse constraint condition to obtain at least one trained first model, and the first sparse constraint condition includes a constraint formed by a function for reducing parameters in the first model.

[0350] In one possible implementation, the training module 1102 is specifically used to train at least one first model under the constraints of a first sparse constraint and a first distance constraint to obtain at least one first model after training, wherein the first sparse constraint includes a constraint formed by a function for reducing parameters in the first model, and the first distance constraint includes a constraint formed by a similarity or distance between at least one first model and a second model.

[0351] In one possible implementation, the training module 1102 is specifically used to: use noise to perturb at least one first model to obtain at least one updated first model; train the updated at least one first model under the constraints of a first sparsity constraint and a first distance constraint to obtain at least one trained first model.

[0352] In a possible implementation, the first distance constraint condition also includes a constraint formed by the similarity or distance between the second model and the third model, and the third model is a model sent by the upstream device.

[0353] In a possible implementation, the first sparse constraint condition includes the norm of a vector or matrix of at least one first model, and the norm includes: 0 Norm, l 1 Norm, l p Norm, l 12 Norm, l p2 Norm, l 0 Continuous function after norm transformation, l 1 Continuous function after norm transformation, l p Continuous function after norm transformation, l 12 Continuous function after norm transformation or l p2 Continuous function after norm transformation, p∈(0,1).

[0354] In a possible implementation manner, the transceiver module 1101 is further configured to receive a third model sent by the upstream device to the first server;

[0355] The training module 1102 is also used to update the locally stored model according to the third model to obtain the second model.

[0356] In a possible implementation, the training module 1102 is further used to train the third model to obtain an updated third model.

[0357] In a possible implementation, the training module 1102 is specifically used to train the third model under the constraint of a second sparse constraint condition to obtain a trained third model, and the second sparse constraint condition includes a constraint formed by a function for reducing parameters in the third model.

[0358] In a possible implementation, the transceiver module 1101 is further configured to send information of the trained third model to an upstream device.

[0359] In a possible implementation, the transceiver module 1101 is further used to send the updated second model as a new model to at least one downstream device, so that the at least one downstream device trains the new first model until a third model that meets the requirements is obtained.

[0360] In a possible implementation, the transceiver module 1101 is also used to aggregate at least one trained first model on the first server to obtain an updated second model, and then send information of the updated second model to the upstream device, so that the upstream device trains the third model according to the information of the updated second model to obtain a trained third model.

[0361] See also Fig.12 , a schematic diagram of the structure of another federated learning device provided in the present application, the federated learning device can be used to perform the above Figure 6-Figure 10 In the steps performed by the client, the federated learning device may include:

[0362] The transceiver module 1201 is used to receive information of the first model sent by the first server;

[0363] A training module 1202 is used to train the first model under a third sparse constraint condition to obtain a trained first model, wherein the third sparse constraint condition includes a constraint formed by a function for reducing parameters in the first model;

[0364] The transceiver module 1201 is also used to send the information of the trained first model to the first server, so that the first server retrains the first model according to the received information of the trained first model to obtain a new first model.

[0365] In one possible implementation, the training module 1202 is specifically used for the first client to train the first model under the constraints of a third sparse constraint and a second distance constraint to obtain a trained first model, and the second distance constraint includes a constraint formed by the similarity or distance between the first model and a locally stored fourth model.

[0366] The present application also provides a server. Fig.13 , Fig.13 A schematic diagram of the structure of a server provided in an embodiment of the present application. The federated learning device 1300 may be deployed with Fig.11 The federated learning device described in the corresponding embodiment is used to implement Figures 6 to 10The functions of the server in the corresponding embodiment. Specifically, the federated learning device 1300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units CPU 1322 (e.g., one or more processors) and memory 1332, one or more storage media 1330 (e.g., one or more mass storage devices) storing application programs 1342 or data 1344.

[0367] The memory 1332 and the storage medium 1330 may be temporary storage or permanent storage. In one embodiment, the memory 1332 is a random access memory (RAM), which can directly exchange data with the central processor 1322, and is used to load data 1344 and application programs 1342 and / or operating system 1341 for direct operation and use by the central processor 1322, and is usually used as a temporary data storage medium for the operating system or other running programs. The program stored in the storage medium 1330 may include one or more modules ( Fig.13 (not shown), each module may include a series of instruction operations in the federated learning device.

[0368] Furthermore, the central processor 1322 may be configured to communicate with the storage medium 1330 to execute a series of instruction operations in the storage medium 1330 on the federated learning device 1300. In a possible implementation, the storage medium 1330 stores the aforementioned Figure 6-Figure 10 Program instructions and data corresponding to the method steps shown in any embodiment.

[0369] The federated learning device 1300 may also include one or more power supplies 1326, one or more wired or wireless network interfaces 1350, one or more input and output interfaces 1358, and / or one or more operating systems 1341, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0370] The embodiment of the present application also provides a federated learning device, which can also be called a digital processing chip or chip. The chip includes a processing unit and a communication interface. The processing unit can obtain program instructions through the communication interface. The program instructions are executed by the processing unit. The processing unit is used to execute the aforementioned Figure 6-Figure 10 The method steps executed by the server in any embodiment shown in FIG.

[0371] The embodiment of the present application also provides a digital processing chip. The digital processing chip integrates a circuit and one or more interfaces for implementing the above-mentioned processor 1322 or the function of the processor 1322. When the digital processing chip integrates a memory, the digital processing chip can complete the method steps of any one or more of the above-mentioned embodiments. When the digital processing chip does not integrate a memory, it can be connected to an external memory through a communication interface. The digital processing chip implements the actions performed by the server device in the above-mentioned embodiment according to the program code stored in the external memory.

[0372] In more detail, when the federated learning device provided in the embodiment of the present application is a chip, the chip specifically includes: a processing unit and a communication unit. The processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit. The processing unit may execute the computer execution instructions stored in the storage unit to enable the chip in the server to execute the above Figure 6-Figure 10 The illustrated embodiment describes a federated learning method.

[0373] See also Fig.14 , a structural diagram of another client provided by this application is described as follows.

[0374] The client may include a processor 1401 and a memory 1402. The processor 1401 and the memory 1402 are interconnected via a line. The memory 1402 stores program instructions and data.

[0375] The memory 1402 stores the aforementioned Figures 6 to 10 The program instructions and data corresponding to the steps in .

[0376] Processor 1401 is used to execute the above Figures 6 to 10 The method steps executed by the client in any of the embodiments shown in FIG.

[0377] The client may also include a transceiver 1403 for receiving or sending data.

[0378] The present application also provides a computer-readable storage medium in which a program is stored. When the program is run on a computer, the computer executes the above-mentioned Figures 6 to 10 The illustrated embodiment describes the steps of the method performed by the client.

[0379] The embodiment of the present application also provides a federated learning device, which can also be called a digital processing chip or chip. The chip includes a processing unit and a communication interface. The processing unit can obtain program instructions through the communication interface. The program instructions are executed by the processing unit. The processing unit is used to execute the aforementioned Figure 6-Figure 10The method steps executed by the client in any of the embodiments shown in FIG.

[0380] The embodiment of the present application also provides a digital processing chip. The digital processing chip integrates a circuit and one or more interfaces for implementing the above-mentioned processor 1401 or the function of the processor 1401. When the digital processing chip integrates a memory, the digital processing chip can complete the method steps of any one or more of the above-mentioned embodiments. When the digital processing chip does not integrate a memory, it can be connected to an external memory through a communication interface. The digital processing chip implements the actions performed by the server device in the above-mentioned embodiment according to the program code stored in the external memory.

[0381] In more detail, when the federated learning device provided in the embodiment of the present application is a chip, the chip specifically includes: a processing unit and a communication unit. The processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit. The processing unit may execute the computer execution instructions stored in the storage unit to enable the chip in the server to execute the above Figure 6-Figure 10 The illustrated embodiment describes a federated learning method.

[0382] Optionally, the aforementioned storage unit may be a storage unit within the chip, such as a register, a cache, etc., and the storage unit may also be a storage unit located outside the chip within the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory RAM, etc.

[0383] Specifically, the aforementioned processing unit or processor may be a central processing unit, a neural-network processing unit (NPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0384] The processor mentioned in any of the above can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more processors for controlling the above Figure 3-Figure 14The method is performed by a program of an integrated circuit.

[0385] The present application also provides a computer-readable storage medium in which a program is stored. When the program is run on a computer, the computer executes the above-mentioned Figure 3-Figure 14 The illustrated embodiments describe steps in a method.

[0386] The present application also provides a computer program product which, when executed on a computer, enables the computer to execute the above-mentioned Figure 3-Figure 14 The illustrated embodiments describe the steps performed by a data processing device or a production plan generating device in the method.

[0387] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0388] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory ROM, a random access memory RAM, a disk or an optical disk, etc., including a number of instructions to enable 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 application.

[0389] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0390] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.

[0391] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0392] Finally, it should be noted that the above is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.

Claims

1. A federated learning method, It is characterized in that include: The first server receives information of at least one first model sent by at least one downstream device; The first server trains the at least one first model to obtain at least one trained first model, wherein the at least one trained first model includes information of the at least one updated first model; The first server aggregates the updated information of the at least one first model to obtain an aggregation result; The first server updates the locally stored second model according to the aggregation result to obtain an updated second model.

2. The method according to claim 1, It is characterized in that The first server trains the at least one first model to obtain the at least one trained first model, including: The first server trains the at least one first model under the constraint of a first sparse constraint condition to obtain at least one trained first model, wherein the first sparse constraint condition includes a constraint formed by a function for reducing parameters in the first model, and the information of the first model includes the parameters in the first model.

3. The method according to claim 1, It is characterized in that The first server trains the at least one first model to obtain the at least one trained first model, including: The first server trains the at least one first model under the constraints of a first sparse constraint and a first distance constraint to obtain at least one trained first model, wherein the first sparse constraint includes a constraint formed by a function for reducing parameters in the first model, the first distance constraint includes a constraint formed by a similarity or distance between the at least one first model and the second model, and the information of the first model includes parameters in the first model.

4. The method according to claim 3, It is characterized in that The first server trains the at least one first model under the constraints of the first sparse constraint condition and the first distance constraint condition to obtain the at least one trained first model, including: The first server perturbs the at least one first model using noise to obtain at least one first model after disturbance update; The first server trains the at least one first model after the disturbance update under the constraints of the first sparse constraint condition and the first distance constraint condition to obtain the at least one trained first model.

5. The method according to claim 3 or 4, It is characterized in that The first distance constraint condition also includes a constraint formed by the similarity or distance between the second model and a third model, and the third model is a model from an upstream device of the first server.

6. The method according to any one of claims 1 to 4, It is characterized in that The method further comprises: The first server receives a third model from an upstream device; The first server updates the locally stored model according to the third model to obtain the second model.

7. The method according to claim 6, It is characterized in that After obtaining the updated second model, the method further includes: The first server trains the third model to obtain an updated third model.

8. The method according to claim 7, It is characterized in that The first server trains the third model to obtain an updated third model, including: The first server trains the third model under the constraint of a second sparse constraint condition to obtain the trained third model, wherein the second sparse constraint condition includes a constraint formed by a function for reducing parameters in the third model.

9. The method according to claim 7 or 8, It is characterized in that The method further comprises: The first server sends information of the trained third model to the upstream device.

10. The method according to claim 7 or 8, It is characterized in that The method further comprises: The first server sends the updated second model as a new first model to the at least one downstream device, so that the at least one downstream device trains the new first model.

11. The method according to claim 6, It is characterized in that After obtaining the updated second model, the method further includes: The first server sends the updated information of the second model to the upstream device, so that the upstream device trains the third model according to the updated information of the second model to obtain a trained third model.

12. The method according to any one of claims 2 to 5, It is characterized in that The first sparse constraint condition includes the norm of the vector or matrix of the at least one first model, and the norm includes: 0 Norm, l 1 Norm, l p Norm, l 12 Norm, l p2 Norm, l 0 Continuous function after norm transformation, l 1 Continuous function after norm transformation, l p Continuous function after norm transformation, l 12 A continuous function after norm transformation or l p2 Continuous function after norm transformation, p∈(0,1).

13. A federated learning method, It is characterized in that include: The first client receives information of the first model sent by the first server; The first client trains the first model under a third sparse constraint condition to obtain a trained first model, wherein the trained first model includes information of the updated first model, the third sparse constraint condition includes a constraint formed by a function for reducing parameters in the first model, and the information of the first model includes parameters in the first model; The first client sends the updated information of the first model to the first server, so that the first server retrains the first model according to the received updated information of the first model to obtain a new first model.

14. The method according to claim 13, It is characterized in that The first client trains the first model under the third sparse constraint condition to obtain a trained first model, including: The first client trains the first model under the constraints of the third sparse constraint and the second distance constraint to obtain the trained first model, and the second distance constraint includes a constraint formed by the similarity or distance between the first model and a locally stored fourth model.

15. A federated learning device, It is characterized in that include: A transceiver module, used for receiving information of at least one first model sent by at least one downstream device; A training module, used for training the at least one first model to obtain at least one trained first model, wherein the at least one trained first model includes information of the at least one updated first model; an aggregation module, configured to aggregate the updated information of the at least one first model to obtain an aggregation result; An updating module is used to update the locally stored second model in combination with the aggregation result to obtain an updated second model.

16. The device according to claim 15, It is characterized in that The training module is specifically used to train the at least one first model under the constraint of a first sparse constraint condition to obtain at least one first model after training, wherein the first sparse constraint condition includes a constraint formed by a function for reducing parameters in the first model, and the information of the first model includes the parameters in the first model.

17. The device according to claim 15, It is characterized in that The training module is specifically used to train the at least one first model under the constraints of a first sparse constraint and a first distance constraint to obtain at least one first model after training, wherein the first sparse constraint includes a constraint formed by a function for reducing parameters in the first model, the first distance constraint includes a constraint formed by the similarity or distance between the at least one first model and the second model, and the information of the first model includes the parameters in the first model.

18. The device according to claim 17, It is characterized in that The training module is specifically used for: Using noise to perturb the at least one first model to obtain at least one first model after disturbance update; The at least one first model after the disturbance update is trained under the constraints of the first sparse constraint condition and the first distance constraint condition to obtain the at least one trained first model.

19. The device according to claim 17 or 18, It is characterized in that The first distance constraint condition also includes a constraint formed by the similarity or distance between the second model and a third model, and the third model is a model sent by an upstream device.

20. The device according to any one of claims 15 to 19, It is characterized in that The transceiver module is further used to receive a third model sent by an upstream device to the first server; The training module is also used to update the locally stored model according to the third model to obtain the second model.

21. The device according to claim 20, It is characterized in that The training module is also used to train the third model to obtain an updated third model.

22. The device according to claim 21, It is characterized in that The training module is specifically used to train the third model under the constraint of a second sparse constraint condition to obtain the trained third model, wherein the second sparse constraint condition includes a constraint formed by a function for reducing parameters in the third model.

23. The device according to claim 21 or 22, It is characterized in that The transceiver module is also used to send the information of the trained third model to the upstream device.

24. The device according to claim 21 or 22, It is characterized in that The transceiver module is also used to send the updated second model as a new first model to the at least one downstream device, so that the at least one downstream device trains the new first model.

25. The device according to claim 20, It is characterized in that The transceiver module is also used to send the updated second model information to the upstream device, so that the second server trains the third model according to the updated second model information to obtain the trained third model.

26. The device according to any one of claims 16 to 19, It is characterized in that The first sparse constraint condition includes the norm of the vector or matrix of the at least one first model, and the norm includes: 0 Norm, l 1 Norm, l p Norm, l 12 Norm, l p2 Norm, l 0 Continuous function after norm transformation, l 1 Continuous function after norm transformation, l p Continuous function after norm transformation, l 12 Continuous function after norm transformation or l p2 Continuous function after norm transformation, p∈(0,1).

27. A federated learning device, It is characterized in that include: A transceiver module, used for receiving information of the first model sent by the first server; A training module, used for training the first model under a third sparse constraint condition to obtain a trained first model, wherein the trained first model includes information of the updated first model, the third sparse constraint condition includes a constraint formed by a function for reducing parameters in the first model, and the information of the first model includes parameters in the first model; The transceiver module is also used to send the updated information of the first model to the first server, so that the first server retrains the first model according to the received updated information of the first model to obtain a new first model.

28. The device according to claim 27, It is characterized in that The training module is specifically used for the first client to train the first model under the constraints of the third sparse constraint and the second distance constraint to obtain the trained first model, and the second distance constraint includes the constraint formed by the similarity or distance between the first model and the locally stored fourth model.

29. A federated learning system, It is characterized in that comprising a plurality of servers and at least one client, wherein the at least one client establishes a connection with the plurality of servers; Any one of the multiple servers is used to implement the steps of any one of the methods of claims 1 to 12; The at least one client is used to implement the steps of the method according to claim 13 or 14.

30. A federated learning device, It is characterized in that The method comprises one or more processors, wherein the one or more processors are coupled to a memory, wherein the memory stores a program, and when the program instructions stored in the memory are executed by the one or more processors, the steps of the method according to any one of claims 1 to 12 are implemented.

31. A federated learning device, It is characterized in that The method comprises one or more processors, wherein the one or more processors are coupled to a memory, wherein the memory stores a program, and when the program instructions stored in the memory are executed by the one or more processors, the steps of the method according to claim 13 or 14 are implemented.

32. A computer-readable storage medium, It is characterized in that The invention comprises a program which, when executed by a processing unit, performs the method according to any one of claims 1 to 14.

33. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

Citation Information

Patent Citations

  • Differentiated noise adding method and system in federated learning gradient exchange

    CN111260061A

  • Federated learning method, device and system

    CN111553484A

  • Federal learning scheduling method and device and system

    CN112508205A

  • Federation learning method and device, equipment and storage medium

    CN112580821A

  • Hybrid federated learning method and architecture

    WO2021022707A1

Cited By

  • Federal learning method for non-independent identically distributed data in edge intelligent controller

    CN119623671A

  • Minkowski distance-based federal learning backdoor defense method

    CN120296727A