Federal learning two-party security robustness aggregation framework and method fusing gradient segmentation and matrix confusion

By adopting a two-party security aggregation framework that is confused with gradient segmentation and matrix in the federated learning system, combined with multiple robust algorithms, the problems of high computing overhead and data accuracy under Byzantine attacks are solved, and efficient and secure data aggregation is achieved. Enhanced system robustness.

CN119051841APending Publication Date: 2024-11-29EAST CHINA NORMAL UNIV +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411030508.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

In the face of Byzantine attacks, existing federated learning systems have high computational overhead and data accuracy are affected, and lack efficient overall solutions to address both computational overhead and data accuracy.

Method used

The two-party security and robust aggregation framework that integrates gradient segmentation and matrix confusion is adopted to perform vertical expansion, matrix obfuscation and random segmentation of gradient data locally through the client, combining the two-party security computing protocol and robust aggregation algorithm, such as Krum, Fltrust and SignGuard implement efficient aggregation computing.

Benefits of technology

It realizes efficient and lossless data aggregation, reduces computing overhead, maintains data accuracy, does not rely on trusted key centers, is compatible with a variety of robust aggregation algorithms, and enhances the Byzantine robustness of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119051841A_ABST
    Figure CN119051841A_ABST
Patent Text Reader

Abstract

The invention discloses a federated learning two-party security robustness aggregation framework and method fusing gradient segmentation and matrix confusion. The framework comprises three participants: a participant Ci; a server P0; and a server P1. The aggregation method is executed by the following modules: 1) initializing the module; 2) a participant and local preprocessing module; 3) a two-party security calculation module; 4) a Byzantine robustness aggregation module algorithm based on gradient distance; and 5) a threshold robustness aggregation algorithm module based on a gradient L2 norm. The method not only can effectively protect privacy information of participants, but also has Byzantine robustness. Meanwhile, the whole system has high efficiency and stability, and reliability and practicability in practical application are effectively ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of network security technology, and in particular relates to a federated learning two-party security robustness aggregation framework and method integrating gradient segmentation and matrix confusion. Background Art

[0002] Federated Learning is an innovative distributed machine learning method that focuses on achieving multi-party collaborative model training while protecting data privacy. With the increasing demand for data privacy protection, federated learning effectively avoids the risk of privacy leakage by allowing participants to independently train models on local data and only share model parameters instead of original data. In the field of healthcare, the privacy protection of patient data is crucial, while at the same time, there are also strict requirements for ensuring the accuracy and robustness of data analysis. Federated learning effectively protects the privacy of individual data by enabling multiple medical institutions to jointly train machine learning models without sharing original data. In the process of federated learning, each participant only shares the gradient information of the local model, thereby achieving collaborative training while ensuring that data privacy is not leaked. However, attackers can reversely infer the original data of the participants by analyzing these gradient information. This privacy leakage may lead to the illegal acquisition and abuse of patients' sensitive health information, seriously threatening patient privacy. In addition, malicious participants can also interfere with the training process of the global model by submitting toxic local gradients. This attack will not only reduce the accuracy of the model, but may even cause the model to output incorrect diagnosis results, thereby affecting medical decisions and patient health. In the field of financial applications, the privacy protection of customer financial data is also crucial. Financial institutions need to perform data analysis to improve service quality and risk control capabilities while protecting customer data privacy. Federated learning can achieve data collaboration between different financial institutions and improve the generalization ability of the model. Although federated learning does not require the sharing of original data and protects the privacy information of users to a certain extent, attackers can still infer deep sensitive information such as customers' financial behavior and transaction records by analyzing the update information of the model. This privacy leakage may lead to the illegal use of customers' financial data, resulting in huge economic losses. In addition, malicious participants may submit false local model updates to affect the training results of the global model. This not only leads to a decrease in the accuracy of the detection model with a fraudulent nature, but also may prevent financial institutions from timely detecting and preventing potential fraudulent behavior, thereby causing economic losses and triggering credit risks.

[0003] In traditional federated learning, FedAvg and FedSGD are the most commonly used aggregation methods. However, applying these methods in a distributed environment containing Byzantine nodes increases the risk of malicious attacks, which may lead to difficulty in model convergence and leakage of sensitive client information. Therefore, many studies have proposed federated learning systems with Byzantine robustness, using robust aggregation algorithms to detect and remove outliers, and ensuring the stability of the entire training process in the presence of Byzantine nodes.

[0004] In order to solve the fault tolerance problem of Byzantine participants, researchers often use statistical methods to process and filter abnormal data in the aggregation stage to improve the robustness of the model. For example, the Trim-Mean method sorts the gradient data and removes extreme values, and then averages the remaining data to reduce the impact of malicious data. Chen et al. proposed GeoMED, which combines the gradient mean and geometric median to process data in a geometric way to enhance robustness. The Krum and Fltrust algorithms identify and filter out malicious gradients by calculating the similarity measure between gradients, ensuring that only benign gradients are used to update the model. In addition, Xu et al. proposed the SignGuard scheme, which combines two filtering techniques, L2 norm restriction and gradient sign clustering, to protect the security of the model by detecting and removing malicious gradients. These methods have improved the Byzantine robustness of the federated learning system to a certain extent. However, these solutions may leak the client's privacy information when processing plaintext gradients. To solve the problem of client privacy leakage, most schemes use cryptographic encryption technology. Aono et al. use additive homomorphic encryption (HE) to protect the privacy of neural network reasoning. Ma et al. proposed a federated learning scheme based on multi-key homomorphic encryption (MK-HE), using the xMK-CKKS algorithm to implement encrypted model updates and aggregation. Geyer et al. proposed a security algorithm based on differential privacy to reduce the privacy risk of shared model updates. Although these schemes are effective in protecting data privacy, they cannot defend against attacks from Byzantine participants; on the other hand, homomorphic encryption will bring high computational overhead, while differential privacy requires a trade-off between privacy protection and model performance. Therefore, many scholars have begun to study joint defense strategies. Miao et al. proposed PBFL based on the Fltrust idea, using CKKS to encrypt data and completing the calculation of cosine similarity through dual-server collaboration. However, the CKKS encryption scheme affects data accuracy, and how to select a suitable root data set is extremely challenging. Rathee et al. proposed a secure aggregation protocol ELSA, in which the client converts gradient data into binary format and transmits it to two collaborative servers, uses the OT protocol for secure aggregation, and uses the L2 norm to filter and defend against toxic gradients. However, ELSA uses the client as the source of encrypted information, which reduces the server load but increases the computational and communication complexity of the client.

[0005] In summary, the existing solutions still have the following problems: (1) High computational overhead: Methods based on homomorphic encryption bring huge computational overhead, increase the burden on the system, and affect the efficiency of practical applications. (2) Data accuracy issues: The introduction of encryption schemes and differential privacy may affect the accuracy of data, resulting in a decrease in model performance. (3) Lack of efficient overall solutions: Although there are a lot of studies on the above two typical problems in federated learning, there is a lack of integrated and efficient solutions that can simultaneously address the above two challenges. Summary of the invention

[0006] In view of the problems existing in the prior art, the purpose of the present invention is to provide a two-party secure robustness aggregation framework and method for federated learning that integrates gradient segmentation and matrix confusion, which is specifically implemented through the following technical solutions:

[0007] A two-party secure robust aggregation framework for federated learning that integrates gradient segmentation and matrix obfuscation. The framework includes the following three parties:

[0008] Party C i :As a participant in federated learning, it has a local private data set, participates in federated learning training tasks, and submits local gradient data g in each round i , and the aggregated gradient of federated learning is calculated on the server side in the form of vectors;

[0009] Server P 0 : One of the entities that executes the two-party secure computation protocol, responsible for training and updating the global model and generating additional parameters for the aggregation algorithm;

[0010] Server P 1 : One of the entities that executes the two-party secure computation protocol, with P 0 Perform two-party secure collaborative computing, calculate and generate a secure confusion matrix, and perform two-party secure aggregation.

[0011] A two-party secure robust aggregation method for federated learning that integrates gradient segmentation and matrix obfuscation is implemented by the following modules:

[0012] 1) Initialization module: This method is based on the obfuscated orthogonal matrix. The client obfuscates the gradient matrix, and the obfuscated gradient matrix information is obtained by the two servers using the obfuscated orthogonal matrix generation algorithm OrthMatGen. In OrthMatGen, based on the orthogonal matrix theory, a lightweight two-party secure multiplication protocol is constructed by carefully designing a secure matrix multiplication protocol;

[0013] 2) Participants and local preprocessing module: Participant C iThe locally generated gradient data is uploaded to the server in the form of a vector. The gradient g i It can be expressed as:

[0014] C i Perform the following three steps to preprocess the gradient data:

[0015] 2-1) Vertical expansion: C i The vector g i Expanded to n×m matrix form, the i-th row of the matrix is ​​g i , the rest of the positions are 0, that is

[0016] 2-2) Matrix Confusion: C i The expanded matrix is ​​confused with the orthogonal confusion matrix M′, M″ to generate the gradient confusion matrix

[0017] 2-3) Random Split: C i According to the parameter d Perform random segmentation and divide the matrix into two parts, {2, d} and {d+1, m-1}, according to the columns of the matrix. 0 =d,m 1 =mm 0 , C i Send the two parts to the corresponding servers respectively, namely Send to P a , a∈{0,1};

[0018] 3) Two-party secure computing module: In the process of secure aggregation in TPSRA, multiple robust aggregation algorithms can be effectively compatible, among which the security protocol implementation of Krum algorithm is as follows:

[0019] 3-1)P a First, for each C i Upload the confusion gradient matrix and sum it up

[0020] 3-2)P a calculate The two servers exchange their calculated data, P a Get the overall calculation result GG about the gradient matrix G T , both servers can be from GG T Obtain the necessary data to execute Krum's algorithm;

[0021] 3-3) By running the Krum algorithm, both servers can obtain the overall value of the aggregated benign gradient, P0 Generate an aggregation vector ξ, whose length is the number of clients n, and the corresponding bit is 0 or 1, which determines whether the gradient vector is selected. The two servers use the two-party secure aggregation algorithm (TPSecAgg) for secure aggregation;

[0022] 3-4)P 0 Aggregate gradient values, update the global model, and then distribute the global model to each participant;

[0023] 4) Byzantine robustness aggregation module algorithm based on gradient distance: including but not limited to the Fltrust algorithm. The Fltrust algorithm requires a clean small-scale data set, which generates gradient updates that determine the direction of global model training. The server needs to add the gradient generated by the root data set to the security aggregation calculation:

[0024] 4-1)P 0 Initialize the root dataset and generate gradients P 0 For g 0 Perform the same vertical expansion to expand into a (n+1)×m dimensional matrix, with the first row of the matrix being g 0 ;

[0025] 4-2)P 0 , P 1 Settings 0 ,s 1 ←SecMatMult(G 0 ,M″ 1 ,k),P 1 Send 1 Give P 0 ;

[0026] 4-3)P 0 calculate At the same time, use the cutting parameter d of the current training round to G 0 Make a cut;

[0027] 4-4) The server sums the received gradients according to the process described above, including the obfuscated root gradient, P 0 Set the aggregation vector ξ. To be compatible with the Fltrust algorithm, the corresponding bit of the aggregation vector is set to s(i) = ReLU(c i ),in The data required for calculation can be obtained from GG T get;

[0028] 5) Gradient L2 norm-based threshold robustness aggregation algorithm module: The SignGuard algorithm is used to explain the two-party security aggregation process. The SignGuard algorithm uses a combination of L2 norm-based threshold restrictions and symbol filtering techniques to increase the robustness of federated learning aggregation, specifically:

[0029] 5-1)P 0 Initialize a random diagonal matrix All diagonal elements are positive numbers, and Q is the sign matrix of confusion;

[0030] 5-2)P 0 , P 1 Settings 0 ,s 1 ←SecMatMult(Q,M″ 1 ,k),P 1 Send 1 Give P 0 ;

[0031] 5-3)P 0 Calculate R = (s 0 +s 1 )M″ 0 , and then split R according to the cutting parameter d of the current training round, R = [R (0) R (1) ], P 0 Send R (1) Give P 1 ;

[0032] 5-4)P a , a∈{0,1}, R (a) Splice to Get the new confused gradient matrix and then calculate it locally

[0033] 5-5)P 0 Set the aggregation vector ξ, select the benign gradient subscript in the aggregation vector through two methods, and set its corresponding bit to 1; the rest of the bits are set to 0.

[0034] Preferably, in step 1), the two-party secure multiplication protocol includes:

[0035] a) Mutually orthogonal matrices: Given a series of matrices If the following relations are satisfied, then this set of matrices is called mutually orthogonal matrices: Where 1≤i,j≤l;

[0036] The mutually orthogonal matrix construction method is:

[0037] a-1) Generate an orthogonal matrix W of (n×l)×(n×l), W=[w 1 ,w 2 ... n×l ], where w i is the i-th column of W, satisfying:

[0038] a-2) Split W into l matrices Each D i The form is D i =[w (i-1)×n+1 ,w (i-1)×n+2 ,...,w i*n ], 1≤i≤l;

[0039] a-3) Return As a set of mutually orthogonal matrices;

[0040] b) Matrix decomposition technique: Given a matrix M, Assuming the decomposition coefficient k, M can be expressed as in satisfy Using matrix decomposition technology, the matrix can be decomposed into matrices of the same size, and M i It does not contain any information about the original matrix. The decomposition coefficient determines the degree of matrix decomposition and can be set randomly.

[0041] The construction method steps of the matrix decomposition technology are:

[0042] b-1) Select a series of random numbers satisfy and a set of random matrices

[0043] b-2) Calculation

[0044] b-3) Return and

[0045] c) Specific implementation of the protocol: Based on mutually orthogonal matrices, the specific details of the two-party secure matrix multiplication protocol SecMatMult are as follows:

[0046] Input: Assume P 0 Have a secret matrix X, P 1 Have the secret matrix Y, decomposition coefficient k;

[0047] Output: Additive Secret Sharing R of XY 0 , R 1 Satisfaction: R 0 +R 1=XY;

[0048] Process: P 0 , P 1 Perform two-party secure computation:

[0049] c-1)P 0 Constructed using matrix decomposition techniques satisfy P 0 Generate a series of mutually orthogonal matrices set up

[0050]

[0051] c-2)P 0 Send T 1 and T 2 Give P 1 ,

[0052] c-3)P 1 Choose a random real number R 1 , calculate S = T 1 YT 2 R 1 ,

[0053] c-4)P 1 Send S to P 0 ,

[0054] c-5)P 0 calculate

[0055] Preferably, in step 1), the specific steps of the confusion orthogonal matrix generation algorithm are:

[0056] Input: In each round of training, P a Generate M′ locally a , M′ a ′, where a∈{0,1}, and matrix decomposition parameter k;

[0057] Output: Orthogonal matrix secret sharing: Satisfies a∈{0,1};

[0058] process:

[0059] 1)P 0 ,P 1 Calculated

[0060] 2) P 0 ,P 1 Calculated

[0061] 3) The two servers share the secret of the obtained orthogonal matrix with all participants; server P a (where a∈{0,1}), using the locally generated confusion orthogonal matrix M′ a (n×n), M″ a (m×m) and aggregation parameter c, the two servers run the orthogonal matrix generation algorithm (OrthMatGen) to generate the secret sharing of the confused orthogonal matrix, and Secret Sharing Satisfaction The secret shared by each server is expressed as The server sends the secret sharing of their respective confusion orthogonal matrices and the aggregation parameter c (set c = 1) to all participants;

[0062] Participants: n participants have their own id, id∈[0,1], participants are denoted as C i , C i Sum the received secret shares of the orthogonal confusion matrix to obtain the matrix elements used for confusion and All participants obtain random cutting parameters d from the server in each round, and the filtering parameters f are used as the filtering parameters of the Krum algorithm. Preferably, in step 3), the two-party security aggregation algorithm (TPSecAgg) is:

[0063] enter: Where a∈{0,1}, the confusion gradient matrix is The aggregation vector is ξ, and the aggregation coefficient is c;

[0064] Output: Aggregated gradients

[0065] process:

[0066] If c = 1, then:

[0067] a)P 0 set up

[0068] b)P 0 ,P 1 Set m 0 ,m 1 ←SecMatMult(t,M′ 1 ,k),P 1 M 1 Send to P 0 ;

[0069] c)P 0 ,P 1 Settings0 , P 0 Will s 0 Send to P 1 ;

[0070] d) P 1 Calculate r 1 ←(s 0 +s1)M′ 1 and send it to P 0 ;

[0071] e)P 0 Calculate r 0 ←m 0 +m 1 , use the aggregation vector ξ for secure aggregation:

[0072] If c = 0, then:

[0073] f)P 1 According to the cutting coefficient, the private orthogonal matrix M″ 1 T Split by lines:

[0074] g)P 1 Settings 0 , P 1 Will s 1 Send to P 0 ;

[0075] h)P 0 Calculate t 0 =(s 0 +s1)M″ 0 T ;

[0076] i)P 1 calculate

[0077] j)P 0 ,P 1 Setting r 0 ,r 1 ←SecMatMult(t 1 ,M″ 0 T ,k);

[0078] k)P 1 r 1 Send to P 0 ;

[0079] l)P0 Use the aggregation vector ξ for safe aggregation:

[0080] Compared with the prior art, the present invention has the following beneficial effects:

[0081] 1) No trusted key center is required. The federated learning system designed by the present invention does not rely on any trusted third-party key generation center, reducing the uncertainty risk of the trusted center. The matrix used by the participants to confuse the gradient is generated by secure calculation of the server, and the confused orthogonal matrix is ​​kept confidential by the server;

[0082] 2) Efficient and without loss of precision. In the aggregation framework proposed in this invention, the participants use a lightweight orthogonal matrix to confuse the local gradient, and the server performs lossless recovery of the aggregated gradient based on the matrix principle, which is more efficient than the method using homomorphic encryption and more accurate than the method using differential privacy;

[0083] 3) Based on lightweight orthogonal confusion matrix and two-party security technology, this invention adopts matrix partitioning for the first time in the field of federated learning, and realizes efficient and secure aggregate computing by carefully designing an efficient two-party secure computing protocol;

[0084] 4) Compatibility of Byzantine robustness algorithms. By studying the commonalities of Byzantine robustness algorithms, on the basis of the above design, the compatibility of multiple robustness algorithms (Krum, Multi-Krum, Fltrust, SignGuard, etc.) is improved, so that the present invention can use multiple robustness aggregation algorithms. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] Figure 1 This is a polymerization framework diagram of the present invention;

[0086] Figure 2 This is the block diagram and data flow diagram of the TPSRA training algorithm of the present invention. DETAILED DESCRIPTION

[0087] The present invention is further described below in conjunction with the accompanying drawings in order to better understand the technical solution.

[0088] The system model of the present invention provides a general federated learning two-party security aggregation framework (TPSRA). The overall architecture of the system is as follows: Figure 1 As shown, it mainly includes three role entities:

[0089] (1)Participant C i :As a participant in federated learning, it has a local private data set and participates in federated learning training tasks. Each round submits local gradient data g i, the federated learning aggregate gradient proposed in the present invention is calculated on the server side in the form of a vector. In a round of federated learning calculation, due to the complexity of the neural network, the gradient matrix generates a gradient vector in a flattened manner. The present invention divides a longer gradient vector into multiple shorter gradient vectors without loss of generality, and fixes the segmentation length to m. The computational efficiency is improved by performing parallel calculations on multiple vectors of the same length. In TPSRA, the participants do not submit their plaintext gradients directly to the server, but first perform preprocessing locally. The preprocessing includes three steps: 1) vertical expansion, 2) matrix confusion, and 3) random segmentation. The main effect of the preprocessing is to confuse the plaintext gradients so that the server cannot directly obtain the plaintext gradients, and the subsequent operations also operate on the preprocessed gradient matrix.

[0090] (2) Server P 0 : One of the entities that executes the two-party secure computation protocol, responsible for training and updating the global model and generating additional parameters for the aggregation algorithm.

[0091] (3) Server P 1 : One of the entities that executes the two-party secure computation protocol, with P 0 Perform two-party secure collaborative computing, calculate and generate a secure confusion matrix, and perform two-party secure aggregation.

[0092] Security model of the present invention: The adversaries in TPSRA include servers or Byzantine participants. The server is set to be honest and curious. The two servers will not collude with each other, but will obtain private information from the data provided by the participants. Byzantine participants may send wrong gradient data to affect the global model training.

[0093] In TPSRA, the adversary can be a server or a malicious participant with Byzantine behavior. Under the security model assumption of the invention, the two servers are honest and curious and will not collude with each other and share each other's data. However, there may be Byzantine participants among all participants, who may disrupt the training process of the global model by sending erroneous or maliciously tampered gradient data, thereby reducing the accuracy or stability of the model. The present invention uses a series of security measures and protocols to ensure that the data privacy of the participants can still be effectively protected when facing Byzantine participants and honest but curious servers, and maintain the overall security and reliability of model training.

[0094] Specific solution of the present invention: The proposed TPSRA framework aims to solve two major challenges in federated learning: 1) data privacy protection of participants; 2) Byzantine elastic federated learning, providing an integrated overall solution. TPSRA efficiently solves the above problems in the aggregation stage through a carefully designed two-party secure computing protocol. Based on the two-party secure computing protocol of matrix partitioning, TPSRA can efficiently be compatible with multiple robust aggregation algorithms, including but not limited to Krum, Multi-Krum, Fltrust, SignGuard, etc. The following describes the various modules of the TPSRA framework (TPSRA-Krum) using the Krum algorithm as an example.

[0095] The data flow of the TPSRA framework is as follows Figure 2 As shown, each round of training includes the following modules:

[0096] 1. Initialization module

[0097] The federated learning system TPSRA proposed in the present invention does not rely on any trusted key authority. TPSRA is based on the confusion orthogonal matrix. The client confuses the gradient matrix, and the confused gradient matrix information is obtained by the two servers using the confusion matrix generation algorithm OrthMatGen. In OrthMatGen, based on the orthogonal matrix theory, a lightweight two-party secure multiplication protocol (SecMatMult) is constructed by carefully designing a secure matrix multiplication protocol.

[0098] (1) Two-party secure multiplication protocol (SecMatMult)

[0099] 1) Mutually orthogonal matrices: Given a series of matrices If the following relations are satisfied, then this set of matrices is called mutually orthogonal matrices: Where 1≤i,j≤l.

[0100] Method for constructing mutually orthogonal matrices:

[0101] a) Generate an orthogonal matrix W of (n×l)×(n×l), W=[w 1 ,w 2 ... n×l ], where w i is the i-th column of W, satisfying: 1≤i,j≤n×l.

[0102] b) Split W into l matrices Each D i The form is

[0103] D i =[w (i-1)×n+1 ,w (i-1)×n+2 ,...,w i*n], 1≤i≤l.

[0104] c) Return As a set of mutually orthogonal matrices.

[0105] 2) Matrix decomposition technology: Given a matrix M, Assuming the decomposition coefficient k, M can be expressed as in satisfy Using matrix decomposition technology, the matrix can be decomposed into matrices of the same size, and M i It does not contain any information about the original matrix. The decomposition coefficient determines the degree of matrix decomposition and can be set randomly.

[0106] Construction method of matrix decomposition technology:

[0107] a) Select a series of random numbers satisfy and a set of random matrices

[0108] b) Calculation

[0109] c) Return and

[0110] 3) Specific implementation of the protocol: Based on mutually orthogonal matrices, the specific details of the two-party secure matrix multiplication protocol (SecMatMult) designed by the present invention are as follows:

[0111] Input: Assume P 0 Have a secret matrix X, P 1 With the secret matrix Y, factorize the coefficients k.

[0112] Output: Additive Secret Sharing R of XY 0 , R 1 Satisfaction: R 0 +R 1 =XY.

[0113] Process: P 0 , P 1 Perform two-party secure computation.

[0114] a)P 0 Constructed using matrix decomposition techniques satisfy P 0 Generate a series of mutually orthogonal matrices set up

[0115] b)P 0 Send T 1 and T2 Give P 1 ;

[0116] c)P 1 Choose a random real number R 1 , calculate S = T 1 YT 2 R 1 ;

[0117] d) P 1 Send S to P 0 ;

[0118] e)P 0 calculate

[0119] (2) Confused orthogonal matrix generation algorithm (OrthMatGen)

[0120] Input: In each round of training, P a Generate M′ locally a ,M″ a , where a∈{0,1}, and the matrix decomposition parameter k.

[0121] Output: Orthogonal matrix secret sharing: Satisfies a∈{0,1}.

[0122] process:

[0123] a)P 0 ,P 1 Calculated

[0124] b)P 0 ,P 1 Calculated

[0125] c) The two servers share the secret of the obtained orthogonal matrix with all participants.

[0126] Server P a (where a∈{0,1}), using the locally generated confusion orthogonal matrix M′ a (n×n), M″ a (m×m) and aggregation parameter c, the two servers run the orthogonal matrix generation algorithm (OrthMatGen) to generate the secret sharing of the confused orthogonal matrix, and Secret Sharing Satisfaction The secret shared by each server is expressed as The server sends the secret sharing of the respective confusion orthogonal matrices and the aggregation parameter c (set c=1) to all participants.

[0127] Participants: n participants have their own id, id∈[0,1], participants are denoted as C i , C i Sum the received secret shares of the orthogonal confusion matrix to obtain the matrix elements used for confusion and All participants obtain a random cutting parameter d from the server in each round, and the filtering parameter f is used as the filtering parameter of the Krum algorithm.

[0128] 2. Participant local pre-processing module: Participant C i The locally generated gradient data is uploaded to the server in the form of a vector. The gradient g i It can be expressed as: C i Perform the following three steps to preprocess the gradient data:

[0129] (1) Vertical expansion: C i The vector g i Expanded to n×m matrix form, the i-th row of the matrix is ​​g i , the rest of the positions are 0, that is

[0130] (2) Matrix confusion, C i The expanded matrix is ​​confused with the orthogonal confusion matrix M′, M″ to generate the gradient confusion matrix

[0131] (3) Random segmentation, C i According to the parameter d Perform random segmentation. Split the matrix into two parts, {2, d} and {d+1, m-1}, according to the columns of the matrix. 0 =d,m 1 =mm 0 . C i Send the two parts to the corresponding servers respectively, namely Send to P a , a∈{0,1}.

[0132] 3. Two-party secure computing module: In the process of secure aggregation in TPSRA, it can effectively be compatible with a variety of robust aggregation algorithms. The security protocol implementation of the Krum algorithm is as follows:

[0133] ①P a First, for each C i Upload the confusion gradient matrix and sum it up

[0134] ②P a calculate The two servers exchange their calculated data, P a Get the overall calculation result GG about the gradient matrix G T , both servers can be from GG T The necessary data for executing Krum's algorithm is obtained from

[0135] ③By running the Krum algorithm, both servers can obtain the overall value of the aggregated benign gradient. 0 Generate an aggregation vector ξ, whose length is the number of clients n, and the corresponding bit is 0 or 1, which determines whether the gradient vector is selected. The two servers use the two-party secure aggregation algorithm (TPSecAgg) for secure aggregation.

[0136] ④P 0 Aggregate gradient values, update the global model, and then distribute the global model to each participant.

[0137] (1) Two-Party Security Aggregation Algorithm (TPSecAgg)

[0138] enter: Where a∈{0,1}, the confusion gradient matrix is The aggregation vector is ξ and the aggregation coefficient is c.

[0139] Output: Aggregated gradients

[0140] process:

[0141] If c=1, then:

[0142] a)P 0 set up

[0143] b)P 0 ,P 1 Set m 0 ,m 1 ←SecMatMult(t,M′ 1 ,k).P 1 M 1 Send to P 0 .

[0144] c)P 0 ,P 1 Settings 0 , P 0 Will s 0 Send to P 1 .

[0145] d) P 1 Calculate r 1 ←(s 0 +s1)M′ 1 and send it to P 0 .

[0146] e)P 0 Calculate r 0 ←m 0 +m 1 , use the aggregation vector ξ for secure aggregation:

[0147]

[0148] If c = 0, then

[0149] f)P 1 According to the cutting coefficient, the private orthogonal matrix M″ 1 T Split by lines:

[0150]

[0151] g)P 1 Settings 0 , P 1 Will s 1 Send to P 0 .

[0152] h)P 0 Calculate t 0 =(s 0 +s1)M″ 0 T .

[0153] i)P 1 calculate

[0154] j)P 0 ,P 1 Setting r 0 ,r 1 ←SecMatMult(t 1 ,M″ 0 T ,k).

[0155] k)P 1 r 1 Send to P 0 .

[0156] l)P 0Use the aggregation vector ξ for safe aggregation:

[0157] The purpose of the secure aggregation algorithm is to aggregate selected benign gradients that are confused by orthogonal matrices. TPSRA uses orthogonal matrix theory to effectively mitigate the impact of the confusion matrix, and ultimately completes the aggregation operation without exposing any plaintext data to external servers. In addition, this process still requires the use of two-party secure computing to ensure the privacy of gradient information.

[0158] 4. Byzantine robust aggregation algorithm based on gradient distance

[0159] The present invention has strong compatibility in robust aggregation algorithms. The following takes the Fltrust algorithm as an example to illustrate the two-party secure calculation process of the Byzantine robust aggregation algorithm based on gradient distance (the same process will not be described again): The Fltrust algorithm requires a clean small-scale data set, which generates gradient updates that determine the direction of global model training. The server needs to add the gradient generated by the root data set to the secure aggregation calculation.

[0160] ①P 0 Initialize the root dataset and generate gradients P 0 For g 0 Perform the same vertical expansion to expand into a (n+1)×m dimensional matrix, with the first row of the matrix being g 0 .

[0161] ②P 0 , P 1 Settings 0 ,s 1 ←SecMatMult(G 0 ,M″ 1 ,k),P 1 Send 1 Give P 0 .

[0162] ③P 0 calculate At the same time, use the cutting parameter d of the current training round to G 0 Make the cut.

[0163] The server sums the received gradients according to the process described above, including the obfuscated root gradient. 0 Set the aggregation vector ξ. To be compatible with the Fltrust algorithm, the corresponding bit of the aggregation vector is set to s(i) = ReLU(c i ),in The data required for calculation can be obtained from GG T get.

[0164] 5. Threshold robust aggregation algorithm based on gradient L2 norm

[0165] Enhanced poisoning attacks are a particularly serious type of attack that can produce large-scale gradient changes in a federated learning environment, thereby affecting the performance of the global model. This type of attack usually interferes with the model training process through carefully designed malicious gradient injections, causing the model to deviate or fail. A reasonable defense measure is for the server to simply ignore updates that exceed a certain threshold. In more complex scenarios, this threshold can even be selected randomly. Studies have shown that limiting the gradient norm during aggregation can effectively reduce the impact of such attacks, and many algorithms also use gradient norm restrictions. The present invention uses the SignGuard algorithm with better performance to explain the two-party secure aggregation process. The SignGuard algorithm uses a combination of threshold restrictions based on the L2 norm and symbol filtering techniques to increase the robustness of federated learning aggregation.

[0166] ①P 0 Initialize a random diagonal matrix All diagonal elements are positive numbers, and Q is the sign matrix of the confusion.

[0167] ②P 0 , P 1 Settings 0 ,s 1 ←SecMatMult(Q,M″ 1 ,k),P 1 Send 1 Give P 0 .

[0168] ③P 0 Calculate R = (s 0 +s 1 )M″ 0 , and then split R according to the cutting parameter d of the current training round, R = [R (0) R (1) ]. 0 Send R (1) Give P 1 .

[0169] ④P a , a∈{0,1}, R (a) Splice to Get the new confused gradient matrix and then calculate it locally

[0170] P 0 Set the aggregation vector ξ. In the aggregation vector, the benign gradient subscripts are selected by two methods, and the corresponding bits are set to 1; the rest of the bits are set to 0.

Claims

1. A two-party secure robust aggregation framework for federated learning that integrates gradient segmentation and matrix confusion, characterized by: The framework includes the following three parties: Participant C i :As a participant in federated learning, it has a local private data set, participates in federated learning training tasks, and submits local gradient data g in each round i , and the aggregated gradient of federated learning is calculated on the server side in the form of vectors; Server P0: One of the entities that executes the two-party secure computation protocol, responsible for training and updating the global model and generating additional parameters for the aggregation algorithm; Server P1: One of the entities that executes the two-party secure computation protocol, performs two-party secure collaborative computation with P0, calculates and generates the security confusion matrix, and performs two-party secure aggregation.

2. The method for two-party secure robustness aggregation of federated learning integrating gradient segmentation and matrix confusion as claimed in claim 1, characterized in that: This method is implemented by the following modules: 1) Initialization module: This method is based on the obfuscated orthogonal matrix. The client obfuscates the gradient matrix, and the obfuscated gradient matrix information is obtained by the two servers using the obfuscated orthogonal matrix generation algorithm OrthMatGen. In OrthMatGen, based on the orthogonal matrix theory, a lightweight two-party secure multiplication protocol is constructed by carefully designing a secure matrix multiplication protocol; 2) Participants and local preprocessing module: Participant C i The locally generated gradient data is uploaded to the server in the form of a vector. The gradient g i It can be expressed as: C i Perform the following three steps to preprocess the gradient data: 2-1) Vertical expansion: C i The vector g i Expanded to n×m matrix form, the i-th row of the matrix is ​​g i , the rest of the positions are 0, that is 2-2) Matrix Confusion: C i The expanded matrix is ​​confused with the orthogonal confusion matrix M′, M″ to generate the gradient confusion matrix 2-3) Random Split: C i According to the parameter d Perform random segmentation, dividing the matrix into two parts {2, d} and {d+1, m-1} according to the columns of the matrix, and record m0=d, m1=m-m0, C i Send the two parts to the corresponding servers respectively, namely Send to P a , a∈{0,1}; 3) Two-party secure computing module: In the process of secure aggregation in TPSRA, multiple robust aggregation algorithms can be effectively compatible, among which the security protocol implementation of Krum algorithm is as follows: 3-1)P a First, for each C i Upload the confusion gradient matrix and sum it 3-2)P a calculate The two servers exchange their calculated data, P a Get the overall calculation result GG about the gradient matrix G T , both servers can be from GG T Obtain the necessary data to execute Krum's algorithm; 3-3) By running the Krum algorithm, both servers can obtain the overall value of the aggregated benign gradient. P0 generates an aggregation vector ξ, whose length is the number of clients n, and the corresponding bit is 0 or 1, which determines whether the gradient vector is selected. Both servers use the two-party secure aggregation algorithm (TPSecAgg) for secure aggregation; 3-4) P0 aggregates the gradient values, updates the global model, and then distributes the global model to each participant; 4) Byzantine robustness aggregation module algorithm based on gradient distance: including but not limited to the Fltrust algorithm. The Fltrust algorithm requires a clean small-scale data set, which generates gradient updates that determine the direction of global model training. The server needs to add the gradient generated by the root data set to the security aggregation calculation: 4-1) P0 initializes the root data set and generates gradients P0 performs the same longitudinal expansion on g0, expanding it into a (n+1)×m-dimensional matrix, with g0 as the first row; 4-2) P0, P1 set s0, s1←SecMatMult(G0, M″1, k), P1 sends s1 to P0; 4-3) P0 calculation At the same time, use the cutting parameter d of the current training round to cut G0; 4-4) The server sums the received gradients according to the process described above, including the obfuscated root gradients, and P0 sets the aggregation vector ξ. In order to be compatible with the Fltrust algorithm, the corresponding bit of the aggregation vector is set to s(i) = ReLU(c i ),in The data required for calculation can be obtained from GG T get; 5) Gradient L2 norm-based threshold robustness aggregation algorithm module: The SignGuard algorithm is used to explain the two-party security aggregation process. The SignGuard algorithm uses a combination of L2 norm-based threshold restrictions and symbol filtering techniques to increase the robustness of federated learning aggregation, specifically: 5-1) P0 initializes a random diagonal matrix All diagonal elements are positive numbers, and Q is the sign matrix of confusion; 5-2) P0, P1 set s0, s1←SecMatMult(Q, M″1, k), P1 sends s1 to P0; 5-3) P0 calculates R = (s0 + s1) M ″ 0, and then splits R according to the cutting parameter d of the current training round, R = [R (0) R (1) ], P0 sends R (1) To P1; 5-4)P a , a∈{0,1}, R (a) Splice to Get the new confused gradient matrix and then calculate it locally 5-5) P0 sets the aggregation vector ξ. In the aggregation vector, the benign gradient subscript is selected by two methods, and its corresponding bit is set to 1; the remaining bits are set to 0.

3. A two-party secure robust aggregation method for federated learning integrating gradient segmentation and matrix obfuscation as described in claim 2, characterized in that In step 1), the two-party secure multiplication protocol includes: a) Mutually orthogonal matrices: Given a series of matrices If the following relations are satisfied, then this set of matrices is called mutually orthogonal matrices: Where 1≤i,j≤l; The mutually orthogonal matrix construction method is: a-1) Generate an orthogonal matrix W of (n×l)×(n×l), W=[w1,w2...w n×l ], where w i is the i-th column of W, satisfying: a-2) Split W into l matrices Each D i The form is D i =[w (i-1)×n+1 ,w (i-1)×n+2 ,...,w i*n ], 1≤i≤l; a-3) Return As a set of mutually orthogonal matrices; b) Matrix decomposition technique: Given a matrix M, Assuming the decomposition coefficient k, M can be expressed as in satisfy Using matrix decomposition technology, the matrix can be decomposed into matrices of the same size, and M i It does not contain any information about the original matrix. The decomposition coefficient determines the degree of matrix decomposition and can be set randomly. The construction method steps of the matrix decomposition technology are: b-1) Select a series of random numbers satisfy and a set of random matrices b-2) Calculation b-3) Return and c) Specific implementation of the protocol: Based on mutually orthogonal matrices, the specific details of the two-party secure matrix multiplication protocol SecMatMult are as follows: Input: Assume P0 has the secret matrix X, P1 has the secret matrix Y, and the decomposition coefficient k; Output: XY’s additive secret sharing R0, R1 satisfies: R0+R1=XY; Process: P0 and P1 perform two-party secure computation: c-1) P0 is constructed using matrix decomposition technology satisfy P0 generates a series of mutually orthogonal matrices set up c-2) P0 sends T1 and T2 to P1, c-3) P1 selects a random real number R1 and calculates S=T1Y-T2R1, c-4) P1 sends S to P0, c-5) P0 calculation 4. A two-party secure robust aggregation method for federated learning integrating gradient segmentation and matrix confusion as described in claim 2, characterized in that In step 1), the specific steps of the confusion orthogonal matrix generation algorithm are: Input: In each round of training, P a Generate M′ locally a , M′ a ′, where a∈{0,1}, and matrix decomposition parameter k; Output: Orthogonal matrix secret sharing: Satisfies a∈{0,1}; process: 1) P0, P1 are calculated 2) P0, P1 are calculated 3) The two servers share the secret of the obtained orthogonal matrix with all participants; server P a (where a∈{0,1}), using the locally generated confusion orthogonal matrix M′ a (n×n), M″ a (m×m) and aggregation parameter c, the two servers run the orthogonal matrix generation algorithm (OrthMatGen) to generate the secret sharing of the confused orthogonal matrix, and Secret Sharing Satisfaction The secret shared by each server is expressed as The server sends the secret sharing of their respective confusion orthogonal matrices and the aggregation parameter c (set c = 1) to all participants; Participants: n participants have their own id, id∈[0,1], participants are denoted as C i , C i Sum the received secret shares of the orthogonal confusion matrix to obtain the matrix elements used for confusion and All participants obtain a random cutting parameter d from the server in each round, and the filtering parameter f is used as the filtering parameter of the Krum algorithm.

5. A two-party secure robust aggregation method for federated learning integrating gradient segmentation and matrix obfuscation as described in claim 2, characterized in that In step 3), the two-party security aggregation algorithm (TPSecAgg) is: enter: Where a∈{0,1}, the confusion gradient matrix is The aggregation vector is ξ, and the aggregation coefficient is c; Output: Aggregated gradients process: If c = 1, then: a) P0 setting b) P0, P1 set m0, m1←SecMatMult(t, M′1, k), and P1 sends m1 to P0; c) P0, P1 settings P0 sends s0 to P1; d) P1 calculates r1←(s0+s1)M′1 and sends it to P0; e) P0 calculates r0←m0+m1 and uses the aggregation vector ξ for safe aggregation: If c = 0, then: f) P1 converts the private orthogonal matrix into a matrix according to the cutting coefficient Split by lines: g) P1 setting P1 sends s1 to P0; h) P0 calculation i) P1 calculation j) P0, P1 setting k) P1 sends r1 to P0; l) P0 uses the aggregation vector ξ for secure aggregation: