Federal learning method based on NAG simulation and stable acceleration method thereof
By adopting NAG simulation algorithm in federated learning, using global acceleration terms to update local models, the problems of local optimality and overfitting in local training are solved, stable and fast global model training is achieved, and convergence rate and generalization are improved. and protect data privacy.
Patent Information
- Application Number
- CN202411325736.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-01-07
AI Technical Summary
Existing federated learning methods are prone to falling into local optimization in local training, resulting in unstable and overfitting of global models, and failing to effectively accelerate the training process.
The federated learning method based on NAG simulation is adopted, and the simulated NAG acceleration algorithm is used on the client and server side respectively, and the global acceleration term is used to update the local model to avoid local optimization and accelerated convergence, and achieve stable and fast global model training.
It effectively avoids local model overfitting, improves the convergence rate and generalization performance of the global model, realizes a stable and accelerated federated learning process, and protects the privacy of client data.
Smart Images

Figure CN119272834A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular, to a federated learning method based on NAG simulation and a stable acceleration method thereof, which can simultaneously achieve stabilized and accelerated global convergence, and also to a corresponding device, system, computer terminal and computer-readable storage medium. Background Art
[0002] Modern distributed networks are becoming increasingly large, such as mobile phones, wearable devices, and autonomous driving, which generate a large amount of data every day. However, due to the increasing data privacy issues and network communication limitations, a purely centralized data storage and analysis approach has become impractical. In fact, data owners often worry about privacy breaches caused by sharing their data with third parties. In this context, strict legislation such as the US Consumer Privacy Bill of Rights and the European Commission's General Data Protection Regulation (GDPR) aims to protect users' privacy. In view of this factor, data storage and analysis are shifting from centralized to distributed. The key driving technology for this shift is edge computing, where edge clients such as smartphones, sensors, and micro servers have high computing and storage capabilities, enabling them to analyze data and transmit results with less latency.
[0003] In this context, McMahan et al. proposed federated learning in their paper “Communication-efficient learning of deep networks from decentralized data” published in 2016. The main idea of federated learning is that the edge client first initializes the local model based on the global model, and then trains the local machine learning model in parallel based on a large amount of stored local data. After that, there is no need to share its original data, just send the local machine learning model to the server. The server then aggregates all the local models and obtains a new global model based on this update, repeating these steps until a certain convergence criterion is met.
[0004] The NAG (Nesterov accelerated gradient descent) acceleration algorithm achieves the optimal convergence rate among first-order optimization algorithms. Therefore, in order to accelerate the training process of federated learning, Yu et al. proposed to execute the standard NAG algorithm in parallel locally in the paper "On the linearspeedup analysis of communication efficient momentum SGD for distributed non-convex optimization" published in the 2019 International Conference on Machine Learning. However, due to data heterogeneity, local accelerated training can easily cause overfitting, resulting in unstable or even non-convergent convergence of the global model.
[0005] After searching, we found:
[0006] The Chinese invention patent application with publication number CN117829317A, "A personalized federated learning method based on local model differences", includes the following steps: the server sends the global model to the local client to initialize the client model; the client trains the model based on local data and uploads the model parameters to the server; the server generates a model difference matrix based on the parameters uploaded by the client in this round; the server aggregates the global model based on the client model, and uses the model difference matrix to select appropriate neighbor models to aggregate and update the personalized model of each client; the local client updates the local model based on the model returned by the server. This federated learning method still has the following technical problems:
[0007] This solution considers training a personalized private model for each node through a node selection strategy, and it is impossible to train a global optimal model.
[0008] In this scheme, local training is still based on the traditional gradient descent algorithm to update the local model. This strategy will still cause local training to fall into local optimality, resulting in overfitting. At the same time, this scheme does not achieve the effect of local accelerated training. Summary of the invention
[0009] In view of the deficiencies in the prior art, the present invention provides a federated learning method based on NAG simulation and a stable acceleration method thereof, which can simultaneously achieve stabilized and accelerated global convergence, and also provides a corresponding device, system, computer terminal and computer-readable storage medium.
[0010] According to one aspect of the present invention, a method for stable acceleration of federated learning based on NAG simulation is provided, which is applied to a client, wherein the client includes a local model, and the method includes:
[0011] Receive the global acceleration item and global model sent by the server;
[0012] Initialize the local model according to the global model;
[0013] Inputting local training data into the initialized local model for model training, and determining a loss function of the local model;
[0014] According to the loss function of the local model, based on back propagation and the global acceleration term, a local acceleration term is obtained;
[0015] Based on the local acceleration item, updating the local model;
[0016] After the local model is updated a certain number of times, the local model is updated for the last time and the initial time to determine the target change of the local model.
[0017] Preferably, the loss function of the local model is the cross entropy loss between the training labels and the true labels of the local data.
[0018] Preferably, the obtaining of the local acceleration term based on the loss function of the local model, based on back propagation and the global acceleration term, comprises:
[0019] Performing a first sliding average on the gradient obtained by back propagation and the global acceleration term;
[0020] The gradient is further subjected to a second sliding average with the result of the first sliding average to obtain a local acceleration term.
[0021] Preferably, updating the local model based on the local acceleration item includes:
[0022] The local model is updated based on the local acceleration term multiplied by a learning rate.
[0023] According to another aspect of the present invention, a method for stable acceleration of federated learning based on NAG simulation is provided, which is applied to a server side, wherein the server side includes a global model, and the method includes:
[0024] Receive the local model target change uploaded by the client;
[0025] Aggregate the local model target changes of all clients on the server side and update the global model;
[0026] Based on the aggregated result of the local model target change amount, the global acceleration term is updated.
[0027] Preferably, aggregating the local model target changes of all clients on the server side and updating the global model includes:
[0028] The local model target changes of all clients are aggregated by the weighted summation method, and the obtained aggregation result is linearly added to the outdated global model to update a new global model.
[0029] Preferably, the updating of the global acceleration term based on the aggregation result of the local model target change amount includes:
[0030] The aggregation result of the local model target change amount is linearly added to the outdated global acceleration term to update and obtain a new global acceleration term.
[0031] Preferably, the above method further comprises:
[0032] The updated global model and global acceleration term are sent to the client.
[0033] According to a third aspect of the present invention, there is provided a federated learning stable acceleration device based on NAG simulation, which is applied to a client, wherein the client includes a local model module for providing a local model, and the device includes:
[0034] A client receiving module, which is used to receive the global model and global acceleration item sent by the server;
[0035] A client initialization module, which is used to initialize the local model according to the global model;
[0036] A first determination module of the client, the module being used to input local training data into the initialized local model for model training, and determine a loss function of the local model;
[0037] A second determination module of the client, the module being used to obtain a local acceleration term according to the loss function of the local model, based on back propagation and the global acceleration term;
[0038] A client update module, which updates the local model based on the local acceleration item;
[0039] The third determination module of the client is used to determine the target change amount of the local model by subtracting the last updated local model from the initial local model after the local model is updated a certain number of times.
[0040] According to a fourth aspect of the present invention, there is provided a federated learning stable acceleration device based on NAG simulation, which is applied to a server side, wherein the server side includes a global model module for providing a global model, and the device includes:
[0041] Server initialization module, used to initialize the global model and global acceleration items;
[0042] A server sending module, used for sending the initialized global model and global acceleration item to the client;
[0043] A server receiving module, used for receiving the local model change amount sent by the client;
[0044] A first determination module of the server is used to perform global aggregation processing on the local model change amount to determine the global model;
[0045] The second determination module of the server is used to determine a global acceleration item based on the aggregation result of the local model change amount.
[0046] According to a fifth aspect of the present invention, a federated learning method based on NAG simulation is provided, comprising:
[0047] On the client side, receive the global acceleration term and the global model sent by the server; initialize the local model according to the global model; input the local training data into the initialized local model for model training, and determine the loss function of the local model; obtain the local acceleration term based on the loss function of the local model based on back propagation and the global acceleration term; update the local model based on the local acceleration term; after the local model is updated a certain number of times, subtract the last updated local model from the initial local model to determine the target change of the local model, and upload it to the server side;
[0048] On the server side, receive the local model target change uploaded by the client; aggregate the local model target change of all clients and update the global model; update the global acceleration item based on the aggregation result of the local model target change; transmit the updated global model and global acceleration item to the client.
[0049] According to a sixth aspect of the present invention, there is provided a federated learning system based on NAG simulation, comprising: a local model updating module and a model change amount calculating module arranged on a client, a global aggregation module and a global acceleration item updating module arranged on a server, and a communication module for connecting the client and the server; wherein:
[0050] The local model update module is used to receive the global acceleration term and the global model sent by the server; initialize the local model according to the global model; input the local training data into the initialized local model for model training, and determine the loss function of the local model; obtain the local acceleration term based on the loss function of the local model, based on back propagation and the global acceleration term; and update the local model based on the local acceleration term;
[0051] The model change calculation module is used to, after the local model is updated a certain number of times, make a difference between the last updated local model and the initial local model, determine the target change amount of the local model, and upload it to the server;
[0052] The global aggregation module is used to receive the local model target change amount participating in the current round of training uploaded by the client; aggregate the local model target change amounts of all clients and update the global model;
[0053] The global acceleration term updating module is used to update the global acceleration term by using the aggregation result of the local model target change amount obtained by the global aggregation module;
[0054] The communication module is used to transmit the local model target change determined by the client to the server, and transmit the global model and global acceleration item updated by the server to the client.
[0055] According to a seventh aspect of the present invention, there is provided a computer terminal comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, can be used to execute any of the above-described methods of the present invention, or to execute any of the above-described devices of the present invention.
[0056] According to an eighth aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it can be used to execute any of the above methods of the present invention, or to run any of the above devices of the present invention.
[0057] Due to the adoption of the above technical solution, the present invention has at least one of the following beneficial effects compared with the prior art:
[0058] The NAG simulation-based federated learning method and stable acceleration method thereof provided by the present invention accelerate the training of local model updates through global acceleration items, which can accelerate convergence and reduce the required communication rounds to complete the training.
[0059] The NAG simulation-based federated learning method and stable acceleration method thereof provided by the present invention accelerate the training of local model updates through global acceleration items, which can avoid local training from falling into local optimality, alleviate local model overfitting, and improve the generalization performance of the aggregated global model.
[0060] The present invention provides a federated learning method based on NAG simulation and a stable acceleration method thereof. Local model updates are accelerated through training with a global acceleration term. In the local stable acceleration training, on the one hand, the local acceleration process can obtain the constraint of the global acceleration term to ensure that the local training will not fall into the local optimum. At the same time, the global acceleration term can be used to accelerate convergence and obtain the global optimum.
[0061] The NAG-simulated federated learning method and its stable acceleration method provided by the present invention adopt a technology that can realize stabilized and accelerated global convergence federated learning, and provide a new solution for federated learning scenarios. By using the simulated NAG acceleration algorithm on the server side and the local client side respectively, the training can be accelerated and the convergence can be stabilized, avoiding the overfitting of private data by the client update, and improving the convergence rate and generalization performance of the global model.
[0062] The NAG simulation-based federated learning method and stable acceleration method provided by the present invention can accelerate model convergence and stabilize convergence by simulating the NAG acceleration algorithm, thereby improving the model convergence rate and generalization performance without causing local data privacy leakage.
[0063] The NAG simulation-based federated learning method and stable acceleration method thereof provided by the present invention can be used as a distributed machine learning method for protecting user data privacy, and can be further applied to multiple application fields such as image classification and natural language processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0065] Figure 1 The present invention is a flowchart of a stable acceleration method for federated learning based on NAG simulation applied to a client in a preferred embodiment of the present invention.
[0066] Figure 2 This is a workflow diagram of a NAG simulation-based federated learning stable acceleration method applied to a server in a preferred embodiment of the present invention.
[0067] Figure 3 It is a structural block diagram of a federated learning system based on NAG simulation in a preferred embodiment of the present invention.
[0068] Figure 4 (a) to (h) are convergence curve diagrams of the NAG simulation-based federated learning method, device and system provided by the present invention on the CIFAR10, CIFAR100, EMNIST and Shakespeare data sets. DETAILED DESCRIPTION
[0069] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0070] In the existing technology, due to data heterogeneity, local accelerated training can easily cause overfitting, resulting in unstable or even non-convergence of the global model.
[0071] In response to the above problems, an embodiment of the present invention provides a stable acceleration method for federated learning based on NAG simulation. By simulating the NAG acceleration algorithm, the method can accelerate the convergence of the model and stabilize the convergence, thereby improving the model convergence rate and generalization performance, and at the same time will not cause local data privacy leakage.
[0072] Specifically, Figure 1 As shown, the first embodiment of the present invention provides a method for stable acceleration of federated learning based on NAG simulation, which is applied to a client, and the client includes a local model. The method includes:
[0073] S1, receiving the global acceleration item and global model sent by the server;
[0074] S2, initialize the local model according to the global model;
[0075] S3, inputting the local training data into the initialized local model for model training, and determining the loss function of the local model;
[0076] S4, performing a first determination process on the local model according to the loss function of the local model, based on back propagation and the global acceleration term, to obtain a local acceleration term;
[0077] S5, performing a first update determination process on the local model based on the local acceleration item;
[0078] Repeat the processes of S4 and S5 to perform a second determination process and a second update determination process, and so on;
[0079] S6, after the local model is updated a certain number of times, the difference between the last updated and initial local models is taken to determine the target change amount of the local model.
[0080] In some preferred implementations, in the above S3, the loss function of the local model is the cross entropy loss between the training labels and the true labels of the local data.
[0081] In some preferred implementations, the above S4, according to the loss function of the local model, based on back propagation and the global acceleration term, performs a first determination process on the local model to obtain the local acceleration term, including:
[0082] Perform the first sliding average on the gradient obtained by backpropagation and the global acceleration term;
[0083] The gradient is continued to be averaged with the result of the first sliding average to obtain the local acceleration term.
[0084] In some preferred implementations, the above S5, based on the local acceleration item, performs a first update determination process on the local model, including:
[0085] Based on the local acceleration term multiplied by the learning rate, the local model is updated to complete the first update determination process.
[0086] Specifically, Figure 2 As shown, the second embodiment of the present invention also provides a federated learning stable acceleration method based on NAG simulation, which is applied to a server side, and the server side includes a global model. The method includes:
[0087] M1, receives the local model target change uploaded by the client;
[0088] M2, aggregates the local model target changes of all clients on the server side and updates the global model;
[0089] M3 updates the global acceleration term based on the aggregated results of the local model target changes.
[0090] In some preferred implementations, the above M2 aggregates the local model target changes of all clients on the server side and updates the global model, including:
[0091] The local model target changes of all clients are aggregated by the weighted summation method, and the obtained aggregation result is linearly added to the outdated global model to update a new global model.
[0092] In some preferred implementations, the above M3 updates the global acceleration term based on the aggregated result of the local model target change, including:
[0093] The aggregated result of the local model target change is linearly added to the old global acceleration term to obtain a new global acceleration term.
[0094] In some preferred embodiments, the method provided in this embodiment further comprises:
[0095] The above M4 sends the updated global model and global acceleration item to the client.
[0096] Based on the same inventive concept, an embodiment of the present invention also provides a federated learning stable acceleration device based on NAG simulation.
[0097] Specifically, the third embodiment of the present invention provides a federated learning device based on NAG simulation, which is applied to a client, and the client includes a local model module for providing a local model. The device includes:
[0098] A client receiving module, which is used to receive the global model and global acceleration item sent by the server;
[0099] Client initialization module, which is used to initialize the local model according to the global model;
[0100] A first determination module of the client, which is used to input local training data into the initialized local model for model training and determine the loss function of the local model;
[0101] A second determination module of the client, which is used to determine the local model according to the loss function of the local model, based on back propagation and the global acceleration term, to obtain the local acceleration term;
[0102] The client update module continuously updates the local model based on the local acceleration item;
[0103] The third determination module of the client is used to determine the target change amount of the local model by subtracting the last updated local model from the initial local model after the local model has been updated a certain number of times.
[0104] It should be noted that the steps in the method provided in the first embodiment of the present invention can be implemented by using corresponding modules, devices, units, etc. in the system of the embodiment. Those skilled in the art can refer to the technical solution of the method in the first embodiment to implement the composition of the system of the embodiment, that is, the embodiment in the first embodiment can be understood as a preferred example for constructing the system of the embodiment, which will not be elaborated here.
[0105] Specifically, the fourth embodiment of the present invention further provides a federated learning stable acceleration device based on NAG simulation, which is applied to a server side, and the server side includes a global model module for providing a global model. The device includes:
[0106] Server initialization module, used to initialize the global model and global acceleration items;
[0107] The server sending module is used to send the initialized global model and global acceleration item to the client;
[0108] The server receiving module is used to receive the local model change amount sent by the client;
[0109] A first determination module of the server is used to perform global aggregation processing on the local model changes to determine the global model;
[0110] The second determination module of the server is used to determine the global acceleration item based on the aggregation result of the local model change amount.
[0111] Based on the same inventive concept, an embodiment of the present invention also provides a federated learning system based on NAG simulation.
[0112] It should be noted that the steps in the method provided in the second embodiment of the present invention can be implemented by using corresponding modules, devices, units, etc. in the system of this embodiment. Those skilled in the art can refer to the technical solution of the method in the second embodiment to implement the composition of the system of this embodiment, that is, the embodiment in the second embodiment can be understood as a preferred example for constructing the system of this embodiment, which will not be elaborated here.
[0113] Specifically, the federated learning method based on NAG simulation provided by the fifth embodiment of the present invention includes:
[0114] On the client side, receive the global acceleration term and global model sent by the server; initialize the local model according to the global model; input the local training data into the initialized local model for model training, and determine the loss function of the local model; according to the loss function of the local model, based on back propagation and the global acceleration term, determine the local model to obtain the local acceleration term; based on the local acceleration term, update the local model; after the local model is updated a certain number of times, subtract the last updated local model from the initial local model to determine the target change of the local model, and upload it to the server side;
[0115] On the server side, receive the local model target change uploaded by the client; aggregate the local model target change of all clients and update the global model; update the global acceleration item based on the aggregation result of the local model target change; transmit the updated global model and global acceleration item to the client.
[0116] It should be noted that the steps in the method of this embodiment can be implemented using the corresponding steps in the first and second embodiments. Those skilled in the art can refer to the technical solutions of the methods in the first and second embodiments to implement the composition of the steps of this embodiment, that is, the embodiments in the first and second embodiments can be understood as preferred examples for constructing the method of this embodiment, which will not be elaborated here.
[0117] Specifically, Figure 3As shown, the sixth embodiment of the present invention provides a federated learning system based on NAG simulation, including: a local model update module and a model change calculation module arranged on a client, a global aggregation module and a global acceleration item update module arranged on a server, and a communication module for connecting the client and the server, wherein the server is connected to one or more clients; wherein:
[0118] The local model update module is used to receive the global acceleration term and the global model sent by the server; initialize the local model according to the global model; input the local training data into the initialized local model for model training, and determine the loss function of the local model; according to the loss function of the local model, based on back propagation and the global acceleration term, determine the local model to obtain the local acceleration term; based on the local acceleration term, update the local model;
[0119] The model change calculation module is used to calculate the difference between the last updated and the initial local models after the local model is updated a certain number of times, determine the target change of the local model, and upload it to the server;
[0120] The global aggregation module is used to receive the local model target changes uploaded by the client for this round of training; aggregate the local model target changes of all clients and update the global model;
[0121] A global acceleration term update module, used to update the global acceleration term using the aggregation result of the local model target change amount obtained by the global aggregation module;
[0122] The communication module is used to transmit the local model target change determined by the client to the server, and transmit the global model and global acceleration item updated by the server to the client.
[0123] It should be noted that the components in the system of this embodiment can be implemented by using the corresponding modules, devices, units, etc. in the systems of the third and fourth embodiments. Those skilled in the art can refer to the technical solutions of the systems in the third and fourth embodiments to implement the components of the system of this embodiment, that is, the embodiments in the third and fourth embodiments can be understood as preferred examples for constructing the system of this embodiment, which will not be elaborated here.
[0124] The seventh embodiment of the present invention further provides a computer terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor can be used to execute any method of the above-mentioned embodiments of the present invention, or to execute any device of the above-mentioned embodiments of the present invention when executing the computer program.
[0125] Optionally, the memory is used to store programs; the memory may include volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviated: RAM), such as static random-access memory (English: static random-access memory, abbreviated: SRAM), double data rate synchronous dynamic random access memory (English: Double Data Rate Synchronous Dynamic Random Access Memory, abbreviated: DDR SDRAM), etc.; the memory may also include non-volatile memory (English: non-volatile memory), such as flash memory (English: flash memory). The memory is used to store computer programs (such as applications, functional modules, etc. that implement the above method), computer instructions, etc., and the above computer programs, computer instructions, etc. can be partitioned and stored in one or more memories. And the above computer programs, computer instructions, data, etc. can be called by the processor.
[0126] The above-mentioned computer programs, computer instructions, etc. may be stored in one or more memories in partitions, and the above-mentioned computer programs, computer instructions, data, etc. may be called by a processor.
[0127] The processor is used to execute the computer program stored in the memory to implement the various steps of the method or various modules of the system involved in the above embodiments. For details, please refer to the relevant descriptions in the above method and system embodiments.
[0128] The processor and the memory may be independent structures or integrated structures. When the processor and the memory are independent structures, the memory and the processor may be coupled and connected via a bus.
[0129] The eighth embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it can be used to execute the method of any one of the above embodiments of the present invention, or to run the device of any one of the above embodiments of the present invention.
[0130] Among them, computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general or special-purpose computer. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a user device. Of course, the processor and the storage medium can also be present in a communication device as discrete components.
[0131] The technical solution provided by the above embodiment of the present invention is further described in detail below in conjunction with a specific application example.
[0132] In this specific application example, the obstacle detection task in autonomous driving is used as a specific application scenario. The federated learning technology used in this specific application example can achieve stabilization and acceleration, including: local model update module, model change calculation module, communication module, global aggregation module and global acceleration item update module, such as Figure 3 As shown in the figure: the local model update model calculates the local acceleration item to update the local model; the model change calculation module calculates the model change after the model is updated and the initial model; the communication module is responsible for uploading the client model change and downloading the server-side global model and global acceleration item; the global aggregation module is responsible for aggregating the model changes uploaded by all clients through the communication module on the server side and updating the global model; the global acceleration item update module performs sliding average summation on the aggregation results to update the global acceleration item.
[0133] Furthermore, in the autonomous driving scenario, each vehicle acts as a client and collects environmental data through its own on-board sensors (such as cameras and radars), including pedestrians, vehicle location, speed, obstacle location, etc. In order to protect privacy, the vehicle's raw data is not directly transmitted to the server, but is trained through a federated learning method.
[0134] Specifically, the server side acts as a trusted third-party organization, and each vehicle acts as a client, building a communication network between the server side and each client, namely the communication module. Among them, each vehicle client does not need to communicate directly, and the server and the client do not transmit the original vehicle sensor data.
[0135] Based on the technical solution provided by the above embodiment of the present invention, a deep learning model with good global generalization performance can be quickly trained. The specific implementation steps are as follows:
[0136] Step 1: The server first initializes the global model and global acceleration term. Due to the unstable communication connection, the client vehicles participating in this round of training are randomly participating. The server needs to send a unified global model and global acceleration term to the client vehicles participating in the training.
[0137] Step 2: Each vehicle acts as a client and initializes the local model based on the global model. The model gradient is calculated based on the local privacy data (such as images and distance data collected by cameras and radars). The model gradient and the global acceleration term are continuously averaged twice to obtain the local acceleration term. Specifically:
[0138]
[0139] in,, is the gradient obtained by backpropagation of client i in the k-1th local iteration of the tth communication round, v t is the global acceleration term, β is the momentum coefficient, is the first sliding average result, is the second sliding average result, which is the local acceleration term.
[0140] Step 3: The client linearly adds the obtained local acceleration term to the local model to update the local model.
[0141] Step 4: After repeating Step 2 and Step 3 K times (K≥1), calculate the model change, that is, the updated model minus the model before the update.
[0142] Step 5: The server will perform global aggregation on the received model changes. The aggregation method is arithmetic averaging. The aggregated result is linearly added to the old global model to obtain a new global model.
[0143] Step 6: The server updates the global acceleration item using a sliding average:
[0144]
[0145] Among them, v t is the old global acceleration term, Δx t is the aggregated result of the client model change, β is the momentum coefficient, η l is the global learning rate.
[0146] Step 7: Repeat steps 1 to 6 until the model converges. This method can effectively improve the generalization ability of the model in autonomous driving scenarios, reduce communication overhead, and accelerate the model training process.
[0147] Implementation Effect
[0148] The implementation effect of the technical solution (this solution) adopted in this specific application example is analyzed from two perspectives: model convergence rate and generalization performance. The implementation process is implemented using the steps in this solution. The data sets used include the image data sets EMNIST, CIFRA-10 and CIFAR-100, and the natural language processing data set Shakespeare. The federated learning technology FedANAG that can achieve stabilization and acceleration using this scheme is compared with the method FedAvg proposed by McMahan et al. in "Communication-efficient learning of deep networks from decentralized data", the method FedDyn proposed by Acer et al. in "Federated Learning Based on Dynamic Regularization", the method SCAFFOLD proposed by Karimiereddy et al. in "scaffold: stochastic controlled averaging for federated learning", FedProx proposed by Li Tian et al. in "Federated optimization inheterogeneous networks", FedLNAG proposed by Yu et al. in "On the linear speedup analysisof communication efficient momentum SGD for distributed non-convex optimization", MimeLite proposed by Karimireddy et al. in "Breaking the centralized barrierfor cross-device federated learning.", the method FedAvgM proposed by Hsu et al. in "Measuring the effects of non-identical data distribution for federated visual classification", and the ablation experiment algorithms FedGNAG and FedLNAG*. Figure 4 As shown in (a) to (h).
[0149] Analysis of the model convergence speed shows that the federated learning technology FedANAG of this scheme converges faster than other algorithms on almost all data sets. As shown in Table 1, it is the statistical results of the convergence rate of the federated learning technology FedANAG of this scheme on the CIFAR10, CIFAR100, EMNIST and Shakespeare data sets.
[0150] Table 1
[0151]
[0152] Analysis of the classification accuracy of the model shows that the federated learning technology FedANAG of this solution has also achieved the best performance in generalization on almost all data sets. As shown in Table 2, the classification accuracy statistics of the federated learning technology FedANAG of this solution on the CIFAR10, CIFAR100, EMNIST and Shakespeare data sets are shown.
[0153] Table 2
[0154]
[0155] The federated learning method based on NAG simulation and the stable acceleration method thereof provided in the above embodiment of the present invention can achieve stabilization and acceleration. On the client side, it includes: receiving the global acceleration term and the global model sent by the server; initializing the local model according to the global model; inputting the local training data into the initialized local model for model training, and determining the loss function of the local model, the loss function is the cross entropy loss between the training label and the real label of the local data; updating the local acceleration term based on the loss function of the local model based on back propagation, and the updating method is to perform the first sliding average of the gradient obtained by back propagation and the global acceleration term, and the gradient continues to perform the second sliding average with the result obtained by the above sliding average to obtain the local acceleration term; the obtained local acceleration term is multiplied by the learning rate to update the model; after a certain number of local updates, the last updated model is subtracted from the initial model to determine the local model change. On the server side, it includes: receiving the model change uploaded by the client; updating the global model by aggregating the model change of all clients on the server side; updating the global acceleration term based on the aggregated result of the model change. The NAG simulation-based federated learning method, device and system provided by the above embodiments of the present invention greatly improve the convergence rate of the global model by introducing stabilization and acceleration technologies, and avoid overfitting of the local model by reducing model differences. It will not leak the data privacy of the client, so that it can adapt to various distributed application scenarios.
[0156] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art may make various modifications or variations within the scope of the claims, which do not affect the essence of the present invention.
Claims
1. A stable acceleration method for federated learning based on NAG simulation, characterized in that: Applied to a client, the client including a local model, the method comprising: Receive the global acceleration item and global model sent by the server; Initialize the local model according to the global model; Inputting local training data into the initialized local model for model training, and determining a loss function of the local model; According to the loss function of the local model, based on back propagation and the global acceleration term, a local acceleration term is obtained; Based on the local acceleration item, updating the local model; After the local model is updated a certain number of times, the local model is updated for the last time and the initial time to determine the target change of the local model.
2. The method for stable acceleration of federated learning based on NAG simulation according to claim 1, characterized in that: Also includes any one or more of the following: -The loss function of the local model is the cross entropy loss between the training labels and the true labels of the local data; -According to the loss function of the local model, based on back propagation and the global acceleration term, obtaining a local acceleration term, including: Performing a first sliding average on the gradient obtained by back propagation and the global acceleration term; Performing a second sliding average on the gradient and the result of the first sliding average to obtain a local acceleration term; -updating the local model based on the local acceleration item, comprising: The local model is updated based on the local acceleration term multiplied by a learning rate.
3. A stable acceleration method for federated learning based on NAG simulation, characterized in that: Applied to a server side, the server side includes a global model, and the method includes: Receive the local model target change uploaded by the client; Aggregate the local model target changes of all clients on the server side and update the global model; Based on the aggregated result of the local model target change amount, the global acceleration term is updated.
4. The method for stable acceleration of federated learning based on NAG simulation according to claim 3 is characterized in that: Also includes any one or more of the following: - The method of aggregating the local model target changes of all clients on the server side and updating the global model includes: Aggregate the target changes of the local models of all clients by weighted summation, linearly add the obtained aggregation result to the old global model, and update to a new global model; -updating the global acceleration term based on the aggregated result of the local model target change, including: Linearly adding the aggregated result of the local model target change amount to the old global acceleration term to update a new global acceleration term; -Send the updated global model and global acceleration terms to the client.
5. A federated learning stable acceleration device based on NAG simulation, characterized in that: Applied to a client, the client includes a local model module for providing a local model, and the device includes: A client receiving module, which is used to receive the global model and global acceleration item sent by the server; A client initialization module, which is used to initialize the local model according to the global model; A first determination module of the client, the module being used to input local training data into the initialized local model for model training, and determine a loss function of the local model; A second determination module of the client, the module being used to obtain a local acceleration term according to the loss function of the local model, based on back propagation and the global acceleration term; A client update module, which updates the local model based on the local acceleration item; The third determination module of the client is used to determine the target change amount of the local model by subtracting the last updated local model from the initial local model after the local model is updated a certain number of times.
6. A federated learning stable acceleration device based on NAG simulation, characterized in that: Applied to a server side, the server side includes a global model module for providing a global model, and the device includes: Server initialization module, used to initialize the global model and global acceleration items; A server sending module, used for sending the initialized global model and global acceleration item to the client; A server receiving module, used for receiving the local model change amount sent by the client; A first determination module of the server is used to perform global aggregation processing on the local model change amount to determine the global model; The second determination module of the server is used to determine a global acceleration item based on the aggregation result of the local model change amount.
7. A federated learning method based on NAG simulation, characterized in that: include: On the client side, receiving the global acceleration item and the global model sent by the server; initializing the local model according to the global model; Inputting local training data into the initialized local model for model training, determining the loss function of the local model; obtaining a local acceleration term based on the loss function of the local model, based on back propagation and the global acceleration term; updating the local model based on the local acceleration term; after the local model is updated a certain number of times, subtracting the last updated local model from the initial local model to determine the local model target change amount, and uploading it to the server; On the server side, receive the local model target change uploaded by the client; aggregate the local model target change of all clients and update the global model; update the global acceleration item based on the aggregation result of the local model target change; transmit the updated global model and global acceleration item to the client.
8. A federated learning system based on NAG simulation, characterized in that: include: A local model update module and a model change calculation module arranged on the client, a global aggregation module and a global acceleration item update module arranged on the server, and a communication module for connecting the client and the server; wherein: The local model update module is used to receive the global acceleration term and the global model sent by the server; initialize the local model according to the global model; input the local training data into the initialized local model for model training, and determine the loss function of the local model; obtain the local acceleration term based on the loss function of the local model, based on back propagation and the global acceleration term; and update the local model based on the local acceleration term; The model change calculation module is used to, after the local model is updated a certain number of times, make a difference between the last updated local model and the initial local model, determine the target change amount of the local model, and upload it to the server; The global aggregation module is used to receive the local model target change amount participating in the current round of training uploaded by the client; aggregate the local model target change amounts of all clients and update the global model; The global acceleration term updating module is used to update the global acceleration term by using the aggregation result of the local model target change amount obtained by the global aggregation module; The communication module is used to transmit the local model target change determined by the client to the server, and transmit the global model and global acceleration item updated by the server to the client.
9. A computer terminal comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it can be used to execute the method described in any one of claims 1 to 4, or to run the device described in any one of claims 6 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it can be used to execute the method described in any one of claims 1 to 4, or to run the device described in any one of claims 6 to 7.
Citation Information
Patent Citations
Personalized federal learning method based on local model difference
CN117829317A