Robust decentralized collaborative learning method and system, computer equipment and medium
By using cross-gradient information and Sharple value technology in decentralized collaborative learning, a gradient weighting mechanism based on client contribution is designed, which solves the problem of non-independent and homogeneous distribution of data, improves model performance and learning efficiency, and significantly accelerates the convergence of the model.
Patent Information
- Application Number
- CN202411441751.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-10-16
AI Technical Summary
In decentralized collaborative learning, due to the different environments and collection preferences of each edge device, the training data is non-independently distributed, which affects learning ability and increases learning difficulty.
By using cross-gradient information and Sharple value technology, a decentralized gradient weighting mechanism based on client contribution is designed to enable the client to aggregate high-quality gradient information, thereby improving model performance and accelerating model convergence.
It effectively solves the problem of non-independent and homogeneous distribution of data between clients, improves model performance and learning efficiency, and significantly accelerates the convergence of the model.
Smart Images

Figure CN118966384B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of machine learning and relates to a robust decentralized collaborative learning method and system, computer equipment and media. Background Art
[0002] Collaborative learning uses the local data and computing power of edge terminal devices to train learning models or parameters, and then shares and integrates model parameter updates through communication between terminal devices, forming a collaborative edge intelligent system. According to the communication topology, collaborative learning can be divided into centralized collaborative learning and decentralized collaborative learning. In centralized collaborative learning, edge devices need to communicate with the central server continuously. When the edge devices are massive or billions of scale, this increases the resource consumption of the central server. In addition, when the central server becomes unreliable, this makes the entire learning process difficult. Therefore, decentralized collaborative learning came into being. Decentralized collaborative learning means that edge devices do not need to rely on any central node, but achieve distributed model training through point-to-point communication and collaboration. In decentralized collaborative learning, due to the different environments and collection preferences of each edge device, the training data between different edge devices are very different in order of magnitude, quantity category and acquired features, thus forming data heterogeneity, that is, the data non-independently identically distributed (Non-IID) phenomenon. The non-independent and identically distributed data will affect the ability of decentralized collaborative learning and increase the difficulty of learning. Therefore, the problem of non-independent and identically distributed data has become a research focus of decentralized collaborative learning. Faced with the non-independent and identically distributed data of the client, we study how to measure the contribution of the client to the global learning goal and adjust the client gradient aggregation weight according to the contribution, so as to improve the learning performance. Summary of the invention
[0003] In view of the above defects and improvement needs of the prior art, the present invention provides a robust decentralized collaborative learning method. The main difficulty of this problem lies in how each client uses the cross-gradient information and local gradient information transmitted by neighbors to measure the contribution of its own data and neighbor data to the global learning task. The present invention uses cross-gradient to effectively solve the problem of non-independent and identically distributed data between clients, and combines the Shapley value technology to design a decentralized gradient weighting mechanism based on client contribution, so that the client aggregates high-quality gradient information, thereby improving model performance and accelerating model convergence.
[0004] One of the technical solutions provided by the present invention to solve the technical problem is: a robust decentralized collaborative learning method, comprising the following steps:
[0005] Step 1: Each client uses local data and the current local model to calculate local gradient information;
[0006] Step 2: According to the communication topology, each client sends the current local model to its neighbors;
[0007] Step 3: After receiving the local model of the neighbor, each client uses its own data and the local model of the neighbor to calculate the corresponding cross-gradient information, and transmits the gradient back to the corresponding neighbor;
[0008] Step 4: Based on the local gradient information and the received cross gradient information, each client uses the validation set to calculate the Shapley value of its neighbors and itself, thereby determining the weights assigned when the cross gradient and local gradient are aggregated;
[0009] Step 5: Each client aggregates local gradient information and cross gradient information according to the assigned weights, and updates the current local model according to the aggregated gradients to obtain the latest local model;
[0010] Repeat steps 1 to 5 until the preset number of learning rounds is reached or the loss value reaches the specified threshold, then stop learning.
[0011] Preferably, in step 4, the method for calculating the Shapley value is as follows:
[0012] make express A collection of clients, Represents the client The set of neighbors that includes itself, is the characteristic function of the cooperative game, describing Each group of union Contribution to decentralized collaborative learning tasks, characteristic function The definition is as follows: ;
[0013] in, represents the validation dataset saved by each client that reflects the global learning goal, To verify the number of samples in the dataset, is the indicator function, For the Aggregation The model obtained by the local model, , Representation Model In the data sample The prediction results on
[0014] Based on the characteristic function, the client In the The Shapley value of a wheel can be defined as:
[0015] ;
[0016] Then through normalization, we get Shapley value in the interval ; Used to measure client In the The quality of the training data contributed in the round.
[0017] Preferably, the weights assigned when the cross gradient and the local gradient are aggregated are calculated according to the obtained Shapley value of the client:
[0018] ;
[0019] in, For Clients In the The weight value in the round; For Clients With the client The connection weights corresponding to the communication topology graph between them.
[0020] The present invention further provides a robust decentralized collaborative learning system, the system comprising:
[0021] Model receiving module, used for the client to send local model information and cross gradient information to neighbors, and receive local model information and cross gradient information sent by neighbors;
[0022] Model training module: The client obtains local gradients based on its own data and model training, and obtains cross gradients based on its own data and neighbor’s local model training;
[0023] In the calculation module, each client uses the global validation set to calculate the client's Shapley value based on the local gradient and the cross gradient transmitted by the neighbors; the corresponding weight when the gradient is aggregated is determined according to the client's Shapley value, and then the local gradient and the cross gradient are aggregated to obtain the final gradient, and the local model is updated according to the final gradient; after multiple iterations, the learning is stopped until the pre-set number of learning rounds is reached or the loss value reaches the specified threshold.
[0024] The present invention also provides a computer-readable medium, which stores a computer program. When the computer program is read and executed by a processor, the robust decentralized collaborative learning method is implemented.
[0025] The present invention also provides a computer device, comprising at least one processor and the computer-readable medium, wherein when the computer program in the computer-readable medium is read and executed by the processor, the robust decentralized collaborative learning method is implemented.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] The present invention uses cross-gradient to effectively solve the problem of non-independent and identically distributed data between clients, and combines the Shapley value technology to design a decentralized gradient weighting mechanism based on client contribution, so that clients can aggregate high-quality gradient information, thereby improving model performance and accelerating model convergence. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 The overall framework of a robust decentralized collaborative learning method disclosed in Example 1 of the present invention;
[0029] Figure 2 : This is an average training loss graph of the method in Example 1 of the present invention; wherein, (a) MNIST data set; (b) CIFAR-10 data set;
[0030] Figure 3 The test accuracy effect diagram of the method in Example 1 of the present invention; wherein, (a) MNIST data set; (b) CIFAR-10 data set;
[0031] Figure 4 A framework diagram of a robust decentralized collaborative learning system disclosed in Embodiment 2 of the present invention;
[0032] Figure 5 This is a framework diagram of a computer device disclosed in Example 3 of the present invention. DETAILED DESCRIPTION
[0033] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0034] Example 1 This example provides a robust decentralized collaborative learning method, such as Figure 1 As shown, the following steps are included:
[0035] In step 1, each client uses local data and the current local model to calculate local gradient information.
[0036] Step 2: According to the communication topology, each client sends the current local model to its neighbors.
[0037] Step 3: After receiving the local model of the neighbor, each client uses its own data and the local model of the neighbor to calculate the corresponding cross-gradient information, and transmits the gradient back to the corresponding neighbor.
[0038] Step 4: Based on the local gradient information and the received cross gradient information, each client uses the validation set to calculate the Shapley value of its neighbors and itself, so as to measure the client's contribution to the global learning goal and determine the weight assigned when the cross gradient and local gradient are aggregated; the specific method is as follows:
[0039] After receiving the cross gradients sent back by the neighbors, each client calculates the neighbor's and its own Shapley value based on the collected gradient information and the validation set, thereby measuring the client's contribution to the global learning goal and providing appropriate weights for gradient aggregation. The Shapley value is an important technology in cooperative games. Its core idea is to distribute rewards based on the contribution of each client to the entire cooperation. The way to calculate the Shapley value is as follows:
[0040] make express A collection of clients, Represents the client The set of neighbors that includes itself, is the characteristic function of the cooperative game, describing Each group of union Contribution to decentralized collaborative learning tasks, characteristic function The definition is as follows:
[0041] ;
[0042] in, represents the validation dataset saved by each client that reflects the global learning goal, To verify the number of samples in the dataset, is the indicator function, For the Aggregation The model obtained by the local model, , Representation Model In the data sample Based on the above feature function, the client In the The Shapley value of a wheel can be defined as: ;
[0043] The obtained Shapley value is normalized to obtain Shapley value in the interval ; Used to measure client In the The quality of the training data contributed in the round;
[0044] According to the obtained client's Shapley value, the client In the The weight value in the round is defined as:
[0045] ;
[0046] in, For Clients With the client The connection weights corresponding to the communication topology graph between them.
[0047] In step 5, each client aggregates local gradient information and cross gradient information according to the assigned weights, and updates the current local model according to the aggregated gradients to obtain the latest local model; repeat steps 1 to 5 until the pre-set number of learning rounds is reached or the loss value reaches the specified threshold, and then stop learning.
[0048] The data sets used in the present invention are MNIST and CIFAR-10 data sets, wherein the MNIST data set is a handwritten digital image data set, including 70,000 handwritten digital images of 10 categories from 0 to 9, of which 60,000 are training images and 10,000 are test images; the CIFAR-10 data set is 60,000 color images of 10 categories: airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships and trucks, of which 50,000 are training images and 10,000 are test images. At the same time, the present invention selects the DMSGD algorithm and two existing decentralized collaborative learning algorithms NET-FLEET and CGA to perform experimental verification of the training set loss value and the test accuracy value, wherein DMSGD is a typical decentralized learning algorithm, but the method does not consider the non-independent and identically distributed problem between client data; in order to solve the problem of heterogeneous data distribution on the client side in decentralized learning, the NET-FLEET algorithm uses a recursive gradient correction technique; the CGA algorithm introduces the cross-gradient information of the client side. However, the NET-FLEET algorithm and the CGA algorithm do not fairly measure the contribution of the client to the global learning goal. In addition, in the experimental setting of the present invention, the communication topology graph between the clients is a fully connected graph, and the total number of clients is 20.
[0049] The experimental results of the training set loss value are as follows Figure 2 As shown in the figure, (a) shows the training loss value reduction result of the MNIST dataset; (b) shows the training loss value reduction result of the CIFAR-10 dataset. Figure 2It can be seen that with the increase of the number of training rounds, the training losses of all methods on the MNIST dataset and the CIFAR-10 dataset are decreasing, and the method (ROSS) proposed in the present invention is significantly better than the existing methods, gradually converges with fewer rounds and can reach the minimum value.
[0050] In the experiment of testing the accuracy value, four data settings are considered, namely long-tail distribution, data noise, label noise, and gradient noise, and the results are as follows Figure 3 As shown, (a) is the test accuracy result of the MNIST dataset after 150 learning rounds, and (b) is the test accuracy result of the CIFAR-10 dataset after 180 learning rounds. Figure 3 It can be seen that the method (ROSS) proposed in the present invention can have a good test accuracy value, which shows that the method of the present invention can effectively improve the performance of decentralized collaborative learning and improve the robustness of the model.
[0051] Embodiment 2 This embodiment provides a robust decentralized collaborative learning system, such as Figure 4 As shown, the system includes:
[0052] Model training module 101, the client obtains local gradients based on its own data and its own model training, and obtains cross gradients based on its own data and neighbor's local model training;
[0053] Model receiving module 102, used for the client to send local model information and cross gradient information to neighbors, and receive local model information and cross gradient information sent by neighbors;
[0054] In calculation module 103, each client uses the global verification set to calculate the client's Shapley value based on the local gradient and the cross gradient transmitted by the neighbor; determines the corresponding weight when the gradient is aggregated according to the client's Shapley value, and then aggregates the local gradient and the cross gradient to obtain the final gradient, and updates the local model according to the obtained final gradient; after multiple iterations, until a pre-set number of learning rounds is reached or the loss value reaches a specified threshold, the learning is stopped.
[0055] Embodiment 3 This embodiment provides a computer device, such as Figure 5 As shown, it includes a processor 101 and a computer-readable medium 102 storing a computer program, wherein the computer-readable medium 102 stores a computer program, and when the computer program is read and executed by the processor, the method of embodiment 1 can be implemented.
[0056] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus dynamic random access memory (Rambus DRAM, referred to as RDRAM), and interface dynamic random access memory (DRDRAM).
[0057] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A robust decentralized collaborative learning method, characterized in that: The following steps are involved: Step 1: The local model processes the image data; each client uses the local data and the current local model to calculate the local gradient information; Step 2: According to the communication topology, each client sends the current local model to its neighbors; Step 3: After receiving the local model of the neighbor, each client uses its own data and the local model of the neighbor to calculate the corresponding cross-gradient information, and transmits the gradient back to the corresponding neighbor; Step 4: Based on the local gradient information and the received cross gradient information, each client uses the validation set to calculate the Shapley value of its neighbors and itself, thereby determining the weights assigned when the cross gradient and local gradient are aggregated; make express A collection of clients, Represents the client The set of neighbors that includes itself, is the characteristic function of the cooperative game, describing Each group of union Contribution to decentralized collaborative learning tasks, characteristic function The definition is as follows: ; in, represents the validation dataset saved by each client that reflects the global learning goal, To verify the number of samples in the dataset, is the indicator function, For the Aggregation The model obtained by the local model, , Representation Model In the data sample The prediction results on Based on the characteristic function, the client In the The Shapley value of a wheel is defined as: ; Then through normalization, we get Shapley value in the interval ; Used to measure client In the The quality of the training data contributed in the round; According to the obtained Shapley value of the client, the weight assigned when the cross gradient and the local gradient are aggregated is calculated: ; in, For Clients In the The weight value in the round; For Clients With the client The connection weight corresponding to the communication topology graph between them; Step 5: Each client aggregates local gradient information and cross gradient information according to the assigned weights, and updates the current local model according to the aggregated gradients to obtain the latest local model; Repeat steps 1 to 5 until the preset number of learning rounds is reached or the loss value reaches the specified threshold, then stop learning.
2. A robust decentralized collaborative learning system, characterized in that: The system includes: Model receiving module, used for the client to send local model information and cross gradient information to neighbors, and receive local model information and cross gradient information sent by neighbors; Model training module: The client obtains local gradients based on its own data and model training, and obtains cross gradients based on its own data and neighbor’s local model training; The computing module comprises: each client uses a global validation set to calculate the client's Shapley value according to the local gradient and the cross gradient transmitted by the neighbor; determines the corresponding weight when the gradient is aggregated according to the client's Shapley value, then aggregates the local gradient and the cross gradient to obtain the final gradient, and updates the local model according to the obtained final gradient; after multiple iterations, stops learning until a preset number of learning rounds is reached or the loss value reaches a specified threshold; when the system is running, implements the method described in claim 1.
3. A computer-readable medium, characterized in that The computer-readable medium stores a computer program, and when the computer program is read and executed by a processor, the method according to claim 1 is implemented.
4. A computer device, characterized in that: The method comprises at least one processor and the computer-readable medium as claimed in claim 3, wherein when the computer program in the computer-readable medium is read and executed by the processor, the method as claimed in claim 1 is implemented.
Citation Information
Patent Citations
Anti-Byzantine attack decentralized learning method and system based on reputation evaluation
CN116862021A
Risk control model training method and device
CN117057597A