Global model weight updating method and device for federated learning, electronic equipment and storage medium

By employing a two-way feature evaluation and trust scoring mechanism, the problem of poor robustness in federated learning defenses is addressed, enabling the identification and suppression of malicious clients and improving the system's security and stability in non-independent, identically distributed environments.

CN122133716APending Publication Date: 2026-06-02CHINA ELECTRONICS STANDARDIZATION INST

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA ELECTRONICS STANDARDIZATION INST
Filing Date
2026-02-04
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing federated learning defense methods are not robust to complex attacks and are difficult to defend against malicious client model poisoning and data pollution. Especially in non-independent and identically distributed environments, trust assessment is easily affected by fluctuations in data distribution, resulting in poor defense performance.

Method used

A bidirectional feature evaluation system is adopted. By calculating the distance between model weights and update values, and combining encoder-decoder networks and Actor-Critic reinforcement learning, a trust scoring mechanism is constructed to dynamically adjust the client's trust score. Based on historical accumulated trust scores, a weighted aggregation is performed to enhance the robustness of model updates.

Benefits of technology

It effectively defends against complex attacks, reduces the influence of malicious clients, improves the stability and security of federated learning in non-independent and identically distributed environments, and ensures that the contributions of compliant clients dominate global model updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122133716A_ABST
    Figure CN122133716A_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, electronic device, and storage medium for updating global model weights in federated learning, relating to the field of federated learning technology. The method includes: determining a first distance between the client's local model weights and the server's baseline model weights, and a second distance between the client's local model update amount and the server's baseline model update amount; determining the change in the client's trust score based on the first and second distances, and determining the client's current cumulative trust score based on the client's historical cumulative trust score and the change in trust score; weighted summing of the local model update amounts of each client based on their current cumulative trust scores to obtain the global model weight update amount; and determining the current global model weight based on the global model weight update amount and the historical global model weights obtained from the previous training round. This invention enhances the robustness and stability of federated learning defenses in non-independent and identically distributed environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of federated learning technology, and in particular to a method, apparatus, electronic device, and storage medium for updating global model weights in federated learning. Background Technology

[0002] Federated learning, as a privacy-preserving distributed collaborative machine learning paradigm, allows participants to collaboratively optimize a global model without exchanging their local raw data, effectively resolving the conflict between data silos and privacy compliance. However, its distributed nature and parameter interaction mechanism inherently expose the system to security threats such as model poisoning and data contamination. Malicious participants may launch backdoor attacks by covertly tampering with local model parameters or training samples, severely damaging the performance and reliability of the global model.

[0003] Existing technologies typically employ aggregation mechanisms based on trust metrics to defend against attacks, such as the FLTrust framework. This approach requires the server to maintain a small-scale root dataset as a trust benchmark, calculate the cosine similarity between server-side updates and client-side local updates, and dynamically assign aggregation weights accordingly. This method primarily relies on single-dimensional gradient direction consistency detection and normalizes the model update vector, attempting to reduce the impact of anomalous behavior on the global model by limiting the update magnitude.

[0004] However, existing technologies rely solely on gradient direction similarity, making it difficult to defend against carefully designed attacks that maliciously mimic the server's update direction, such as CCS (Circumventing Cosine Similarity) attacks. Furthermore, distributional biases in the root dataset can easily invalidate the trust benchmark. In addition, single-round trust assessments are susceptible to misjudgments due to fluctuations in non-independent identically distributed (Non-IID) data. These factors collectively contribute to the poor robustness of existing federated learning defenses. Summary of the Invention

[0005] This invention provides a method, apparatus, electronic device, and storage medium for updating global model weights in federated learning, in order to solve the technical problem of poor robustness of federated learning defenses in the prior art.

[0006] This invention provides a global model weight update method for federated learning, comprising: Get the local model weights and local model update amount after the client performs this round of local model training, and the baseline model weights and baseline model update amount after the server performs this round of local model training; Determine the first distance between the local model weights and the baseline model weights, and the second distance between the local model update amount and the baseline model update amount, respectively; The change in the client's trust score is determined based on the first distance and the second distance, and the current cumulative trust score of the client is determined based on the client's historical cumulative trust score and the change in the trust score. The local model update amounts of each client are weighted and summed based on the current cumulative trust scores of each client to obtain the global model weight update amount; the weight of the local model update amount increases with the corresponding current cumulative trust scores. The current global model weights are determined based on the global model weight update amount and the historical global model weights obtained from the previous training round.

[0007] According to a global model weight update method for federated learning provided by the present invention, obtaining the local model update amount includes: Get the size of the local dataset for each client; Determine a first ratio between the size of the local dataset and the sum of the sizes of the individual local datasets; The local model update amount is determined based on the first ratio, the historical global model weight, and the local model weight.

[0008] According to a global model weight update method for federated learning provided by the present invention, obtaining the update amount of the baseline model includes: Get the local dataset size for each client and the root dataset size for the server; Determine a second ratio between the size of the root dataset and the sum of the sizes of the individual local datasets; The update amount of the baseline model is determined based on the second ratio, the historical global model weight, and the baseline model weight.

[0009] According to the global model weight update method of federated learning provided by the present invention, the first distance or the second distance includes at least one of cosine similarity, Wasserstein distance, entropy distance, Lp norm and statistical distance.

[0010] According to a global model weight update method for federated learning provided by the present invention, the step of determining the change in the client's trust score based on the first distance and the second distance includes: The hidden state representations of the first distance and the second distance are extracted using an encoder; The hidden state representation is decoded by a decoder to obtain the change in the trust score.

[0011] According to a global model weight update method for federated learning provided by the present invention, the step of decoding the hidden state representation through a decoder includes: Total number of training rounds; Before the training rounds reach a preset number, the hidden state representation is decoded using a supervised learning-based decoder. After the training rounds reach a preset number, the hidden state representation is decoded using a decoder based on Actor-Critic reinforcement learning, and the training rounds are reset to zero.

[0012] According to a global model weight update method for federated learning provided by the present invention, the step of determining the current cumulative trust score of the client based on the client's historical cumulative trust score and the change in the trust score includes: If the change in the trust score is less than or equal to zero, then the historical cumulative trust score is used as the current cumulative trust score. If the change in the trust score is greater than zero, then the current cumulative trust score is obtained by summing the historical cumulative trust score and the change in the trust score.

[0013] The present invention also provides a global model weight update device for federated learning, comprising: The data acquisition module is used to acquire the local model weights and local model update amount after the client performs this round of local model training, and the baseline model weights and baseline model update amount after the server performs this round of local model training. The first determining module is used to determine the first distance between the local model weights and the benchmark model weights, and the second distance between the local model update amount and the benchmark model update amount, respectively; The second determining module is used to determine the change in the client's trust score based on the first distance and the second distance, and to determine the client's current cumulative trust score based on the client's historical cumulative trust score and the change in the trust score. The weighted aggregation module is used to perform a weighted summation of the local model update amounts of each client based on the current cumulative trust score of each client, to obtain the global model weight update amount; the weight of the local model update amount increases with the corresponding current cumulative trust score. The third determining module is used to determine the current global model weight based on the historical global model weights and the global model weight update amount.

[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a global model weight update method for federated learning as described above.

[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a global model weight update method for federated learning as described above.

[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a global model weight update method for federated learning as described above.

[0017] The global model weight update method, apparatus, electronic device, and storage medium for federated learning provided by this invention construct a more comprehensive client behavior profile by measuring the bidirectional feature divergence between model weights and model update volume. This makes it difficult for malicious clients to disguise themselves in both the parameter space and update direction, effectively defending against complex attacks such as CCS. At the same time, the adoption of a trust scoring mechanism based on historical accumulation smooths out the score fluctuations caused by differences in single-round data distribution, reduces uncertainty, and enhances the robustness and stability of federated learning defense in non-independent and identically distributed (Non-IID) environments. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating the global model weight update method for federated learning provided by this invention.

[0020] Figure 2 This is a schematic diagram of the global model weight update device for federated learning provided by the present invention.

[0021] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0023] First, we will introduce several federal learning defense schemes.

[0024] The first approach is based on the geometric median, which reduces the impact of outliers and improves the robustness of the federated learning system by calculating the median of the coordinates updated in the client model. The specific implementation of this approach relies on: a multi-dimensional coordinate median calculation algorithm; a distance-based outlier detection mechanism; and defense strategies against median shift attacks.

[0025] The second approach is the FLTrust framework, which innovatively pioneers a trust-weighted aggregation framework: a cosine similarity measure between the client's update and the server-computed reference gradient; and dynamic aggregation weight allocation based on trust scores. The specific implementation of this approach relies on: a small-scale root dataset maintained on the server as a trust benchmark; directional similarity evaluation between the server's model update and the client's local model update; cosine similarity as a trust scoring mechanism; and normalization processing of the local model update magnitude, projecting the client update onto a spherical space.

[0026] The third approach is based on clustering, which identifies malicious clients through cluster analysis and identifies malicious models as statistical outliers. This approach relies on: a feature space clustering algorithm for client model updates; a density-based anomaly detection method; and the statistical assumption that the number of malicious clients is less than half.

[0027] The first approach described above is relatively vulnerable to median shift attacks, as attackers can manipulate the median calculation results through carefully designed parameter modifications; it also requires prior knowledge of the maximum number of malicious clients. In terms of performance, median calculation in large parameter spaces has high computational complexity, making it unsuitable for deep neural network models; and it is inefficient for updating high-dimensional models.

[0028] In terms of functionality, FLTrust relies on the server maintaining a small but class-complete dataset, which reduces its availability; the distribution bias of the root dataset may cause the trust benchmark to fail. In terms of performance, cosine similarity calculation and model update normalization operations significantly increase computational complexity, increasing single-round training time by 40%-60%; the server needs additional storage and maintenance of the root dataset, increasing system resource consumption. In terms of security, a well-designed CCS attack can bypass the cosine similarity detection mechanism; malicious clients can impersonate benign clients by mimicking the server's update direction.

[0029] The third approach described above has limitations in functionality. Firstly, the clustering method assumes that the number of malicious clients is less than half, which may not hold true in real-world attack scenarios. Secondly, its ability to identify behavioral patterns in clients with non-convex distributions is limited. Thirdly, in terms of security, malicious clients engaging in coordinated attacks can evade detection by forming clusters. Finally, this method is poorly adaptable to dynamically changing attack strategies.

[0030] The following is combined with Figures 1 to 3 The present invention describes a global model weight update method, apparatus, electronic device, and storage medium for federated learning.

[0031] Figure 1 This is a flowchart illustrating the global model weight update method for federated learning provided by this invention, as shown below. Figure 1 As shown, the method includes, but is not limited to, steps S1, S2, S3, S4 and S5.

[0032] Step S1: Obtain the local model weights and local model update amount after the client performs this round of local model training, and the baseline model weights and baseline model update amount after the server performs this round of local model training.

[0033] This invention involves multiple rounds of model training. Before training, the global model weights need to be randomly initialized. The cumulative trust score for each client is initialized to 0.

[0034] During the t-th training round, the server will use the global model weights obtained from the (t-1)-th training round. Broadcast to all clients. The i-th client will be based on... In local dataset This round will be conducted on the above. Secondary local model training to obtain local model weights and the local model weights Local dataset Size and Send to the server. This invention will consider the size of each client's local dataset and the weights of the local model. and global model weights Calculate the local model update volume for each client. Local model update volume Weights for the local model Compared to the previous round of global model weights The vector of change.

[0035] After receiving the parameters sent by each client, the server will base its actions on... In the root dataset This round will be conducted on the above. Sublocal model training yields the baseline model weights. This invention will adjust the size of each client's local dataset and the root dataset accordingly. Size, baseline model weights and global model weights Computation server baseline model update Baseline model update volume Weights for the baseline model Compared to the previous round of global model weights The vector of change.

[0036] Step S2: Determine the first distance between the local model weights and the baseline model weights, and the second distance between the local model update amount and the baseline model update amount.

[0037] The first distance can represent the weights of the local model. Weights of the benchmark model The differences between them are: the first distance, which measures the feature divergence in the weight domain; and the second distance, which characterizes the amount of local model updates. Update amount compared to baseline model The difference between them, the second distance is the feature divergence measure in the gradient domain.

[0038] Step S3: Determine the change in the client's trust score based on the first distance and the second distance, and determine the client's current cumulative trust score based on the client's historical cumulative trust score and the change in trust score.

[0039] The first and second distances corresponding to the i-th client can be used as inputs, and the change in the trust score of the i-th client can be calculated using a preset evaluation algorithm or function. When the first and second distances are small, the change in trust score should be positive, indicating that the client's trustworthiness needs to be improved; when the first and second distances are large, the change in trust score should be negative, indicating that the client's trustworthiness needs to be reduced.

[0040] Alternatively, the historical cumulative trust score obtained from the (t-1)th round of training can be directly used. Change in trust rating Summing the results yields the current cumulative trust score for the i-th client. The cumulative trust score is used to quantify the data quality and the credibility of the model's contributions from the client.

[0041] Step S4: Based on the current cumulative trust score of each client, the local model update amount of each client is weighted and summed to obtain the global model weight update amount; the weight of the local model update amount increases with the corresponding current cumulative trust score.

[0042] Understandably, the current cumulative trust score Higher-end clients have higher local model update frequency. The greater the weight when summing, the smaller the weight; conversely, the smaller the weight.

[0043] In one embodiment, the global model weight update amount The calculation formula can be: ; Where N is the number of clients. Local model update amount The weight.

[0044] Step S5: Determine the current global model weights based on the global model weight update amount and the historical global model weights obtained from the previous training round.

[0045] Optionally, the global model weights can be updated. and historical global model weights Summing is performed to obtain the current global model weights. Due to the weight of local model updates. According to the corresponding current cumulative trust score The cumulative trust score increases, and the higher the cumulative trust score of a client, the greater the contribution of its local model update to the global model weight; conversely, the lower the cumulative trust score of a client, the smaller the contribution of its local model update to the global model weight.

[0046] In other words, when updating the global model, this invention will retain more client contributions that are close to the baseline model and have high credibility, ensuring the dominant role of compliant clients in the global model, while suppressing client contributions that are far from the baseline model and have low credibility, thereby defending against attacks from malicious clients.

[0047] As described above, this invention constructs a more comprehensive client behavior profile through a bidirectional feature divergence measurement of model weights and model update volume. This makes it difficult for malicious clients to simultaneously impersonate each other in the parameter space and update direction, effectively defending against complex attacks such as CCS. Simultaneously, the adoption of a trust scoring mechanism based on historical accumulation smooths out score fluctuations caused by differences in single-round data distribution, reducing uncertainty and enhancing the robustness and stability of federated learning defenses in non-independent identically distributed (Non-IID) environments. Non-independent identically distributed (NID) refers to the uneven distribution of data among different clients, a common data distribution pattern in real-world federated learning scenarios.

[0048] In one embodiment, step S1, obtaining the local model update amount, may further include: Get the size of the local dataset for each client; Determine the first ratio between the size of the local dataset and the sum of the sizes of the individual local datasets; The local model update amount is determined based on the first ratio, the historical global model weights, and the local model weights.

[0049] Local model update volume The calculation formula can be: ; The local model update calculated by this formula includes not only the direction of change in the local model weights, but also the weight information of the client data scale.

[0050] This invention precisely quantifies the update contribution each client should make based on its data size by introducing the ratio of the local dataset size to the total dataset size as a scaling factor. This standardized method for calculating local model update volume eliminates the bias in update magnitude caused by data imbalance, providing a unified and fair metric for measuring the distance to the benchmark model in subsequent calculations, and improving the accuracy of anomaly detection.

[0051] In one embodiment, step S1, obtaining the baseline model update amount, may further include: Get the local dataset size for each client and the root dataset size for the server; Determine a second ratio between the size of the root dataset and the sum of the sizes of the individual local datasets; The baseline model update amount is determined based on the second ratio, the historical global model weights, and the baseline model weights.

[0052] Baseline model update The calculation formula can be: ; This invention maps the server's baseline model update to the same scale space as the client's local model update by scaling the server's baseline model update according to the ratio of the root dataset to the client's total dataset. This ensures that the calculated second distance truly reflects the essential difference between the client's behavioral patterns and the trusted baseline, rather than the numerical difference caused by the data scale, thus guaranteeing the effectiveness of the bidirectional feature divergence measurement.

[0053] In one embodiment, the first or second distance of the present invention may include at least one of cosine similarity, Wasserstein distance, entropy distance, Lp norm, and statistical distance.

[0054] Cosine similarity measures the difference in direction between two vectors, focusing on the consistency of their update trends. Wasserstein distance measures the difference between two probability distributions, suitable for analyzing the statistical properties of parameter distributions. Entropy distance measures the difference in asymmetry between two probability distributions. Lp norms (such as L0.5 norm, L1 norm, L2 norm, and L∞ norm) measure the absolute distance or Euclidean distance between two vectors in numerical space. Statistical distances can include at least one of the following: mean difference, median difference, standard deviation difference, and minimum-maximum difference.

[0055] This invention provides a variety of measurement tools, allowing you to select the most sensitive distance metric based on the specific application scenario (such as image classification or natural language processing). By combining multiple measurement tools (such as simultaneously considering differences in direction and magnitude), it is possible to more comprehensively characterize the deviation between the local model and the benchmark model, thereby providing richer and more accurate input features for calculating trust scores and effectively reducing the misjudgment rate.

[0056] In one embodiment, step S3, determining the change in the client's trust score based on the first distance and the second distance, may further include: The hidden state representations of the first and second distances are extracted using an encoder; The hidden state representation is decoded by a decoder to obtain the change in trust score.

[0057] This invention pre-constructs a network structure containing an encoder and a decoder. The encoder takes a first distance and a second distance as input feature vectors. The encoder consists of several fully connected layers or convolutional layers, used to extract and compress features from the high-dimensional or multi-dimensional distance features of the input, outputting a low-dimensional hidden state representation. This hidden state representation implies the core features of the model differences. The decoder receives the hidden state representation and, through mapping by the decoding layer (usually a fully connected layer combined with an activation function), restores or maps the hidden state representation to a specific change in trust score. This change in trust score represents the magnitude by which the client's trust should increase or decrease based on the current distance features.

[0058] This invention leverages the powerful feature extraction and nonlinear fitting capabilities of an encoder-decoder architecture to automatically learn the complex mapping relationship between distance features and malicious behavior. Compared to fixed thresholds, this method can uncover deeper anomaly patterns from bidirectional features, improving not only the recognition rate of known attacks but also exhibiting stronger generalization and adaptability to unknown or variant attacks.

[0059] In one embodiment, the present invention decodes the hidden state representation using a decoder, which may further include: Total number of training rounds; Before the training rounds reach a preset number, the hidden state representation is decoded using a supervised learning-based decoder. After the training rounds reach the preset number, the hidden state representation is decoded using a decoder based on Actor-Critic reinforcement learning, and the training rounds are reset to zero.

[0060] The preset number of rounds can be 5, and each 5 rounds constitutes one cycle.

[0061] Supervised learning phase: Before the training rounds reach the preset number of times, the hidden state representation is decoded by a decoder based on supervised learning, which can ensure the stability in the early stage of training.

[0062] Reinforcement learning phase: After the training rounds reach a preset number, the decoder acts as an Actor network (policy network), generating changes in trust scores based on the environmental state; simultaneously, a Critic network (value network) is used to evaluate the long-term value of this scoring policy. The Actor network may include a fully connected layer, an attention layer, and a sigmoid layer, while the Critic network may contain multiple residual blocks and a fully connected layer.

[0063] After completing a reinforcement learning optimization, the training round count is reset to zero and the count is restarted, forming a cyclical optimization mechanism that triggers Actor-Critic reinforcement learning periodically.

[0064] This invention combines the stability of supervised learning with the adaptability of reinforcement learning. Maintaining stable supervised inference in the early stages or most rounds avoids system oscillations; periodically triggering Actor-Critic reinforcement learning allows the system to dynamically adjust its trust scoring strategy based on the current attack environment. This dynamically evolving defense mechanism adapts to constantly changing attack strategies, achieving a proactive defense effect of "evolving in response to attacks."

[0065] In one embodiment, step S3, determining the client's current cumulative trust score based on the client's historical cumulative trust score and the change in trust score, may further include: If the change in trust score is less than or equal to zero, the historical cumulative trust score will be used as the current cumulative trust score. If the change in trust score is greater than zero, then the current cumulative trust score is obtained by summing the historical cumulative trust score and the change in trust score.

[0066] The formula for calculating the current cumulative trust score can be expressed as: ; If the change in trust score is less than or equal to zero, it means that the client performed poorly in this round and is far from the baseline model. No deduction is made, but the historical cumulative trust score is directly assigned to the current cumulative trust score, that is, the cumulative trust score remains unchanged.

[0067] If the change in trust score is greater than zero, it means that the client performed well in this round and is close to the benchmark model. Then, an addition operation is performed, adding the historical cumulative trust score to the positive change in trust score to obtain the current cumulative trust score.

[0068] This invention designs a non-negative cumulative trust management mechanism. This mechanism is based on the cumulative effect of long-term behavior. On the one hand, it ensures that benign clients with consistently good performance accumulate a high trust barrier, preventing misjudgment due to occasional fluctuations in a single round. On the other hand, malicious clients, unable to continuously gain positive trust increments, have their weight in the aggregation process gradually diluted by benign clients with high cumulative scores. This significantly reduces the uncertainty of single-round evaluations and improves the system's stability and fault tolerance in long-term operation.

[0069] The complete algorithm of this invention can be obtained as follows: Input: N datasets with local training datasets The client; possesses the root dataset The server; global iteration count Rg; local iteration count Current iteration index t; Client-side local model weights Global model weights w; Encoder; Decoder; Cumulative trust score TS; Distance feature f; Output: Global model weights w - Random initialization / / Initialize global weights Initialize cumulative trust score TS=0 / / Initialize cumulative trust score for t=1,2,···,Rg do Step 1: Local Training Phase The server will Send to all clients For each client i∈{1,···,N}, compute do in parallel. -Use parameters ( , , Perform local model training / / Local training send{ ,| |, The size of the local dataset is transferred to the server. end for -Use parameters ( , , Perform local model training on the server. / / Step 2: Calculate distance features For each client i∈{1,···,N}, compute do in parallel. end for For each client i∈{1,···,N}, do Gradient = Distance Calculation ( , / / Calculate gradient distance features Weight = Distance Calculation ( , / / Calculate weighted distance features -[ gradient, [Weight] / / Merge distance features end for / / Step 3: Calculate and aggregate trust scores =Decoder(Encoder([ gradient, [Weight] / / Calculate the change in trust score For each client i∈{1,···,N}, do / / Update cumulative trust score end for / / Updated based on weighted aggregation of trust scores = + / / Update global model weights enf for return w In summary, this invention proposes a security protection system suitable for federated learning environments. This system targets scenarios with non-independent and identically distributed data and achieves accurate identification and effective suppression of malicious behavior by extracting and evaluating multi-dimensional features of parameters uploaded by clients.

[0070] This defense framework employs a proactive security protection mechanism, overcoming the limitations of traditional single-dimensional detection. Existing methods typically rely on similarity comparison or outlier detection, which struggles to address highly covert and strategically varied attacks. To address this, this invention innovatively constructs a bidirectional feature evaluation system, extracting features from both the model parameter space and gradient update distribution dimensions, and mining deep behavioral patterns through an encoder-decoder structure. The system integrates the Actor-Critic reinforcement learning algorithm to dynamically optimize trust scores, while introducing a historical accumulated trust mechanism to avoid misjudgments caused by single-round fluctuations, thus maintaining judgment stability in complex environments.

[0071] This invention enhances system security by imposing bidirectional feature constraints on client behavior. At the parameter level, the influence of anomalous parameters is reduced by quantifying and penalizing weight deviations; at the gradient level, potential malicious patterns are identified by analyzing update distribution characteristics. This dual constraint mechanism effectively reduces the attack power of malicious parameters because their weight decreases significantly in trust assessment, thus weakening their negative impact on the global model. This mechanism provides effective protection for model security in non-independent, identically distributed environments. Simultaneously, compliant clients, by virtue of their standardized behavior patterns, obtain higher trust scores, ensuring their updates dominate model aggregation and further consolidating overall system security. The introduction of reinforcement learning components enables the system to dynamically distinguish between normal and anomalous behavior patterns, preventing benign clients from being misjudged through differentiated scoring strategies, ensuring the accuracy and fairness of the defense mechanism.

[0072] The core breakthrough of this invention lies in elevating single-dimensional defense to bidirectional feature-based collaborative protection. Through complementary analysis of the parameter and gradient domains, combined with a hybrid decision-making mechanism of supervised learning and reinforcement learning, a three-dimensional protection system against complex attack strategies is formed. In real-world scenarios with heterogeneous data distribution, this framework can collaboratively optimize model performance and system security, providing robust and reliable security guarantees for federated learning.

[0073] The federated learning security framework constructed in this invention relies on multi-dimensional feature analysis and dynamic trust assessment mechanisms to achieve accurate identification and effective suppression of malicious clients, significantly improving the overall security of the system.

[0074] The global model weight update device for federated learning provided by the present invention will be described below. The global model weight update device for federated learning described below can be referred to in correspondence with the global model weight update method for federated learning described above.

[0075] like Figure 2 As shown, the global model weight update device for federated learning provided by the present invention includes: The data acquisition module is used to acquire the local model weights and local model update amount after the client performs this round of local model training, and the baseline model weights and baseline model update amount after the server performs this round of local model training. The first determining module is used to determine the first distance between the local model weights and the baseline model weights, and the second distance between the local model update amount and the baseline model update amount, respectively. The second determining module is used to determine the change in the client's trust score based on the first distance and the second distance, and to determine the client's current cumulative trust score based on the client's historical cumulative trust score and the change in trust score. The weighted aggregation module is used to sum the local model update amounts of each client based on the current cumulative trust score of each client, and obtain the global model weight update amount; the weight of the local model update amount increases with the corresponding current cumulative trust score. The third determination module is used to determine the current global model weights based on the historical global model weights and the global model weight update amount.

[0076] Figure 3 A schematic diagram of the physical structure of an electronic device is provided. This electronic device may include a processor, a communications interface, memory, and a communication bus, wherein the processor, communications interface, and memory communicate with each other via the communication bus. The processor can invoke logical instructions in the memory to execute a global model weight update method for federated learning. This method includes: obtaining the local model weights and local model update amounts after the client performs local model training in this round, and the baseline model weights and baseline model update amounts after the server performs local model training in this round; determining a first distance between the local model weights and the baseline model weights, and a second distance between the local model update amounts and the baseline model update amounts; determining the change in the client's trust score based on the first and second distances, and determining the client's current cumulative trust score based on the client's historical cumulative trust score and the change in trust score; weighted summing of the local model update amounts of each client based on the current cumulative trust scores of each client to obtain the global model weight update amount; the weight of the local model update amount increases with the corresponding current cumulative trust score; and determining the current global model weight based on the global model weight update amount and the historical global model weights obtained from the previous round of training.

[0077] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0078] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the global model weight update method for federated learning provided by the above methods. The method includes: obtaining the local model weights and local model update amounts after the client performs the current round of local model training, and the baseline model weights and baseline model update amounts after the server performs the current round of local model training; determining a first distance between the local model weights and the baseline model weights, and a second distance between the local model update amounts and the baseline model update amounts; determining the change in the client's trust score based on the first distance and the second distance, and determining the client's current cumulative trust score based on the client's historical cumulative trust score and the change in trust score; performing a weighted summation of the local model update amounts of each client based on the current cumulative trust scores of each client to obtain the global model weight update amount; the weight of the local model update amount increases with the corresponding current cumulative trust score; and determining the current global model weight based on the global model weight update amount and the historical global model weights obtained in the previous round of training.

[0079] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a global model weight update method for federated learning provided by the methods described above. The method includes: obtaining the local model weights and local model update amounts after the client performs the current round of local model training, and the baseline model weights and baseline model update amounts after the server performs the current round of local model training; determining a first distance between the local model weights and the baseline model weights, and a second distance between the local model update amounts and the baseline model update amounts, respectively; determining the change in the client's trust score based on the first distance and the second distance, and determining the client's current cumulative trust score based on the client's historical cumulative trust score and the change in trust score; performing a weighted summation of the local model update amounts of each client based on the current cumulative trust scores of each client to obtain the global model weight update amount; the weight of the local model update amount increases with the corresponding current cumulative trust score; and determining the current global model weight based on the global model weight update amount and the historical global model weights obtained in the previous round of training.

[0080] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0081] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A global model weight update method for federated learning, characterized in that, include: Get the local model weights and local model update amount after the client performs this round of local model training, and the baseline model weights and baseline model update amount after the server performs this round of local model training; Determine the first distance between the local model weights and the baseline model weights, and the second distance between the local model update amount and the baseline model update amount, respectively; The change in the client's trust score is determined based on the first distance and the second distance, and the current cumulative trust score of the client is determined based on the client's historical cumulative trust score and the change in the trust score. The local model update amounts of each client are weighted and summed based on the current cumulative trust scores of each client to obtain the global model weight update amount. The weight of the local model update increases with the corresponding current cumulative trust score; The current global model weights are determined based on the global model weight update amount and the historical global model weights obtained from the previous training round.

2. The global model weight update method for federated learning according to claim 1, characterized in that, Obtaining the local model update amount includes: Get the size of the local dataset for each client; Determine a first ratio between the size of the local dataset and the sum of the sizes of the individual local datasets; The local model update amount is determined based on the first ratio, the historical global model weight, and the local model weight.

3. The global model weight update method for federated learning according to claim 1, characterized in that, Obtaining the baseline model update includes: Get the local dataset size for each client and the root dataset size for the server; Determine a second ratio between the size of the root dataset and the sum of the sizes of the individual local datasets; The update amount of the baseline model is determined based on the second ratio, the historical global model weight, and the baseline model weight.

4. The global model weight update method for federated learning according to claim 1, characterized in that, The first distance or the second distance includes at least one of cosine similarity, Wasserstein distance, entropy distance, Lp norm, and statistical distance.

5. The global model weight update method for federated learning according to claim 1, characterized in that, Determining the change in the client's trust score based on the first distance and the second distance includes: The hidden state representations of the first distance and the second distance are extracted using an encoder; The hidden state representation is decoded by a decoder to obtain the change in the trust score.

6. The global model weight update method for federated learning according to claim 5, characterized in that, Decoding the hidden state representation using a decoder includes: Total number of training rounds; Before the training rounds reach a preset number, the hidden state representation is decoded using a supervised learning-based decoder. After the training rounds reach a preset number, the hidden state representation is decoded using a decoder based on Actor-Critic reinforcement learning, and the training rounds are reset to zero.

7. The global model weight update method for federated learning according to claim 1, characterized in that, Determining the client's current cumulative trust score based on the client's historical cumulative trust score and the change in the trust score includes: If the change in the trust score is less than or equal to zero, then the historical cumulative trust score is used as the current cumulative trust score. If the change in the trust score is greater than zero, then the current cumulative trust score is obtained by summing the historical cumulative trust score and the change in the trust score.

8. A global model weight update device for federated learning, characterized in that, include: The data acquisition module is used to acquire the local model weights and local model update amount after the client performs this round of local model training, and the baseline model weights and baseline model update amount after the server performs this round of local model training. The first determining module is used to determine the first distance between the local model weights and the benchmark model weights, and the second distance between the local model update amount and the benchmark model update amount, respectively; The second determining module is used to determine the change in the client's trust score based on the first distance and the second distance, and to determine the client's current cumulative trust score based on the client's historical cumulative trust score and the change in the trust score. The weighted aggregation module is used to perform a weighted summation of the local model update amounts of each client based on the current cumulative trust score of each client, so as to obtain the global model weight update amount. The weight of the local model update increases with the corresponding current cumulative trust score; The third determining module is used to determine the current global model weight based on the historical global model weights and the global model weight update amount.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the global model weight update method for federated learning as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the global model weight update method for federated learning as described in any one of claims 1 to 7.