Federal learning method and system for parameter granularity adaptive frequency modulation
Through parameter granularity adaptive frequency modulation and urgent non-blocking aggregation technology, the synchronization frequency is adjusted according to the parameter granularity in federated learning, solving the problems of low resource utilization and insufficient model accuracy, and achieving more efficient training efficiency and accuracy.
Patent Information
- Application Number
- CN202410782352.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-18
AI Technical Summary
Federated learning has shortcomings in training efficiency and model accuracy, especially the difficulty in setting the synchronization frequency due to edge device resource limitations and differences in data distribution, low resource utilization, and the existing technology can only adjust the synchronization frequency at model granularity, ignoring Parameter differences lead to inaccurate frequency modulation timing.
Using the parameter granularity adaptive frequency modulation method, the server selects the client and transmits parameter synchronization frequency update information. The client adjusts the parameter synchronization frequency according to the gradient conflict rate to achieve targeted frequency settings for each parameter, combined with urgent non-blocking aggregation and pooling. technology to improve resource utilization.
A more accurate frequency setting for each parameter is achieved, the convergence accuracy and resource utilization of the model are improved, and the problems of low model accuracy and insufficient resource utilization in the existing technology are overcome.
Smart Images

Figure CN118607618A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of distributed machine learning technology, and in particular to a federated learning method, system, medium and terminal for parameter granularity adaptive frequency modulation. Background Art
[0002] Federated learning is a distributed machine learning method that has emerged in recent years. Traditional distributed machine learning methods require collecting training data, evenly distributing it to different clients for training, and aggregating training results through frequent communication between devices and nodes in the cluster through high-bandwidth networks. With the strengthening of data privacy regulations (such as the EU's GDPR), traditional centralized data processing methods face more and more legal and ethical challenges. In many industries, data is often scattered across different organizations or devices, forming so-called "data silos." These data are difficult to centralize for privacy, security or legal reasons. Against this backdrop, federated learning came into being, allowing models to be trained on multiple decentralized edge devices or servers while protecting data privacy and security. This approach was proposed by Google in 2016, originally to improve the keyboard prediction function on its mobile devices.
[0003] Although federated learning can protect user privacy, it faces many problems compared to traditional distributed machine learning. For example (1) at the system level, since data cannot be collected, calculations can only be performed on edge devices where the data is located. The computing and communication resources of these devices are inferior to those of clusters. Distributed machine learning requires a lot of computing and frequent communication between clients. This makes the training efficiency of federated learning far less than that of traditional distributed machine learning. For example (2) the data on each edge device often has different distributions, which causes the local models trained on each device to deviate from the local data, ultimately resulting in the performance of the aggregated global model not being optimal.
[0004] In order to solve these problems, there are relatively mature existing technologies, which are as follows:
[0005] Prior art 1:
[0006] Due to the limited client network resources in federated learning scenarios, the FedAvg method is usually used to train the model. In traditional distributed machine learning, all clients aggregate parameters once after a local iteration, which brings a lot of communication overhead. FedAvg proposes to train in rounds, selecting only a part of the clients for each round. Each selected client in each round will aggregate the model after multiple local iterations, thereby reducing communication overhead exponentially and improving training efficiency.
[0007] Although the FedAvg method can improve training efficiency, due to differences in data distribution on edge devices, the number of iterations of each round of local training, that is, the synchronization frequency, will seriously affect the effect of the final model training. The more local iterations there are, the closer the model parameters will be to the local optimal point of the local training data, causing the aggregated model to deviate from the global optimal point. The fewer local iterations there are, the more frequent communication overhead will be. It becomes very difficult to set the synchronization frequency. At the same time, although this method reduces the frequency of communication and improves training efficiency, there is still the problem of insufficient client resource utilization: such as Figure 1 As shown in the figure, from a microscopic perspective, the training and aggregation of the model are two completely separate stages. The training stage only uses computing resources, and network resources are completely idle. The aggregation stage only uses network resources, and computing resources are completely idle. During the entire training process, one resource is completely idle at any time.
[0008] Prior art 2:
[0009] In order to solve the problem of synchronization frequency setting, AdaComm proposes to adaptively and dynamically adjust the synchronization frequency according to the current training loss function value during model training. Specifically, the synchronization period of each round is given by the formula Calculate, where τ0, τ k are the initial and kth round synchronization periods, ω0, ω k are the model parameters of the initial and kth rounds, respectively, and F(x) is the loss function of the model on the global data. As the number of rounds of model training increases, the loss function value on each client will gradually decrease, thereby gradually reducing the synchronization period. This method can ensure that the model maintains a smaller synchronization frequency in the early stages of training, reduce synchronization overhead, and enable the model to converge quickly. At the same time, in the later stages of training, a higher accuracy can be achieved through a larger synchronization frequency.
[0010] Although AdaComm can dynamically and adaptively adjust the synchronization frequency to achieve a balance between training efficiency and model accuracy, it still has certain shortcomings and limitations. Since the loss value of the model is used as the frequency adjustment indicator, this method can only adjust the synchronization frequency at the granularity of the entire model. However, neural network models usually have a large number of parameters, and these parameters have obvious differences in their effects on the model and the laws of change during the training process. Adjusting the synchronization frequency as a whole ignores this difference, and the judgment of the frequency adjustment timing is not accurate enough. At the same time, this method still does not solve the problem of low resource utilization in method 1. Summary of the invention
[0011] In view of the defects in the prior art, the purpose of the present invention is to provide a federated learning method, system, medium and terminal with parameter granularity adaptive frequency modulation.
[0012] According to one aspect of the present invention, a method for federated learning of parameter granularity adaptive frequency modulation is provided, comprising:
[0013] The server selects the clients that participate in each round of training and transmits the update information of each parameter synchronization frequency to the selected clients;
[0014] The model training process of the client participating in the training receives the aggregated parameters from the communication daemon and performs synchronous training according to the synchronization frequency of each parameter;
[0015] The communication daemon process of the client participating in the training receives the training parameters from the model training process, communicates with the server to aggregate the parameters, then receives the aggregated parameters from the server and returns them to the model training process in the next round of training;
[0016] During aggregation, the server calculates the gradient conflict rate based on the gradients uploaded by each client. When the gradient conflict rate of a parameter is less than the set frequency modulation threshold, the original synchronization frequency f of the parameter is adjusted to the new synchronization frequency 2f, and the position of the parameter that needs to be updated is transmitted to all clients in the next round of training.
[0017] Preferably, different parameters have different synchronization frequencies, and all parameters are trained with the same number of rounds, specifically:
[0018] In each round of training, different parameters are C1, C2, C3...C n The corresponding synchronization frequencies are f1, f2, f3...f n , where f1>f2>f3>……>f n ;
[0019] The number of iterations of this round of training model is N times, N ≥ 1 / f n ;
[0020] Parameter C i In which 1 / f i Normal iterations, the remaining N-1 / f i The parameter freezing method is used to keep the value unchanged.
[0021] Preferably, in one round of synchronization, the parameter C i Complete 1 / f i After the normal iteration, the communication daemon immediately sets the parameter C i Send to the server to complete the aggregation.
[0022] Preferably, the server calculates the gradient conflict rate based on the gradients uploaded by each client. include:
[0023]
[0024] Among them, g i [x] is the gradient of the xth parameter on the ith client in this round of training.
[0025] Preferably, the gradient conflict rate is calculated for each parameter in the model;
[0026] In the early stage of training, when the gradient conflicts on different clients are small, the gradient conflict rate approaches 1; in the later stage of training, when the gradient conflicts on different clients are large and a dynamic balance is reached, the gradient conflict rate will decrease to approach 0.
[0027] Preferably, a sliding average method is used to smooth the gradient to reduce the volatility of the gradient conflict rate, specifically:
[0028] Where θ is the smoothing coefficient, is the gradient of the smoothed parameter of the rth round, is the gradient of the i-th parameter in the r-th round.
[0029] Preferably, in each round of training, a pooling technique is used to save only the sum of the positive and negative parts of all client gradients, specifically:
[0030] Maintain a gradient positive value pool and a gradient negative value pool on the server side, with the same dimension as the gradient;
[0031] After receiving a client's gradient, use it to update the global model;
[0032] After adding the positive part and the negative part of the gradient of the client to the positive value pool and the negative value pool respectively, the gradient of the client is deleted;
[0033] Calculate the gradient conflict rate: in They are the smoothed parameter positive pool and negative pool respectively.
[0034] According to a second aspect of the present invention, a federated learning system with parameter granularity adaptive frequency modulation is provided, comprising:
[0035] Server: The server selects the clients that participate in each round of training and transmits the update information of each parameter in this round to the selected clients;
[0036] Client model training part: The model training process of the client participating in the training receives the aggregated parameters from the communication daemon and performs synchronous training according to the synchronization frequency of each parameter;
[0037] Client daemon part: The communication daemon of the client participating in the training receives the synchronized parameters from the model training process, communicates with the server to aggregate the parameters, then receives the aggregated parameters from the server and returns them to the model training process in the next round of training;
[0038] Aggregation frequency modulation module: During aggregation, the server calculates the gradient conflict rate based on the gradients uploaded by each client. When the gradient conflict rate of a certain parameter is less than the set frequency modulation threshold, the original synchronization frequency f of the parameter is adjusted to the new synchronization frequency 2f, and the position of the parameter that needs to be updated in the next round of training is transmitted to all clients.
[0039] According to the third aspect of the present invention, there is provided a terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the terminal can be used to execute the method for federated learning of parameter granularity adaptive frequency modulation, or to run the system for federated learning of parameter granularity adaptive frequency modulation.
[0040] According to a fourth aspect of the present invention, a computer-readable storage medium stores a computer program thereon, which, when executed by a processor, can be used to execute the federated learning method for parameter granularity adaptive frequency modulation, or to run the federated learning system for parameter granularity adaptive frequency modulation.
[0041] Compared with the prior art, the embodiments of the present invention have at least one of the following beneficial effects:
[0042] The parameter-granularity adaptive frequency modulation federated learning method and system in the embodiment of the present invention can achieve more accurate frequency setting for each parameter by adopting the parameter-granularity frequency modulation method, thereby improving the convergence accuracy of the final model while ensuring the training efficiency;
[0043] The parameter granularity adaptive frequency modulation federated learning method and system in the embodiment of the present invention can achieve overlapping utilization of computing resources and communication resources, thereby improving the training efficiency of the model due to the adoption of an urgent non-blocking aggregation method and a corresponding multi-process system design;
[0044] In summary, the embodiment of the present invention adopts a combination of the above-mentioned technologies, which can achieve targeted and precise frequency setting of each parameter, improve resource utilization, improve the accuracy of the model while improving training efficiency, and overcome the problems of low model accuracy and insufficient resource utilization in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] 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:
[0046] Figure 1 A resource utilization diagram at different times for the prior art;
[0047] Figure 2 is a diagram of the overall system architecture in one embodiment of the present invention;
[0048] Figure 3 A resource utilization diagram at different times in a preferred embodiment of the present invention;
[0049] Figure 4 A graph showing the changes in parameter values on different clients in federated learning;
[0050] Figure 5 This is a statistical chart of the time when each parameter stagnates during the LSTM model training process;
[0051] Figure 6 The figures are comparison diagrams of the effects of the method of an embodiment of the present invention and prior art one (FedAvg) and prior art two (AdaComm), wherein (a) is a comparison diagram of the final accuracy effect of training a CNN model, (b) is a comparison diagram of the final accuracy effect of training a ResNet-20 model, and (c) is a comparison diagram of the final accuracy effect of training a LSTM model. DETAILED DESCRIPTION
[0052] 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.
[0053] The parameter change rules of each client in the federated learning in the existing technology are explored, such as Figure 4 As shown in the figure, in the later stage of the training of the FedAvg method, the parameters of different clients have obvious bifurcation due to the different distribution of local data. This phenomenon shows that when the synchronization frequency is too small and the model converges to the local optimum, there is a conflict between the gradients of the local models on different clients. When this conflict reaches a dynamic balance, the model training will stagnate at a suboptimal point. The bifurcation phenomenon is the specific manifestation of the model training stagnating at a suboptimal point.
[0054] In order to avoid the above bifurcation phenomenon, in one embodiment of the present invention, a method for federated learning with adaptive frequency modulation of parameter granularity is provided, and its overall framework follows the parameter server structure widely used in federated learning, such as Figure 2As shown in the figure, it includes a parameter server and multiple clients. Each client contains a model training process and a communication daemon. The difference is that the gradient conflict rate is used to characterize the gradient conflict of each parameter between different clients, and this is used as the frequency modulation indicator of the parameter granularity to avoid bifurcation. Specifically, the main steps of this parameter granularity adaptive frequency modulation federated learning method are as follows:
[0055] S100, the server selects a client participating in each round of training, and transmits synchronization frequency update information of each model parameter in the deep learning model (such as a pathological analysis model, a financial analysis model) to the selected client;
[0056] S200, the model training process of the client participating in the training receives the aggregated parameters from the communication daemon process, and performs synchronous training according to the synchronization frequency of each parameter;
[0057] S300, the communication daemon process of the client participating in the training receives the training parameters completed in S200 from the model training process, communicates with the server to aggregate the parameters, then receives the aggregated parameters from the server and implements S200 to return to the model training process in the next round of training;
[0058] S400, during aggregation, the server calculates the gradient conflict rate based on the gradients uploaded by each client. When the gradient conflict rate of a parameter is less than the set frequency modulation threshold, the original synchronization frequency f of the parameter is adjusted to the new synchronization frequency 2f, and the position of the parameter that needs to be updated is transmitted to all clients in the next round of training.
[0059] In the above embodiment, the gradient conflict rate is used as the parameter synchronization frequency adjustment index, which is calculated for each parameter in the model. However, the loss function value is used as the index in the prior art, which can only be calculated for the entire model, such as Figure 5 As shown, it is a statistical diagram of the time when each parameter in the LSTM model training process experiences training stagnation using a damage function. The blue line indicates the order of reaching training stagnation in the same layer, and the difference between the parameters at the 5th and 95th percentiles reaching training stagnation. There is a significant difference in the time when parameters reach training stagnation in different layers or within a layer, which indicates that it is inaccurate to adjust the parameter synchronization frequency using the model granularity or the layer granularity, and the synchronization frequency should be adjusted at the parameter granularity based on the gradient conflict rate in the above embodiment.
[0060] The above embodiment adopts a frequency modulation method with parameter granularity, which can accurately and timely detect whether the training of each parameter in the model is stagnant at a local optimal point. When stagnation is found, the synchronization frequency is immediately increased to prevent it from staying at the local optimal point and affecting the accuracy of model convergence.
[0061] Before the above step S100, it may further include collecting local data of real application scenarios, cleaning and standardizing the local data to ensure data quality, and further using the local data to independently train the model locally to generate initial model parameters.
[0062] For local data in real application scenarios, it can be corresponding data according to actual application needs, such as patient data in hospitals or clinics, user data and / or market data in banks and financial institutions, production data and / or equipment data in factories in the manufacturing industry, traffic data in traffic management agencies, user purchase data in the retail industry, user experience data of mobile devices, public safety, energy consumption and environmental monitoring data in urban management, etc. Of course, the acquisition of these data should be carried out under the premise of complying with the law.
[0063] The local data of the above-mentioned real-world application scenarios are cleaned and standardized, which may include one or more of removing duplicate data, filling in missing data items, masking privacy information, correcting erroneous information, mixing and rearranging data, adjusting category components, converting data types, etc., so as to ensure data quality.
[0064] Data collection for each client can be performed independently. The collected data is based on the characteristic data of the specific application in which the client is located and is related to the specific behavior of each client. The distribution of data collected between clients is different, and correspondingly, the parameters of the model trained by each client are also different. Acquiring data in the above manner can avoid the sharing of some sensitive data, thereby achieving privacy protection or data security protection, and providing safer and more accurate basic data for subsequent adaptive frequency modulation.
[0065] In order to better use the gradient conflict rate to characterize the gradient conflicts of various parameters between different clients, in a preferred embodiment of the present invention, a method for calculating the gradient conflict rate in this round of training is proposed, specifically:
[0066]
[0067] where g i [x] is the gradient of the xth parameter on the ith client in this round of training.
[0068] It can be seen from the formula that in the early stage of training, when the gradient conflicts on different clients are small, the gradient conflict rate approaches 1; in the late stage of training, when the gradient conflicts on different clients are large, when a dynamic balance is reached, the gradient conflict rate will be reduced to approach 0. In some specific embodiments, the default frequency modulation threshold is 0.1.
[0069] Since different parameters have different synchronization frequencies (synchronization frequency refers to the number of local iterations in a round of training). If all parameters maintain the same number of training iterations, the number of training rounds for different parameters will be different, which will affect the convergence consistency of the model. Therefore, in a preferred embodiment of the present invention, a unified number of rounds is adopted to maintain the same number of rounds for all parameters. Specifically, different parameters are C1, C2, C3...C n The corresponding synchronization frequencies are f1, f2, f3...f n , where f1>f2>f3>……>f n ;
[0070] The number of iterations of this round of training model is N times, N ≥ 1 / f n ;
[0071] Parameter C i In which 1 / f i Normal iterations, the remaining N-1 / f i The parameter freezing method is used to keep the value unchanged.
[0072] Furthermore, in a specific embodiment, assuming that the training model has two parameters, and the synchronization periods in this round are 100 and 200 respectively, then the training model in this round is iterated 200 times in total, of which the first parameter is only normally iterated in the first 100 times, and the parameter is frozen in the remaining 100 times to keep the value unchanged. The second parameter is fully iterated 200 times.
[0073] In the above embodiment, different parameters are trained in a unified number of rounds, which can ensure the consistency of training of different parameters and prevent over-training of certain parameters; it can also avoid additional communication overhead.
[0074] The existing federated learning method has the problem of low resource utilization. Therefore, in a preferred embodiment of the present invention, the idea of urgent non-blocking aggregation is proposed. Specifically, Figure 3 As shown in the figure, in one round of synchronization, when the training of parameters with low synchronization frequency reaches the local iteration number, these parameters are immediately sent to the parameter server by the communication daemon to complete the aggregation. This process does not block the normal training of other parameters. This method can greatly overlap computing and communication, improve resource utilization, and thus improve training efficiency.
[0075] Generally, the stochastic gradient descent method is widely used for model training. This method will cause the gradient in the training process to have a certain volatility, and thus the calculated gradient conflict rate will have volatility. Therefore, in a preferred embodiment, the sliding average method is used to smooth the gradient, and its calculation formula is as follows:
[0076] Where θ is the smoothing coefficient, is the gradient of the smoothed parameter of the rth round, is the gradient of the i-th parameter in the r-th round.
[0077] In this embodiment, by using the smoothed gradient to calculate the gradient conflict rate, the stability of the calculated index can be greatly improved, making the selection of frequency modulation more accurate.
[0078] In addition, in actual scenarios, federated learning will use thousands of clients for training, and clients may frequently participate in or exit training due to factors such as network and power. Saving the gradient value of each client in order to calculate the gradient conflict rate will generate non-negligible memory overhead. Therefore, in a preferred embodiment of the present invention, a pooling technique is used to save only the sum of the positive and negative parts of all client gradients. Specifically:
[0079] Maintain a gradient positive value pool and a gradient negative value pool on the server side, with the same dimension as the gradient;
[0080] After receiving a client's gradient, it is used to update the global model (i.e., the gradient is added to the parameter value aggregation of the global model according to the weight), and the positive and negative parts are added to the above-mentioned positive pool and negative pool respectively, and then they can be deleted.
[0081] Calculate the gradient conflict rate: in They are the smoothed parameter positive pool and negative pool respectively.
[0082] In this embodiment, the additional memory overhead of calculating the gradient conflict rate can be reduced from O(N) complexity to O(1) complexity through the above pooling process.
[0083] Based on the same inventive concept, in another embodiment of the present invention, a federated learning system with parameter granularity adaptive frequency modulation is provided, comprising:
[0084] Server: The server selects the clients that participate in each round of training and transmits the update information of each parameter in this round to the selected clients;
[0085] Client model training part: The model training process of the client participating in the training receives the aggregated parameters from the communication daemon and performs synchronous training according to the synchronization frequency of each parameter;
[0086] Client daemon part: The communication daemon of the client participating in the training receives the synchronized parameters from the model training process, communicates with the server to aggregate the parameters, then receives the aggregated parameters from the server and returns them to the model training process in the next round of training;
[0087] Aggregation frequency modulation module: During aggregation, the server calculates the gradient conflict rate based on the gradients uploaded by each client. When the gradient conflict rate of a parameter is less than the set frequency modulation threshold, the original synchronization frequency f of the parameter is adjusted to the new synchronization frequency 2f, and the position of the parameter that needs to be updated is transmitted to all clients in the next round of training.
[0088] The specific implementation techniques of each module / unit in the above example of the present invention may refer to the corresponding steps of the federated learning method for parameter granularity adaptive frequency modulation in the above embodiment, which will not be repeated here.
[0089] Based on the same inventive concept, in other embodiments of the present invention, a terminal is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it can be used to execute the federated learning method of parameter granularity adaptive frequency modulation, or to run the federated learning system of parameter granularity adaptive frequency modulation.
[0090] Based on the same inventive concept, in other embodiments of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, it can be used to execute the federated learning method of parameter granularity adaptive frequency modulation, or to run the federated learning system of parameter granularity adaptive frequency modulation.
[0091] The technical solutions in the above embodiments of the present invention can be applied in many industrial application scenarios, especially in many real-world application scenarios where machine learning models need to be deployed in a decentralized manner and undergo continuous federated training. For example,
[0092] In the healthcare field, federated learning can be used to analyze patient data from different hospitals or clinics to improve disease diagnosis, treatment planning, and drug discovery while protecting patient privacy.
[0093] For example, federated learning is needed to predict a patient's resistance to a certain therapeutic drug. The steps are as follows:
[0094] S1. In each medical institution participating in the federal model training, local data is cleaned and standardized to ensure data quality.
[0095] Among them, local data can be data related to patient treatment. For example, each piece of data can include content elements such as patient identifier, age, gender, medical history, drug information, treatment results, timestamp, etc.
[0096] Data cleaning and standardization are performed on each piece of patient data to ensure the accuracy, consistency and availability of the data.
[0097] Specifically, data cleaning includes data collection (collecting patient data from different medical information systems), missing value processing (identifying missing values and filling or deleting records as appropriate), outlier detection (using statistical methods such as box plots, Z-scores or IQR to identify and process outliers), format unification (ensuring that all data follows the same format, such as date and time), text cleaning (removing irrelevant characters, extra spaces and punctuation), data type conversion (converting text data into numerical or categorical data), duplicate data processing (identifying and processing duplicate records), data consistency check (ensuring that data is logically consistent, such as the logical relationship between age and date), data verification (verifying whether the data complies with predetermined business rules), data deduplication (removing duplicate or similar entries through clustering or pattern recognition), data desensitization (removing or replacing sensitive information such as name, address, etc.), and data backup (creating a backup of data during the cleaning process).
[0098] The data standardization process includes data normalization (scaling data to a specific range, such as between 0 and 1), normalization (converting data to a mean of 0 and a standard deviation of 1), encoding conversion (encoding categorical data, such as using One-Hot Encoding), feature engineering (deriving new features from raw data), dataset integration (integrating the cleaned dataset into a unified dataset), and dataset partitioning (dividing the dataset into training, validation, and test sets).
[0099] The final data features should have the following properties: accuracy (the data reflects the patient's true condition), consistency (data format and unit are unified), completeness (missing values are properly handled), reliability (data is verified and complies with business rules), availability (data is ready for analysis and model training), privacy protection (sensitive information is properly handled), and standardization (data is scaled to a uniform range or distribution).
[0100] Through the above process, each piece of patient data will be converted into a clean, standardized and high-quality format, providing reliable input for data analysis, machine learning model training or clinical decision support systems.
[0101] S2. Select a suitable deep learning model as the basis for federated learning.
[0102] S3. Each medical institution independently trains the model using local data to generate initial model parameters.
[0103] S4. Through the federated learning platform, the model parameters of various medical institutions are aggregated to update the global model.
[0104] S5. Use the above-mentioned federated learning method of parameter granularity adaptive frequency modulation of S100-S400 to iterate the model training, optimize the model parameters, and improve the model performance.
[0105] S6. Evaluate the performance of the aggregated model to ensure its accuracy and reliability in the medical field.
[0106] S7. Deploy the trained model to medical institutions with relevant application needs for actual medical diagnosis and treatment.
[0107] In other embodiments, it can also be applied to banks and financial institutions, which can use federated learning to share knowledge in areas such as fraud detection, credit scoring, and market analysis without sharing sensitive customer data.
[0108] In other embodiments, it can also be applied to the manufacturing industry, where different factories can share models of production efficiency and equipment maintenance to optimize the production process while maintaining business confidentiality.
[0109] In other embodiments, it can also be applied to traffic management agencies, which can use federated learning to analyze traffic flow data, optimize traffic signal control and traffic planning, while protecting data privacy.
[0110] In other embodiments, it can also be applied to retailers to share customer purchasing patterns and preferences through federated learning to improve inventory management and personalized recommendations without revealing detailed information of individual customers.
[0111] In other embodiments, it can also be applied to mobile devices, and federated learning can be used to improve user experience, for example, by sharing user behavior patterns to improve keyboard prediction and personalized services.
[0112] In other embodiments, city management departments can use federated learning to analyze data from different sources in the city, such as public safety, energy consumption, and environmental monitoring, to improve city management and services.
[0113] In these scenarios, the communication bandwidth between different entities is often very limited, which will become a performance bottleneck for federated training.
[0114] By applying the above-mentioned technical scheme of the present invention, the communication cost of the distributed machine learning process can be reduced, the deployment cost can be effectively saved, the actual deployment of machine learning technology can be promoted, and the continuous iterative development of artificial intelligence technology can be promoted.
[0115] In order to verify the feasibility and technical effect of the parameter granularity adaptive frequency modulation federated learning method and system in the above embodiment, a specific embodiment of the present invention uses a 32-core, 64GB memory node as a parameter server, and 100 2-core 4GB memory nodes as clients to perform federated learning training for a certain period of time. The parameter server bandwidth is limited to 10Gbps, and the uplink and downlink bandwidth of each client is limited to 1Mbps. A total of three models are trained, namely: using the EMNIST data set to train the CNN model, using the CIFAR-10 data set to train the ResNet-20 model, and using the KWS data set to train the LSTM model. The distribution of the data set on the client uses the Dirichlet distribution, and the Dirichlet factor is set to 0.5. Figure 6 This is a comparison diagram of the effects of the prior art 1 and 2 of the federated learning method for parameter granularity adaptive frequency modulation according to an embodiment of the present invention. It can be concluded from the figure that:
[0116] (a) shows that the final accuracy rates of CNN training by the methods of the prior art 1, prior art 2 and the embodiment of the present invention are 57.59%, 63.84% and 69.74% respectively;
[0117] (b) shows that the final accuracy of ResNet-20 trained by the methods of the prior art 1, prior art 2 and the embodiment of the present invention is 57.66%, 61.88% and 64.60% respectively;
[0118] (c) shows that the final accuracy rates of LSTM training using the methods of prior art 1, prior art 2 and the embodiment of the present invention are 69.70%, 75.45% and 81.95% respectively.
[0119] Compared with the prior art 1, the method of the embodiment of the present invention can improve the accuracy of the model by 6.94% to 12.25% within the prescribed training time;
[0120] Compared with the second prior art, the method of the embodiment of the present invention can improve the accuracy of the model by 2.72% to 6.50% within the prescribed training time.
[0121] It can be seen that the parameter granularity adaptive frequency modulation federated learning method and system in the embodiment of the present invention dynamically adjusts the synchronization frequency of each parameter at the parameter granularity, which is more flexible and more accurate in frequency adjustment. The convergence accuracy of the final model is also higher. At the same time, through the idea of urgent non-blocking synchronization, the utilization of computing resources and communication resources overlaps, greatly increasing the utilization of overall resources and accelerating the training efficiency of the model.
[0122] It should be noted that the steps in the method provided by the present invention can be implemented by using corresponding modules, devices, units, etc. in the system. Those skilled in the art can refer to the technical solution of the system to implement the step flow of the method, that is, the embodiments in the system can be understood as preferred examples for implementing the method, which will not be elaborated here.
[0123] Those skilled in the art know that, in addition to implementing the system and its various devices provided by the present invention in a purely computer-readable program code, the system and its various devices provided by the present invention can be made to implement the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices provided by the present invention can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component; the devices for implementing various functions can also be considered as both software modules for implementing the method and structures within the hardware component.
[0124] 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 can make various modifications or variations within the scope of the claims, which does not affect the essence of the present invention. The above preferred features can be used in any combination without conflicting with each other.
Claims
1. A method for federated learning with parameter granularity adaptive frequency modulation, characterized in that: include: The server selects the clients that participate in each round of training and transmits the update information of each parameter synchronization frequency to the selected clients; The model training process of the client participating in the training receives the aggregated parameters from the communication daemon and performs synchronous training according to the synchronization frequency of each parameter; The communication daemon process of the client participating in the training receives the training parameters from the model training process, communicates with the server to aggregate the parameters, then receives the aggregated parameters from the server and returns them to the model training process in the next round of training; During aggregation, the server calculates the gradient conflict rate based on the gradients uploaded by each client. When the gradient conflict rate of a parameter is less than the set frequency modulation threshold, the original synchronization frequency f of the parameter is adjusted to the new synchronization frequency 2f, and the position of the parameter that needs to be updated is transmitted to all clients in the next round of training.
2. According to claim 1, a federated learning method for parameter granularity adaptive frequency modulation is characterized in that: Different parameters have different synchronization frequencies, and all parameters are trained with the same number of rounds, specifically: In each round of training, different parameters are C1, C2, C3...C n The corresponding synchronization frequencies are f1, f2, f3...f n , where f1>f2>f3>……>f n ; The number of iterations of this round of training model is N times, N ≥ 1 / f n ; Parameter C i In which 1 / f i Normal iterations, the remaining N-1 / f i The parameter freezing method is used to keep the value unchanged.
3. The method for parameter granularity adaptive frequency modulation federated learning according to claim 2, characterized in that: In one round of synchronization, the parameter C i Complete 1 / f i After the normal iteration, the communication daemon immediately sets the parameter C i Send to the server to complete the aggregation.
4. The method for federated learning of parameter granularity adaptive frequency modulation according to claim 1, characterized in that: The server calculates the gradient conflict rate based on the gradients uploaded by each client include: Among them, g i [x] is the gradient of the xth parameter on the ith client in this round of training.
5. The method for federated learning of parameter granularity adaptive frequency modulation according to claim 4, characterized in that: The gradient conflict rate is calculated for each parameter in the model; In the early stage of training, when the gradient conflicts on different clients are small, the gradient conflict rate approaches 1; In the later stages of training, when the gradient conflicts on different clients are large and a dynamic balance is reached, the gradient conflict rate will decrease to approach 0.
6. The method for federated learning of parameter granularity adaptive frequency modulation according to claim 4, characterized in that: The sliding average method is used to smooth the gradient to reduce the volatility of the gradient conflict rate. Specifically: Where θ is the smoothing coefficient, is the gradient of the smoothed parameter of the rth round, is the gradient of the i-th parameter in the r-th round.
7. The method for federated learning of parameter granularity adaptive frequency modulation according to claim 6, characterized in that: In each round of training, pooling technology is used to save only the sum of the positive and negative parts of all client gradients, specifically: Maintain a gradient positive value pool and a gradient negative value pool on the server side, with the same dimension as the gradient; After receiving a client's gradient, use it to update the global model; After adding the positive value part and the negative value part of the gradient of the client to the positive value pool and the negative value pool respectively, deleting the gradient of the client; Calculate the gradient conflict rate: in They are the smoothed parameter positive pool and negative pool respectively.
8. A federated learning system with parameter granularity adaptive frequency modulation, characterized in that: include: Server: The server selects the clients that participate in each round of training and transmits the update information of each parameter in this round to the selected clients; Client model training part: The model training process of the client participating in the training receives the aggregated parameters from the communication daemon and performs synchronous training according to the synchronization frequency of each parameter; Client daemon part: The communication daemon of the client participating in the training receives the synchronized parameters from the model training process, communicates with the server to aggregate the parameters, then receives the aggregated parameters from the server and returns them to the model training process in the next round of training; Aggregation frequency modulation module: During aggregation, the server calculates the gradient conflict rate based on the gradients uploaded by each client. When the gradient conflict rate of a certain parameter is less than the set frequency modulation threshold, the original synchronization frequency f of the parameter is adjusted to the new synchronization frequency 2f, and the position of the parameter that needs to be updated in the next round of training is transmitted to all clients.
9. A 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 program, it can be used to execute the method described in any one of claims 1 to 7, or to run the system described in claim 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, it can be used to execute the method described in any one of claims 1 to 7, or to run the system described in claim 8.
Citation Information
Patent Citations
Excitation method for federated learning driven by digital twinning in air-ground network
CN112367109A
Search cue word determination method and system and information processing method
CN113032819A
System for decentralized ownership and secure sharing of personalized health data
CN113169957A
Federal learning-based backdoor attack defense method and system, and storable medium
CN113962322A
Cited By
Distributed modeling method and system
CN118798254A
A distributed modeling method and system
CN118798254B
