A federated learning method and system for parameter granularity adaptive frequency modulation
By using parameter granularity adaptive frequency tuning and urgent non-blocking aggregation techniques, the problems of low training efficiency and insufficient resource utilization in federated learning are solved, thereby improving the convergence accuracy and resource utilization of the model.
Patent Information
- Application Number
- CN202410782352.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-06-18
AI Technical Summary
Federated learning suffers from problems such as low training efficiency, insufficient resource utilization, and low model accuracy, especially due to the limited computing and communication resources of edge devices, and the difficulty of accurately adjusting the synchronization frequency and resource utilization with existing technologies.
A parameter-granular adaptive frequency modulation method is adopted, which adjusts the synchronization frequency of each parameter by gradient collision rate, and an urgent non-blocking aggregation technique is used to achieve overlapping utilization of computing resources and communication resources.
It improves the model's convergence accuracy and training efficiency, solves the problem of low resource utilization, and achieves more efficient resource utilization and more accurate frequency adjustment.
Smart Images

Figure CN118607618B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed machine learning technology, and more specifically, to a federated learning method, system, medium, and terminal with adaptive frequency tuning of parameter granularity. Background Technology
[0002] Federated learning is a distributed machine learning method that has emerged in recent years. Traditional distributed machine learning methods require collecting training data, distributing it evenly across different clients for training, and aggregating training results through frequent communication between devices and nodes within the cluster via high-bandwidth networks. With the strengthening of data privacy regulations (such as the EU's GDPR), traditional centralized data processing methods face increasing legal and ethical challenges. In many industries, data is often scattered across different organizations or devices, forming so-called "data silos." This data is difficult to centralize due to privacy, security, or legal reasons. Against this backdrop, federated learning has emerged, allowing models to be trained on multiple distributed edge devices or servers while protecting data privacy and security. This method was proposed by Google in 2016, initially to improve its keyboard prediction functionality on mobile devices.
[0003] While 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, computation can only be performed on edge devices where the data resides. These devices lack the computational and communication resources of a cluster. Distributed machine learning requires a large amount of computation and frequent communication between clients. This makes the training efficiency of federated learning far inferior to that of traditional distributed machine learning. Another example is (2) the data on each edge device often has different distributions, which causes the local models trained on each device to be biased towards the local data, ultimately resulting in the aggregated global model not achieving optimal performance.
[0004] To address these issues, there are already relatively mature existing technologies, as detailed below:
[0005] Existing technology 1:
[0006] Because client network resources are limited in federated learning scenarios, the FedAvg method is typically used for model training. In traditional distributed machine learning, all clients aggregate parameters after one local iteration, resulting in significant communication overhead. FedAvg proposes a round-based approach, selecting only a subset of clients for training in each round. Each selected client iterates locally multiple times before model aggregation, thereby significantly reducing communication overhead and improving training efficiency.
[0007] While the FedAvg method can improve training efficiency, the number of iterations per round of local training—the synchronization frequency—significantly impacts the final model's performance due to the varying data distributions on edge devices. More local iterations cause the model's parameters to converge towards local optima on the local training data, leading to a deviation of the aggregated model from the global optimum. Conversely, fewer local iterations result in more frequent communication overhead. Determining the optimal synchronization frequency becomes extremely difficult. Furthermore, although this method reduces communication frequency and improves training efficiency, it still suffers from insufficient client-side resource utilization. Figure 1 As shown, from a micro perspective, model training and aggregation are two completely separate stages. The training stage uses only computational resources, while network resources remain completely idle. Similarly, the aggregation stage uses only network resources, while computational resources remain completely idle. Throughout the entire training process, at any given moment, one type of resource is completely idle.
[0008] Existing technology 2:
[0009] To address the synchronization frequency setting issue, AdaComm proposes an adaptive and dynamic adjustment of the synchronization frequency during model training based on the current training loss function value. Specifically, the synchronization cycle for each round is determined by the formula... Calculate, where τ0 and τ k These are the initial and k-th round synchronization periods, ω0 and ω1, respectively. k Here, represents the model parameters for the initial stage and the k-th round, respectively, and F(x) is the model's loss function on the global data. As the number of training rounds increases, the loss function values on each client gradually decrease, thus reducing the synchronization cycle. This method ensures that the model maintains a low synchronization frequency in the early stages of training, reducing synchronization overhead and enabling the model to converge quickly. Simultaneously, in the later stages of training, a higher synchronization frequency can achieve higher accuracy.
[0010] While AdaComm can adaptively and dynamically adjust the synchronization frequency to achieve a balance between training efficiency and model accuracy, it still has certain shortcomings and limitations. Because it uses the model's loss value as the frequency adjustment metric, this method can only adjust the synchronization frequency at the granular level of the entire model. However, neural network models typically have a large number of parameters, and these parameters vary significantly in their effects on the model and their changes during training. Adjusting the synchronization frequency holistically ignores these differences and is not accurate enough in judging the timing of frequency adjustments. Furthermore, this method still does not solve the low resource utilization problem mentioned in the first solution. Summary of the Invention
[0011] To address the shortcomings of existing technologies, the purpose of this invention is to provide a federated learning method, system, medium, and terminal with adaptive frequency modulation at the parameter granularity.
[0012] According to one aspect of the present invention, a federated learning method with adaptive frequency tuning at the parameter granularity is provided, comprising:
[0013] The server selects the clients to participate in each round of training and transmits the update information of the synchronization frequency of each parameter to the selected clients;
[0014] The model training process of the participating client receives aggregated parameters from the communication daemon and performs synchronous training according to the synchronization frequency of each parameter.
[0015] The communication daemon of the client participating in the training receives the training parameters from the model training process, communicates with the server to aggregate the parameters, 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 certain parameter is less than the set frequency tuning threshold, the original synchronization frequency f of the parameter is adjusted to a new synchronization frequency 2f, and the position of the parameter whose frequency 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 for 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 Among them, f1>f2>f3>……>f n ;
[0019] The model is trained in this round of iterations N times, where N ≥ 1 / f n ;
[0020] Parameter C i 1 / f of them i In the next normal iteration, the remaining N-1 / f i The parameter freezing method is used to keep the value unchanged.
[0021] Preferably, in one round of synchronization, parameter C i Complete 1 / f i After the first normal iteration, the communication daemon immediately sends 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] represents the gradient of the x-th parameter on the i-th client during this training round.
[0025] Preferably, the gradient conflict rate is calculated for each parameter in the model;
[0026] In the early stages of training, when gradient conflicts are small on different clients, the gradient conflict rate approaches 1; in the later stages of training, when gradient conflicts are large on different clients and a dynamic equilibrium is reached, the gradient conflict rate will decrease to approach 0.
[0027] Preferably, a moving average method is used to smooth the gradient to reduce the volatility of the gradient conflict rate, specifically:
[0028] Where θ is the smoothing coefficient. Let be the gradient of the i-th parameter in the r-th round after smoothing. Let be the gradient of the i-th parameter in the r-th round.
[0029] Preferably, in each round of training, pooling is used to save only the sum of the positive values and the sum of the negative values in all client gradients, specifically:
[0030] Maintain a positive and negative pool for the gradient on the server side, with the same dimension as the gradient.
[0031] After receiving a gradient from a client, use it to update the global model;
[0032] After adding the positive and negative parts of the gradient of the client to the positive pool and the negative pool respectively, the gradient of the client is deleted.
[0033] Calculate the gradient conflict rate: in These are the positive and negative value pools of the smoothed parameters, respectively.
[0034] According to a second aspect of the present invention, a federated learning system with adaptive frequency tuning at the parameter granularity is provided, comprising:
[0035] Server: The server selects the clients to participate in training in each round and transmits the update information of each parameter in this round to the selected clients;
[0036] Client-side model training: 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 training receives the synchronized parameters from the model training process, communicates with the server to aggregate the parameters, and 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 tuning 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 tuning threshold, the original synchronization frequency f of the parameter is adjusted to a new synchronization frequency 2f, and the position of the parameter whose frequency needs to be updated is transmitted to all clients in the next round of training.
[0039] According to a third aspect of the present invention, a terminal is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can be used to execute the aforementioned parameter-granularity adaptive frequency modulation federated learning method, or to run the aforementioned parameter-granularity adaptive frequency modulation federated learning system.
[0040] According to a fourth aspect of the invention, a computer-readable storage medium has a computer program stored thereon, which, when executed by a processor, can be used to perform the described parameter-granularity adaptive frequency modulation federated learning method, or to run the described parameter-granularity adaptive frequency modulation federated learning system.
[0041] Compared with the prior art, the embodiments of the present invention have at least one of the following beneficial effects:
[0042] The parameter-granular adaptive frequency tuning federated learning method and system in this embodiment of the invention, by adopting a parameter-granular frequency tuning method, can achieve more accurate frequency settings for each parameter, thereby improving the convergence accuracy of the final model while ensuring training efficiency.
[0043] The federated learning method and system with adaptive frequency modulation of parameter granularity in the embodiments of the present invention, by adopting an urgent non-blocking aggregation method and a corresponding multi-process system design, can achieve overlapping utilization of computing and communication resources, thereby improving the training efficiency of the model.
[0044] In summary, the embodiments of the present invention combine the above-mentioned technologies, which can achieve targeted and precise frequency settings for each parameter, improve resource utilization, and improve model accuracy while increasing training efficiency, thus overcoming the problems of low model accuracy and insufficient resource utilization in the prior art. Attached Figure Description
[0045] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0046] Figure 1 A resource utilization diagram of existing technology at different times;
[0047] Figure 2 This is a diagram of the overall system architecture in one embodiment of the present invention;
[0048] Figure 3 This is a resource utilization diagram at different times in a preferred embodiment of the present invention;
[0049] Figure 4 A graph showing the variation of parameter values across different clients in federated learning;
[0050] Figure 5 A statistical graph showing the time when various parameters of the LSTM model experienced training stagnation during training;
[0051] Figure 6 The figures show a comparison of the effectiveness of the method of this invention with existing technologies 1 (FedAvg) and 2 (AdaComm), where (a) is a comparison of the final accuracy of training a CNN model, (b) is a comparison of the final accuracy of training a ResNet-20 model, and (c) is a comparison of the final accuracy of training an LSTM model. Detailed Implementation
[0052] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention. These all fall within the scope of protection of the present invention.
[0053] This study investigated the parameter variation patterns of each client in existing federated learning technologies, such as... Figure 4 As shown, in the later stages of training, the FedAvg method exhibits a significant bifurcation phenomenon due to the different distributions of local data on different clients. This phenomenon indicates that when the synchronization frequency is too low, causing the model to converge to a local optimum, gradient conflicts arise between the local models on different clients. When this conflict reaches a dynamic equilibrium, model training stagnates at a suboptimal point. This bifurcation phenomenon is a concrete manifestation of the model training stagnating at a suboptimal point.
[0054] To avoid the aforementioned bifurcation phenomenon, one embodiment of the present invention provides a federated learning method with adaptive frequency tuning at the parameter granularity. Its overall framework follows the parameter server structure widely used in federated learning, such as... Figure 2As shown, it includes a parameter server and multiple clients. Each client contains a model training process and a communication daemon. The difference lies in using the gradient conflict rate to characterize the gradient conflicts between different clients, and using this as a frequency tuning metric at the parameter granularity to avoid bifurcation. Specifically, the main steps of this parameter-granularity adaptive frequency tuning federated learning method are as follows:
[0055] S100, the server selects the clients to participate in training in each round and transmits the synchronization frequency update information of each model parameter in the deep learning model (such as pathological analysis model, financial analysis model) to the selected clients;
[0056] S200: 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.
[0057] S300: The communication daemon of the client participating in the training receives the training parameters completed by S200 from the model training process, communicates with the server to aggregate the parameters, receives the aggregated parameters from the server, and implements the return of S200 to the model training process in the next round of training.
[0058] In 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 certain parameter is less than the set frequency tuning threshold, the original synchronization frequency f of that parameter is adjusted to a new synchronization frequency 2f, and the position of the parameter whose frequency needs to be updated is transmitted to all clients in the next round of training.
[0059] In the above embodiments, the gradient conflict rate is used as an indicator of the synchronization frequency adjustment parameter, and this is calculated for each parameter in the model. However, existing technologies use the loss function value as an indicator, which can only be calculated for the entire model. Figure 5 The graph shown illustrates the time it takes for each parameter to stagnate during LSTM model training using the corruption function. The blue line represents the order in which parameters reach stagnation within the same layer, showing the difference between the 5th percentile and the 95th percentile. Significant differences exist in the time it takes for parameters to reach stagnation, both across different layers and within a single layer. This indicates that adjusting parameter synchronization frequency at the model or layer level is inaccurate. The method described above, based on gradient conflict rate, should be used to adjust the synchronization frequency at the parameter level.
[0060] The above embodiments employ a parameter-granular frequency modulation method, which can accurately and promptly detect whether the training of each parameter in the model has stalled at a local optimum. When stalling is detected, the synchronization frequency is immediately increased to prevent it from lingering at a local optimum and affecting the accuracy of model convergence.
[0061] Prior to step S100 above, the process may further include collecting local data from real-world application scenarios, and cleaning and standardizing the local data to ensure data quality. Furthermore, the model may be independently trained locally using the local data to generate initial model parameters.
[0062] For local data in real-world application scenarios, this can be data tailored to specific application needs. Examples include patient data from hospitals or clinics, user and / or market data from banks and financial institutions, production and / or equipment data from factories in the manufacturing industry, traffic data from transportation management agencies, user purchase data from the retail industry, user experience data from mobile devices, and public safety, energy consumption, and environmental monitoring data from urban management. Of course, the acquisition of this data must be conducted in accordance with the law.
[0063] Cleaning and standardizing local data for the aforementioned real-world application scenarios can include one or more of the following: removing duplicate data, completing missing data items, masking privacy information, correcting errors, rearranging and mixing data, adjusting categorical components, and converting data types, thereby ensuring data quality.
[0064] Data collection can be conducted independently on each client. The collected data is based on the characteristics of the specific application running on that client and is related to the specific behavior of each client. The data distribution differs among clients, and correspondingly, the parameters of the models trained on each client also differ. By acquiring data in this way, the sharing of some sensitive data can be avoided, thereby achieving privacy protection or data security protection, and providing safer and more accurate basic data for subsequent adaptive frequency modulation.
[0065] To better utilize the gradient conflict rate to characterize the gradient conflict of various parameters between different clients, a preferred embodiment of this invention proposes a method for calculating the gradient conflict rate in this round of training, specifically as follows:
[0066]
[0067] Where g i [x] represents the gradient of the x-th parameter on the i-th client during this training round.
[0068] As can be seen from this formula, in the early stages of training, when gradient conflicts on different clients are small, the gradient conflict rate approaches 1; in the later stages of training, when gradient conflicts on different clients are large, the gradient conflict rate will decrease to approach 0 when dynamic equilibrium is reached. In some specific embodiments, the default frequency modulation threshold is 0.1.
[0069] Because different parameters have different synchronization frequencies (synchronization frequency refers to the number of local iterations in a training round), keeping all parameters at the same number of training iterations would result in different training rounds for different parameters, thus affecting the convergence consistency of the model. Therefore, in a preferred embodiment of the present invention, a uniform number of rounds is used to keep the number of training rounds consistent for all parameters. Specifically, the different parameters are C1, C2, C3...C n The corresponding synchronization frequencies are f1, f2, f3...f n Among them, f1>f2>f3>……>f n ;
[0070] The model is trained in this round of iterations N times, where N ≥ 1 / f n ;
[0071] Parameter C i 1 / f of them i In the next normal iteration, the remaining N-1 / f i The parameter freezing method is used to keep the value unchanged.
[0072] Furthermore, in one specific embodiment, assuming the trained model has two parameters with synchronization cycles of 100 and 200 respectively, the model iterates a total of 200 times in this round of training. The first parameter only iterates normally in the first 100 iterations, while its value is frozen in the remaining 100 iterations. The second parameter iterates completely 200 times.
[0073] In the above embodiments, different parameters are trained using the same number of rounds, which can ensure the consistency of training for different parameters, prevent overtraining of certain parameters, and avoid additional communication overhead.
[0074] Existing federated learning methods suffer from low resource utilization. Therefore, in a preferred embodiment of this invention, the idea of urgent non-blocking aggregation is proposed. Specifically, as... Figure 3 As shown, in a synchronization round, once the training of parameters with low synchronization frequency reaches the local iteration count, these parameters are immediately sent to the parameter server by the communication daemon to complete aggregation. This process does not block the normal training of other parameters. This method can greatly overlap computation and communication, improve resource utilization, and thus enhance training efficiency.
[0075] Generally, stochastic gradient descent is widely used for model training. This method introduces some volatility in the gradients during training, leading to fluctuations in the calculated gradient conflict rate. Therefore, in a preferred embodiment, a moving average method is used to smooth the gradients, and its calculation formula is as follows:
[0076] Where θ is the smoothing coefficient. Let be the gradient of the i-th parameter in the r-th round after smoothing. Let be the gradient of the i-th parameter in the r-th round.
[0077] In this embodiment, by using a 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] Furthermore, in real-world scenarios, federated learning uses thousands of clients for training, and these clients may frequently join or leave the training due to network issues, battery drain, and other factors. Storing the gradient values of each client to calculate the gradient conflict rate incurs a significant memory overhead. Therefore, in a preferred embodiment of this invention, pooling technology is used to store only the sum of the positive and negative values of the gradients from all clients. Specifically:
[0079] Maintain a positive and negative pool for the gradient on the server side, with the same dimension as the gradient.
[0080] After receiving a gradient from a client, the gradient is used to update the global model (that is, the gradient is added to the aggregated parameter values of the global model according to the weights). After adding the positive and negative parts to the positive and negative value pools mentioned above, it can be deleted.
[0081] Calculate the gradient conflict rate: in These are the positive and negative value pools of the smoothed parameters, respectively.
[0082] In this embodiment, the additional memory overhead for 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, other embodiments of the present invention provide a federated learning system with adaptive frequency tuning at the parameter granularity, comprising:
[0084] Server: The server selects the clients to participate in training in each round and transmits the update information of each parameter in this round to the selected clients;
[0085] Client-side model training: 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-side daemon process: The communication daemon process of the client participating in training receives the synchronized parameters from the model training process, communicates with the server to aggregate the parameters, receives the aggregated parameters from the server and returns them to the model training process in the next round of training.
[0087] Aggregation frequency tuning 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 tuning threshold, the original synchronization frequency f of the parameter is adjusted to a new synchronization frequency 2f, and the position of the parameter whose frequency 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 examples of the present invention can be referred to the steps of the federated learning method with adaptive frequency modulation of parameter granularity in the above embodiments, and 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 parameter granularity adaptive frequency modulation federated learning method, or to run the parameter granularity adaptive frequency modulation federated learning system.
[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, which, when executed by a processor, can be used to execute the described parameter granularity adaptive frequency modulation federated learning method, or to run the described parameter granularity adaptive frequency modulation federated learning system.
[0091] The technical solutions in the above embodiments of the present invention can be applied in a wide range of industrial scenarios, especially since many real-world application scenarios require distributed deployment of machine learning models and continuous federated training. For example,
[0092] In the medical 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 might be used to predict a patient's resistance to a particular treatment. The steps are as follows:
[0094] S1. In each medical institution participating in the training of the federated model, local data is cleaned and standardized to ensure data quality.
[0095] Local data can be data related to patient treatment. For example, each piece of data may include patient identifier, age, gender, medical history, medication information, treatment results, timestamp, and other content elements.
[0096] Each patient's data is cleaned and standardized to ensure its accuracy, consistency, and usability.
[0097] Specifically, data cleaning includes data collection (collecting patient data from different medical information systems), missing value handling (identifying missing values and filling or deleting records as needed), outlier detection (using statistical methods such as box plots, Z-scores, or IQR to identify and handle outliers), formatting (ensuring all data follows the same format, such as dates and times), text cleaning (removing irrelevant characters, redundant spaces, and punctuation), data type conversion (converting text data into numerical or categorical data), deduplication (identifying and handling duplicate records), data consistency checks (ensuring data is logically consistent, such as the logical relationship between age and date), data validation (verifying whether data conforms to predetermined business rules), data deduplication (removing duplicate or similar entries through clustering or pattern recognition), data anonymization (removing or replacing sensitive information, such as names, addresses, etc.), and data backup (creating backups 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 have a mean of 0 and a standard deviation of 1), encoding transformation (encoding categorical data, such as using one-hot encoding), feature engineering (deriving new features from the original data), dataset integration (integrating the cleaned datasets into a unified dataset), and dataset partitioning (dividing the dataset into training, validation, and test sets).
[0099] The final data characteristics should have the following features: accuracy (the data reflects the patient's true condition), consistency (the data format and units are consistent), completeness (missing values are handled appropriately), reliability (the data is validated and conforms to business rules), usability (the data is ready for analysis and model training), privacy protection (sensitive information is handled appropriately), and standardization (the data is scaled to a uniform range or distribution).
[0100] Through the above process, each patient's data will be transformed 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 and generates 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. Using the federated learning method with adaptive frequency tuning of parameter granularity in S100-S400 described above, the model is trained iteratively to optimize model parameters and improve 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, where federated learning can be used to share knowledge on fraud detection, credit scoring, and market analysis, without sharing sensitive customer data.
[0108] In other embodiments, it can also be applied to manufacturing, where different factories can share models of production efficiency and equipment maintenance to optimize production processes while maintaining trade secrets.
[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 using federated learning to share customer buying patterns and preferences to improve inventory management and personalized recommendations without revealing individual customer details.
[0111] In other embodiments, it can also be applied to mobile devices, where federated learning can be used to improve the user experience, for example, by improving keystroke prediction and personalization services through sharing user behavior patterns.
[0112] In other embodiments, city management authorities 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 can become a performance bottleneck for federated training.
[0114] By applying the above-mentioned technical solution 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 facilitated.
[0115] To verify the feasibility and technical effectiveness of the federated learning method and system with adaptive frequency modulation of parameter granularity described in the above embodiments, 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 for 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. Three models are trained in total: a CNN model trained using the EMNIST dataset, a ResNet-20 model trained using the CIFAR-10 dataset, and an LSTM model trained using the KWS dataset. The datasets on the clients are distributed using a Dirichlet distribution with a Dirichlet factor set to 0.5. Figure 6 This figure shows a comparison of the performance of prior art one and two of the federated learning method with adaptive frequency modulation of parameter granularity according to embodiments of the present invention. From the figure, we can summarize that:
[0116] (a) The figure shows that the final accuracy rates of the CNN trained by the methods of prior art 1, prior art 2 and the embodiment of the present invention are 57.59%, 63.84% and 69.74%, respectively;
[0117] (b) The figure shows that the final accuracy of ResNet-20 trained by the methods of prior art 1, prior art 2 and the embodiment of the present invention is 57.66%, 61.88% and 64.60%, respectively;
[0118] (c) The figure shows that the final accuracy of LSTM training by the methods of prior art 1, prior art 2 and the embodiment of the present invention is 69.70%, 75.45% and 81.95%, respectively.
[0119] Compared to the prior art, the method of this invention can improve the accuracy of the model by 6.94% to 12.25% within a specified training time.
[0120] Compared to the prior art, the method of this invention can improve the accuracy of the model by 2.72% to 6.50% within a specified training time.
[0121] As can be seen, the parameter-granularity adaptive frequency-adjusting federated learning method and system in this embodiment of the invention dynamically adjusts the synchronization frequency of each parameter at the parameter granularity level, resulting in greater flexibility and more accurate frequency adjustment. The final model convergence accuracy is also higher. Simultaneously, by employing the concept of urgent non-blocking synchronization, the utilization of computing and communication resources overlaps, greatly increasing the overall resource utilization rate and accelerating model training efficiency.
[0122] It should be noted that the steps in the method provided by the present invention can be implemented using the corresponding modules, devices, units, etc. in the system. Those skilled in the art can implement the steps of the method by referring to the technical solution of the system. That is, the embodiments in the system can be understood as preferred examples of implementing the method, and will not be elaborated here.
[0123] Those skilled in the art will understand that, in addition to implementing the system and its various devices provided by this invention in the form of purely computer-readable program code, the same functions can be achieved entirely through logical programming of the method steps, making the system and its various devices of this invention function as logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, the system and its various devices provided by this invention can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component; alternatively, the devices for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0124] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various modifications or variations within the scope of the claims, which do not affect the essence of the present invention. The above preferred features can be used in any combination without conflict.
Claims
1. A federated learning method with adaptive frequency tuning at the parameter granularity, characterized in that, include: Each client collects local data from real-world application scenarios and cleans and standardizes the local data. The data collection by each client is independent, and the collected data is feature data based on the specific application of that client and is related to the specific behavior of each client. The data distribution of each client is different, and correspondingly, the parameters of the model trained by each client are also different. Each client independently trains its model and generates initial model parameters using cleaned and standardized local data. The server selects the clients to participate in each round of training and transmits the update information of the synchronization frequency of each parameter to the selected clients; The model training process of the participating client receives aggregated parameters from the communication daemon and performs synchronous training according to the synchronization frequency of each parameter. The communication daemon of the client participating in the training receives the training parameters from the model training process, communicates with the server to aggregate the parameters, receives the aggregated parameters from the server, and returns them to the model training process in the next round of training. During a synchronization round, once the training of parameters with low synchronization frequency reaches the local iteration count, 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. 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 tuning threshold, the original synchronization frequency f of the parameter is adjusted to a new synchronization frequency 2f, and the position of the parameter whose frequency needs to be updated is transmitted to all clients in the next round of training. In each round of training, pooling is used to save only the sum of the positive and negative parts of all client gradients; The server calculates the gradient conflict rate based on the gradients uploaded by each client. ,include: , in, The first in this round of training On the first client The gradient of each parameter.
2. The federated learning method with adaptive frequency tuning at the parameter granularity according to claim 1, characterized in that, Different parameters have different synchronization frequencies, and all parameters are trained for 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 Among them, f1>f2>f3>……>f n ; The model is trained in this round of iterations N times, where N ≥ 1 / f n ; Parameter C i 1 / f of them i In the next normal iteration, the remaining N-1 / f i The parameter freezing method is used to keep the value unchanged.
3. The federated learning method with adaptive frequency tuning at the parameter granularity according to claim 2, characterized in that, In a round of synchronization, parameter C i Complete 1 / f i After the first normal iteration, the communication daemon immediately sends parameter C. i Send to the server to complete the aggregation.
4. The federated learning method with adaptive frequency tuning at the parameter granularity according to claim 1, characterized in that, The gradient conflict rate is calculated for each parameter in the model; In the early stages of training, when gradient conflicts on different clients are small, the gradient conflict rate approaches 1. In the later stages of training, when gradient conflicts are large on different clients and a dynamic equilibrium is reached, the gradient conflict rate will decrease to close to 0.
5. The federated learning method with adaptive frequency tuning at the parameter granularity according to claim 1, characterized in that, The gradient is smoothed using a moving average method to reduce the volatility of the gradient conflict rate. Specifically: ,in For smoothing coefficients, Let be the gradient of the i-th parameter in the r-th round after smoothing. Let be the gradient of the i-th parameter in the r-th round.
6. The federated learning method with adaptive frequency tuning at the parameter granularity according to claim 5, characterized in that, In each round of training, pooling is used to save only the sum of the positive and negative parts of all client gradients, specifically: Maintain a positive and negative pool for the gradient on the server side, with the same dimension as the gradient. After receiving a gradient from a client, use it to update the global model; After adding the positive and negative parts of the gradient of the client to the positive pool and the negative pool respectively, the gradient of the client is deleted. Calculate the gradient conflict rate: ,in , These are the positive and negative value pools of the smoothed parameters, respectively.
7. A federated learning system with adaptive frequency tuning at the parameter granularity, used to implement the method of claim 1, characterized in that, include: Server: The server selects the clients to participate in training in each round and transmits the update information of each parameter in this round to the selected clients; Client-side model training: 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 training receives the synchronized parameters from the model training process, communicates with the server to aggregate the parameters, and then receives the aggregated parameters from the server and returns them to the model training process in the next round of training. Aggregation frequency tuning 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 tuning threshold, the original synchronization frequency f of the parameter is adjusted to a new synchronization frequency 2f, and the position of the parameter whose frequency needs to be updated is transmitted to all clients in the next round of training.
8. 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 perform the method of any one of claims 1-6, or to run the system of claim 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program can be used to perform the method of any one of claims 1-6, or to run the system of claim 7.
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
