Method and apparatus for evaluating model weights in distributed machine learning, and medium

By using iterative principal component analysis and iterative filtering methods, the gradient change direction is dynamically extracted and abnormal gradients are identified, thus solving the efficiency and robustness problems of model weight evaluation in high-dimensional deep learning models and achieving efficient and robust model weight evaluation.

CN122390004APending Publication Date: 2026-07-14CHINA UNITED NETWORK COMM GRP CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA UNITED NETWORK COMM GRP CO LTD
Filing Date
2026-05-09
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing technologies are not efficient for weight evaluation in distributed machine learning models under various attack scenarios and gradient changes, especially in high-dimensional deep learning models where performance degrades significantly.

Method used

Iterative principal component analysis and iterative filtering methods are adopted. The main change direction of the gradient is dynamically extracted by PCA to identify abnormal gradients and reduce the impact of high-dimensional noise. Combined with iterative updating of principal component directions, the gradient set uploaded by the working node is used for evaluation to avoid multi-stage cascaded calculations.

Benefits of technology

It improves defense performance, reduces computational overhead, and increases sample utilization efficiency in high-dimensional models. It is suitable for privacy-sensitive scenarios such as federated learning and supports fault tolerance of up to 80% attack ratio.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122390004A_ABST
    Figure CN122390004A_ABST
Patent Text Reader

Abstract

The application provides a model weight evaluation method and device in distributed machine learning, electronic equipment and computer readable storage medium, and relates to the technical field of distributed machine learning. The evaluation method comprises the following steps: obtaining an initial gradient set of a plurality of working nodes in distributed machine learning; performing iterative principal component analysis and iterative filtering on the initial gradient set to obtain a target gradient set of the plurality of working nodes; and evaluating the model weight of the plurality of working nodes according to the target gradient set. At least the problem that the related art cannot be efficiently applied to various attack situations and various gradient change situations is solved. It is suitable for weight evaluation and optimization scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of distributed machine learning, and particularly to a method, apparatus, electronic device, and computer-readable storage medium for evaluating model weights in distributed machine learning. Background Art

[0002] In the field of distributed machine learning, Byzantine fault tolerance has become an important topic for ensuring the security and stability of model training. As the model scale increases, especially in privacy-sensitive scenarios such as federated learning, the training process needs to be coordinated among multiple computing nodes, which also makes the system more vulnerable to node failures or malicious attacks.

[0003] To address such Byzantine faults, two main types of defense schemes have been developed in the prior art: one is the defense algorithms for the case where the number of attackers is less than half (q < m / 2), such as the Krum algorithm, which aggregates by selecting nodes with the smallest distance to neighboring gradients, while the geometric median mean rule uses robust statistics to enhance the anti-interference ability; these methods perform well in medium- and low-dimensional problems, but when the model dimension d increases, they will encounter severe curse of dimensionality, and their error bounds grow linearly or sub-linearly, resulting in a significant decline in the performance of the algorithm in high-dimensional deep learning models. The other type of methods attempts to break through the limitation of "half attack" and aims to handle extreme cases of any number of Byzantine nodes (q ≥ m / 2). Typical representatives include the gradient filtering strategy based on an auxiliary clean dataset and the Zeno scoring mechanism. These methods judge the credibility by comparing the gradients uploaded by nodes with the reference gradients calculated from the auxiliary data, and theoretically can continue to run in scenarios where the attacking nodes are in the majority, but their lower error bounds are usually That is, highly dependent on the number of auxiliary data; when facing the parameter space of modern deep neural networks with tens of thousands of dimensions, the demand for the number of clean samples will become unrealistic as the dimension expands, limiting its application in real scenarios.

[0004] In addition, most of the existing "semi-verified mean estimation" technologies adopt an indirect list-decodable learning framework. This type of method needs to first generate O(1 / α) candidate means, and then use O(ln(1 / α)) auxiliary samples for hypothesis screening. This staged and cascaded estimation process not only increases the computational burden but also significantly reduces the sample utilization efficiency. Under a more severe strong contamination model (where the attacker can targetedly tamper with the sample distribution), the stability and accuracy of the above methods further decline, making it difficult to handle high-dimensional Byzantine-robust learning tasks.

[0005] In summary, the related technologies cannot be efficiently applied to various attack situations and various gradient change situations. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to address the above-mentioned shortcomings of the prior art by providing a method, apparatus, electronic device and computer-readable storage medium for evaluating model weights in distributed machine learning. This method can achieve comprehensive and efficient model weight evaluation.

[0007] In a first aspect, the present invention provides a method for evaluating model weights in distributed machine learning, comprising: obtaining an initial gradient set of several worker nodes in distributed machine learning; performing iterative principal component analysis and iterative filtering on the initial gradient set to obtain a target gradient set of several worker nodes; and evaluating the model weights of several worker nodes based on the target gradient set.

[0008] Preferably, iterative principal component analysis and iterative filtering are performed on the initial gradient set to obtain target gradient sets for several working nodes. Specifically, this includes: S1, filtering out the first gradient set to be aggregated from the initial gradient set and assigning the value of i to 1, where i represents the number of filtering iterations; S2, determining the principal component and the corresponding eigenvector of the i-th gradient set to be aggregated, and judging whether the principal component is greater than or equal to a preset threshold, where the principal component is used to characterize the distribution and orientation of the i-th gradient set to be aggregated in the feature space; S3, in response to the principal component being greater than or equal to the preset threshold, filtering out the (i+1)-th gradient set to be aggregated from the i-th gradient set to be aggregated based on the principal component and the corresponding eigenvector of the i-th gradient set to be aggregated, and assigning the value of i to i+1; repeating S2-S3 until the principal component is less than the preset threshold, and determining the i-th gradient set to be aggregated as the target gradient set.

[0009] Preferably, determining the principal components and corresponding eigenvectors of the i-th gradient set to be aggregated specifically includes: calculating the mean vector and covariance matrix of the i-th gradient set to be aggregated; performing eigenvalue decomposition on the covariance matrix to extract one or more eigenvalues ​​and corresponding eigenvectors of the i-th gradient set to be aggregated; sorting the one or more eigenvalues ​​and determining the principal components of the i-th gradient set to be aggregated from the sorting results. } and the eigenvectors corresponding to the principal components.

[0010] Preferably, the process of filtering out the (i+1)th gradient set to be aggregated from the i-th gradient set to be aggregated based on the principal components and the corresponding eigenvectors of the principal components specifically includes: constructing the principal component space of the i-th gradient set to be aggregated based on the eigenvectors corresponding to the principal components; evaluating the anomaly score of each sample in the i-th gradient set to be aggregated based on the mean vector, covariance matrix, and principal component space of the i-th gradient set to be aggregated; calculating the ratio of the anomaly score of each sample in the i-th gradient set to be aggregated to the maximum anomaly score to obtain the anomaly probability of each sample in the i-th gradient set to be aggregated; and filtering out the (i+1)th gradient set to be aggregated based on the anomaly probability.

[0011] Preferably, the working nodes include one or more of the following: normal nodes and Byzantine nodes. The model weights of several working nodes are evaluated based on the target gradient set, specifically including: obtaining an auxiliary gradient set and calculating the mean vector of the auxiliary gradient set, wherein the auxiliary gradient set refers to one or more preset local gradients of the normal nodes; calculating the aggregated gradients of several working nodes based on the principal component space of the target gradient set, the mean vectors of the target gradient set and the auxiliary gradient set; and calculating the model weights of several working nodes based on the aggregated gradients.

[0012] Preferably, filtering out the first gradient set to be aggregated from the initial gradient set specifically includes: calculating the filtering threshold corresponding to the initial gradient set and the L2 norm of each sample in the initial gradient set, wherein the filtering threshold refers to the third power of the number of samples in the initial gradient set; and determining the samples in the initial gradient set whose L2 norm is less than or equal to the filtering threshold as the first gradient set to be aggregated.

[0013] Preferably, the initial gradient set includes one or more of the following: local gradients of normal nodes and contaminated data of Byzantine nodes.

[0014] Secondly, the present invention also provides an evaluation device for model weights in distributed machine learning, comprising an acquisition module, a filtering module, and an evaluation module. The acquisition module is used to acquire the initial gradient set of several working nodes in distributed machine learning. The filtering module is used to perform iterative principal component analysis and iterative filtering on the initial gradient set to obtain the target gradient set of several working nodes. The evaluation module is used to evaluate the model weights of several working nodes based on the target gradient set.

[0015] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to implement the method for evaluating model weights in distributed machine learning provided in the first aspect above.

[0016] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the method for evaluating model weights in distributed machine learning provided in the first aspect.

[0017] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for evaluating model weights in distributed machine learning. By introducing Principal Component Analysis (PCA) to dynamically extract the main change direction of gradients, it can more accurately identify anomalous gradients, reduce the impact of high-dimensional noise, and improve the defense performance of high-dimensional models (such as deep neural networks). PCA is performed using only the gradient set uploaded by the worker nodes, requiring little or no auxiliary data, making it more suitable for privacy-sensitive scenarios like federated learning where auxiliary data is scarce. Iterative filtering combines anomaly detection with the optimization process, avoiding redundant calculations in multi-stage cascades and reducing computational overhead. By iteratively updating the principal component direction, gradient information can be utilized more fully, improving sample utilization efficiency. Therefore, this invention can achieve comprehensive and efficient model weight evaluation. Attached Figure Description

[0018] Figure 1 This is a flowchart of a method for evaluating model weights in distributed machine learning according to Embodiment 1 of the present invention;

[0019] Figure 2 This is a flowchart of the method for evaluating model weights in distributed machine learning applied to the master node in Embodiment 1 of the present invention;

[0020] Figure 3 This is a flowchart illustrating how, in Embodiment 1 of the present invention, the target gradient set is determined and the model weights of several working nodes are derived from the target gradient set.

[0021] Figure 4 This is a schematic diagram of the structure of a model weight evaluation device in distributed machine learning according to Embodiment 2 of the present invention. Detailed Implementation

[0022] To enable those skilled in the art to better understand the technical solution of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0023] It is understood that the specific embodiments and accompanying drawings described herein are merely for explaining the invention and are not intended to limit the invention.

[0024] It is understood that, without conflict, the various embodiments and features in the embodiments of the present invention can be combined with each other.

[0025] It is understood that, for ease of description, only the parts related to the present invention are shown in the accompanying drawings, while the parts unrelated to the present invention are not shown in the drawings.

[0026] It is understood that each unit or module involved in the embodiments of the present invention may correspond to only one entity structure, or may be composed of multiple entity structures, or multiple units or modules may be integrated into one entity structure.

[0027] It is understood that, without conflict, the functions and steps marked in the flowcharts and block diagrams of this invention may occur in a different order than that marked in the accompanying drawings.

[0028] It is understood that the flowcharts and block diagrams of this invention illustrate the possible architecture, functions, and operations of systems, apparatuses, devices, and methods according to various embodiments of this invention. Each block in the flowchart or block diagram may represent a unit, module, program segment, or code, containing executable instructions for implementing the specified function. Furthermore, each block or combination of blocks in the block diagram and flowchart can be implemented using a hardware-based system to achieve the specified function, or using a combination of hardware and computer instructions.

[0029] It is understood that the units and modules involved in the embodiments of the present invention can be implemented by software or by hardware. For example, the units and modules can be located in a processor.

[0030] Example 1:

[0031] like Figure 1 As shown, this embodiment provides a method for evaluating model weights in distributed machine learning. The method for evaluating model weights in distributed machine learning includes:

[0032] S101, obtain the initial gradient set of several worker nodes in distributed machine learning.

[0033] Specifically, working nodes include one or more of the following: normal nodes and Byzantine nodes.

[0034] Specifically, the initial gradient set includes one or more of the following: local gradients of normal nodes and contaminated data of Byzantine nodes.

[0035] In this embodiment, worker nodes are computational units participating in distributed machine learning tasks. They are responsible for tasks such as model training, gradient calculation, and updating model parameters. Normal nodes are those that operate as expected in distributed machine learning; they can correctly execute tasks, calculate accurate gradients, and communicate effectively with other nodes. Normal nodes follow protocols and provide reliable computation results. Byzantine nodes are nodes that exhibit unreliable or malicious behavior in distributed machine learning. These nodes may send incorrect gradients, deliberately interfere with the computation process, or fail to follow protocols. Contaminated data refers to erroneous data caused by malicious behavior of malicious nodes (Byzantine nodes) or system errors.

[0036] In distributed machine learning, the method for evaluating model weights can be applied to any one of the M worker nodes, or to other nodes besides the M worker nodes, which can be called the master node. Figure 2 As shown. The initial gradient set with M working nodes. For example, the master node First send to M working nodes Broadcast parameters M worker nodes compute their own initial gradients in parallel, specifically including: the m-th worker node can calculate its initial gradient according to the formula... Calculate its initial gradient in round t. Iterative principal component analysis and iterative filtering are performed for each round based on the initial gradient of each round, where, Right now Figure 2 In , This represents the model parameters of the master node in round t, where t = 0, ..., T, and T represents the preset number of iteration rounds. If the m-th working node is a normal node, then the m-th working node will set its initial gradient. The local gradient of the m-th worker node is sent to the master node; if the m-th worker node is a Byzantine node, then the m-th worker node may maliciously construct arbitrary gradients. The dimensional vector is sent to the master node as contaminated data. If there are Byzantine nodes among the M worker nodes, then the master node receives the initial gradient sets from several worker nodes. The middle part contains outliers.

[0037] It should be noted that the master node can be embedded as a modular component into federated learning frameworks (such as GoogleFedAvg, OpenFL, Flower, FATE, etc.) as a server-side gradient processing plugin, replacing existing simple averaging or geometric median aggregation methods without changing the logic of the worker nodes, thereby significantly reducing the system transformation cost.

[0038] S102, perform iterative principal component analysis and iterative filtering on the initial gradient set to obtain the target gradient set of several working nodes.

[0039] It should be noted that the target gradient value refers to the gradient that is ultimately used to evaluate model weights in distributed machine learning.

[0040] Specifically, S102: Perform iterative principal component analysis and iterative filtering on the initial gradient set to obtain the target gradient set for several working nodes, including steps S1021-S1024:

[0041] S1021, filter out the first gradient set to be aggregated from the initial gradient set, and assign i a value of 1, where i represents the number of filtering times.

[0042] Specifically, filtering out the first gradient set to be aggregated from the initial gradient set includes: calculating the filtering threshold corresponding to the initial gradient set and the L2 norm of each sample in the initial gradient set, where the filtering threshold refers to the number of samples in the initial gradient set. The first gradient set to be aggregated is determined by the first set of gradients whose L2 norm is less than or equal to the filtering threshold.

[0043] In this embodiment, from Delete the satisfied samples The first gradient set to be aggregated is obtained. .

[0044] S1022, determine the principal components of the i-th gradient set to be aggregated, the eigenvectors corresponding to the principal components, and determine whether the principal components are greater than or equal to a preset threshold. The principal components are used to characterize the distribution and direction of the i-th gradient set to be aggregated in the feature space.

[0045] Specifically, determining the principal components and corresponding eigenvectors of the i-th gradient set to be aggregated includes: calculating the mean vector and covariance matrix of the i-th gradient set to be aggregated; performing eigenvalue decomposition on the covariance matrix to decompose one or more eigenvalues ​​and corresponding eigenvectors of the i-th gradient set to be aggregated; sorting the one or more eigenvalues ​​and determining the principal components and corresponding eigenvectors of the i-th gradient set to be aggregated from the sorting results.

[0046] In this embodiment, according to the formula , Calculate the i-th gradient set to be aggregated. mean vector Covariance Matrix According to the formula ,right Perform eigenvalue decomposition (i.e., spectral decomposition) and output one or more eigenvalues ​​corresponding to the i-th gradient set to be aggregated. One or more eigenvalues The corresponding feature vectors ,in, Represents the covariance matrix The eigenvalue diagonal matrix (arranged in descending order). , This indicates the number of eigenvalues. Principal components typically correspond to the largest eigenvalues ​​because they represent the largest variance or the most important information in the dataset. Therefore, this embodiment uses a preset p-value to determine the number of eigenvalues. , Determine the principal components of the i-th gradient set to be aggregated. and principal components Corresponding feature vector ,in, For the preset less than or equal to Positive integers. This embodiment obtains the statistical characteristics of the current gradient set to be aggregated by calculating the mean and covariance, thereby preparing for spectral decomposition and improving the accuracy of principal components and the eigenvectors corresponding to the principal components.

[0047] It should be noted that, typically, the p-value can be fixed or dynamically determined based on certain criteria (such as the cumulative explained variance ratio). This embodiment can pre-set a fixed p-value based on experience or specific needs; for example, if the first two principal components are considered sufficient to describe most of the data variation, then p=2 can be set. Alternatively, the p-value can be dynamically determined, for example, based on the cumulative explained variance ratio to determine how many principal components to retain until the cumulative explained variance reaches a certain threshold.

[0048] S1023, in response to the principal component being greater than or equal to a preset threshold, filter out the (i+1)th gradient set to be aggregated from the i-th gradient set to be aggregated based on the principal component of the i-th gradient set to be aggregated and the feature vector corresponding to the principal component, and assign i to the value i+1.

[0049] In this embodiment, a preset threshold is used. For example, when Greater than or equal to Then, based on the principal components of the i-th gradient set to be aggregated... and principal components Corresponding feature vector From the i-th gradient set to be aggregated Filter out the (i+1)th gradient set to be aggregated ,in, Represents the covariance matrix Dimensions This represents the preset hyperparameters. Represents eigenvalues The standard deviation.

[0050] Specifically, based on the principal components and corresponding eigenvectors of the i-th gradient set to be aggregated, the (i+1)-th gradient set to be aggregated is filtered out from the i-th gradient set to be aggregated. This includes: constructing the principal component space of the i-th gradient set to be aggregated based on the eigenvectors corresponding to the principal components; evaluating the anomaly score of each sample in the i-th gradient set to be aggregated based on the mean vector, covariance matrix, and principal component space of the i-th gradient set to be aggregated; calculating the ratio of the anomaly score of each sample in the i-th gradient set to be aggregated to the maximum anomaly score to obtain the anomaly probability of each sample in the i-th gradient set to be aggregated; and filtering out the (i+1)-th gradient set to be aggregated based on the anomaly probability.

[0051] In this embodiment, according to Construct the principal component space of the i-th gradient set to be aggregated According to the formula Calculate The abnormal scores of each sample in the sample, among which, Represents the m-th sample Anomaly scoring. Based on anomaly probability. Remove samples from the i-th gradient set to be aggregated, and filter out the (i+1)-th gradient set to be aggregated, where... .

[0052] S1024, repeat S1022-S1023 until the principal component is less than the preset threshold, and determine the i-th gradient set to be aggregated as the target gradient set.

[0053] In this embodiment, when Greater than or equal to Then the i-th gradient set to be aggregated Determined as the target gradient set .

[0054] S103 evaluates the model weights of several working nodes based on the target gradient set.

[0055] In this embodiment, within the context of machine learning and deep learning, model weights (or parameters) are the specific values ​​of each neuron or layer in the model, determining how the model processes input data and produces output. The target gradient set, on the other hand, is the gradient value calculated for each worker node (i.e., each parameter or layer) during training. These gradient values ​​guide parameter updates to reduce the value of the loss function (i.e., the model's error). Therefore, after iteratively performing principal component analysis and principal component filtering on the initial gradient sets of several worker nodes to obtain the target gradient sets for those nodes, this embodiment can deduce the model weights for those worker nodes from the target gradient sets, such as... Figure 3 As shown.

[0056] Specifically, S103: Evaluate the model weights of several working nodes based on the target gradient set, including steps S1031-S1033:

[0057] S1031, Obtain the auxiliary gradient set and calculate the mean vector of the auxiliary gradient set, where the auxiliary gradient set refers to one or more preset local gradients of the normal node.

[0058] In this embodiment, an auxiliary gradient set is used. For example, in this embodiment, the same logic applies to calculating the i-th gradient set to be aggregated. mean vector Calculate the mean vector of the auxiliary gradient set. ,in, This represents the total number of samples in the auxiliary dataset.

[0059] It should be noted that the required auxiliary gradient set is extremely small (<1%) and does not rely on large-scale pre-labeled samples, which is consistent with the actual environment of scarce and heterogeneous data in enterprise-level real applications. This embodiment has made breakthroughs in several key indicators such as high-dimensional noise suppression, auxiliary sample minimization and computational efficiency optimization, and has the ability to significantly improve model convergence and analysis accuracy in high attack rate and high-dimensional data scenarios.

[0060] S1032, calculate the aggregate gradient of several working nodes based on the principal component space of the target gradient set, the mean vector of the target gradient set and the auxiliary gradient set.

[0061] In this embodiment, according to the formula Calculate the aggregate gradient of several working nodes. ,in, Denotes the principal component space of the target gradient set. This represents the mean vector of the target gradient set. This represents the identity matrix. This embodiment separates the difficult-to-estimate mean component using subspace identification technology, then corrects the mean component using an auxiliary gradient set, while directly using the sample mean of untrusted data in other directions. This significantly reduces the dependence on dimensionality while ensuring robustness against Byzantine attacks.

[0062] S1033 calculates the model weights of several working nodes based on the aggregated gradient.

[0063] In this embodiment, according to the formula Calculate the model weights of the master node in round t+1, where, This represents the preset learning rate. This represents the aggregated gradient calculated based on the target gradient set of several working nodes in round t. , Let represent the principal component space of the target gradient set obtained after iterative principal component analysis and iterative filtering of the initial gradient set of several working nodes in round t. This represents the mean vector of the target gradient set obtained after iterative principal component analysis and iterative filtering of the initial gradient set of several worker nodes in round t. In this embodiment, the model weights of the master node in round T are determined as the model weights of several worker nodes and distributed to them.

[0064] It should be noted that the specific implementation code for the model weight evaluation method in distributed machine learning in this embodiment includes the following:

[0065] Algorithm 1:Semi verified mean estimation

[0066] Input: Large corrupted dataset small clean dataset

[0067] Output: Estimated mean

[0068] Parameter:

[0069] Initialize ;

[0070] ;

[0071] while True do

[0072] Calculate sample mean and sample covariance using (2) and(3);

[0073] Conduct spectral decomposition of , such that , with

[0074] ;

[0075] If then

[0076] Let , in which is the first columns of ;

[0077] For each , calculate using (4);

[0078] ;

[0079] For each , remove from with probability ;

[0080] Else

[0081] break;

[0082] end

[0083] end

[0084] Calculate ;

[0085] ;

[0086] Return ;

[0087] Algorithm 2: Robust Distributed Gradient Descent

[0088] Input : Master machine , working machines

[0089] Output : Estimated weight

[0090] Parameter : Initial weight parameter , step length ,algorithm parameters

[0091] For do

[0092] Master machine: broadcast current parameter to all workingmachines;

[0093] For in parallel do

[0094] Worker machine : compute local gradients using (20);

[0095] If is normal machine then

[0096] Send to master;

[0097] else

[0098] send arbitrary dimensional vector to master;

[0099] end

[0100] end

[0101] Master machine: Receive from each working machine;

[0102] Calculate aggregated gradient using Algorithm 1 in which , is the clean dataset stored in the master, with parameter ;

[0103] Update parameter ;

[0104] End.

[0105] Experiments were conducted using standard image classification datasets such as CIFAR-10 and MNIST, and tested on ResNet-18 and 2-layer CNN deep neural network models. When facing various attack types (including random attacks, directional attacks, and adaptive attacks), the proposed method maintained significantly better model accuracy and stability than existing methods (such as Krum, Geometric Median, Zeno, NormCap, etc.) even under extreme conditions with an attack ratio as high as 80%. Especially in high-dimensional models (such as ResNet), traditional methods rapidly degrade in performance, while this embodiment effectively reduces the impact of dimensionality on error through low-dimensional subspace projection and spectral filtering mechanisms, achieving suppression of high-dimensional noise and improved robust learning capabilities. Theoretical analysis shows that it achieves minimum-maximum statistical rate under both additive and strong contamination models, with high computational efficiency. Experiments verified its superior performance on synthetic and real data, especially significantly outperforming existing methods in high-dimensional scenarios. Furthermore, this embodiment supports extreme fault tolerance with an attack ratio as high as 80%, making it suitable for scenarios with extremely high security requirements, such as banking, healthcare, and government. Given the current trend of increasingly distributed large-scale artificial intelligence models and increasingly heterogeneous system deployments, the technical solution provided in this embodiment can effectively bridge the contradiction between "high-performance computing" and "robust security assurance" and has broad practical application potential.

[0106] This embodiment provides a method for evaluating model weights in distributed machine learning. By introducing principal component analysis to dynamically extract the main change direction of the gradient, it can more accurately identify abnormal gradients, reduce the impact of high-dimensional noise, and improve the defense performance of high-dimensional models (such as deep neural networks). Principal component analysis is performed using only the gradient set uploaded by the worker nodes, requiring little or no auxiliary data. This is more suitable for privacy-sensitive scenarios such as federated learning where auxiliary data is scarce. Iterative filtering combines anomaly detection with the optimization process, avoiding redundant calculations in multi-stage cascades and reducing computational overhead. By iteratively updating the principal component direction, gradient information can be utilized more fully, improving sample utilization efficiency and achieving comprehensive, efficient, and applicable model weight evaluation.

[0107] Example 2:

[0108] like Figure 4 As shown, this embodiment also provides a device for evaluating model weights in distributed machine learning, including an acquisition module 21, a filtering module 22, and an evaluation module 23. The acquisition module 21 is used to acquire the initial gradient set of several working nodes in distributed machine learning. The filtering module 22 is used to perform iterative principal component analysis and iterative filtering on the initial gradient set to obtain the target gradient set of several working nodes. The evaluation module 23 is used to evaluate the model weights of several working nodes based on the target gradient set.

[0109] Specifically, the filtering module 22 includes: a first filtering unit 221, a first determining unit 222, a second filtering unit 223, and a second determining unit 224. The first filtering unit 221 is used to filter out the first gradient set to be aggregated from the initial gradient set and assign the value of i to 1, where i represents the number of filtering. The first determining unit 222 is used to determine the principal component and the feature vector corresponding to the principal component of the i-th gradient set to be aggregated, and to determine whether the principal component is greater than or equal to a preset threshold, where the principal component is used to characterize the distribution and direction of the i-th gradient set to be aggregated in the feature space. The second filtering unit 223 is used to filter out the (i+1)-th gradient set to be aggregated from the i-th gradient set to be aggregated according to the principal component and the feature vector corresponding to the principal component, in response to the principal component being greater than or equal to the preset threshold, and assign the value of i to i+1. The second determining unit 224 is used to determine the i-th gradient set to be aggregated as the target gradient set until the principal component is less than the preset threshold.

[0110] Specifically, the first determining unit 222 includes: a first calculation subunit, a decomposition subunit, and a first determining subunit. The first calculation subunit is used to calculate the mean vector and covariance matrix of the i-th gradient set to be aggregated. The decomposition subunit is used to perform eigenvalue decomposition on the covariance matrix to decompose one or more eigenvalues ​​corresponding to the i-th gradient set to be aggregated and the eigenvectors corresponding to the one or more eigenvalues. The first determining subunit is used to sort the one or more eigenvalues ​​and determine the principal components of the i-th gradient set to be aggregated and the eigenvectors corresponding to the principal components from the sorting results.

[0111] Specifically, the second filtering unit 223 includes: a construction subunit, an evaluation subunit, a second calculation subunit, and a filtering subunit. The construction subunit is used to construct the principal component space of the i-th gradient set to be aggregated based on the feature vectors corresponding to the principal components. The evaluation subunit is used to evaluate the anomaly score of each sample in the i-th gradient set to be aggregated based on the mean vector, covariance matrix, and principal component space of the i-th gradient set to be aggregated. The second calculation subunit is used to calculate the ratio of the anomaly score of each sample in the i-th gradient set to be aggregated to the maximum anomaly score, thereby obtaining the anomaly probability of each sample in the i-th gradient set to be aggregated. The filtering subunit is used to filter out the (i+1)-th gradient set to be aggregated from the i-th gradient set to be aggregated based on the anomaly probability.

[0112] Specifically, the evaluation module 23 includes: an acquisition unit 231, a first calculation unit 232, and a second calculation unit 233. The acquisition unit 231 is used to acquire an auxiliary gradient set and calculate the mean vector of the auxiliary gradient set, wherein the auxiliary gradient set refers to one or more preset local gradients of normal nodes. The first calculation unit 232 is used to calculate the aggregate gradient of several working nodes based on the principal component space of the target gradient set, the mean vector of the target gradient set and the auxiliary gradient set. The second calculation unit 233 is used to calculate the model weights of several working nodes based on the aggregate gradient.

[0113] Specifically, the first filtering unit 221 includes: a third calculation subunit and a second determination subunit. The third calculation subunit is used to calculate the filtering threshold corresponding to the initial gradient set and the L2 norm of each sample in the initial gradient set, wherein the filtering threshold refers to the third power of the number of samples in the initial gradient set. The second determination subunit is used to determine the samples in the initial gradient set whose L2 norm is less than or equal to the filtering threshold as the first gradient set to be aggregated.

[0114] Understandably, the above-described apparatus for evaluating model weights in distributed machine learning executes the method for evaluating model weights in distributed machine learning corresponding to Embodiment 1 provided above. Therefore, the beneficial effects it can achieve can be referred to the beneficial effects of the scheme corresponding to the method for evaluating model weights in distributed machine learning in Embodiment 1 provided above, and will not be repeated here.

[0115] Example 3:

[0116] This embodiment also provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor is configured to run the computer program to implement the model weight evaluation method in distributed machine learning as described in Embodiment 1 above.

[0117] Example 4:

[0118] This embodiment also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the method for evaluating model weights in distributed machine learning as described in Embodiment 1 above.

[0119] It is understood that the above embodiments are merely exemplary implementations used to illustrate the principles of the present invention, and the present invention is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. A method for evaluating model weights in distributed machine learning, characterized in that, include: Obtain the initial gradient set of several worker nodes in distributed machine learning; Iterative principal component analysis and iterative filtering are performed on the initial gradient set to obtain the target gradient set for several working nodes; The model weights of several working nodes are evaluated based on the target gradient set.

2. The method for evaluating model weights in distributed machine learning according to claim 1, characterized in that, The iterative principal component analysis and iterative filtering of the initial gradient set to obtain the target gradient set for several working nodes specifically includes: S1, filter out the first gradient set to be aggregated from the initial gradient set, and assign the value 1 to i, where i represents the number of filtering times; S2, determine the principal component of the i-th gradient set to be aggregated, the feature vector corresponding to the principal component, and determine whether the principal component is greater than or equal to the preset threshold. The principal component is used to characterize the distribution and direction of the i-th gradient set to be aggregated in the feature space. S3, in response to the principal component being greater than or equal to a preset threshold, filter out the (i+1)th gradient set to be aggregated from the i-th gradient set to be aggregated based on the principal component of the i-th gradient set to be aggregated and the feature vector corresponding to the principal component, and assign i to the value i+1; Repeat S2-S3 until the principal components are less than the preset threshold, and then determine the i-th gradient set to be aggregated as the target gradient set.

3. The method for evaluating model weights in distributed machine learning according to claim 2, characterized in that, The determination of the principal components of the i-th gradient set to be aggregated and the corresponding feature vectors of the principal components specifically includes: Calculate the mean vector and covariance matrix of the i-th gradient set to be aggregated; Perform eigenvalue decomposition on the covariance matrix to extract one or more eigenvalues ​​corresponding to the i-th gradient set to be aggregated, and the eigenvectors corresponding to the one or more eigenvalues ​​respectively. Sort one or more eigenvalues ​​and determine the principal components of the i-th gradient set to be aggregated and the corresponding eigenvectors of the principal components from the sorting results.

4. The method for evaluating model weights in distributed machine learning according to claim 3, characterized in that, Based on the principal components of the i-th gradient set to be aggregated and the corresponding eigenvectors of the principal components, filter out the (i+1)-th gradient set to be aggregated from the i-th gradient set to be aggregated, including: Based on the eigenvectors corresponding to the principal components, construct the principal component space of the i-th gradient set to be aggregated; Based on the mean vector, covariance matrix, and principal component space of the i-th gradient set to be aggregated, the anomaly score of each sample in the i-th gradient set to be aggregated is evaluated. Calculate the ratio of the anomaly score of each sample in the i-th gradient set to be aggregated to the maximum anomaly score to obtain the anomaly probability of each sample in the i-th gradient set to be aggregated. Based on the anomaly probability, filter out the (i+1)th gradient set to be aggregated from the i-th gradient set to be aggregated.

5. The method for evaluating model weights in distributed machine learning according to claim 4, characterized in that, Working nodes include one or more of the following: normal nodes, Byzantine nodes, The process of evaluating the model weights of several working nodes based on the target gradient set specifically includes: Obtain the auxiliary gradient set and calculate the mean vector of the auxiliary gradient set, where the auxiliary gradient set refers to one or more preset local gradients of the normal node; Based on the principal component space of the target gradient set, the mean vector of the target gradient set and the auxiliary gradient set, the aggregate gradient of several working nodes is calculated. The model weights of several working nodes are calculated based on the aggregated gradient.

6. The method for evaluating model weights in distributed machine learning according to claim 2, characterized in that, The step of filtering out the first set of gradients to be aggregated from the initial gradient set specifically includes: Calculate the filtering threshold corresponding to the initial gradient set and the L2 norm of each sample in the initial gradient set, where the filtering threshold refers to the third power of the number of samples in the initial gradient set. Samples in the initial gradient set whose L2 norm is less than or equal to the filtering threshold are identified as the first gradient set to be aggregated.

7. The method for evaluating model weights in distributed machine learning according to claim 1, characterized in that, The initial gradient set includes one or more of the following: local gradients of normal nodes and contaminated data of Byzantine nodes.

8. A device for evaluating model weights in distributed machine learning, characterized in that, It includes an acquisition module, a filtering module, and an evaluation module. The acquisition module is used to obtain the initial gradient set of several worker nodes in distributed machine learning. The filtering module performs iterative principal component analysis and iterative filtering on the initial gradient set to obtain the target gradient set for several working nodes. The evaluation module is used to evaluate the model weights of several working nodes based on the target gradient set.

9. An electronic device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to implement a method for evaluating model weights in distributed machine learning as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a method for evaluating model weights in distributed machine learning as described in any one of claims 1 to 7.