A trustworthiness-based defense method and system for a poisoning attack of federated learning

By performing secure scoring and encryption on the client dataset in federated learning, combined with SM2 homomorphic encryption, the problem of data and model poisoning attacks is solved, ensuring the security and accuracy of the global model.

CN117910015BActive Publication Date: 2026-11-24NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410112936.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-26
Publication Date
2026-11-24
Estimated Expiration
2044-01-26

AI Technical Summary

Technical Problem

Federated learning suffers from data poisoning and model poisoning attacks that are difficult to defend against, especially malicious client data and models that are difficult to identify, and gradient parameters are easily leaked or tampered with during transmission, affecting the availability of the global model.

Method used

The client downloads a scoring program to score the dataset for security, generates a security score, encrypts it, and uploads it. The central server performs encrypted comparison and parameter weight transformation to finally generate a global model. The gradient parameters are protected using an additive homomorphic encryption method based on SM2.

Benefits of technology

Effectively identify and prevent data poisoning, reduce the impact of model poisoning, ensure gradient parameter safety, and improve the reliability and accuracy of the global model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117910015B_ABST
    Figure CN117910015B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on credibility's federal learning poisoning attack defense method and system, it is related to network security technical field, including the following steps: through client from central server downloads scoring program, collects data set, and scores the security of data set, generates security score;Client encrypts security score and model gradient parameter, generates ciphertext score, uploads to central server;Central server carries out ciphertext comparison to ciphertext score, converts parameter weight, finally obtains global model, realizes poisoning attack defense by global model.The present application judges whether there is data poisoning in client by scoring program to prevent malicious client from joining the update calculation of this federal learning model, in the transmission process, in order to prevent model poisoning, homomorphic encryption method based on SM2 is used to prevent model gradient parameter from being leaked or tampered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network security technology, and in particular to a trust-based federated learning poisoning attack defense method and system. Background Technology

[0002] With the development of the digital economy, open data sharing and collaborative analysis are essential. Traditional centralized data processing methods can no longer meet the needs of business models that rely on open data and collaborative analysis. Federated learning allows multiple users to collaboratively train a shared global model without sharing data on local devices, meaning the data is available but not visible. Although federated learning greatly improves the efficiency and performance of machine learning, model poisoning attacks can still lead to serious consequences such as a decrease in the accuracy of the resulting model.

[0003] Poisoning attacks in federated learning can be divided into data poisoning attacks and model poisoning attacks. In a data poisoning attack, an adversary injects or modifies malicious data into the dataset of the attacked client. The central server is invisible to the training data, which remains on the local client, making it impossible to determine whether the client contains malicious data. Therefore, data poisoning attacks are difficult to detect, and the model trained with this malicious data will ultimately compromise the usability of the global model after being uploaded to the central server. Model poisoning attacks in federated learning are different. Because the client is a black box to the server, the adversary can directly manipulate the local model training process on the client, causing the trained local model to deviate as much as possible from the true model, ultimately compromising the usability of the global model and thus achieving a model poisoning attack.

[0004] The main challenges in defending against poisoning attacks in federated learning currently lie in the following aspects:

[0005] 1. Data poisoning occurs on the local client side. Attackers add poisoned samples to the model's training dataset and use the training or fine-tuning process to compromise the model's usability. The central server has difficulty detecting whether the local model has been compromised.

[0006] 2. If an adversary poisons the model during transmission, causing gradient parameters to be leaked or tampered with, homomorphic encryption can be used to transmit and compute in ciphertext, but there is currently no homomorphic encryption scheme based on Chinese national cryptographic standards.

[0007] 3. Once a malicious client participates in the aggregation of the global model, the malicious parameters it provides will affect the training of the global model. There is a lack of reliable aggregation mechanisms to reduce this impact. Summary of the Invention

[0008] In view of the problems existing in the existing trust-based federated learning poisoning attack defense and system, this invention is proposed.

[0009] Therefore, the problem to be solved by this invention is to effectively address data poisoning and model poisoning.

[0010] To solve the above-mentioned technical problems, the present invention provides the following technical solution:

[0011] In a first aspect, embodiments of the present invention provide a trust-based federated learning poisoning attack defense method, which includes the following steps:

[0012] The client downloads the scoring program from the central server, collects the dataset, scores the security of the dataset, and generates a security score.

[0013] The client encrypts the security score and model gradient parameters to generate a ciphertext score, and uploads it to the central server.

[0014] The central server performs a cryptographic comparison on the encrypted scores, transforms the parameter weights, and finally obtains the global model.

[0015] As a preferred embodiment of the trust-based federated learning poisoning attack defense method described in this invention, the security of the dataset includes central tendency, discrete tendency, distribution trend, outlier situation and data legality.

[0016] The scoring program performs trend analysis on the dataset to obtain parameters of central tendency and dispersion.

[0017] Outlier detection was performed on the dataset using K-means to obtain the number and proportion of outliers;

[0018] Calculate the amount of data in the dataset that does not conform to the data rules, obtain the number and proportion of invalid data, and generate data validity.

[0019] As a preferred embodiment of the trust-based federated learning poisoning attack defense method described in this invention, the client encryption method employs SM2-based additive homomorphic encryption, specifically including the following steps:

[0020] The client and the central server are configured with the same public parameters;

[0021] The central server randomly selects a private key: The public key of the central server is: pk = [sk]G;

[0022] Calculate the point S = [h]pk on the elliptic curve, where h = 1. When S is at infinity, the client reports an error and exits.

[0023] Select random number Calculate c1 = [k]G = (x1, y1) and [k]pk = (x2, y2);

[0024] Calculate c2 = [m]G + [k]pk and c3 = H(x2||m||y2);

[0025] Generate the ciphertext fraction c = (c1, c2, c3);

[0026] The model gradient parameters w of the client j Encrypting with security score x yields:

[0027]

[0028] C(x)=(c1=[k1]G, c2=[x]G+[k1]pk, c3)

[0029] Finally, the data is transmitted to the central server.

[0030] Here, x||y represents the concatenation of byte string or bit string x and y.

[0031] As a preferred embodiment of the trust-based federated learning poisoning attack defense method of the present invention, the method by which the central server performs a cryptographic comparison of the ciphertext score includes:

[0032] Let the ciphertext score be C(x) and the corresponding plaintext score be x. Compare the ciphertext score with the confidence threshold y in a closed state.

[0033] Take the negative of the confidence threshold y, -y, and calculate the homomorphic ciphertext C(-y);

[0034] Using the property of homomorphism, the ciphertext fraction C(x) and ciphertext fraction C(-y) are calculated as follows:

[0035] C(x)=(c1=[k1]G, c2=[x]G+[k1]pk, c3)

[0036] C(-y)=(c1'=[k2]G, c2'=[-y]G+[k2]pk, c3')

[0037] Calculate the following based on the ciphertext fractions C(x) and C(-y):

[0038] [xy]G = c2 + c2' - [sk](c1 + c1')

[0039] Finally, recover xy and determine the relationship between the plaintext represented by xy and the value 0:

[0040] When the plaintext represented by xy is greater than or equal to the value 0, the confidence threshold y is satisfied.

[0041] When the plaintext represented by xy is less than the numerical value 0, the confidence threshold y is not met.

[0042] As a preferred embodiment of the trust-based federated learning poisoning attack defense method described in this invention, the central server's decryption method for the ciphertext score c = (c1, c2, c3) includes:

[0043] Verify whether c1 satisfies the elliptic curve equation E. If it does not, the client will report an error and exit. If it does, proceed to the next step.

[0044] Calculate the elliptic curve point S = [h]c1, where h = 1. When the elliptic curve point S is at infinity, the client reports an error and exits. When the elliptic curve point S is not at infinity, proceed to the next step.

[0045] Calculate the elliptic curve points [sk]c1=(x2,y2) and [m]G=c2-[sk]c1, and use the BSGS algorithm to recover the plaintext m from [m]G;

[0046] Calculate u = H(x²||m||y²), determine whether u = c³ is true. If true, output plaintext m; otherwise, the plaintext m is calculated incorrectly.

[0047] Where P represents a prime number, and the elliptic curve equation E is defined in the finite field F. p An elliptic curve on a given surface, where G is the q-th base point (x) of the elliptic curve. G ,y G ), where [k]G represents a point k times the base point G of the elliptic curve, where

[0048] As a preferred embodiment of the trust-based federated learning poisoning attack defense method described in this invention, the calculation method of the global model includes: decrypting the ciphertext score of the client that meets the trust threshold y and using it as the client trust score Cred; normalizing the trust scores of all clients; and calculating the corresponding weights when aggregating model parameters.

[0049] Specifically, the following methods are included:

[0050] The method for calculating the weighting coefficients:

[0051]

[0052] In the formula, ρ j Represented as a weighting coefficient, Cred j This represents the trustworthiness of client j;

[0053] The weighted model gradient ciphertext parameters are calculated and expressed as follows:

[0054]

[0055] Based on the weighted model gradient ciphertext parameters, all clients perform closed-state weighted aggregation to calculate the global model:

[0056]

[0057] After homomorphically decrypting the weighted model gradient ciphertext parameters, the global model under the plaintext is calculated as follows:

[0058]

[0059] In the formula, W represents the global model.

[0060] As a preferred embodiment of the trust-based federated learning poisoning attack defense method of the present invention, wherein: the trust threshold y is set based on the weighted threshold setting of risk assessment;

[0061] The specific steps include: setting multiple sets of security indicators, then weighting and summing them according to the importance of each indicator to determine the comprehensive threshold. The calculation formula is as follows:

[0062] y=\sum_{i=1}^{n}w_i\times S_i

[0063] In the formula, (S_i) represents the score of the i-th security indicator, (w_i) represents the weight of the i-th indicator, and n represents the total number of security indicators.

[0064] Secondly, embodiments of the present invention provide a trust-based federated learning poisoning attack defense system, which includes: a scoring module, an encryption module, a comparison module, and an aggregation module;

[0065] The scoring module is used to collect datasets and score them according to the scoring rules;

[0066] The encryption module is used to encrypt the model gradient parameters and security scores using an additive homomorphic method based on SM2;

[0067] The comparison module is used to perform a cryptographic comparison of the encrypted scores uploaded by the client to the central server and select the client that meets the score and the trust threshold.

[0068] The aggregation module is used to calculate the confidence normalized weight coefficients, assign the corresponding confidence weights to the gradient parameters of the corresponding client model, and finally perform dense-state weighted aggregation to obtain the global model.

[0069] Thirdly, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement any step of the aforementioned trust-based federated learning poisoning attack defense method.

[0070] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the above-described trust-based federated learning poisoning attack defense method.

[0071] The beneficial effects of this invention are:

[0072] 1. The client downloads a scoring program to score the datasets in the client for security purposes. Different datasets have different weightings for the scores. Therefore, datasets that do not meet the score requirements are excluded, and only datasets that meet the score are accepted. This can avoid the possibility of damaging the model. At the same time, when the security score is low, the central server can also identify malicious attacks, which can play a preventive role.

[0073] 2. By setting up simultaneous encryption, the transmitted data can be encrypted. Transmission and computation in ciphertext can effectively prevent adversaries from poisoning the model during transmission and prevent gradient parameters from being leaked or tampered with.

[0074] 3. A scoring program is used to determine whether a client has poisoned the data, thus preventing malicious clients from participating in the computation of this federated learning model update. During transmission, to prevent model poisoning, a homomorphic encryption method based on SM2 is used to prevent gradient parameters from being leaked or tampered with. At the same time, the credibility of the client's dataset is calculated according to the scoring program, and the weights of the corresponding computations of the client's local model are assigned according to the credibility. Finally, a weighted aggregation is performed to obtain the global model. In this way, even if a poisoned client participates in this round of computation, its impact on the global model can be minimized. Attached Figure Description

[0075] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:

[0076] Figure 1 This is a flowchart of a trust-based federated learning poisoning attack defense method.

[0077] Figure 2 This is a diagram illustrating the interaction process of a trust-based federated learning poisoning attack defense method.

[0078] Figure 3 This is a flowchart of the modules for a trust-based federated learning poisoning attack defense method. Detailed Implementation

[0079] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0080] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0081] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.

[0082] This invention is described in detail with reference to the schematic diagrams. When detailing the embodiments of this invention, for ease of explanation, the cross-sectional views illustrating the device structure may be partially enlarged, not adhering to the usual scale. Furthermore, the schematic diagrams are merely examples and should not be construed as limiting the scope of protection of this invention. In actual fabrication, the three-dimensional spatial dimensions of length, width, and depth should be included.

[0083] Furthermore, in the description of this invention, it should be noted that the terms "upper," "lower," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are used solely for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. In addition, the terms "first," "second," or "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0084] Unless otherwise explicitly specified and limited, the terms "installation," "connection," and "joining" in this invention should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; similarly, they can refer to mechanical connections, electrical connections, or direct connections, or indirect connections through an intermediate medium, or internal connections between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0085] Example 1

[0086] Reference Figure 1 and Figure 2This is the first embodiment of the present invention, which provides a trust-based federated learning poisoning attack defense method, including the following steps:

[0087] S1: The client downloads the scoring program from the central server, collects the dataset, scores the security of the dataset, and generates a security score.

[0088] The security of a dataset includes central tendency, dispersion, distribution trend, outlier cases, and data validity;

[0089] Central tendency includes the mode, mean, and median;

[0090] Dispersion includes interquartile range, range, mean deviation, and standard deviation;

[0091] Distribution trends include kurtosis and skewness.

[0092] Outlier information includes the number of outliers and the percentage of outliers in the dataset;

[0093] Data validity includes the number of invalid data entries and the percentage of invalid data entries.

[0094] The scoring program performs trend analysis on the dataset to obtain parameters of central tendency and dispersion.

[0095] Outlier detection was performed on the dataset using K-means to obtain the number and proportion of outliers;

[0096] Calculate the amount of data in the dataset that does not conform to the data rules, obtain the number and proportion of invalid data, and generate data validity.

[0097] The total security score for the dataset is set at 100 points, where:

[0098] The central tendency of the dataset accounts for 15 points in total, and the parameters used to measure it include: mode (5 points), mean (5 points), and median (5 points).

[0099] The total score for dispersion is 20 points, and the parameters to be measured include: interquartile range (5 points), range (5 points), mean deviation (5 points), and standard deviation (5 points).

[0100] The total score for distribution trend is 15 points, and the coefficients for measurement include: kurtosis coefficient (7.5 points) and skewness coefficient (7.5 points).

[0101] Outlier cases account for 30 points of the total score, and the evaluation factors include: the number of outliers (10 points) and the proportion of outliers in the dataset (20 points).

[0102] The total score for data legality is 20 points, and the measurement coefficients include: the number of invalid data points (7.5 points) and the percentage of invalid data points (7.5 points).

[0103] S2: The client encrypts the security score and model gradient parameters, generates a ciphertext score, and uploads it to the central server.

[0104] The client-side encryption method employs SM2-based additive homomorphic encryption, specifically including the following steps:

[0105] The client and the central server are configured with the same common parameters;

[0106] The central server randomly selects a private key: The central server's public key is: pk = [sk]G;

[0107] When the client needs to send message m to the central server, the client performs the following calculation.

[0108] Calculate the point S = [h]pk on the elliptic curve, where h = 1. When S is at infinity, the client reports an error and exits.

[0109] Select random number Calculate c1 = [k]G = (x1, y1) and [k]pk = (x2, y2);

[0110] Calculate c2 = [m]G + [k]pk and c3 = H(x2||m||y2);

[0111] Generate the ciphertext fraction c = (c1, c2, c3);

[0112] The client's model gradient parameters w j Encrypting with security score x yields:

[0113]

[0114] C(x)=(c1=[k1]G, c2=[x]G+[k1]pk, c3)

[0115] Finally, it is transmitted to the central server;

[0116] Where x||y represents the concatenation of byte string or bit string x and y, and the c2 part of the standard SM2 scheme is Where t = KDF(x2||y2, mlen), KDF:{0,1}*×mlen→{0,1}mlen. In this embodiment, part c2 does not use t, but instead becomes [m]G+[k]pk, thus making the scheme homomorphic, so there is no need to calculate the value of t. Here, (mlen) represents the bit length of the plaintext space M. This represents the XOR operation between bit strings.

[0117] S3: The central server performs a closed-state comparison of the encrypted scores, transforms the parameter weights, and finally obtains the global model.

[0118] The methods used by the central server to perform encrypted comparison of ciphertext fractions include:

[0119] Let the ciphertext score be C(x) and the corresponding plaintext score be x. Compare the ciphertext score with the confidence threshold y in a closed state.

[0120] Take the negative of the confidence threshold y, -y, and calculate the homomorphic ciphertext C(-y);

[0121] Using the property of homomorphism, the ciphertext fraction C(x) and ciphertext fraction C(-y) are calculated as follows:

[0122] C(x)=(c1=[k1]G, c2=[x]G+[k1]pk, c3)

[0123] C(-y)=(c1'=[k2]G, c2'=[-y]G+[k2]pk, c3')

[0124] Calculate the following based on the ciphertext fractions C(x) and C(-y):

[0125] [xy]G = c2 + c2' - [sk](c1 + c1')

[0126] Finally, recover xy and determine the relationship between the plaintext represented by xy and the value 0:

[0127] When the plaintext represented by xy is greater than or equal to the value 0, the confidence threshold y is satisfied.

[0128] When the plaintext represented by xy is less than the numerical value 0, the confidence threshold y is not met.

[0129] The central server's decryption methods for the ciphertext fraction c = (c1, c2, c3) include:

[0130] Verify whether c1 satisfies the elliptic curve equation E. If it does not, the client will report an error and exit. If it does, proceed to the next step.

[0131] Calculate the elliptic curve point S = [h]c1, where h = 1. If the elliptic curve point S is at infinity, the client will report an error and exit. If the elliptic curve point S is not at infinity, proceed to the next step.

[0132] Calculate the elliptic curve points [sk]c1=(x2,y2) and [m]G=c2-[sk]c1, and use the BSGS algorithm to recover the plaintext m from [m]G;

[0133] Determine if the ciphertext is the result of a homomorphic operation. If it is, output the plaintext m directly, complete the decryption, and exit.

[0134] If not, a verification is performed. The verification method is as follows: calculate u = H(x2||m||y2), and determine whether u = c3 is true. If it is true, output plaintext m; if it is false, plaintext m is calculated incorrectly.

[0135] Where P represents a prime number, and the elliptic curve equation E is defined in the finite field F. p An elliptic curve on a given surface, where G is the q-th base point (x) of the elliptic curve. G ,y G ), where [k]G represents a point k times the base point G of the elliptic curve, where

[0136] The calculation method of the global model includes decrypting the ciphertext score of the client that meets the trust threshold y and using it as the client trust score Cred, normalizing the trust scores of all clients, and calculating the corresponding weights when aggregating the model parameters.

[0137] Specifically:

[0138] The weighting coefficients are calculated using the following formula:

[0139]

[0140] In the formula, ρ j Represented as a weighting coefficient, Cred j This represents the trustworthiness of client j;

[0141] The final global model is obtained by performing a dense-state weighted aggregation on all participating clients. The gradient ciphertext parameters of the weighted model are then calculated, as expressed by the formula:

[0142]

[0143] Based on the weighted model gradient ciphertext parameters, all clients perform closed-state weighted aggregation to calculate the global model:

[0144]

[0145] After homomorphically decrypting the weighted model gradient ciphertext parameters, the global model under the plaintext is calculated as follows:

[0146]

[0147] In the formula, W represents the global model.

[0148] The method for setting the confidence threshold y is based on the weighted threshold setting of risk assessment, including: setting multiple sets of security indicators, and then weighting and summing them according to the importance of each indicator to determine the comprehensive threshold. The calculation formula is as follows:

[0149] y=\sum_{i=1}^{n}w_i\times S_i

[0150] In the formula, (S_i) represents the score of the i-th security indicator, (w_i) represents the weight of the i-th indicator, and n represents the total number of security indicators.

[0151] In this embodiment, the number of clients can be one or more.

[0152] In summary, the client downloads a scoring program to score the datasets on its machine. Different datasets have different weightings for these scores; therefore, datasets that do not meet the required scores are excluded, and only those that do are accepted. This avoids the possibility of damaging the model. Furthermore, the central server can detect malicious attacks when the security score is low, serving as a preventative measure. The shared encryption setting encrypts the transmitted data, ensuring that transmission and computation are in encrypted form. This effectively prevents adversaries from poisoning the model during transmission, preventing the leakage or tampering of gradient parameters. The scoring program determines whether the client has poisoned its data, preventing malicious clients from participating in the updated computation of the federated learning model. During transmission, a homomorphic encryption method based on SM2 is used to prevent the leakage or tampering of gradient parameters. Simultaneously, the client's dataset credibility is calculated based on the scoring program, and weights are assigned to the corresponding computations of the client's local models according to the credibility. Finally, a weighted aggregation is performed to obtain the global model. This way, even if a poisoned client participates in this round of computation, its impact on the global model can be minimized.

[0153] Example 2

[0154] Based on the first embodiment, this embodiment further provides a trust-based federated learning poisoning attack defense system, including a scoring module, an encryption module, a comparison module, and an aggregation module;

[0155] The scoring module is used to collect datasets and score them according to the scoring rules;

[0156] The encryption module is used to encrypt the model gradient parameters and security scores using an additive homomorphic method based on SM2;

[0157] The comparison module is used to perform a cryptographic comparison of the encrypted scores uploaded by the client to the central server and select the client that meets the score and the trust threshold.

[0158] The aggregation module is used to calculate the confidence normalized weight coefficients, assign the corresponding confidence weights to the gradient parameters of the corresponding client model, and finally perform dense-state weighted aggregation to obtain the global model.

[0159] This embodiment also provides a computer device applicable to the trust-based federated learning poisoning attack defense method, including a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the trust-based federated learning poisoning attack defense method proposed in the above embodiment.

[0160] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0161] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, it implements the trust-based federated learning poisoning attack defense method proposed in the above embodiments.

[0162] The storage medium proposed in this embodiment and the data storage method proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0163] Example 3

[0164] Based on the previous two embodiments, this embodiment provides a trust-based federated learning poisoning attack defense method. To verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.

[0165] Comparative Example 1: No scoring procedure was used; otherwise, it was the same as Example 1.

[0166] Comparative Example 2: No simultaneous encryption mechanism is used; otherwise, it is the same as Example 1.

[0167] Testing method: Data poisoning and model poisoning were used respectively, with 1000 tests for each method. Finally, the global model was checked to see if any problems occurred.

[0168] Table 1: Probability of global model's ability to defend against different scenarios

[0169] Data poisoning success rate Model poisoning success rate Global model error Comparative Example 1 23.2% 3.4% 35.7% Comparative Example 2 1.8% 32.4% 29.6% Example 1 0.42% 0.31% 1.7%

[0170] As can be seen from the table above, this embodiment can largely solve the impact of data poisoning and model poisoning, and reduce the training results of the global model.

[0171] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A trust-based federated learning method for defending against poisoning attacks, characterized in that: Includes the following steps: The client downloads the scoring program from the central server, collects the dataset, scores the security of the dataset, and generates a security score. The client encrypts the security score and model gradient parameters to generate a ciphertext score, and uploads it to the central server. The central server performs a closed-state comparison on the encrypted scores, transforms the parameter weights, and finally obtains the global model of federated learning. The security of the dataset includes central tendency, dispersion, distribution trend, outlier cases, and data validity; The scoring program performs trend analysis on the dataset to obtain parameters of central tendency and dispersion. Outlier detection was performed on the dataset using K-means to obtain the number and proportion of outliers; Calculate the amount of data in the dataset that does not conform to the data rules, obtain the number and proportion of invalid data, and generate data validity; The client's encryption method employs SM2-based additive homomorphic encryption, specifically including the following steps: The client and the central server are configured with the same public parameters; The central server randomly selects a private key: sk∈ The public key of the central server is: pk=[sk]G; Calculate the point S=[h]pk on the elliptic curve, where h=1. When S is at infinity, the client reports an error and exits. Choose a random number k∈ Calculate c1=[k]G=(x1,y1) and [k]pk=(x2,y2); Calculate c2=[m]G+[k]pk and c3=H(x2||m||y2); Generate the ciphertext fraction c = (c1, c2, c3); The model gradient parameters w of the client j Encrypting with security score x yields: ; ; Finally, the data is transmitted to the central server. Where x||y represents the concatenation of byte string or bit string x and y; The method by which the central server performs a cryptographic comparison of the ciphertext scores includes: Let the ciphertext score be C(x) and the corresponding plaintext score be x. Compare the ciphertext score with the confidence threshold y in a closed state. Take the negative of the confidence threshold y, -y, and calculate the homomorphic ciphertext C(-y). Using the property of added homomorphism, the ciphertext fraction C(x) and ciphertext fraction C(-y) are calculated as follows: ; ; Calculate based on the ciphertext fraction C(x) and the ciphertext fraction C(-y): ; Finally, recover xy and determine the relationship between the plaintext represented by xy and the value 0: When the plaintext represented by xy is greater than or equal to the value 0, the confidence threshold y is satisfied. When the plaintext represented by xy is less than the numerical value 0, the confidence threshold y is not met.

2. The trust-based federated learning poisoning attack defense method as described in claim 1, characterized in that: The central server's decryption method for the ciphertext fraction c=(c1,c2,c3) includes: Verify whether c1 satisfies the elliptic curve equation E. If it does not, the client will report an error and exit. If it does, proceed to the next step. Calculate the elliptic curve point S = [h]c1, where h = 1. When the elliptic curve point S is at infinity, the client reports an error and exits. When the elliptic curve point S is not at infinity, proceed to the next step. Calculate the elliptic curve points [sk]c1=(x2,y2) and [m]G=c2-[sk]c1, and use the BSGS algorithm to recover the plaintext m from [m]G; Calculate u=H(x2||m||y2), determine whether u=c3 is true. If true, output plaintext m; if false, the plaintext m is calculated incorrectly. Where P represents a prime number, and the elliptic curve equation E is defined in the finite field F. p An elliptic curve on a given surface, where G is the q-th base point (x) of the elliptic curve. G ,y G ), [k]G represents a point k times the base point G of the elliptic curve, where k∈ .

3. The trust-based federated learning poisoning attack defense method as described in claim 2, characterized in that: The calculation method of the global model includes decrypting the ciphertext score of the client that meets the trust threshold y and using it as the client trust level Cred, normalizing the trust level of all clients, and calculating the corresponding weights when the model parameters are aggregated in a dense state. Specifically: The weighting coefficients are calculated using the following formula: ; In the formula, Represented as weighting coefficients, This represents the trustworthiness of client j; The weighted model gradient ciphertext parameters are calculated using the following formula: ; Based on the weighted model gradient ciphertext parameters, all clients perform closed-state weighted aggregation to calculate the global model: ; After homomorphically decrypting the weighted model gradient ciphertext parameters, the global model under the plaintext is calculated as follows: ; In the formula, W represents the global model.

4. The trust-based federated learning poisoning attack defense method as described in claim 3, characterized in that: The method for setting the confidence threshold y is based on a weighted threshold setting for risk assessment, including: setting multiple sets of security indicators, then weighting and summing them according to the importance of each indicator to determine the comprehensive threshold. The calculation formula is as follows: ; In the formula, Let be the score of the i-th security indicator. Let represent the weight of the i-th indicator, and n represent the total number of safety indicators.

5. A trust-based federated learning poisoning attack defense system, based on the trust-based federated learning poisoning attack defense method according to any one of claims 1 to 4, characterized in that: It includes a scoring module, an encryption module, a comparison module, and an aggregation module; The scoring module is used to collect datasets and score them according to the scoring rules; The encryption module is used to encrypt the model gradient parameters and security scores using an additive homomorphic method based on SM2; The comparison module is used to perform a cryptographic comparison of the encrypted scores uploaded by the client to the central server and select the client that meets the score and the trust threshold. The aggregation module is used to calculate the confidence normalized weight coefficients, assign the corresponding confidence weights to the gradient parameters of the corresponding client model, and finally perform dense-state weighted aggregation to obtain the global model.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the trust-based federated learning poisoning attack defense method according to any one of claims 1 to 4.

7. 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 the steps of the trust-based federated learning poisoning attack defense method according to any one of claims 1 to 4.