A mask-based global model training method, apparatus, and device

By using a mask training method in distributed learning to generate and flip masks to protect data privacy, the privacy leakage problem in existing technologies is solved, efficient and secure global model training is achieved, communication costs are reduced, and the privacy protection capability of the model is improved.

CN119249475BActive Publication Date: 2025-11-14INSTITUTE OF INFORMATION ENGINEERING CHINESE ACADEMY OF SCIENCES
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411222582.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2025-11-14
Estimated Expiration
2044-09-02

AI Technical Summary

Technical Problem

Existing distributed learning methods pose privacy risks in terms of protecting data privacy, especially data reconstruction attacks and attribute inference attacks. Existing technologies struggle to provide effective privacy protection without significantly reducing model accuracy or increasing computational and communication overhead.

Method used

A mask-based global model training method is adopted. Global and local masks are generated by randomly initializing model parameters, and the masks are flipped using a random flip probability vector. The binary mask is transmitted for communication, and the server performs aggregation and correction to achieve privacy protection.

Benefits of technology

It effectively resists data reconstruction attacks and attribute inference attacks, reduces communication overhead, enhances data privacy protection, and maintains the accuracy and scalability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119249475B_ABST
    Figure CN119249475B_ABST
Patent Text Reader

Abstract

This invention relates to the field of privacy protection, providing a mask-based global model training method, apparatus, and device. The method includes: a server initializing model parameters and various masks; a client interacting with the server to obtain a global mask and update its local mask; the client processing the model parameters using the updated mask to obtain the model output and updating the mask accordingly; then, performing binary processing and random flipping on the mask before uploading it to the server; the server selecting a set of clients, aggregating and correcting their uploaded masks, and generating a new global mask for the next iteration; through multiple iterations until a preset number of iterations is met, finally outputting the trained global model. This invention protects user privacy through masking technology while simultaneously achieving global model training, improving the privacy and security of model training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of privacy protection technology, and in particular to a mask-based global model training method, apparatus, and device. Background Technology

[0002] In recent years, with the rapid development of big data and artificial intelligence technologies, deep learning has made significant progress in many fields such as image recognition, speech recognition, and natural language processing. To improve the training speed and data processing capabilities of deep learning, distributed learning methods have emerged. By distributing massive datasets and computational tasks across multiple machines for parallel processing, distributed learning effectively solves the bottleneck problems of data storage and computing resources in single-machine training, greatly improving the efficiency and scalability of model training.

[0003] Among the various implementations of distributed learning, Federated Learning (FL) has attracted considerable attention due to its unique privacy protection mechanism. Federated Learning allows participants to train models locally and aggregate global models by sharing model weights or gradient updates with a central server, thus avoiding the direct transmission of raw data and reducing the risk of data leakage. However, despite its advantages in protecting the privacy of raw data, research shows that servers can still extract client privacy information from shared model weights or gradients. This risk of privacy leakage mainly stems from two types of privacy inference attacks: data reconstruction attacks and attribute inference attacks. The former aims to reconstruct the client's original training samples, while the latter focuses on inferring sensitive attributes in the training set, such as the user's gender and age.

[0004] To address these privacy risks, academia and industry have explored various privacy protection technologies, primarily including encryption, differential privacy, trusted execution environments (TEAs), and defense strategies against specific attacks. Encryption-based methods protect the confidentiality of data exchange through homomorphic encryption or multi-party computation, but these methods often come with high computational and communication overhead. Differential privacy protects privacy by adding noise to model updates; while effectively resisting data reconstruction attacks, it can significantly reduce model accuracy. TEAs (such as Intel SGX) protect the confidentiality of code and data by isolating the execution environment, but still face challenges such as memory limitations in practical deployments. In addition, there are some specially designed defense methods aimed at resisting specific data reconstruction attacks, but these methods typically cannot fully protect sensitive attribute information. Summary of the Invention

[0005] This invention provides a mask-based global model training method, apparatus, and device, which solves the data privacy leakage defects in the prior art and achieves secure, efficient, and fast global model training.

[0006] This invention provides a mask-based global model training method, comprising the following steps:

[0007] Step 1: The server randomly initializes the model parameters, generates a global mask for the server and a local mask for the client based on the model parameters, and determines the random flip probability vector based on the local mask;

[0008] Step 2: The client interacts with the server to obtain the global mask for this iteration, and updates the first local mask for this iteration to the second local mask based on the global mask;

[0009] Step 3: The client applies the second local mask to the model parameters to obtain the model output. Based on the model output, the training set, the second local mask, and the model parameters, the gradient of the second local mask is obtained. The second local mask is updated based on the gradient of the second local mask to obtain the third local mask.

[0010] Step 4: The client performs binary processing on the third local mask to obtain the fourth local mask; according to the random flip probability vector, the fourth local mask is randomly flipped to obtain the fifth local mask; the flipping is the inversion of the binary value.

[0011] Step 5: Each client uploads its local fifth local mask to the server;

[0012] Step 6: The server randomly selects one or more clients from all clients to form a client set. The server aggregates and corrects the fifth local mask uploaded by each client in the client set to obtain a sixth local mask. The sixth local mask is used as the global mask for the next iteration of client interaction.

[0013] Iterate through steps 2-6 until the number of iterations meets the preset requirement, then terminate the training and output the trained global model.

[0014] According to the mask-based global model training method provided by the present invention, the steps of randomly initializing model parameters, generating a global mask for the server and a local mask for the client based on the model parameters, and determining a random flip probability vector according to the number of model layers specifically include: after the server determines the global model, the server randomly initializes and fixes the model parameters of the global model; the server randomly initializes a global mask with the same shape as the model parameters; each client randomly initializes a local mask with the same initial value and the same shape as the model parameters; and the random flip probability vector is determined according to the number of layers of the global model and the local mask.

[0015] According to a mask-based global model training method provided by the present invention, the client interacts with the server to obtain the global mask for the current iteration, and updates the first local mask for the current iteration to a second local mask based on the global mask. Specifically, the method includes: the client obtaining the global mask for the current iteration from the server; performing an absolute value operation on each corresponding element in the first local mask matrix; performing positive or negative processing on the result of the absolute value operation based on the value of each element in the global mask; and replacing each element in the first local mask with the value after the positive or negative processing to obtain the updated second mask matrix.

[0016] According to a mask-based global model training method provided by the present invention, the step of applying a second local mask to model parameters to obtain model output, and obtaining the gradient of the second local mask based on the model output, training set, second local mask, and model parameters, specifically includes: calculating model output based on the second local mask and model parameters; determining the gradient matrix of the activation function based on the second local mask; determining a loss function based on the training set and model output; and determining the gradient of the second local mask based on the model output, training set, gradient matrix, and loss function.

[0017] According to a mask-based global model training method provided by the present invention, the step of randomly flipping the fourth local mask according to the random flipping probability vector to obtain the fifth local mask specifically includes: determining the random flipping probability of each layer in the random flipping probability vector; flipping the element values ​​of the corresponding layer of the fourth local mask according to the random flipping probability of each layer, and obtaining the fifth local mask after the flipping is completed.

[0018] According to a mask-based global model training method provided by the present invention, the step of updating the second local mask according to the gradient of the second local mask to obtain a third local mask specifically includes: determining a temporary quantity according to the gradient of the second local mask and the learning rate; and obtaining the difference between the second local mask and the temporary quantity as the third local mask.

[0019] The present invention also provides a mask-based global model training device, comprising the following modules:

[0020] An initialization module is used to randomly initialize model parameters on the server side, generate a global mask for the server and a local mask for the client based on the model parameters, and determine a random flip probability vector based on the local mask.

[0021] The local mask acquisition module is used for the client to interact with the server to obtain the global mask for this iteration, and to update the first local mask for this iteration to the second local mask based on the global mask;

[0022] The local mask training module is used by the client to apply the second local mask to the model parameters to obtain the model output, obtain the gradient of the second local mask based on the model output, the training set, the second local mask, and the model parameters, and update the second local mask based on the gradient of the second local mask to obtain the third local mask.

[0023] The local mask random flipping module is used by the client to perform binary processing on the third local mask to obtain a fourth local mask; and to randomly flip the fourth local mask according to the random flipping probability vector to obtain a fifth local mask; the flipping is to invert the binary value;

[0024] The local mask transmission module is used by each client to upload its fifth local mask to the server;

[0025] The online aggregation module is used by the server to randomly select one or more clients from all clients to form a client set, aggregate and correct the fifth local mask uploaded by each client in the client set to obtain a sixth local mask; the sixth local mask is used as the global mask for the next iteration to interact with the client.

[0026] The model output module controls the iterative execution of the local mask acquisition module, local mask training module, local mask random flipping module, local mask transmission module, and online aggregation module until the number of iterations meets the preset requirements, at which point training terminates and the trained global model is output.

[0027] 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 the mask-based global model training method described above.

[0028] 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 the mask-based global model training method as described above.

[0029] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the mask-based global model training method as described above.

[0030] This invention provides a mask-based global model training method, apparatus, and device, which offers the following advantages: By using mask-based training, the model parameters used for communication are transformed into binary masks. Compared to floating-point parameters, this not only resists data reconstruction attacks but also reduces communication overhead, helping to reduce the risk of data leakage and thus enhancing data privacy protection. Since the transmitted data is a mask rather than complete model parameters or large amounts of original data, this training method effectively reduces communication costs between clients and servers in distributed learning environments. The mask is typically much smaller than the original data or complete model parameters, saving bandwidth and transmission time. A random flip probability vector is introduced during training to randomly flip the mask, protecting sensitive attribute information and resisting attribute inference attacks. Simultaneously, the probability of flipping the mask is determined based on the attribute information embedded in each layer, ensuring model accuracy. This invention is applicable to distributed learning environments where multiple clients can train in parallel, while the server is responsible for aggregating and updating the mask. This architecture has good scalability, easily increasing or decreasing the number of clients participating in training to adapt to different computing resources and data distributions. Attached Figure Description

[0031] 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.

[0032] Figure 1 This is one of the flowcharts illustrating the mask-based global model training method provided by this invention.

[0033] Figure 2 This is a flowchart of the initialization process for model parameters, global mask, local mask, and random flip probability vector provided by the present invention.

[0034] Figure 3 This is the second flowchart illustrating the mask-based global model training method provided by this invention.

[0035] Figure 4 This is a schematic diagram of the structure of the mask-based global model training device provided by the present invention.

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

[0037] 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.

[0038] In recent years, deep learning has been widely applied in various fields such as image processing, speech processing, and natural language processing. With the rise of the big data concept, the demand for training speed and data processing capabilities in deep learning has been continuously increasing. Traditional single-machine-based training processes are insufficient to meet the massive data storage and computation requirements. To improve data computation speed, reduce task time, and enhance scalability, it is necessary to distribute tasks with large amounts of data and computation across multiple machines. Therefore, distributed deep learning training methods have been proposed.

[0039] However, since raw data often contains a lot of sensitive information, the information exchange between various participants in distributed learning poses a risk of privacy leakage. Federated Learning (FL), as a distributed deep learning method, avoids revealing sensitive information and thus protects the privacy of raw data by sharing model weights or gradient updates with a central server. However, researchers have demonstrated that an honest server can obtain private information from the shared model weights or gradients. Specifically, many privacy-inferring attacks have been proposed, mainly including data reconstruction attacks and attribute inference attacks. The former attempts to reconstruct the client's original training samples, while the latter does not focus on the specific data but aims to infer sensitive attributes in the training set, such as gender. Therefore, in federated learning scenarios, how to defend against different attacks while maintaining good accuracy is an urgent problem to be solved.

[0040] To address the aforementioned privacy issues, various protection technologies have been proposed, which can be mainly categorized into the following four types.

[0041] 1. A secure aggregation method based on encryption.

[0042] 2. Differential Privacy (DP) mechanism.

[0043] 3. A privacy-preserving federated learning framework utilizing a Trusted Execution Environment (TEE).

[0044] 4. Defense methods specifically designed to resist data reconstruction attacks.

[0045] The existing distributed learning privacy protection schemes mentioned above are unable to effectively balance accuracy, privacy, and efficiency.

[0046] Secure aggregation ensures that the central server can only obtain locally updated aggregation results using homomorphic encryption and secret sharing techniques, which inevitably brings considerable additional computational and communication overhead.

[0047] Differential privacy mechanisms add Gaussian or Laplace noise to model updates, theoretically providing an upper bound on membership, which refers to whether a sample is included in the training set or whether the client participates in the global update. However, to provide sufficient privacy protection against data reconstruction attacks and attribute inference attacks, it leads to a significant reduction in accuracy.

[0048] Other defense methods specifically designed to defend against data reconstruction attacks are ineffective in protecting attribute information.

[0049] In summary, in a distributed environment, existing defense measures cannot achieve complete protection against the leakage of raw data and sensitive attribute information without causing a significant decrease in utility or a large defense overhead.

[0050] The purpose of this invention is to design a new privacy protection framework for distributed learning scenarios that can balance accuracy, privacy and communication efficiency.

[0051] This invention improves the model parameters transmitted during communication. By using mask-based training, the model parameters used for communication are transformed into binary masks. Compared with floating-point parameters, this not only resists data reconstruction attacks but also reduces communication overhead. Furthermore, this invention designs a privacy-aware random mechanism to randomly flip the mask, protecting sensitive attribute information and resisting attribute inference attacks. Simultaneously, the probability of flipping the mask is determined based on the attribute information embedded in each layer, thus ensuring model accuracy.

[0052] The following is combined with Figures 1-5 The embodiments of the present invention are described in detail.

[0053] The privacy protection method for distributed learning provided by this invention, taking federated learning as an example, is implemented by the client and server participating in federated learning. The method mainly includes six steps: initialization, obtaining the mask, training the mask, randomly flipping the mask, uploading the mask, and online model aggregation.

[0054] Figure 1 This is one of the flowcharts illustrating the mask-based global model training method provided by this invention, such as... Figure 1 As shown, the method includes the following steps:

[0055] S110. The server randomly initializes model parameters, generates a global mask for the server and a local mask for the client based on the model parameters, and determines a random flip probability vector based on the local mask.

[0056] According to a mask-based global model training method provided by the present invention, the steps of randomly initializing model parameters, generating a global mask for the server and a local mask for the client based on the model parameters, and determining a random flip probability vector based on the number of model layers specifically include: after the server determines the global model, the server randomly initializes and fixes the model parameters of the global model; the server randomly initializes a global mask with the same shape as the model parameters; each client randomly initializes a local mask with the same initial value and the same shape as the model parameters; and a random flip probability vector is determined based on the number of layers of the global model and the local mask. The global mask and the local mask are collectively referred to as masks.

[0057] Specifically, step 1, initialization, includes fixing model parameters, generating a global mask, generating a local mask, and determining the random flip probability vector. The specific steps are as follows: Figure 2 As shown, it includes the following four steps:

[0058] Step 11: The server randomly initializes and then fixes the model's parameters. After determining the global model, the server randomly initializes and then fixes the model's parameters.

[0059] Step 12: The server randomly initializes the global binary mask. Then the server randomly initializes the global binary mask. Its shape is the same as the model parameters, and each element randomly takes the value of 0 or 1;

[0060] Step 13: All clients randomly initialize their local real number masks using the same seed. Its shape is the same as the model parameters; the same seed means the same starting point.

[0061] Step 14: The server determines the random flip probability vector. , where L is the number of layers in the model. Each element corresponds to a layer of model parameters and also to a layer of the mask, representing the... Layer mask with The probability remains constant, The probability is randomly flipped, and the value of each element is determined by the attribute leakage risk of the corresponding layer of the model.

[0062] If the first The probability of random flipping of the layer mask is Generate auxiliary data with a similar distribution to the training set. Depending on whether it contains The attributes in the image are used to train two models based on the mask, denoted as follows: and Take the first one from each of them. layer mask and ,but The calculation method is as follows:

[0063]

[0064] Among them, cos( () indicates the calculation of cosine similarity. The initial random flip probability jointly specified by the client and the server. .

[0065] By initializing global and local masks and combining them with randomly flipped probability vectors, data can be effectively masked during training, thus protecting the privacy of the original data. This masking mechanism can prevent data leakage, which is especially important when dealing with sensitive or private data.

[0066] S120. The client interacts with the server to obtain the global mask for this iteration, and updates the first local mask for this iteration to the second local mask based on the global mask.

[0067] According to a mask-based global model training method provided by the present invention, the client interacts with the server to obtain the global mask for the current iteration, and updates the first local mask for the current iteration to a second local mask based on the global mask. Specifically, the method includes: the client obtaining the global mask for the current iteration from the server; performing an absolute value operation on each corresponding element in the first local mask matrix; performing positive or negative processing on the result of the absolute value operation based on the value of each element in the global mask; and replacing each element in the first local mask with the value after the positive or negative processing to obtain the updated second mask matrix.

[0068] Specifically, step 2, obtaining the mask. The client obtains the global mask from the server. This global mask is in binary form, and updates the first local mask based on the global mask.

[0069] Specifically, the client obtains the first... Global binary mask for the next interaction And update the local real number mask using the following formula. :

[0070]

[0071] Among them, abs( ) indicates taking the absolute value. Represents the first element of the global binary mask matrix. Line number Column elements, The first element of the local real number mask matrix represents the... Line number Column elements. It should be noted that the first local mask is obtained before the absolute value operation, and the second local mask is obtained after taking the absolute value and performing a positive / negative operation. Both the first and second local masks are in real number form.

[0072] The introduction of a global mask adds a layer of masking to the original data, further enhancing data privacy protection. Because a global mask is in binary form, it provides an additional obfuscation mechanism when combined with a local real-value mask, making the original data more difficult to reverse engineer.

[0073] S130. The client applies the second local mask to the model parameters to obtain the model output. Based on the model output, the training set, the second local mask, and the model parameters, the client obtains the gradient of the second local mask. Based on the gradient of the second local mask, the client updates the second local mask to obtain the third local mask.

[0074] According to a mask-based global model training method provided by the present invention, the step of applying a second local mask to model parameters to obtain model output, and obtaining the gradient of the second local mask based on the model output, training set, second local mask, and model parameters, specifically includes: calculating model output based on the second local mask and model parameters; determining the gradient matrix of the activation function based on the second local mask; determining a loss function based on the training set and model output; and determining the gradient of the second local mask based on the model output, training set, gradient matrix, and loss function.

[0075] According to a mask-based global model training method provided by the present invention, the step of updating the second local mask according to the gradient of the second local mask to obtain a third local mask specifically includes: determining a temporary quantity according to the gradient of the second local mask and the learning rate; and obtaining the difference between the second local mask and the temporary quantity as the third local mask.

[0076] Specifically, step 3 involves training the mask. The client applies the second local mask to the model parameters, and then uses the training set, the second local mask, and the model parameters to obtain the gradient, which is then used to obtain a new third local mask.

[0077] Specifically, the client updates the second local mask. Train the local model. For each sample in the training set... Model parameters The model is calculated as follows:

[0078]

[0079] in Hadamard product, which is the product of elements at the same position in a matrix. This represents the Sigmoid function, i.e. , Indicates the threshold is The hard threshold function, which is used to determine the threshold for each element of a matrix if its value is greater than a certain threshold. If the value is less than or equal to 1, then it becomes 1. If it becomes 0, then in this example, let .

[0080] From this, we can obtain the second local mask. The gradient is:

[0081]

[0082] in The loss function of the model, Let be the gradient matrix of the Sigmoid function, and let its be the gradient of the Sigmoid function. Line number Column element values , Indicates passing through the hard threshold function The calculated matrix of the first Line number The element values ​​of the column.

[0083] This updates the second local mask in real form. The third local mask in real number form :

[0084]

[0085] in This is the learning rate.

[0086] By training with a mask instead of directly training model parameters, the original data is better protected. This is because the masking mechanism acts as a data masking mechanism during training, reducing the risk of data leakage. In distributed learning environments, frequent information exchange is required between clients and servers. Since masks are transmitted instead of complete model parameters or raw data, this significantly reduces communication costs.

[0087] S140. The client performs binary processing on the third local mask to obtain a fourth local mask; according to the random flip probability vector, the fourth local mask is randomly flipped to obtain a fifth local mask; the flipping is the inversion of the binary value.

[0088] According to a mask-based global model training method provided by the present invention, the step of randomly flipping the fourth local mask according to the random flipping probability vector to obtain the fifth local mask specifically includes: determining the random flipping probability of each layer in the random flipping probability vector; flipping the element values ​​of the corresponding layer of the fourth local mask according to the random flipping probability of each layer, and obtaining the fifth local mask after the flipping is completed.

[0089] Specifically, step 4, mask randomization. The client randomly flips the local mask according to the random flip probability vector, where flipping means inverting the values ​​of the binary mask.

[0090] Specifically, the first The client calculates the first The fourth local mask during the next interaction That is, the third local mask in real form is processed by an activation function to obtain the fourth local mask in binary form. Then, for the... The fourth local mask of the layer, with The probability of randomly flipping the first The value of each element in the fourth local mask is determined by flipping the binary value. After randomly flipping each element, the fifth local mask in binary form is obtained. .

[0091] By randomly flipping the mask values, the information in the original data is further obfuscated, making it more difficult to reverse engineer the original data from the mask. This randomness increases the difficulty for attackers to recover sensitive information, thereby enhancing the level of privacy protection.

[0092] S150. Each client uploads its local fifth local mask to the server.

[0093] Specifically, step 5 involves uploading the mask. Each client uploads its own binary fifth local mask. Upload to the server.

[0094] S160. The server randomly selects one or more clients from all clients to form a client set, aggregates and corrects the fifth local mask uploaded by each client in the client set to obtain a sixth local mask; the sixth local mask is used as the global mask for the next iteration to interact with the client.

[0095] Specifically, step 6, online model aggregation. The server aggregates the collected fifth local mask, then eliminates the effects of random flipping to obtain the corrected local mask, which serves as the global mask for the next interaction with the client.

[0096] Specifically, the server comes from all Randomly selected from clients A set of clients The elements in the j-th row and i-th column of the fifth local mask in their uploaded binary form. Perform aggregation to obtain the elements in the sixth local mask. The calculation formula is:

[0097]

[0098]

[0099] Among them, for the first A layered binary mask eliminates the effects of random flipping layer by layer using the following formula:

[0100]

[0101] This yields the corrected mask, which will serve as the global mask for the next interaction with the client. .

[0102] S170, iterate through S120-S160 until the number of iterations meets the preset requirement, then terminate the training and output the trained global model.

[0103] Specifically, repeat steps 2-6 until the number of interactions meets the preset total number of interactions. If the condition is met, training will terminate and the trained global model will be output.

[0104] By aggregating local masks from multiple clients and eliminating the effects of random flipping, the server can obtain a more accurate global mask. Since the client's local mask is randomly flipped before uploading, this protects client data privacy to some extent. Simultaneously, the aggregation and elimination of random flipping effects on the server side is equivalent to "averaging" multiple masks, which helps reduce the impact of individual outliers or noise on the global model, thereby enhancing the model's robustness.

[0105] like Figure 3The diagram shown is a second illustration of a mask-based model training process provided by the present invention. The global model is initialized through an initialization module, obtaining a global binary mask, model parameters, and a random flip vector. The global binary mask is obtained through a mask acquisition module, and an updated local real-valued mask is output. The model is trained using a mask training module based on the model parameters, training set, and the updated local real-valued mask. The trained local real-valued mask is input into a random flip mask module for binary conversion, flipped using a random flip probability vector, and the randomly flipped local binary mask is uploaded. The trained model is output through an online model aggregation module.

[0106] In summary, this invention proposes a model training method based on binary masks. By using mask-based training, the communication cost between the client and the server in distributed learning can be reduced, communication efficiency can be improved, and privacy protection against data reconstruction attacks can be provided, thus achieving defense against data reconstruction attacks.

[0107] This invention proposes a layer-by-layer parameter randomization method. By quantifying the attribute leakage risk of each layer of the model mask, the probability of mask randomization is determined. By using mask randomization and adjusting the randomization probability, this method not only defends against attribute inference attacks and provides greater protection for sensitive masks, but also reduces perturbations added to masks with lower privacy risks. This alleviates the decline in model accuracy caused by defensive measures, mitigates the decrease in model usability, and balances model privacy with practicality.

[0108] The mask-based global model training device provided by the present invention will be described below. The mask-based global model training device described below can be referred to in correspondence with the mask-based global model training method described above.

[0109] like Figure 4 The image shows a mask-based global model training device provided by the present invention, comprising:

[0110] The initialization module 410 is used to randomly initialize model parameters on the server side, generate a global mask for the server and a local mask for the client based on the model parameters, and determine a random flip probability vector based on the local mask.

[0111] The local mask acquisition module 420 is used for the client to interact with the server to obtain the global mask for this iteration, and to update the first local mask for this iteration to the second local mask based on the global mask;

[0112] The local mask training module 430 is used by the client to apply the second local mask to the model parameters to obtain the model output, obtain the gradient of the second local mask based on the model output, the training set, the second local mask, and the model parameters, and update the second local mask based on the gradient of the second local mask to obtain the third local mask.

[0113] The local mask random flipping module 440 is used by the client to perform binary processing on the third local mask to obtain a fourth local mask; and to randomly flip the fourth local mask according to the random flipping probability vector to obtain a fifth local mask; the flipping is to invert the binary value.

[0114] The local mask transmission module 450 is used by each client to upload its local fifth local mask to the server;

[0115] The online aggregation module 460 is used by the server to randomly select one or more clients from all clients to form a client set, aggregate and correct the fifth local mask uploaded by each client in the client set to obtain a sixth local mask; and use the sixth local mask as the global mask for the next iteration to interact with the client.

[0116] The model output module 470 is used to control the iterative execution of the local mask acquisition module, local mask training module, local mask random flipping module, local mask transmission module and online aggregation module until the number of iterations meets the preset requirements, then the training is terminated and the trained global model is output.

[0117] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logical instructions in the memory 530 to execute a mask-based global model training method, which includes: Step 1, the server randomly initializes model parameters, generates a global mask for the server and a local mask for the client based on the model parameters, and determines a random flip probability vector based on the local mask; Step 2, the client interacts with the server to obtain the global mask for this iteration, and updates the first local mask for this iteration to a second local mask based on the global mask; Step 3, the client applies the second local mask to the model parameters to obtain the model output, obtains the gradient of the second local mask based on the model output, training set, second local mask, and model parameters, and updates the second local mask based on the gradient of the second local mask to obtain a third local mask. Step 4: The client processes the third local mask into binary to obtain the fourth local mask; according to the random flip probability vector, the fourth local mask is randomly flipped to obtain the fifth local mask; flipping is equivalent to inverting the binary value; Step 5: Each client uploads its local fifth local mask to the server; Step 6: The server randomly selects one or more clients from all clients to form a client set, aggregates and corrects the fifth local masks uploaded by each client in the client set to obtain the sixth local mask; the sixth local mask is used as the global mask for the next iteration to interact with the client; Steps 2-6 are iteratively executed until the number of iterations meets the preset requirement, then training is terminated and the trained global model is output.

[0118] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, 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.

[0119] 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 mask-based global model training method provided by the above methods. The method includes: Step 1: The server randomly initializes model parameters, generates a global mask for the server and a local mask for the client based on the model parameters, and determines a random flipping probability vector based on the local mask; Step 2: The client interacts with the server to obtain the global mask for the current iteration, and updates the first local mask for the current iteration to a second local mask based on the global mask; Step 3: The client applies the second local mask to the model parameters to obtain the model output, and obtains the second local mask based on the model output, training set, second local mask, and model parameters. Step 4: The client processes the third local mask into binary form to obtain the fourth local mask. Then, it randomly flips the fourth local mask according to the random flip probability vector to obtain the fifth local mask. Flipping is equivalent to inverting the binary value. Step 5: Each client uploads its fifth local mask to the server. Step 6: The server randomly selects one or more clients from all clients to form a client set. It aggregates and corrects the fifth local masks uploaded by each client in the client set to obtain the sixth local mask. The sixth local mask is used as the global mask for the next iteration in interaction with the client. Steps 2-6 are iteratively executed until the number of iterations meets the preset requirement, at which point training terminates and the trained global model is output.

[0120] 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 the mask-based global model training method provided by the above methods. This method includes: Step 1: The server randomly initializes model parameters, generates a global mask for the server and a local mask for the client based on the model parameters, and determines a random flipping probability vector based on the local mask; Step 2: The client interacts with the server to obtain the global mask for the current iteration, and updates the first local mask for the current iteration to a second local mask based on the global mask; Step 3: The client applies the second local mask to the model parameters to obtain the model output, obtains the gradient of the second local mask based on the model output, training set, second local mask, and model parameters, and then applies the gradient of the second local mask to the model output. Step 4: The gradient updates the second local mask to obtain the third local mask; Step 5: The client processes the third local mask into binary to obtain the fourth local mask; Based on the random flip probability vector, the fourth local mask is randomly flipped to obtain the fifth local mask; Flipping is equivalent to inverting the binary value; Step 6: Each client uploads its local fifth local mask to the server; Step 7: The server randomly selects one or more clients from all clients to form a client set, aggregates and corrects the fifth local masks uploaded by each client in the client set to obtain the sixth local mask; The sixth local mask is used as the global mask for the next iteration to interact with the client; Steps 2-6 are iteratively executed until the number of iterations meets the preset requirement, then training is terminated and the trained global model is output.

[0121] 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.

[0122] 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.

[0123] 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 mask-based global model training method, characterized in that, include: Step 1: The server randomly initializes the model parameters, generates a global mask for the server and a local mask for the client based on the model parameters, and determines the random flip probability vector based on the local mask; Step 2: The client interacts with the server to obtain the global mask for this iteration, and updates the first local mask for this iteration to the second local mask based on the global mask; Step 3: The client applies the second local mask to the model parameters to obtain the model output. Based on the model output, the training set, the second local mask, and the model parameters, the gradient of the second local mask is obtained. The second local mask is updated based on the gradient of the second local mask to obtain the third local mask. Step 4: The client performs binary processing on the third local mask to obtain the fourth local mask; Based on the random flip probability vector, the fourth local mask is randomly flipped to obtain the fifth local mask; the flipping is the inversion of binary values. Step 5: Each client uploads its local fifth local mask to the server; Step 6: The server randomly selects one or more clients from all clients to form a client set, aggregates and corrects the fifth local mask uploaded by each client in the client set, and obtains the sixth local mask. The sixth local mask will be used as the global mask for the next iteration when interacting with the client. Iterate through steps 2-6 until the number of iterations meets the preset requirement, then terminate the training and output the trained global model.

2. The mask-based global model training method according to claim 1, characterized in that, The random initialization of model parameters, the generation of a global mask for the server and a local mask for the client based on the model parameters, and the determination of a random flipping probability vector according to the number of model layers, specifically include: Once the server determines the global model, it randomly initializes and fixes the model parameters of the global model. The server randomly initializes a global mask with the same shape as the model parameters. Each client randomly initializes a local mask with the same initial value and the same shape as the model parameters; The random flip probability vector is determined based on the number of layers in the global model and the local mask.

3. The mask-based global model training method according to claim 1, characterized in that, The client interacts with the server to obtain the global mask for this iteration, and updates the first local mask for this iteration to the second local mask based on the global mask, specifically including: The client obtains the global mask for this iteration from the server; Perform absolute value operation on each corresponding element in the first local mask matrix; The result of the absolute value operation is positive or negative based on the value of each element in the global mask; Replace each element in the first local mask with its positive and negative values ​​to obtain the updated second mask matrix.

4. The mask-based global model training method according to claim 1, characterized in that, The step of applying the second local mask to the model parameters to obtain the model output, and obtaining the gradient of the second local mask based on the model output, the training set, the second local mask, and the model parameters, specifically includes: Calculate the model output based on the second local mask and the model parameters; The gradient matrix of the activation function is determined based on the second local mask; Determine the loss function based on the training set and the model output; The gradient of the second local mask is determined based on the model output, the training set, the gradient matrix, and the loss function.

5. The mask-based global model training method according to claim 1, characterized in that, The step of randomly flipping the fourth local mask according to the random flipping probability vector to obtain the fifth local mask specifically includes: Determine the random flip probability of each layer in the random flip probability vector; The element values ​​of the corresponding layer of the fourth local mask are flipped according to the random flipping probability of each layer, and the fifth local mask is obtained after the flipping is completed.

6. The mask-based global model training method according to claim 1, characterized in that, The step of updating the second local mask according to its gradient to obtain the third local mask specifically includes: The temporary quantity is determined based on the gradient of the second local mask and the learning rate; The difference between the second local mask and the temporary value is used as the third local mask.

7. A mask-based global model training device, characterized in that, include: An initialization module is used to randomly initialize model parameters on the server side, generate a global mask for the server and a local mask for the client based on the model parameters, and determine a random flip probability vector based on the local mask. The local mask acquisition module is used for the client to interact with the server to obtain the global mask for this iteration, and to update the first local mask for this iteration to the second local mask based on the global mask; The local mask training module is used by the client to apply the second local mask to the model parameters to obtain the model output, obtain the gradient of the second local mask based on the model output, the training set, the second local mask, and the model parameters, and update the second local mask based on the gradient of the second local mask to obtain the third local mask. The local mask random flipping module is used by the client to perform binary processing on the third local mask to obtain the fourth local mask; Based on the random flip probability vector, the fourth local mask is randomly flipped to obtain the fifth local mask; the flipping is the inversion of binary values. The local mask transmission module is used by each client to upload its fifth local mask to the server; The online aggregation module is used by the server to randomly select one or more clients from all clients to form a client set, and aggregate and correct the fifth local mask uploaded by each client in the client set to obtain a sixth local mask; The sixth local mask will be used as the global mask for the next iteration when interacting with the client. The model output module controls the iterative execution of the local mask acquisition module, local mask training module, local mask random flipping module, local mask transmission module, and online aggregation module until the number of iterations meets the preset requirements, at which point training terminates and the trained global model is output.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the mask-based global model training method as described in any one of claims 1 to 6.

9. A non-transitory 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 mask-based global model training method as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the mask-based global model training method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Federal learning local model parameter aggregation method

    CN115021905A

  • Federal learning differential privacy protection method based on model difference sparsification

    CN115146313A