A horizontal federated learning method, device and storage medium
By combining the horizontal federated learning method of star and ring architecture, and using the incremental learning method for cyclic communication and model transfer, the problems of training robustness and low computing power utilization in the existing technology are solved, and the model is significantly improved. Accuracy and efficiency.
Patent Information
- Application Number
- CN202210226465.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-09
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-03-09
AI Technical Summary
The existing horizontal federated learning training architecture has poor robustness and low computer computing power utilization when processing non-independent and identically distributed data, resulting in low training efficiency and reduced accuracy.
Combining the star and ring architecture, using the incremental learning method, the central server selects the initial federated learning model and parameters, and performs cyclic communication and model transfer between clients until the loss function converges, making full use of the local computing power of all users. , to avoid idle computing power.
It improves the robustness and computing power utilization of training, and significantly improves the model accuracy and training efficiency in the case of non-IID data.
Smart Images

Figure CN114742240B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a horizontal federated learning method, device and storage medium. Background Art
[0002] As computing substrates such as phones, sensors, and wearables grow in power and popularity, learning statistical models locally in a network of distributed devices is increasingly attractive compared to moving data to data centers. This technology is called federated learning. Federated learning is defined as follows: In the process of machine learning, each participant can use the data of other parties for joint modeling, and the parties do not need to share data resources, that is, when the data does not leave the local area, joint data training is performed to establish a shared machine learning model, while horizontal federated learning is a federated learning algorithm performed when the data types of each user are similar but the user groups are different.
[0003] Federated learning is mainly divided into horizontal federated learning and vertical federated learning. When there are many overlaps in user features but few overlaps in users of multiple data sets, we split the data set horizontally (i.e., user dimension) and take out the data with the same user features but different users for training. This method is called horizontal federated learning. When there are many overlaps in users but few overlaps in user features of multiple data sets, we split the data set vertically (i.e., feature dimension) and take out the data with the same user features but different users for training. This method is called vertical federated learning.
[0004] The application scenario of horizontal federated learning is that different users have the same data structure. For example, hospitals in different regions have different patient groups, but their CT images have the same data format. Horizontal federated learning achieves the purpose of training without exchanging original data by using models or gradient transmission.
[0005] There are currently two types of training architectures for horizontal federated learning. One is a star architecture, which aggregates the parameters of multiple users to a central server in a federated network. In a star architecture, multiple users run concurrently, and the computer computing power utilization rate is high. However, the robustness is poor for distributed operations on no-iid data, and the accuracy of the aggregated model is often greatly reduced due to the different weights of each model. The other is a ring architecture, in which each user forms a ring structure, passes parameters to each other, and uses the model parameters obtained from the previous user for training. The ring structure has strong training robustness and can obtain stronger adaptability when training on different data sets. However, when a certain user is training, all remaining users need to wait, and the training efficiency is extremely low. In the entire ring network, only the computing power of one machine is being utilized, resulting in too long training time. Summary of the invention
[0006] In view of the shortcomings of the prior art, the present invention provides a horizontal federated learning method, device and storage medium. The present invention mainly integrates the use of star architecture and ring architecture for training in horizontal federated learning. Since the present method integrates the training method of incremental learning, the robustness of training is improved compared with the star training structure; and because of the special parallel loop training mechanism of the present invention, the problem of idle computer computing power of the ring training architecture is greatly reduced during the training process. Compared with the traditional parameter calculation method, this algorithm can achieve better results when dealing with non-independent and identically distributed (IID) data.
[0007] The technical means adopted by the present invention are as follows:
[0008] A horizontal federated learning method, comprising:
[0009] S1. The central server selects the initial federated learning model and parameters according to the training task and the data sample type, and sends the initial federated learning model and weight parameters to all clients participating in the federated learning;
[0010] S2. Each client starts model training based on its own local training data at the same time, thereby obtaining a local learning model;
[0011] S3, each client uses a cyclic communication method to send the local learning model to the next client, and trains based on the local training data of the next client. After all clients complete the training, the cyclic communication order is updated, and the model is continued to be transmitted and trained until the set number of training times is reached;
[0012] S4. Each client sends the last trained model to the central server for aggregation, and then uses the aggregation result to update the federated learning model. S2-S4 are repeatedly executed until the loss function converges and the training is completed.
[0013] Further, S3, each client uses a cyclic communication method to send the local learning model to the next client, and trains based on the local training data of the next client. After all clients complete the training, the cyclic communication sequence is updated, and the model is continued to be transmitted and trained until the set number of training times is reached, including:
[0014] S301, the central server randomly generates a linked list s for storing the training sequence of each client, and sends the linked list s to each client;
[0015] S302, each client sends the local learning model to the next client in the order in the linked list s, and the last client in the linked list s sends its local model to the first client in the linked list s;
[0016] S303, each client continues to train the received model based on local training data;
[0017] S304, the central server randomly updates the linked list s, and sends the updated linked list s to each client;
[0018] S305. Repeat S302-S304 until the set number of training times is reached.
[0019] Furthermore, the number of training times set in S3 is an integer multiple of the number of clients.
[0020] Furthermore, the weight parameter first sent down by the central server in S1 is a random weight.
[0021] The present invention also provides a horizontal federated learning device, which is used to implement any of the horizontal federated learning methods described above, including:
[0022] An initialization module is used to select an initial federated learning model and parameters according to the training task and data sample type through a central server, and send the initial federated learning model and weight parameters to all clients participating in the federated learning;
[0023] The initial training module is used to start model training simultaneously through each client based on its own local training data, thereby obtaining a local learning model;
[0024] A loop training module is used to send the local learning model to the next client through a loop communication method between each client, and perform training based on the local training data of the next client. After all clients complete the training, the loop communication sequence is updated, and the model is continued to be transmitted and trained until the set number of training times is reached;
[0025] The model aggregation module is used to send the last trained model to the central server for aggregation through each client, and then use the aggregation result to update the federated learning model. The cyclic training process is repeatedly performed until the loss function converges and the training is completed.
[0026] The present invention also provides a storage medium, which includes a stored program, wherein when the program is run, any of the horizontal federated learning methods described above is executed.
[0027] Compared with the prior art, the present invention has the following advantages:
[0028] The present invention provides a horizontal federated learning model training architecture and updates the horizontal federated model transmission mode. Specifically, when training the transmission model or gradient parameters, the model is first propagated in a ring shape, and then propagated to the server in a star shape. The server side performs model aggregation to obtain a global federated learning model and completes a round of training. The training is then repeated until the model converges. This algorithm is inspired by incremental learning and performs model training in a synchronous cycle in each client. Through the synchronous start training mode, the local computing power of all users is fully utilized, avoiding the waste of computing power caused by the situation where all clients on the ring connection are waiting for the client being trained. When processing non-IID data, better and more stable results can be obtained compared with traditional algorithms. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0030] Figure 1 This is the horizontal federated learning training architecture of the present invention.
[0031] Figure 2 Schematic diagram of the flow of the horizontal federated learning method of the present invention.
[0032] Figure 3 Schematic diagram of the architecture of the horizontal federated learning method of the present invention. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0034] Federated learning is a machine learning method that ensures that data does not leave the local area and combines data from multiple parties to jointly build a model that is applicable to all data. As the underlying technology for the future development of AI, federated learning will continue to promote the innovation and leap of global AI technology by relying on a model that connects data islands under secure and reliable data protection measures. With the penetration and application of federated learning in a wider range and more industry scenarios, it will have a huge impact on all kinds of people, organizations, industries and society at a higher level. The public value of federated learning is mainly reflected in accelerating the innovation and development of artificial intelligence technology, protecting privacy information and data security, and promoting the improvement of the level of intelligence in the whole society. Its commercial value is reflected in the birth of new formats and models based on joint modeling, reducing the cost of technology improvement and promoting the development of innovative technologies, driving cross-domain enterprise-level data cooperation, and intelligent strategies to assist market layout and enhance competitiveness.
[0035] This algorithm is used for training horizontal federated learning and improves the effect of horizontal federated learning by building a better client-server interaction model.
[0036] Based on the above research and development background, Figure 1-3 As shown, the present invention provides a horizontal federated learning method, comprising:
[0037] S1. The central server selects the initial federated learning model and parameters according to the training task and the data sample type, and sends the initial federated learning model and weight parameters to all clients participating in the federated learning.
[0038] Specifically, the central server selects the appropriate federated learning model and parameters according to the training task and data sample type, and sends the model structure and parameters to k clients a1, a2, ...a k , to ensure that the data format and model structure of all clients are compatible.
[0039] S2. Each client starts model training simultaneously based on its own local training data, and then obtains a local learning model.
[0040] Specifically, user terminals a1, a2, ...a k Use the respective data D1, D2, ...D locally k , using the global model f x Start training at the same time and get models f1, f2, ... f suitable for their respective data. k .
[0041] S3. Each client uses a cyclic communication method to send the local learning model to the next client, and trains based on the local training data of the next client. After all clients complete the training, the cyclic communication order is updated, and the model is continued to be transmitted and trained until the set number of training times is reached.
[0042] Specifically include:
[0043] S301. The central server randomly generates a linked list s for storing the training sequence of each client, and sends the linked list s to each client.
[0044] Specifically, the central server randomly generates a linked list s representing the training order, so that all users a1, a2, ... a participating in the training k The order is disrupted. The server subscripts represent the order of the servers, where the last user a k The next player is regarded as a1, and the previous player of a1 is regarded as a k , thus forming a ring-shaped user structure. Note that each cycle training a n It does not represent the same client, but represents the client at position n in this training. The central server will save the linked list s of the training order and the global weight f x Distribute to all users uniformly. If it is the first training, the initial weight f x is a random weight.
[0045] S302. Each client sends the local learning model to the next client in the order in the linked list s, and the last client in the linked list s sends its local model to the first client in the linked list s.
[0046] Specifically, after all users have been trained, a1, a2, …a k-1 ,a k According to the linked list s, each model is passed to its next home a2, a3, ...a k ,a1, and receive from the previous home a k ,a1,…a k-2 ,a k-1 Model.
[0047] S303: Each client continues to train the received model based on local training data.
[0048] S304, the central server randomly updates the linked list s, and sends the updated linked list s to each client;
[0049] S305. Repeat S302-S304 until the set number of training times is reached.
[0050] Specifically, when a1, a2, -a k Complete model f1,f2,-f nAfter the downstream model is transmitted and the upstream model is received, the circular training between the clients starts from S302, and the received model weights are used as the initial training weights, and the training starts at the same time. Similarly, after all users have completed the training, the downstream model is transmitted and the upstream model is received again until the set number of training times is reached. The number of training times is at least k, preferably an integer multiple of k, to ensure that the data of all users is used fairly for all model training.
[0051] S4. Each client sends the last trained model to the central server for aggregation, and then uses the aggregation result to update the federated learning model. S2-S4 are repeatedly executed until the loss function converges and the training is completed.
[0052] Specifically, the central server will f1,f2,-f n Collect and aggregate the model parameters uniformly, and then use the aggregation results to optimize the global model f x And update the training sequence list s. Then return to S2, randomly number the users again, and iterate the above steps until the loss function converges, thus completing the entire training process.
[0053] Inspired by incremental learning and federated averaging algorithms, the present invention combines the star-shaped and ring-shaped federated learning architectures for horizontal federated learning training. After the central server sorts the clients, all clients start training the models at the same time and transmit them to the next server using a ring-shaped communication method. After a certain number of rounds of cyclic training, all clients upload their trained models to the central server using a star-shaped communication structure, which aggregates the parameters and shuffles the client order, and organizes the next round of training.
[0054] The present invention can be used in the medical field. Taking IBM's supercomputer system Watson as an example, the training data Watson used should contain the characteristics of diseases, gene sequences, medical reports, test results and academic papers. But in fact, without a stable data source, most data face the problem of label loss. Since medical data is difficult to collect, insufficient data and labels will lead to poor performance of machine learning models. Assuming that medical institutions around the world unite by sharing their data, they will then have a large enough data set to train models better than before. However, due to the restrictions of various privacy protection clauses, the data of these medical institutions cannot be interoperable.
[0055] Horizontal federated learning is a distributed multi-party machine learning algorithm in which the participating parties exchange gradients, models and other parameters. After applying federated learning, each medical institution can collect patient data separately, train personalized models, communicate the models in a ring between the medical institutions, and after completing a certain number of rounds of training, upload them to the central server for aggregation, and then send them to each medical institution for retraining. Repeat the training cycle many times to obtain a global model applicable to all data. On the one hand, since multiple medical institutions jointly collect patient data, resulting in an increase in training data and the problem of label loss, transfer learning can also be used to fill in the missing labels, thereby expanding the data set and greatly improving the performance of the model; on the other hand, the invention has a solid theoretical basis and excellent performance, so the accuracy of the obtained model is improved compared with traditional algorithms such as the federated average algorithm, which is of great significance for auxiliary diagnosis.
[0056] The present invention also provides a horizontal federated learning device, which is used to implement any of the horizontal federated learning methods described above, including:
[0057] An initialization module is used to select an initial federated learning model and parameters according to the training task and data sample type through a central server, and send the initial federated learning model and weight parameters to all clients participating in the federated learning;
[0058] The initial training module is used to start model training simultaneously through each client based on its own local training data, thereby obtaining a local learning model;
[0059] A loop training module is used to send the local learning model to the next client through a loop communication method between each client, and perform training based on the local training data of the next client. After all clients complete the training, the loop communication sequence is updated, and the model is continued to be transmitted and trained until the set number of training times is reached;
[0060] The model aggregation module is used to send the last trained model to the central server for aggregation through each client, and then use the aggregation result to update the federated learning model. The cyclic training process is repeatedly performed until the loss function converges and the training is completed.
[0061] As for the embodiments of the present invention, since they correspond to the embodiments above, the description is relatively simple. For the relevant similarities, please refer to the description of the above embodiments, which will not be described in detail here.
[0062] The present invention also provides a storage medium, which includes a stored program, wherein when the program is run, any of the horizontal federated learning methods described above is executed.
[0063] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0064] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0065] In the embodiments provided in the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0066] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0067] In addition, each functional unit in the embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0068] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A horizontal federated learning method, characterized in that: include: S1. The central server selects the initial federated learning model and parameters according to the training task and the data sample type, and sends the initial federated learning model and weight parameters to all clients participating in the federated learning; S2. Each client starts model training based on its own local training data at the same time, thereby obtaining a local learning model; S3, each client uses a cyclic communication method to send the local learning model to the next client, and trains based on the local training data of the next client. After all clients complete the training, the cyclic communication order is updated, and the model is continued to be transmitted and trained until the set number of training times is reached; S4. Each client sends the last trained model to the central server for aggregation, and then uses the aggregation result to update the federated learning model. S2-S4 are repeatedly executed until the loss function converges and the training is completed.
2. A horizontal federated learning method according to claim 1, characterized in that: S3. Each client sends the local learning model to the next client in a cyclic communication manner, and performs training based on the local training data of the next client. After all clients complete the training, the cyclic communication sequence is updated, and the model is continued to be transmitted and trained until the set number of training times is reached, including: S301, the central server randomly generates a linked list s for storing the training sequence of each client, and sends the linked list s to each client; S302, each client sends the local learning model to the next client in the order in the linked list s, and the last client in the linked list s sends its local model to the first client in the linked list s; S303, each client continues to train the received model based on local training data; S304, the central server randomly updates the linked list s, and sends the updated linked list s to each client; S305. Repeat S302-S304 until the set number of training times is reached.
3. A horizontal federated learning method according to claim 1, characterized in that: The number of training times set in S3 is an integer multiple of the number of clients.
4. A horizontal federated learning method according to claim 1, characterized in that: The weight parameter first sent by the central server in S1 is a random weight.
5. A horizontal federated learning device, used to implement the horizontal federated learning method according to any one of claims 1 to 4, characterized in that: include: An initialization module is used to select an initial federated learning model and parameters according to the training task and data sample type through a central server, and send the initial federated learning model and weight parameters to all clients participating in the federated learning; The initial training module is used to start model training simultaneously through each client based on its own local training data, thereby obtaining a local learning model; A loop training module is used to send the local learning model to the next client through a loop communication method between each client, and perform training based on the local training data of the next client. After all clients complete the training, the loop communication sequence is updated, and the model is continued to be transmitted and trained until the set number of training times is reached; The model aggregation module is used to send the last trained model to the central server for aggregation through each client, and then use the aggregation result to update the federated learning model. The cyclic training process is repeatedly performed until the loss function converges and the training is completed.
6. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is run, the horizontal federated learning method described in any one of claims 1 to 4 is executed.
