Federal learning model training method and related equipment
By introducing a dynamic weight adaptive mechanism into the federated learning model, the problem of insufficient task learning in federated learning model training in multi-task scenarios is solved, and more efficient and accurate model training and update are achieved.
Patent Information
- Application Number
- CN202411372435.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In a multitasking scenario, how to fully learn all tasks in federated learning model training and integrate multitasking characteristics between all participants in the global model to ensure good generalization of the final model.
A training method for federated learning model is proposed. The initial global model is sent to the participants through the central server. The participants dynamically adaptively train the local model based on local data and send the local model to the central server. The central server updates the global model based on the local model and dynamic adjustment of weights. At the same time, an internal and external dynamic weight adaptation mechanism is adopted to dynamically adjust the weight according to data quality, task quantity and task difficulty.
Through the dynamic weight adaptation mechanism, the model training accuracy and efficiency are improved, so that the federated learning model can better adapt to the data characteristics and task conditions of different participants and achieve smarter and more efficient model updates.
Smart Images

Figure CN119443306A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present application relate to the field of computer technology, and in particular, to a training method and related equipment for a federated learning model. Background Art
[0002] With the development of artificial intelligence technology, data has become a key factor in promoting innovation and decision-making. However, with the widespread application of artificial intelligence technology, data privacy protection has become a focus of attention. Due to the risk of privacy leakage during the data collection process, some individuals or organizations are reluctant to share their data, resulting in data closure and isolation. Federated learning, as a paradigm of distributed machine learning, makes full use of fragmented data in an isolated environment for model training. In federated learning, each participant trains the model locally and updates the global model information by only transmitting model parameters, avoiding the transmission of sensitive data to a centralized server. This distributed collaborative approach promotes more extensive data integration and sharing, and provides greater development space for cross-industry and cross-domain artificial intelligence.
[0003] However, how to fully learn all tasks during model training is a problem that federated learning needs to solve in multi-task scenarios. In addition, in terms of model aggregation, it is necessary to consider how to integrate the features of multiple tasks among all participants in the global model to ensure that the final federated learning model has good generalization. Summary of the invention
[0004] In view of this, the purpose of one or more embodiments of the present application is to propose a training method and related equipment for a federated learning model to solve the problems raised by the background technology.
[0005] Based on the above objectives, one or more embodiments of the present application provide a training method for a federated learning model, including: The central server sends the initial global model to the participants; The participant dynamically and adaptively trains the initialized global model according to local data to obtain a local model, and sends the local model to the central server; The central server dynamically aggregates the local models to obtain an updated global model.
[0006] Optionally, the participant dynamically and adaptively trains the initialized global model according to local data to obtain a local model, including: Inputting the local data into the currently trained model to obtain output results of multiple tasks; Determine a dynamic adaptive weight for each task according to the output result; The optimization objective function of the participant is adjusted according to the dynamic adaptive weight.
[0007] Optionally, the optimization objective function of the participant is: ; in, Indicates Participants on The fixed weight coefficient of each training task, Indicates the Participants on The loss value of the training task, and Indicates the Local data of each participant.
[0008] Optionally, the dynamic adaptive weight is calculated by the following formula: ; in, Indicates Participants on The loss rate of each training task, , Represents a hyperparameter.
[0009] Optionally, the central server dynamically aggregates the local models to obtain an updated global model, including iteratively performing the following operations: The central server obtains a total optimization objective function according to the local model and the dynamic adjustment weight of the local model; According to the overall optimization objective function, the updated global model is obtained.
[0010] Optionally, the overall optimization objective function is: ; in, Indicates The weight coefficient of each participant, Indicates the The loss value of each participant.
[0011] Optionally, the dynamic adjustment weight is calculated by the following formula: ; in, Indicates The loss rate of each participant, , Represents a hyperparameter.
[0012] Based on the same inventive concept, one or more embodiments of the present application further provide a training device for a federated learning model, including a central server and participants: The central server is used to send the initial global model to the participants; and The global model is updated based on the dynamic aggregation of local models; The participant is used to dynamically and adaptively train the initialized global model according to local data to obtain a local model, and send the local model to the central server.
[0013] Based on the same inventive concept, one or more embodiments of the present application also provide an electronic device, including 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 training method of the federated learning model as described in any one of the above items is implemented.
[0014] Based on the same inventive concept, one or more embodiments of the present application also provide a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute any of the above-mentioned training methods for the federated learning model.
[0015] From the above, it can be seen that the training method of the federated learning model provided in one or more embodiments of the present application sends the initial global model to the participants through the central server; the participants dynamically and adaptively train the initialized global model according to local data to obtain a local model, and send the local model to the central server; the central server dynamically aggregates the local models to obtain an updated global model.
[0016] One or more embodiments of the present application train the federated learning model according to the data quality, task quantity and task difficulty of each participant through a dynamic weight adaptation mechanism within the participants and a dynamic weight adaptation mechanism between the participants, thereby improving the model training accuracy and training efficiency.
[0017] The training device, electronic device and computer-readable storage medium of a federated learning model provided in the present application are all capable of implementing the steps of the training method of the above-mentioned federated learning model, and therefore also have the beneficial effects of the training method of the above-mentioned federated learning model. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate one or more embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only one or more embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A flowchart of a training method for a federated learning model according to one or more embodiments of the present application; Figure 2 A schematic diagram of the structure of a training device for a federated learning model of one or more embodiments of the present application; Figure 3 A schematic diagram of the hardware structure of an electronic device according to one or more embodiments of the present application. DETAILED DESCRIPTION
[0020] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0021] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in one or more embodiments of the present application should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in one or more embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0022] As mentioned in the background technology section, with the development of artificial intelligence technology, data has become a key factor in promoting innovation and decision-making. Whether it is self-driving cars or smart homes, data-driven artificial intelligence technology has completely changed the way we live and work. However, with the widespread application of artificial intelligence technology, data privacy protection has become a focus of attention. Due to the risk of privacy leakage during the data collection process, some individuals or organizations are reluctant to share their data, resulting in data closure and isolation. Federated learning, as a paradigm of distributed machine learning, makes full use of fragmented data in an isolated environment for model training. In federated learning, each participant trains the model locally and updates the global model information by only transmitting model parameters, avoiding the transmission of sensitive data to a centralized server. This distributed collaborative approach promotes more extensive data integration and sharing, and provides greater development space for cross-industry and cross-domain artificial intelligence.
[0023] However, in real application scenarios, federated learning still faces a series of unresolved problems, such as data heterogeneity, resource constraints, and varying difficulty levels of multiple tasks.
[0024] Specifically, federated learning usually involves multiple participants, who may come from different geographical locations, organizations, or application fields. Due to different data sources, there are significant differences in data distribution between participants. How to reduce the impact of differentiated data on model performance without introducing additional computing and communication costs is a key issue in current research.
[0025] In federated networks, resource-constrained wearable devices are involved. These devices usually collect different types of data for training according to the usage scenarios. However, due to the limited computing power and storage capacity of these devices, it is impossible to effectively and continuously update the model and transfer parameters to cope with different task scenarios. Therefore, designing a lightweight model structure and an efficient communication protocol is a key measure to effectively adapt edge devices.
[0026] When there are multiple training tasks within a participant at the same time, different tasks have different training difficulties. How to fully learn all tasks during model training is a problem that federated learning needs to solve in multi-task scenarios. In addition, in terms of model aggregation, it is necessary to consider how to integrate the features of multiple tasks among all participants in the global model to ensure that the final federated learning model has good generalization.
[0027] Therefore, this application proposes a training method for a federated learning model and designs an internal and external dynamic weight adaptation mechanism, which includes two parts: a dynamic weight adaptation mechanism within the participant and a dynamic weight adaptation mechanism between the participants. In the internal dynamic weight adaptation mechanism, for complex scenarios such as multi-task training that may exist within the participants, this application designs a heuristic local multi-task learning model to achieve collaboration and constraints between multiple tasks; in the external dynamic weight adaptation mechanism, according to the data quality, number of tasks and task difficulty of each participant, this application designs a dynamic aggregation strategy for the global model. By utilizing the internal and external dynamic weight adaptation mechanism, the model can better adapt to the data characteristics and task conditions of different participants, thereby achieving more intelligent and efficient model updates in federated learning.
[0028] Compared with the aggregation method in the related art that assigns a fixed aggregation parameter weight to each participant, the mechanism proposed in the technical solution of this application allows the model to calculate the contribution weight of each participant to the entire model in each round of communication and dynamically assign weight coefficients to the participants. The method proposed in this application significantly improves the learning efficiency and accuracy of the model.
[0029] refer to Figure 1 The training method of the federated learning model of one or more embodiments of the present application comprises the following steps: Step S101: The central server sends the initial global model to the participants.
[0030] It is possible to define the shared Of which Each participant has their own local dataset , the local data set is not shared. The participants establish communication with the server, and the server exchanges model parameters or gradients with the participants to achieve distributed training.
[0031] Step S102: The above-mentioned participants dynamically and adaptively train the above-mentioned initialized global model according to local data to obtain a local model, and send the above-mentioned local model to the above-mentioned central server.
[0032] Assume Participants train simultaneously task, then for the The optimization objectives of each participant are: ; in, Indicates Participants on The fixed weight coefficient of each training task, Indicates the Participants on The loss value of the training task, and Indicates the Local data of each participant.
[0033] In the internal dynamic adaptive module, in order to optimize the Multi-task training within a participant can dynamically determine the weight assigned to each task by considering the loss rates observed in previous rounds. This dynamic adjustment process allows the system to effectively balance the contribution of each task during training. Local training rounds, Participants on The weight of the task The definition is as follows: ; in, Indicates Participants on The loss rate of each training task, , Represents a hyperparameter.
[0034] In some embodiments, in order to reduce communication costs, in the process of establishing communication between the participants and the server, the present application also proposes an asynchronous model aggregation method. The asynchronous model aggregation method is divided into three stages: the initial stage of model training, the middle stage of model training, and the late stage of model training.
[0035] In the early stages of model training (e.g., 1 to 10 rounds), participants upload the complete multi-task model by default. At this time, the global model is still in the initial learning stage, and it is necessary to obtain complete data features from each participant to update the global model.
[0036] In the mid-term stage of model training, this application proposes an evaluation matrix. The matrix is a tool for continuously monitoring model performance to determine whether it is necessary to upload a complete multi-task model or only a classifier in a specific training round. The evaluation matrix includes a variety of evaluation indicators to evaluate the performance of the model, including the loss function value (Loss): used to measure the performance of the model on the training set and the validation set; Accuracy: measure the classification performance of the model on the validation set; Convergence rate: the rate of change of the loss function or accuracy with the training round; Gradient change: used to detect changes in the amplitude of model parameter updates; Differences in data contribution of each participant: used to measure the differences in contributions of different participants to the global model update.
[0037] The server can make judgments based on a single or multiple indicators. When using a single indicator, for example, monitoring the rate of change of the loss function value or the accuracy (△Loss or △Accuracy) to determine whether the global model has entered a stable performance stage. Set a threshold (such as △Loss < 0.01 or △Accuracy < 0.01): If △Loss or △Accuracy is greater than the threshold, it means that the model is still learning quickly and the complete model continues to be uploaded; if △Loss or △Accuracy is less than the threshold, it means that the model tends to be stable and you can consider uploading only the classifier. When combining multiple indicators, the server will perform a weighted average of different indicators and set weights to achieve more flexible judgments. By adjusting the weights of each indicator, the server can more accurately evaluate the progress of model training. For example, a higher weight can be given to the rate of change of the loss function because its stability more directly reflects the convergence state of the overall performance of the model; while the rate of change of the accuracy rate assists in judging the generalization ability of the model on different data sets.
[0038] In the later stages of model training, when the evaluation matrix shows that the model's performance has been stable over multiple training rounds and the global model's performance is close to convergence, participants only need to upload the classifier for fine-tuning instead of transmitting the complete multi-task model, which effectively reduces the amount of communication.
[0039] Through this strategy, we can effectively balance communication overhead and model performance, ensuring that the global model is fully optimized in different training stages.
[0040] Step S103: The central server dynamically aggregates the local models to obtain an updated global model.
[0041] The overall optimization objective function of the central server is: ; in, Indicates The weight coefficient of each participant, Indicates the The loss value of each participant.
[0042] In the external dynamic adaptive module, assume that Round 1, Weighting coefficients of the participants Defined as: ; in, Indicates the The loss rate of each participant, , is a hyperparameter.
[0043] It can be understood that the method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities.
[0044] It should be noted that the method of one or more embodiments of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of one or more embodiments of the present application, and the multiple devices will interact with each other to complete the described method.
[0045] It should be noted that the above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0046] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a training device for a federated learning model.
[0047] like Figure 2 As shown, the above device includes a central server 11 and a participant 12: The central server 11 is used to send the initial global model to the participant 12; and The global model is updated based on the dynamic aggregation of local models; The participant 12 is used to dynamically and adaptively train the initialized global model according to local data to obtain a local model, and send the local model to the central server 11.
[0048] For the convenience of description, the above devices are described in terms of functions and modules. Of course, when implementing one or more embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0049] The apparatus of the above-mentioned embodiment is used to implement the corresponding method in the above-mentioned embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0050] Figure 3A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0051] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0052] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solution provided in the embodiment of the present application is implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0053] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0054] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0055] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).
[0056] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiment of the present application, and does not necessarily include all the components shown in the figure.
[0057] The electronic device of the above embodiment is used to implement the corresponding method in the above embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0058] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0059] A person of ordinary skill in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0060] In addition, to simplify the description and discussion, and in order not to make one or more embodiments of the present application difficult to understand, the well-known power / ground connections to the integrated circuit (IC) chip and other components may or may not be shown in the provided figures. In addition, the device may be shown in the form of a block diagram to avoid making one or more embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which one or more embodiments of the present application will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is obvious to those skilled in the art that one or more embodiments of the present application can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0061] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many alternatives, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the discussed embodiments.
[0062] One or more embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present application should be included in the scope of protection of this disclosure.
Claims
1. A training method for a federated learning model, characterized in that: include: The central server sends the initial global model to the participants; The participant dynamically and adaptively trains the initialized global model according to local data to obtain a local model, and sends the local model to the central server; The central server dynamically aggregates the local models to obtain an updated global model.
2. The method according to claim 1, characterized in that The participant dynamically and adaptively trains the initialized global model according to local data to obtain a local model, including: Inputting the local data into the currently trained model to obtain output results of multiple tasks; Determine a dynamic adaptive weight for each task according to the output result; The optimization objective function of the participant is adjusted according to the dynamic adaptive weight.
3. The method according to claim 2, characterized in that The optimization objective function of the participants is: ; in, Indicates Participants on The fixed weight coefficient of each training task, Indicates the Participants on The loss value of the training task, and Indicates the Local data of each participant.
4. The method according to claim 2, characterized in that: The dynamic adaptive weight is calculated by the following formula: ; in, Indicates Participants on The loss rate of each training task, , Represents a hyperparameter.
5. The method according to claim 1, characterized in that The central server dynamically aggregates the local models to obtain an updated global model, including iteratively performing the following operations: The central server obtains a total optimization objective function according to the local model and the dynamic adjustment weight of the local model; According to the overall optimization objective function, the updated global model is obtained.
6. The method according to claim 5, characterized in that The overall optimization objective function is: ; in, Indicates The weight coefficient of each participant, Indicates the The loss value of each participant.
7. The method according to claim 5, characterized in that The dynamic adjustment weight is calculated by the following formula: ; in, Indicates The loss rate of each participant, , Represents a hyperparameter.
8. A training device for a federated learning model, characterized in that: Including central server and participants: The central server is used to send the initial global model to the participants; and The global model is updated based on the dynamic aggregation of local models; The participant is used to dynamically and adaptively train the initialized global model according to local data to obtain a local model, and send the local model to the central server.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute any one of claims 1 to 7.
Citation Information
Patent Citations
Data processing method and device, processor and electronic equipment
CN116523593A
Generalized adjustment method for federal learning and federal learning system
CN116796865A
Adaptively adjusting influence in federated learning model updates
US20210287114A1