Gradient heterogeneous dual optimization method, device, electronic device and storage medium in distributed machine learning system
By introducing momentum terms and bucket aggregation technology into the distributed learning system, the local and global gradient differences are optimized, the robustness problem caused by gradient heterogeneity in the distributed system is solved, and the system's ability to resist malicious node attacks is significantly improved.
Patent Information
- Application Number
- CN202410465104.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-18
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-04-18
AI Technical Summary
Existing technologies cannot effectively solve the robustness problem caused by gradient heterogeneity in distributed systems, especially in the face of malicious nodes and attacks, and cannot simultaneously optimize local gradient differences and global gradient differences.
The gradient heterogeneous dual optimization method is adopted to optimize the local and global gradient differences and reduce gradient heterogeneity by introducing momentum terms in the distributed learning system and performing bucket aggregation and geometric median global aggregation on the parameter server side.
It significantly improves the robustness of the distributed system in the face of malicious node attacks, reduces the generalization error of the machine learning model, and improves the system's anti-attack capability.
Smart Images

Figure CN118070929B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of distributed machine learning system optimization, and more specifically, relates to a gradient heterogeneous dual optimization method, device, electronic device and storage medium in a distributed machine learning system. Background Art
[0002] With the development of IoT technology, a large number of devices and sensors have generated a wealth of high-value data, providing great opportunities and challenges for making smarter and more efficient decisions. However, a single machine faces problems such as insufficient computing power, storage limitations, and slow processing speed when processing huge amounts of data. In response to the limitations of a single machine, distributed systems have emerged. By assigning tasks to multiple computing nodes, distributed systems effectively increase the speed of data processing and analysis, and achieve efficient management of large-scale data.
[0003] However, with the widespread application of distributed systems, security threats also arise. Problems such as configuration differences between nodes in distributed systems, different data samples, and communication delays lead to differences in the gradients calculated by each node, forming gradient heterogeneity. Malicious nodes use the differences in different gradients to find loopholes in the model parameter update mechanism, and then inject harmful gradients to carry out more complex and hidden attacks. Gradient heterogeneity makes it impossible for distributed systems to effectively detect potential malicious nodes, which in turn makes the attacks of malicious nodes pose a serious threat to model performance and affects the robustness of distributed systems.
[0004] Gradient heterogeneity is mainly reflected in two aspects: local gradient difference and global gradient difference. Different nodes process different local data, resulting in different local gradients for training, forming local gradient differences. In addition, due to asynchronous calculations between nodes, different nodes submit their gradient updates at different times, which in turn causes inconsistency in global gradients and forms global gradient differences. By reducing local gradient differences and global gradient differences, gradient heterogeneity can be effectively reduced, thereby improving the robustness of distributed systems.
[0005] In the prior art, Chinese patent document CN117436513A discloses a method for accelerating the convergence of federated learning based on modified gradient descent. The machine learning algorithm model parameters are initialized on a logical aggregation server as an initialized global model. The initialized global model is broadcast to a random subset of the participant set. The participant initializes the local model as the initialized global model, optimizes the local model through a local modified gradient descent algorithm, and uploads it to the logical aggregation server after training a preset threshold. The logical aggregation server aggregates all local models that have completed training in this round, generates a global model for the next round of local training, and determines whether the global model has converged. If so, the federated learning process ends after broadcasting the global model. This solution can effectively accelerate the convergence of federated learning and prevent the stable point from shifting.
[0006] Chinese patent document CN110889509A discloses a joint learning method and device based on gradient momentum acceleration, which embeds the same machine learning model on each edge node, and executes the momentum gradient descent algorithm in the current aggregation interval to obtain the model parameters and momentum parameters at each moment in the current aggregation interval; the central server aggregates these model parameters to obtain global model parameters, and the central server aggregates these momentum parameters to obtain global momentum parameters; the global model parameters in the current aggregation interval are substituted into the loss function formula to obtain the loss function value and compare it with the loss function value obtained in the previous aggregation interval to obtain the optimized global model parameters, and after all aggregation intervals are calculated, the optimized global model parameters are obtained; the advantage of the present invention is that the momentum gradient descent algorithm is used for the local update process of joint learning, that is, the parameter update process of the edge node, and the algorithm converges faster.
[0007] However, the above methods do not solve the problem caused by gradient heterogeneity in distributed systems. In addition, most existing algorithms only focus on reducing local gradient differences (such as SAGA, SVRG and other algorithms) or global gradient differences (such as bucketing algorithms), but cannot take both into account at the same time. This situation seriously restricts the robustness of distributed systems in the face of malicious nodes and attacks.
[0008] Based on this, there is an urgent need for a new method that can simultaneously optimize the local gradient difference and the global gradient difference in distributed machine learning systems to alleviate the negative impact of gradient heterogeneity and improve the robustness of distributed systems. Summary of the invention
[0009] The present invention aims to overcome at least one defect of the above-mentioned prior art and provide a gradient heterogeneous dual optimization method in a distributed machine learning system to solve the technical problem in the prior art that the robustness performance of the distributed system in the face of malicious nodes and attacks is restricted due to the existence of local gradient differences and global gradient differences.
[0010] The present invention also discloses a device loaded with a gradient heterogeneous dual optimization method in a distributed machine learning system.
[0011] The detailed technical scheme of the present invention is as follows:
[0012] A gradient heterogeneous dual optimization method in a distributed machine learning system, the method comprising:
[0013] S1. Build includes A distributed learning system with nodes and a single parameter server, wherein the nodes are divided into honest nodes and malicious nodes;
[0014] S2. According to a preset iterative optimization method, based on the data sample selected by the honest node from its local data set, calculate and correct the local gradient of the data sample to iteratively optimize the local gradient difference;
[0015] S3. Introduce the momentum term. For honest nodes, combine the corrected local gradient with the corresponding momentum vector of the previous iteration round to obtain the momentum vector of the current iteration round corresponding to the honest node. Then normalize the momentum vector of the current iteration round corresponding to the honest node to a unit momentum vector and send it to the parameter server. For malicious nodes, directly send the generated malicious gradient to the parameter server. The parameter server aggregates the unit momentum vector and the malicious gradient to obtain a local aggregation result.
[0016] S4. Globally aggregate the local aggregation results to obtain a global gradient for updating global model parameters to iteratively optimize the global gradient difference.
[0017] Preferably, in step S1, a distributed machine learning system is established by minimizing the loss function, and its optimization goal is:
[0018] (1);
[0019] In formula (1): Represents the sum of the loss functions of the honest nodes The minimum parameter value, Indicates the total number of nodes, represents the number of malicious nodes; , =1,2... , Represents an honest node About global model parameters on its local dataset The average loss of each honest node is that the local data set of each honest node is evenly distributed from the data set, and the local data set of each honest node contains data samples, Represents an honest node In the The global model parameters on the data samples loss.
[0020] Preferably, according to the present invention, in step S2, the local gradient of the data sample is corrected, specifically:
[0021] (2);
[0022] In formula (2): represents the corrected local gradient, Represents an honest node No. The local gradient of the data samples, Indicates the last iteration round The global gradient aggregated by the parameter server in , Represents an honest node The average of all gradients in the stochastic gradient table, Indicates the current iteration round, Indicates the current iteration round The global model parameters.
[0023] Preferably, in step S3, for the honest node, the corrected local gradient is combined with the momentum vector of the corresponding previous iteration round to obtain the momentum vector of the current iteration round corresponding to the honest node, specifically:
[0024] (3);
[0025] In formula (3): Indicates the current iteration round corresponding to the honest node The momentum vector of Indicates the last iteration round The momentum vector of is the momentum coefficient, represents the corrected local gradient.
[0026] Preferably, according to the present invention, in step S3, the momentum vector of the current iteration round corresponding to the honest node is normalized to a unit momentum vector, specifically:
[0027] (4);
[0028] In formula (4): represents the transformed unit momentum vector, Represents an honest node Current iteration round The momentum vector of .
[0029] Preferably, in step S3, the parameter server aggregates the unit momentum vector and the malicious gradient to obtain a local aggregation result, specifically:
[0030] (5);
[0031] In formula (5): Indicates The group vector local aggregation result includes the unit momentum vector sent by the honest node and the malicious gradient sent by the malicious node. represents the number of vectors in each group, and ,express The honest nodes in the nodes upload a unit momentum vector to the parameter server in each iteration, and the malicious nodes upload a malicious gradient to the parameter server in each iteration, and these uploaded vectors are divided into Group, Represents a vector sequence The vectors.
[0032] Preferably, in step S4, the local aggregation results are globally aggregated to obtain a global gradient for updating global model parameters to iteratively optimize the global gradient difference, specifically:
[0033] (6);
[0034] (7);
[0035] In formula (6)~(7): represents the global gradient obtained after aggregation, represents the learning rate, Represents the updated global model parameters.
[0036] In another aspect of the present invention, a device for implementing a gradient heterogeneous dual optimization method in a distributed machine learning system is provided, the device comprising:
[0037] Building modules, used to build A distributed learning system with nodes and a single parameter server, wherein the nodes are divided into honest nodes and malicious nodes;
[0038] A first optimization module, configured to calculate and correct the local gradient of the data sample based on the data sample selected by the honest node from its local data set according to a preset iterative optimization method, so as to iteratively optimize the local gradient difference;
[0039] An aggregation module is used to combine the corrected local gradient of the honest node with the corresponding momentum vector of the previous iteration round to obtain the momentum vector of the current iteration round corresponding to the honest node, and then normalize the momentum vector of the current iteration round corresponding to the honest node to a unit momentum vector and send it to the parameter server; for malicious nodes, directly send the generated malicious gradient to the parameter server, and the parameter server aggregates the unit momentum vector and the malicious gradient to obtain a local aggregation result;
[0040] The second optimization module is used to globally aggregate the local aggregation results to obtain a global gradient for updating global model parameters to iteratively optimize the global gradient difference.
[0041] In another aspect of the present invention, there is also provided an electronic device, comprising:
[0042] at least one processor; and
[0043] A memory storing instructions, which, when executed by the at least one processor, enables the at least one processor to perform the gradient heterogeneous dual optimization method in the distributed machine learning system as described above.
[0044] In another aspect of the present invention, a machine-readable storage medium is provided, which stores executable instructions, and when the instructions are executed, the machine executes the gradient heterogeneous dual optimization method in the distributed machine learning system as described above.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] (1) In the gradient heterogeneous dual optimization method in the distributed machine learning system provided by the present invention, in the local gradient optimization process, each honest node uses its local data for distributed learning, and updates and corrects the local gradient of each node in the process of continuous iterative learning and training, thereby optimizing the local gradient difference. In the global gradient optimization process, the momentum term is introduced, and the momentum vector is normalized to a unit momentum vector. The parameter server performs bucket aggregation based on the unit momentum vector, and uses the geometric median for global aggregation until the optimization goal is met, the iteration is completed, and the optimization of the global gradient difference is achieved.
[0047] (2) The present invention reduces gradient heterogeneity to a greater extent by dual optimization of local gradients and global gradients, ensuring that even under malicious node attacks, the machine learning model achieves better performance than simply reducing local gradient differences or global gradient differences, and further reduces the generalization error of the machine learning model, thereby improving the robustness of the distributed system under large-scale malicious node attacks. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flow chart of the gradient heterogeneous dual optimization method in the distributed machine learning system described in the present invention.
[0049] Figure 2 This is a comparison chart of the algorithm accuracy of the method of the present invention and the existing method without attack.
[0050] Figure 3 This is a comparison chart of the algorithm accuracy of the method of the present invention and the existing method under sign-flipping attack. DETAILED DESCRIPTION
[0051] The present disclosure is further described below in conjunction with the accompanying drawings and embodiments.
[0052] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present disclosure belongs.
[0053] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present disclosure. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0054] In the absence of conflict, the embodiments in the present disclosure and the features in the embodiments may be combined with each other.
[0055] In view of the defects of the prior art, the present invention provides a gradient heterogeneity dual optimization scheme for distributed machine learning systems, named BUM method, which aims to reduce gradient heterogeneity by dual optimization of local gradients and global gradients, thereby improving system robustness. This unique dual optimization strategy reduces gradient heterogeneity to a greater extent, ensuring that even under malicious node attacks, the machine learning model achieves better performance than simply reducing local gradient differences or global gradient differences, and further reduces the generalization error of the machine learning model, improving the robustness of the distributed system under large-scale malicious node attacks.
[0056] The following is a further description of the gradient heterogeneous dual optimization method and device in the distributed machine learning system of the present invention in conjunction with specific embodiments.
[0057] Embodiment 1,
[0058] Ginseng Figure 1 This embodiment provides a gradient heterogeneous dual optimization method in a distributed machine learning system, the method comprising:
[0059] S1. Build includes A distributed learning system with 10 nodes and a single parameter server, wherein the nodes are divided into honest nodes and malicious nodes.
[0060] Specifically, assuming Among the nodes Malicious nodes send false information to the parameter server to disrupt the normal operation of the system. Each honest node has a The local data set is a local data set of data samples, which can be evenly distributed from the classification data set (including but not limited to the COVTYPE data set), and the data samples are evenly distributed on the corresponding honest nodes.
[0061] The COVTYPE dataset contains 581,012 training data samples with p=54 dimensions, which are used for the classification of land cover types. Specifically, there are 7 different categories, representing different land cover types, such as forests, grasslands, mountains, etc. Each data sample in the COVTYPE database represents a 30×30 meter forest area in Colorado, USA. 54 digital features are used to describe some geographical and ecological attributes of this area, such as altitude, slope angle, etc. The goal is to predict which of the 7 forest cover types this forest area belongs to, which is a typical multi-class classification problem.
[0062] In this embodiment, Represents an honest node In the The global model parameters on the data samples of loss, Represents an honest node About global model parameters on its local dataset The average loss is: , =1,2... .
[0063] In this embodiment, a distributed machine learning system is established by minimizing the loss function, and its optimization goal is:
[0064] (1);
[0065] In formula (1): Represents the sum of the loss functions of the honest nodes The minimum parameter value, Indicates the total number of nodes, Indicates the number of malicious nodes.
[0066] S2. According to a preset iterative optimization method, based on the data samples selected by the honest node from its local data set, the local gradient of the data sample is calculated and corrected to iteratively optimize the local gradient difference.
[0067] In the distributed learning system, the preset iterative optimization method includes the first stage: the parameter server broadcasts the current global model to each honest node. After each honest node receives the global model, it first uses its own local data set to calculate the gradient relative to the global model, and then performs local gradient optimization locally to reduce the local gradient difference.
[0068] Specifically, each honest node Maintain a local stochastic gradient table of data samples. In the first iteration, the honest node Initialize a gradient storage for each data sample: .in, Represents an honest node On The global model parameters corresponding to the selected data samples are Represents an honest node No. The gradient corresponding to the data sample in the stochastic gradient table is represents the global model parameters at the first iteration.
[0069] In subsequent iterations, the parameter server will use the currently trained global model parameters Sent to each honest node, the honest node uniformly randomly selects an index The data sample is used to calculate its local gradient : .in, Represents an honest node In the The data sample selected at the iteration .
[0070] Then, the calculated local gradient is corrected to reduce the local gradient difference.
[0071] Specifically, the calculated local gradient is subtracted from the global gradient calculated by the parameter server in the previous iteration, and then added to the corresponding honest node The average value of all gradients in the stochastic gradient table is:
[0072] (2);
[0073] In formula (2): represents the corrected local gradient, Represents an honest node No. The local gradient of the data samples, Indicates the last iteration round The global gradient aggregated by the parameter server in , Represents an honest node The average of all gradients in the stochastic gradient table, Indicates the current iteration round, Indicates the current iteration round The global model parameters.
[0074] At the end of each local iteration, the honest nodes By storing the corrected local gradient To update the stochastic gradient table of its data samples.
[0075] S3. Introduce the momentum term. For honest nodes, combine the corrected local gradient with the corresponding momentum vector of the previous iteration round to obtain the momentum vector of the current iteration round corresponding to the honest node, and then normalize the momentum vector of the current iteration round corresponding to the honest node to a unit momentum vector and send it to the parameter server. For malicious nodes, directly send the generated malicious gradient to the parameter server, and the parameter server aggregates the unit momentum vector and the malicious gradient to obtain a local aggregation result.
[0076] This step is the second stage of the preset iterative optimization method. The momentum term is introduced. The honest node uses the corrected local gradient and the historical gradient information in the previous iteration to perform momentum calculation to further reduce the local gradient difference.
[0077] Specifically, honest nodes Combine the corrected local gradient with the momentum vector generated by the previous iteration to generate a new momentum vector, which is the momentum vector of the current iteration corresponding to the honest node:
[0078] (3);
[0079] In formula (3): Represents an honest node The corresponding current iteration round The momentum vector of Indicates the last iteration round The momentum vector of is the momentum coefficient, represents the corrected local gradient.
[0080] By introducing the momentum term, historical gradients can be accumulated to smooth and reduce the difference between the current gradient and the past gradient. Locally, this is equivalent to reducing the gap between the gradients calculated by the nodes in different iterations. When the gradients calculated by the nodes in different iterations are similar or consistent, it means that their understanding of the data and the update direction are consistent, which helps the entire system optimize the global model parameters in a more consistent direction.
[0081] Therefore, by introducing the momentum term and reducing the difference between the gradients calculated by the nodes in different iterations, the gradients calculated by each node in different iterations can be made more similar or consistent, thereby further optimizing the local gradient difference.
[0082] Furthermore, in order to control the momentum modulus and prevent the momentum from being too large and causing oscillation, in this embodiment, the momentum vector of the current iteration round of the honest node is preferably normalized to a unit momentum vector, so that each update is smoother and more stable, specifically:
[0083] (4);
[0084] In formula (4): Represents an honest node The transformed unit momentum vector, Represents an honest node Current iteration round The momentum vector of .
[0085] The main purpose of normalizing the momentum vector to a unit momentum vector is to prevent the oscillation or divergence of parameter updates caused by excessive momentum, so that each update is smoother; at the same time, by controlling the momentum size, the convergence speed is accelerated, the robustness of the algorithm is improved, numerical overflow or gradient disappearance is prevented, and the stability of the entire optimization process is enhanced.
[0086] Subsequently, the honest node sends the unit momentum vector obtained in the current iteration round to the parameter server, and the Byzantine node (malicious node) sends the malicious gradient generated directly to the parameter server. After the parameter server receives the vectors sent by all nodes, it uses the bucketing technology to locally aggregate these vectors. The bucketing technology helps to reduce the instability of communication between nodes and reduce the variance of the global gradient, thereby optimizing the global gradient difference.
[0087] The specific process of bucketing technology is as follows: First, the parameter server randomly sorts these vectors to obtain a vector sequence Then, the vector sequence The vectors in are divided into groups, each containing Finally, the parameter server performs local averaging on the vectors in each group, that is, calculates the average value of all gradients in the group to obtain the local aggregation result:
[0088] (5);
[0089] In formula (5): Indicates The group vector local aggregation result includes the unit momentum vector sent by the honest node and the malicious gradient sent by the malicious node. represents the number of vectors in each group, and ,express The honest nodes in the nodes upload a unit momentum vector to the parameter server in each iteration, and the malicious nodes upload a malicious gradient to the parameter server in each iteration, and these uploaded vectors are divided into Group, Represents a vector sequence The vectors.
[0090] S4. Globally aggregate the local aggregation results to obtain a global gradient for updating global model parameters to iteratively optimize the global gradient difference.
[0091] This step is the third stage of the preset iterative optimization method. The parameter server preferably uses the geometric median to globally aggregate the local aggregation results to obtain the global gradient:
[0092] (6);
[0093] In formula (6): represents the global gradient.
[0094] Subsequently, the obtained global gradient is used to update the global model parameters, namely:
[0095] (7);
[0096] In formula (7): represents the updated global model parameters, Represents the learning rate.
[0097] After the update is completed, a new global model is obtained, and then the new global model is broadcast to each node, and the next round of iteration is performed until the updated global model converges to a stable state or reaches the maximum number of iterations. The iteration stops, and the minimum loss function and the optimal parameter value are obtained. .
[0098] This method effectively performs dual optimization on both the "local-global" side to reduce gradient differences, thereby alleviating the negative impact of gradient heterogeneity on distributed systems and improving the robustness of distributed learning systems in the face of malicious attacks.
[0099] The following are relevant experiments to verify the effectiveness of the method of this embodiment, as follows:
[0100] The COVTYPE dataset is evenly distributed to 50 honest nodes, and 20 Byzantine nodes (malicious nodes) are additionally started. The performance of the proposed BUM method is tested under no attack and sign-flipping attack. -Regularized logistic regression cost function:
[0101] (8);
[0102] In formula (8): Represents an honest node In the The global model parameters on the data samples of loss, is the feature vector, Represents a label, the value is , , is a constant, is an exponential function.
[0103] 1) No attack: Do not use Byzantine nodes. The results are as follows Figure 2 shown.
[0104] 2) Under the sign-flipping attack: The Byzantine node sets the gradient it sends to -1 times the average value of the honest node unit momentum vector. The result is as follows Figure 3 shown.
[0105] The sign-flipping attack is to calculate the mean mu of the unit momentum vector of the honest node and set the gradient mean of the Byzantine node to -mu.
[0106] It can be seen from the experimental results that under no attack and sign-flipping attack, the accuracy of the BUM method in this embodiment is significantly higher than that of existing algorithms such as SGD, SAGA, SVRG and SARAH, which proves the importance of simultaneously optimizing local gradient differences and global gradient differences for dealing with distributed optimization problems.
[0107] In summary, in this method, each node in the distributed system uses its local data for distributed learning. In the process of continuous iterative learning and training, the local gradient of each node is updated and corrected based on the above method. At the same time, the momentum term is introduced, and the momentum vector is normalized to a unit momentum vector; the parameter server performs bucket aggregation based on the unit momentum vector and its malicious gradient, and uses the geometric median for global aggregation until the above optimization problem is satisfied, that is, the loss function is minimized. At this time, the iterative training is completed and the optimal global model parameters are obtained. In the above process, the method performs dual optimization based on gradient heterogeneity to reduce local gradient differences and global gradient differences, thereby improving the robustness of the distributed system under malicious node attacks.
[0108] Embodiment 2,
[0109] This embodiment provides a device for implementing a gradient heterogeneous dual optimization method in a distributed machine learning system, the device comprising:
[0110] Building modules, used to build A distributed learning system with nodes and a single parameter server, wherein the nodes are divided into honest nodes and malicious nodes;
[0111] A first optimization module, configured to calculate and correct the local gradient of the data sample based on the data sample selected by the honest node from its local data set according to a preset iterative optimization method, so as to iteratively optimize the local gradient difference;
[0112] An aggregation module is used to combine the corrected local gradient of the honest node with the corresponding momentum vector of the previous iteration round to obtain the momentum vector of the current iteration round corresponding to the honest node, and then normalize the momentum vector of the current iteration round corresponding to the honest node to a unit momentum vector and send it to the parameter server; for malicious nodes, directly send the generated malicious gradient to the parameter server, and the parameter server aggregates the unit momentum vector and the malicious gradient to obtain a local aggregation result;
[0113] The second optimization module is used to globally aggregate the local aggregation results to obtain a global gradient for updating global model parameters to iteratively optimize the global gradient difference.
[0114] Embodiment 3,
[0115] This embodiment also provides an electronic device, including:
[0116] at least one processor; and
[0117] A memory storing instructions, which, when executed by the at least one processor, enables the at least one processor to perform the gradient heterogeneous dual optimization method in the distributed machine learning system as described above.
[0118] In this embodiment, the electronic device may include, but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile computing devices, smart phones, tablet computers, cellular phones, personal digital assistants (PDAs), handheld devices, messaging devices, wearable computing devices, consumer electronic devices, and the like.
[0119] Embodiment 4,
[0120] This embodiment also provides a machine-readable storage medium storing executable instructions, which, when executed, enable the machine to perform the gradient heterogeneous dual optimization method in the distributed machine learning system as described above.
[0121] Specifically, a system or device equipped with a readable storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer or processor of the system or device can read and execute instructions stored in the readable storage medium.
[0122] In this case, the program code itself read from the machine-readable medium can realize the function of any one of the above embodiments, and thus the machine-readable code and the machine-readable storage medium storing the machine-readable code constitute part of this specification.
[0123] Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tapes, non-volatile memory cards, and ROMs. Optionally, the program code may be downloaded from a server computer or a cloud via a communication network.
[0124] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0125] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0126] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0127] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0128] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solution of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the claims of the present invention shall be included in the protection scope of the claims of the present invention.
Claims
1. A gradient heterogeneous dual optimization method in a distributed machine learning system, characterized in that: The method comprises: S1: Build contains A distributed learning system with nodes and a single parameter server, wherein the nodes are divided into honest nodes and malicious nodes, and each honest node has a A local data set of data samples, wherein the local data set is uniformly distributed from the COVTYPE data set used for land cover type classification tasks; S2: According to a preset iterative optimization method, based on the data sample selected by the honest node from its local data set, the local gradient of the data sample is calculated and corrected to iteratively optimize the local gradient difference, specifically: (2); In formula (2): represents the corrected local gradient, Represents an honest node No. The local gradient of the data samples, Indicates the last iteration round The global gradient aggregated by the parameter server in , Represents an honest node The average of all gradients in the stochastic gradient table, Indicates the current iteration round, Indicates the current iteration round The global model parameters of S3: Introduce the momentum term. For the honest node, combine the corrected local gradient with the corresponding momentum vector of the previous iteration round to obtain the momentum vector of the current iteration round corresponding to the honest node. Then normalize the momentum vector of the current iteration round corresponding to the honest node to a unit momentum vector and send it to the parameter server. The momentum vector of the current iteration round corresponding to the honest node is: (3); In formula (3): Represents an honest node The corresponding current iteration round The momentum vector of Indicates the last iteration round The momentum vector of is the momentum coefficient, represents the corrected local gradient; For malicious nodes, the generated malicious gradient is directly sent to the parameter server, and the parameter server aggregates the unit momentum vector and the malicious gradient to obtain a local aggregation result, which is specifically: (5); In formula (5): Indicates The group vector local aggregation result includes the unit momentum vector sent by the honest node and the malicious gradient sent by the malicious node. represents the number of vectors in each group, and ,express The honest nodes in the nodes upload a unit momentum vector to the parameter server in each iteration, and the malicious nodes upload a malicious gradient to the parameter server in each iteration, and these uploaded vectors are divided into Group, Represents a vector sequence The vectors; S4: performing global aggregation on the local aggregation results to obtain a global gradient for updating global model parameters to iteratively optimize the global gradient difference, wherein performing global aggregation on the local aggregation results is specifically as follows: (6); In formula (6): Represents the global gradient after aggregation.
2. The gradient heterogeneous dual optimization method in a distributed machine learning system according to claim 1, characterized in that: In step S1, a distributed machine learning system is established by minimizing the loss function, and its optimization goal is: (1); In formula (1): Represents the sum of the loss functions of the honest nodes The minimum parameter value, Indicates the total number of nodes, represents the number of malicious nodes; , =1,2... , Represents an honest node About global model parameters on its local dataset The average loss of , and each honest node's local data set contains data samples, Represents an honest node In the The global model parameters on the data samples loss.
3. The gradient heterogeneous dual optimization method in a distributed machine learning system according to claim 1, characterized in that: In step S3, the momentum vector of the current iteration round corresponding to the honest node is normalized to a unit momentum vector, specifically: (4); In formula (4): Represents an honest node The transformed unit momentum vector, Represents an honest node Current iteration round The momentum vector of .
4. The gradient heterogeneous dual optimization method in a distributed machine learning system according to claim 1, characterized in that: In step S4, the global gradient is obtained for updating the global model parameters to iteratively optimize the global gradient difference, specifically: (7); In formula (7): represents the global gradient after aggregation, represents the learning rate, Represents the updated global model parameters.
5. A device for implementing a gradient heterogeneous dual optimization method in a distributed machine learning system, characterized in that: The device comprises: Building modules, used to build A distributed learning system with nodes and a single parameter server, wherein the nodes are divided into honest nodes and malicious nodes, and each honest node has a A local data set of data samples, wherein the local data set is uniformly distributed from the COVTYPE data set used for land cover type classification tasks; The first optimization module is used to calculate and correct the local gradient of the data sample based on the data sample selected by the honest node from its local data set according to a preset iterative optimization method, so as to iteratively optimize the local gradient difference, specifically: (2); In formula (2): represents the corrected local gradient, Represents an honest node No. The local gradient of the data samples, Indicates the last iteration round The global gradient aggregated by the parameter server in , Represents an honest node The average of all gradients in the stochastic gradient table, Indicates the current iteration round, Indicates the current iteration round The global model parameters of The aggregation module is used to combine the corrected local gradient of the honest node with the corresponding momentum vector of the previous iteration round to obtain the momentum vector of the current iteration round corresponding to the honest node, and then normalize the momentum vector of the current iteration round corresponding to the honest node to a unit momentum vector and send it to the parameter server; wherein the momentum vector of the current iteration round corresponding to the honest node is: (3); In formula (3): Represents an honest node The corresponding current iteration round The momentum vector of Indicates the last iteration round The momentum vector of is the momentum coefficient, represents the corrected local gradient; For malicious nodes, the generated malicious gradient is directly sent to the parameter server, and the parameter server aggregates the unit momentum vector and the malicious gradient to obtain a local aggregation result, which is specifically: (5); In formula (5): Indicates The group vector local aggregation result includes the unit momentum vector sent by the honest node and the malicious gradient sent by the malicious node. represents the number of vectors in each group, and ,express The honest nodes in the nodes upload a unit momentum vector to the parameter server in each iteration, and the malicious nodes upload a malicious gradient to the parameter server in each iteration, and these uploaded vectors are divided into Group, Represents a vector sequence The vectors; The second optimization module is used to globally aggregate the local aggregation results to obtain a global gradient for updating global model parameters to iteratively optimize the global gradient difference, wherein the local aggregation results are globally aggregated, specifically: (6); In formula (6): Represents the global gradient after aggregation.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and A memory storing instructions, which, when executed by the at least one processor, causes the at least one processor to perform the gradient heterogeneous dual optimization method in a distributed machine learning system as described in any one of claims 1 to 4.
7. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores executable instructions, which, when executed, enable the machine to perform the gradient heterogeneous dual optimization method in a distributed machine learning system as described in any one of claims 1 to 4.
