Homomorphic encryption model extraction and privacy protection method and related equipment

By using SphinxE and SphinxI algorithms in the homomorphic encryption model, the model is divided into two parts, combining homomorphic encryption and differential privacy mechanisms, the calculation efficiency and confidentiality balance in the machine learning solution based on homomorphic encryption privacy protection is solved, and high efficiency is achieved , safe model training and deployment.

CN119026152APending Publication Date: 2024-11-26XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411093391.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The privacy protection machine learning scheme based on homomorphic encryption has computational efficiency and accuracy problems during model training, and the differential privacy mechanism is difficult to find a balance when protecting the confidentiality of the model, which is easy to leak sensitive information or reduce model performance, and the server's access rights are also A confidentiality threat that may lead to a model.

Method used

SphinxE and SphinxI algorithms are used to divide the model into two parts, and different defense strategies are applied on the server and client respectively. By combining homomorphic encryption and differential privacy mechanisms, avoiding relying solely on the differential privacy mechanism, improving the privacy protection strength of the model, and Some model structures and parameters are transferred to the client to reduce server access.

Benefits of technology

It realizes stronger privacy protection, reduces the cost of model development and deployment, avoids the negative impact of differential privacy noise on model performance, enhances the confidentiality and computing efficiency of the model, and reduces the computing overhead of the server and potential security threats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119026152A_ABST
    Figure CN119026152A_ABST
Patent Text Reader

Abstract

The invention discloses a homomorphic encryption model extraction and privacy protection method and related equipment, a SphinxE algorithm divides a model into two parts according to training requirements, different defense strategies are applied, model privacy protection only depending on a differential privacy mechanism is avoided, stronger privacy protection is provided, and a SphinxI algorithm hides information of a client. According to the SphinxI solution, a model structure is hidden for a server, which means that the server cannot know how a final result is to be output. Even if the server serves as an opponent, the number of output categories and the network structure of the M2 cannot be determined in the attack, and the two algorithms are low in deployment cost and high in confidentiality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of homomorphic encryption, and specifically relates to a method for extracting and protecting privacy of a homomorphic encryption model and related equipment. Background Art

[0002] With the rapid development and widespread application of artificial intelligence technology, the training and service costs of artificial intelligence models are getting higher and higher. In order to reduce costs, outsourcing artificial intelligence model training and services to machine learning services of third-party cloud service providers has become a mainstream approach. In this context, privacy-preserving machine learning that protects users' personal sensitive data and model confidentiality has become increasingly important. According to the technology adopted, privacy-preserving machine learning schemes are mainly divided into three categories, namely privacy-preserving machine learning based on secure multi-party computing, privacy-preserving machine learning based on differential privacy, and privacy-preserving machine learning based on homomorphic encryption. In these schemes, the data owner wants to outsource the training of artificial intelligence models to cloud servers and wants to prevent the cloud servers from accessing data and specific parameters of the training model, thereby ensuring strict privacy protection. In terms of providing stronger privacy protection, privacy-preserving machine learning schemes based on homomorphic encryption protect model parameters and training data through homomorphic encryption, so they have broad prospects.

[0003] According to different privacy protection tasks, privacy-preserving machine learning schemes based on homomorphic encryption can be divided into privacy-preserving model training schemes based on homomorphic encryption and privacy-preserving model prediction schemes based on homomorphic encryption. In 2016, Gilad-Bachrach et al. proposed using homomorphic encryption to protect privacy data in order to achieve security protection of user privacy data. The client encrypts the data and then sends it to the cloud provider. Their scheme combines homomorphic encryption with machine learning and proposes a privacy-preserving machine learning framework based on homomorphic encryption. In order to further realize the privacy-preserving machine learning framework of homomorphic encryption for deep learning, Nandakumar et al. further accelerated the training process of the model and completed the secure training of the model using fully homomorphic technology.

[0004] Since privacy-preserving machine learning solutions based on homomorphic encryption are usually based on non-interactivity, machine learning solutions that only use homomorphic encryption will bring high computational costs, and too much homomorphic computing will lead to serious efficiency and accuracy problems. And it usually uses approximate algorithms to calculate the results on the nonlinear layer, which further increases the computational overhead and reduces the usability of the model. To solve this problem, Juvekar et al. introduced secret sharing and garbled circuits to implement nonlinear layer operations and improve the accuracy of the nonlinear layer. However, it focuses on the model prediction process and does not implement privacy protection solutions during the model training process.

[0005] The Sphinx scheme avoids homomorphic multiplication of ciphertext through an interactive scheme to improve the computational efficiency of the model, thereby greatly reducing the overhead. In order to compensate for the privacy problem of unencrypted parameters, a differential privacy mechanism is introduced to provide certain privacy protection. In the initialization phase of the Sphinx scheme, the client generates a homomorphic encrypted public key and private key and transmits the public key to the server. Then, the server initializes the model and its parameters and encrypts the bias component using homomorphic encryption. During the model training phase, the weight component is protected by differential privacy, while the bias component is protected by homomorphic encryption. In order to reduce the overall computational overhead, during the training process, the client provides a privacy dataset and the server acts as a semi-honest server to train the model. First, the client encrypts the training data and then sends it to the server, which performs forward propagation as the input of the model. After the forward propagation is completed, the server calculates the encrypted loss value based on the loss function. Then, the gradient descent algorithm is executed. Since the bias component exists in the form of ciphertext, the optimization algorithm can be directly executed based on the loss function. The weight component is a plaintext protected by the differential privacy mechanism, but the gradient obtained by the server is a homomorphic ciphertext. Therefore, it is necessary to return to the client to decrypt the gradient and add differential privacy noise, and then send it to the server to update the weight component. This solution saves a lot of computing overhead on the server, and the computing overhead of the client as an auxiliary is also acceptable. It also implements a safe and efficient privacy-preserving machine learning solution through the differential privacy mechanism.

[0006] Although this solution achieves an efficient privacy-preserving machine learning solution, it still has the following problems:

[0007] (1) This solution has a balance problem when using differential privacy mechanism to protect the confidentiality of the model. Differential privacy protects individual privacy by adding a certain amount of random noise to the data or query results, thereby preventing personal information from being inferred through data analysis. However, the addition of differential privacy noise needs to ensure that it neither leaks too much plaintext parameter information nor excessively interferes with the performance of the model.

[0008] When the differential privacy noise level is set low, the model training and prediction may be more accurate, but this also means that the added noise is not enough to effectively hide the characteristics of individual data, which may leak sensitive information. On the contrary, if the differential privacy noise level is set too high, although individual privacy can be better protected, too much noise will significantly reduce the performance of the model. Noise may mask important patterns and relationships in the data, resulting in the model being unable to learn and predict accurately. In addition, high noise levels may also lead to slower convergence during model training, requiring more iterations and computing resources, thereby increasing the cost of model development and deployment.

[0009] (2) When the server acts as a model trainer, it is responsible for processing and optimizing model parameters, but it may also become a potential security threat. The server has full access to the model training process, which allows it to access unencrypted parameters and various information in the training process. This access provides the server with an opportunity to obtain sensitive information in the training dataset through various attack methods. As a model trainer, the server may use member inference attacks or member reconstruction attacks to obtain more training set information and reconstruct the training data used by the model based on the existing unencrypted parameters and model training information. It may also directly threaten the confidentiality of the model through model extraction attacks. Summary of the invention

[0010] The present invention provides a method for extracting and protecting privacy of a homomorphic encryption model and related equipment, which solves the problems of high cost and poor confidentiality in the development and deployment of homomorphic encryption models.

[0011] To achieve the above object, the present invention provides the following technical solutions:

[0012] Extraction and privacy protection methods of homomorphic encryption models, including:

[0013] The client creates a homomorphic encryption key pair;

[0014] Based on the homomorphic encryption key pair, the SphinxE algorithm and the SphinxI algorithm are applied respectively to perform model training;

[0015] Output the trained model;

[0016] Among them, the SphinxE algorithm divides the model into two parts on the server according to the training requirements and applies different defense strategies. The SphinxI algorithm divides the model into two parts on the client according to the training requirements. One part is encrypted on the server, and the other part is transferred to the client without encryption.

[0017] Preferably, the SphinxE algorithm is specifically:

[0018] Based on the homomorphic encryption key pair created by the client, the homomorphic encryption public key and model training requirements are sent to the server;

[0019] The server divides the model M into two parts, M1 and M2, according to the training requirements, and applies different defense strategies to M1 and M2. The server initializes the parameters of the models M1 and M2, and encrypts the bias parameters of the model M1 and all the parameters of the model M2.

[0020] The client randomly extracts a batch of data, encrypts it with a homomorphic encryption public key, and sends it to the server; the server independently completes the forward propagation process and calculates the gradient corresponding to the loss function, the gradient corresponding to the weight component, and the gradient corresponding to the bias component for each data;

[0021] Based on each data, the gradient corresponding to the loss function, the gradient corresponding to the weight component, and the gradient corresponding to the bias component are calculated, and the model is gradient descended;

[0022] Repeatedly extract data and update the model until the set training rounds are reached, and output the trained model M.

[0023] Preferably, preferably, the sphinx scheme without using the differential privacy mechanism is used on M1 to encrypt only the bias component, and all parameters are encrypted on M2.

[0024] Preferably, the training requirements include model structure, learning rate, batch size, number of training rounds and loss function.

[0025] Preferably, based on each data, the gradient corresponding to the loss function, the gradient corresponding to the weight component, and the gradient corresponding to the bias component are calculated, and the steps of performing gradient descent on the model are specifically as follows:

[0026] The server calculates the average gradient of each batch for the bias parameters of model M1 and all parameters of model M2;

[0027] The server updates all encryption parameters. In the tth round of training, the bias components of models M1 and M2 are gradient-descended to obtain the gradients of the weight parameters of models M1 and M2.

[0028] The server sends the gradient of the weight parameters of model M1 to the client;

[0029] The client decrypts and calculates the average gradient of each batch, and sends the calculation result back to the server;

[0030] The server updates the weight components of model M1 and performs gradient descent on the weight components of model M1.

[0031] Preferably, the SphinxI algorithm is specifically:

[0032] Based on the homomorphic encryption key pair created by the client and the homomorphic encryption public key, the client divides the model M into two parts, M1 and M2, sends the training requirements of model M1 to the server, and initializes model M2 locally;

[0033] The server initializes the parameters of model M1 according to the training requirements and encrypts the bias parameters of model M1;

[0034] The client randomly selects a batch of data, encrypts it with the homomorphic encryption public key PK, and sends it to the server;

[0035] The server independently completes the forward propagation process of model M1 and sends the calculation results to the client;

[0036] The client decrypts the calculation result of the server, uses the calculation result to complete the forward propagation process of model M2, and calculates the loss function to complete the reverse propagation process of model M2;

[0037] The client encrypts the input gradient of model M2 using the homomorphic encryption public key and sends it to the server;

[0038] The server calculates the average gradient of each batch for all parameters of model M1;

[0039] Perform model gradient descent based on the input gradient of model M2 and the average gradient of all parameters of model M1 per batch;

[0040] Repeatedly extract data and update the model until the set training round is reached. The server outputs the trained model M1 and the client outputs the trained model M2.

[0041] Preferably, the model gradient descent is performed based on the input gradient of the model M2 and the average gradient of each batch of all parameters of the model M1 as follows;

[0042] In the tth round of training, the bias components of models M1 and M2 are gradient descended;

[0043] The server sends the gradient of the weight parameters of model M1 to the client;

[0044] The client decrypts and calculates the average gradient of each batch and sends the calculation result to the server;

[0045] The server updates the weight components of model M1 and performs gradient descent on the weight components of model M1.

[0046] Extraction and privacy protection system of homomorphic encryption models, including:

[0047] Creation module: The client creates a homomorphic encryption key pair;

[0048] Training module: Apply SphinxE algorithm and SphinxI algorithm based on homomorphic encryption key pairs;

[0049] Output module: output the trained model;

[0050] Among them, the SphinxE algorithm divides the model into two parts on the server according to the training requirements and applies different defense strategies. The SphinxI algorithm divides the model into two parts on the client according to the training requirements. One part is encrypted on the server, and the other part is transferred to the client without encryption.

[0051] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of a method for extracting a homomorphic encryption model and protecting privacy are implemented.

[0052] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a homomorphic encryption model extraction and privacy protection method.

[0053] Compared with the prior art, the present invention has the following beneficial effects: the present invention provides a method for extracting and protecting the privacy of a homomorphic encryption model. The SphinxE algorithm divides the model into two parts according to the training requirements, applies different defense strategies, avoids the model privacy protection that only relies on the differential privacy mechanism, and provides stronger privacy protection. The SphinxI algorithm hides the client's information. The SphinxI solution hides the model structure from the server, which means that the server cannot know how the final result will be output. Even if the server acts as an adversary, it cannot determine the number of output categories and the network structure of M2 in the attack. The two algorithms have low deployment costs and high confidentiality. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 This is a flow chart of the method for extracting and protecting privacy of the homomorphic encryption model of the present invention;

[0055] Figure 2 A flow chart of a model extraction scheme for an embodiment of the present invention;

[0056] Figure 3 A convolutional neural network model used in the embodiment of the present invention;

[0057] Figure 4 The Euclidean distance between the parameters obtained by extracting the Sphinx model with a noise level of 2 in 100 training rounds and the corresponding encrypted parameters in the embodiment of the present invention;

[0058] Figure 5 The Euclidean distance between the parameters obtained by extracting the Sphinx model with a noise level of 4 in 100 training rounds and the corresponding encryption parameters in the embodiment of the present invention;

[0059] Figure 6The Euclidean distance between the parameters obtained by extracting the Sphinx model with a noise level of 8 in 100 training rounds and the corresponding encryption parameters in the embodiment of the present invention;

[0060] Figure 7 The SphinxE training program of the present invention;

[0061] Figure 8 The SphinxI training program of the present invention;

[0062] Fig. 9 This is a block diagram of the extraction and privacy protection system of the homomorphic encryption model of the present invention. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0064] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

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

[0066] like Figure 1 As shown, an embodiment of the present invention provides a method for extracting and protecting privacy of a homomorphic encryption model, including:

[0067] S101 client creates a homomorphic encryption key pair;

[0068] S102 applies SphinxE algorithm and SphinxI algorithm to perform model training based on homomorphic encryption key pairs;

[0069] S103 outputs the trained model;

[0070] Among them, the SphinxE algorithm divides the model into two parts on the server according to the training requirements and applies different defense strategies. The SphinxI algorithm divides the model into two parts on the client according to the training requirements. One part is encrypted on the server, and the other part is transferred to the client without encryption.

[0071] Specifically, Figure 2 Shown

[0072] 1The client has a large amount of private data that needs to be processed and trained to obtain a private model, but it does not have sufficient computing power and needs to rely on the server to complete this process. The client sends the public key, model structure, training parameters (number of training rounds and learning rate), and encrypted training data to the server through a secure channel.

[0073] The server itself has sufficient computing power and storage space, and can provide these resources in the form of an interface. The server trains the model according to the client's requirements.

[0074] System Model:

[0075] 1. Before model training begins, a secure communication channel is established between the server and the client for interaction.

[0076] 2. During the model training process, the client's private data is encrypted, and only the client can decrypt the ciphertext during the interaction process.

[0077] 3. Malicious servers and external attackers (such as business competitors) may try to obtain the trained model and attack it.

[0078] SphinxE algorithm Figure 7 Shown:

[0079] 1. The client creates a homomorphic encryption key pair (PK, SK) and sends the homomorphic encryption public key PK and model training requirements to the server;

[0080] 2. The server divides the model M into two parts, M1 and M2, according to the training requirements (model structure, learning rate, batch size, number of training rounds, loss function), and applies different defense strategies (using the sphinx solution without differential privacy mechanism on M1 to encrypt only the bias component, and encrypting all parameters on M2). The server initializes the parameters of models M1 and M2 (including the weight component W 0 and the bias parameter b 0 ), and encrypt the bias parameters of model M1 and all parameters of model M2.

[0081] 3. The client randomly selects a batch of data B = {x1, x2, ...x B}Use homomorphic encryption public key PK to encrypt and send to the server. The server completes the forward propagation process independently and performs a forward propagation on each data x. j Calculate the gradient of the loss function and the weight component And the gradient corresponding to the bias component

[0082] 4. The server calculates the average gradient of each batch for all encrypted parameters, namely the bias parameters of model M1 and all parameters of model M2 Include and

[0083] 5. The server updates all encryption parameters. In the tth round of training, the bias components of models M1 and M2 are gradient descended: the bias component of the t+1th round [b t+1 ] is the previous round's [b t ] According to the gradient descent rule, subtract the product of the learning rate and the corresponding gradient and update it to Similarly, for the bias component [W t+1 ] is the previous round According to the gradient descent rule, the product of the learning rate and the corresponding gradient is subtracted and updated as:

[0084] 6. The server sends the gradient of the weight parameters of model M1 Sent to the client.

[0085] 7. The client decrypts and obtains And calculate the average gradient for each batch And send the calculation results back to the server.

[0086] 8. The server updates the weight component of model M1 and performs gradient descent on the weight component of model M1. The product of the learning rate and the corresponding gradient in the previous round is subtracted and updated as follows:

[0087] 9. Repeat steps 3-8 until the model training is completed (the expected accuracy is achieved or a certain number of training rounds are reached).

[0088] 10. The server outputs the trained model M.

[0089] The privacy protection of the original Sphinx solution is applied in the M1 model without using the differential privacy mechanism. All parameters are encrypted in the M2 model to obtain more reliable security. SphinxE circumvents the privacy protection of the model that only relies on the differential privacy mechanism, and the encrypted weight parameters in the M2 model provide stronger privacy protection.

[0090] First, the client extracts the image features and encrypts them into homomorphic ciphertext and sends them to the server. According to the mathematical properties of homomorphic encryption, the forward propagation process and the backward propagation process are performed on M. The M1 model uses the Sphinx privacy protection scheme, so an interactive backward propagation scheme is still required. The M2 model, however, allows direct backward propagation based on the ciphertext because it is fully encrypted.

[0091] In the forward propagation process, the weight components in the M1 model are unencrypted, and the multiplication between homomorphic ciphertext and plaintext is used. In the M2 model, since the weights are encrypted, the multiplication between homomorphic ciphertext and homomorphic ciphertext is used. For the security of the model, the computational overhead of homomorphic multiplication is inevitable, but in deep neural networks, the initial parameters of the linear layer are often fewer, so a certain amount of homomorphic computational overhead is acceptable. In addition, since all parameters in the M2 model exist in the form of ciphertext, the gradient descent algorithm of the M2 model can be completed independently by the server during the back propagation process, thereby reducing the communication overhead of ciphertext back propagation. By encrypting part of the model, the model information leakage problem caused by the existence of a large number of plaintext parameters is solved and the efficiency of model training is maintained.

[0092] SphinxI algorithm Figure 8 Shown:

[0093] 1. The client creates a homomorphic encryption key pair (PK, SK) and uses the homomorphic encryption public key PK. The client divides the model M into two parts, M1 and M2, sends the training requirements of model M1 to the server, and initializes model M2 locally.

[0094] 2. The server initializes the parameters of model M1 (including weight component W) according to the training requirements 0 and the bias parameter b 0 ), and encrypt the bias parameters of model M1.

[0095] 3. The client randomly selects a batch of data B = {x1, x2, ...x B}Encrypted using homomorphic encryption public key PK and sent to the server.

[0096] 4. The server independently completes the forward propagation process of model M1.

[0097] 5. The server sends the calculation results to the client.

[0098] 6. The client decrypts the calculation results of the server, uses the calculation results to complete the forward propagation process of model M2, and calculates the loss function to complete the reverse propagation process of model M2.

[0099] 7. The client encrypts the input gradient of model M2 using the homomorphic encryption public key PK and sends it to the server.

[0100] 8. The server calculates the average gradient of each batch for all parameters of model M1

[0101] 9. In the tth round of training, the bias components of models M1 and M2 are gradient descended: the bias component of the t+1th round [b t+1 ] is the previous round's [b t ] According to the gradient descent rule, subtract the product of the learning rate and the corresponding gradient and update it to

[0102] 10. The server sends the gradient of the weight parameters of model M1 Sent to the client.

[0103] 11. The client decrypts and obtains And calculate the average gradient for each batch And send the calculation results back to the server.

[0104] 12. The server updates the weight component of model M1 and performs gradient descent on the weight component of model M1. The product of the learning rate and the corresponding gradient in the previous round is subtracted and updated as follows:

[0105] 13. Repeat steps 3-12 until the model training is completed (the expected accuracy is achieved or a certain number of training rounds are reached).

[0106] 14. The server outputs the trained model M1, and the client outputs the trained model M2.

[0107] In the M1 model, the privacy protection of the original Sphinx solution is applied and the differential privacy mechanism is not used. In the M2 model, the present invention removes it from the server and transfers it to the client in an unencrypted form.

[0108] After the client submits the encrypted data to the server, the server performs a forward propagation process on the M1 model and then sends the result to the client. The client first performs a forward propagation on M2 to obtain the final result and calculate the loss function, performs a back propagation on the model M2 according to the loss function, encrypts the gradient, and then sends it back to the server, which performs gradient descent according to the back propagation algorithm in Sphinx.

[0109] Compared with the previous solution, SphinxI increases the communication overhead and is more dependent on the assistance of the client due to the need to transmit intermediate results. The SphinxI solution hides the client's information. The SphinxI solution hides the model structure from the server, which means that the server cannot know how the final result will be output. Even if the server acts as an adversary, it cannot determine the number of output categories and the network structure of M2 in the attack. Therefore, in this interactive solution, the confidentiality of the model is greatly enhanced by increasing the weight of the model held by the user. And in terms of the computational efficiency of the client, the M2 model is not encrypted, so the computational amount of the client is acceptable. By transferring part of the model to the client for training through an interactive solution, the problems of model information leakage and model structure leakage are solved and the efficiency of model training is maintained.

[0110] The homomorphic encryption algorithm is:

[0111] 1. Gen(1 λ ,L)→{pk,sk,evk}, client homomorphic encryption key generation algorithm, parameters determined by level parameter L and security parameter λ, output public key pk, private key sk and homomorphic computation key evk.

[0112] 2.Enc pk (m)→{c}, for plaintext m, output its ciphertext c.

[0113] 3. Eva evk (c1,c2), perform homomorphic calculation on ciphertext c1 and ciphertext c2. When performing homomorphic addition, the calculation result c is output add ←c1+c2, for homomorphic multiplication, output the calculation result c mult ←c1×c2.

[0114] 4.Dec sk (c)→{m}, for the ciphertext c, output its plaintext m.

[0115] The model extraction algorithm is:

[0116] 1. The attacker obtains part of the data set D based on a small amount of leaked data or based on data distribution.

[0117] 2. The attacker applies data augmentation technology to dataset D to obtain dataset D attack .

[0118] 3. The attacker locally establishes an extraction model M′ with the same structure as the model M on the server, and initializes the extraction model with the initial parameters corresponding to the plaintext parameters and encrypted parameters on the server.

[0119] 4. The attacker sets the training parameters with the same learning rate and number of rounds.

[0120] 5. Perform model training according to requirements: If you want to improve the accuracy of the extraction model, perform gradient descent on all parameters; if you want to restore the original model encryption parameters, keep the trained plaintext unchanged and only perform gradient descent on the parameters corresponding to the original model encryption parameters.

[0121] The main idea of ​​the model extraction method for interactive homomorphic encryption protected models is to use the privacy loopholes of the unencrypted parameters of the existing model on the server to extract the model through the server as an attacker. The attacker first establishes an extraction model M′ with the same structure as the model M on the server locally and initializes the extraction model with the initial parameters corresponding to the plaintext parameters and encryption parameters on the server. The attacker sets the training parameters with the same learning rate and rounds. Model training is performed according to demand: if the accuracy of the extraction model is to be improved, all parameters are gradient descent, so that the model can be extracted; if the original model encryption parameters are to be restored, the trained plaintext remains unchanged, and only the parameters corresponding to the original model encryption parameters are gradient descent, so as to restore the encryption parameters.

[0122] Data generation algorithm:

[0123] 1. The attacker generates an unlabeled dataset D based on the data distribution.

[0124] 2. The attacker locally establishes an extraction model M′ with the same structure as the model M on the server, and initializes the extraction model with the initial parameters corresponding to the plaintext parameters and encrypted parameters on the server.

[0125] 3. The attacker inputs the unlabeled dataset D into the extraction model M′ and performs model prediction to obtain the corresponding prediction results for each data.

[0126] 4. For each data in the unlabeled dataset D, if the maximum predicted value y of the data accounts for a higher proportion than a certain threshold T among all predicted values, then add it to the training dataset D of the extraction model M′ attack .

[0127] 5. The attacker obtains dataset D attack .

[0128] The present invention proposes a model extraction scheme to address the privacy issues existing in encrypting only part of the parameters in a privacy-preserving machine learning scheme based on homomorphic encryption and the model performance issues caused by differential privacy applications. The model is divided into two parts and a model training scheme is applied with different privacy protection mechanisms.

[0129] Table 1 shows the effect of our model parameter extraction. For the encrypted model parameters, we used 1%, 5%, and 10% of the training set data as the leaked data, and used our model extraction scheme to extract the plaintext corresponding to the encrypted parameters. Figure 4 , Figure 5 and Figure 6 As shown in , the optimal rounds for each god-level network layer to achieve the Euclidean distance of the recovery parameters are different. We select the optimal round as the round for parameter extraction based on multiple experiments. Our solution can achieve the same accuracy as the original model, and the parameters on some neural network linear layers can also achieve an absolute difference rate of less than 20%. And as the number of leaked data sets used increases, the parameters can achieve a better degree of recovery. For the first few layers of the convolutional network, due to the characteristics of machine learning itself, different parameter values ​​can achieve the same balance effect. And as the number of training times increases, there will be a decrease in the Euclidean distance, such as Figure 4 , Figure 5 and Figure 6 As shown. This is because we use too few data samples. Even if the data is increased, overfitting problems will occur after multiple trainings. The process of extracting model parameters through retraining is a synchronous process of adjusting the initial bias component and eliminating the interference of model differential privacy, that is, finding the bias component suitable for the model weight component. Therefore, even if the training set is the same, there will be a certain gap between the original bias parameters and the original bias parameters due to the influence of differential privacy. That is, after the model training of the model extraction scheme reaches the same balance as the original model, the unchanged weight component and the bias parameter reach a nearly identical balance. After this, the training of the model is to adapt to the training data set to eliminate the influence of differential privacy that still exists, but due to the fixed weight component and the limitations of the training set itself, it is difficult for the model to achieve higher accuracy and can only achieve the same accuracy as the victim model.

[0130] Table 2 shows the effect of our model extraction scheme. In the Sphinx scheme, the extraction model using 0.5% of the training set as the leaked data has achieved a model accuracy of more than 90%. When using the leaked dataset for model extraction, since the attacker knows the initial parameters of the model and the unencrypted parameters of the trained model on the server, as well as the overall training parameters, the effect of the model extraction scheme depends on the quality of the leaked data and the quality of the initially constructed local model.

[0131] The accuracy of the model extraction scheme using synthetic data is related to the differential privacy noise level added to the Sphinx scheme. When the noise level is higher, the accuracy of the original model decreases, but the accuracy of the extracted model also decreases. When the noise level is lower, the accuracy of the original model increases, and the accuracy of the extracted model also increases. The quality of the model obtained by the model extraction scheme using synthetic data depends on the quality of the synthetic data. When the accuracy of the locally built model, that is, the model that only uses unencrypted parameters on the server, is higher, its synthetic data is better, and its corresponding extraction model performance is better.

[0132] SphinxE and SphinxI can achieve 96.80% and 97.82% accuracy respectively, which is higher than the Sphinx solution using differential privacy, indicating that our solution avoids the impact of differential privacy on model performance. And the use of the SphinxI solution can improve the overall performance and reduce the accuracy impact of ciphertext operations by using an unencrypted model on the client, achieving almost the same model accuracy as the Sphinx model without differential privacy, so our solution is efficient.

[0133] In terms of defense effect, SphinxE and SphinxI achieved 86.96% and 81.47% respectively in the model extraction scheme using 0.5% of the training set as the leaked data, which improved the defense effect compared with the Sphinx scheme. SphinxE hides some weight components, so its performance will be greatly affected when building the initial local model, but its initial parameters can still be obtained on the server. The scheme reduces the information leakage of the model, and its model extraction scheme will achieve a certain degree of defense effect on the model extraction scheme. The SphinxI scheme hides the model structure and initial parameters of the M2 model from the attacker on the server side, reducing the information leakage of the model. Here, assuming that the attacker extracts the model with the same M2 structure, it can still only achieve an accuracy of 81.47%. The effect of this model extraction depends only on the quality of the leaked data set. The performance of the local model initially constructed by the attacker is greatly reduced, which improves the defense effect of the model.

[0134] In the defense of model extraction using synthetic data, the extraction model achieved an accuracy of 40.53% and 9.91% for the model trained by SphinxE and the model trained by SphinxI, respectively, which has a good defense effect compared with Sphinx using differential privacy. Model extraction using synthetic data depends on the model performance of the initial model built locally, while SphinxE hides most of the parameters and SphinxI hides part of the model structure, which reduces the model performance of the extraction model initially built by the attacker, thereby affecting the quality of the synthetic data and ultimately achieving a good privacy protection effect.

[0135] Table 3 shows the comparison of our theoretical overhead with similar schemes, where E represents the encryption overhead, D represents the decryption overhead, and M represents the number of layers in the model. Represents the computational overhead of each layer of the model, The computing overhead of the server at each layer can be divided according to the responsibilities of the role and the computational overhead of the client at each layer In this setting, when the model M layers of the comparison schemes are the same, the SphinxE scheme increases the server's computational overhead and adds the back-propagation gradient part of the M2 model compared to the Sphinx model, while the client reduces the back-propagation part of the M2 model. The SphinxI scheme increases the client's computational workload by transferring the model M2 to the client, and the increased interaction process also increases the number of encryption and decryption times and communication overhead between the client and the server. By adding a part of the computation, more reliable model confidentiality is achieved, and ultimately a balance between security and efficiency is achieved.

[0136] Table 1 Effect of model extraction scheme on restoring encrypted parameters on Sphinx scheme

[0137]

[0138]

[0139] Table 2 Effects of model extraction scheme on privacy-preserving model training scheme and similar schemes

[0140]

[0141] Table 3 Comparison of theoretical overhead of privacy-preserving model training scheme and similar schemes

[0142]

[0143] As shown in the figure, an embodiment of the present invention further provides a homomorphic encryption model extraction and privacy protection system, including:

[0144] Creation module: The client creates a homomorphic encryption key pair;

[0145] Training module: Apply SphinxE algorithm and SphinxI algorithm based on homomorphic encryption key pairs;

[0146] Output module: output the trained model;

[0147] Among them, the SphinxE algorithm divides the model into two parts on the server according to the training requirements and applies different defense strategies. The SphinxI algorithm divides the model into two parts on the client according to the training requirements. One part is encrypted on the server, and the other part is transferred to the client without encryption.

[0148] A terminal device is provided in one embodiment of the present invention. The terminal device of this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor executes the computer program, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0149] The computer program may be divided into one or more modules / units, and the one or more modules / units are stored in the memory and executed by the processor to accomplish the present invention.

[0150] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0151] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0152] The memory may be used to store the computer programs and / or modules, and the processor implements various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory.

[0153] If the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0154] Although the embodiments of the present invention are described above in conjunction with the accompanying drawings, the present invention is not limited to the above-mentioned specific embodiments and application fields, and the above-mentioned specific embodiments are only illustrative and instructive, rather than restrictive. Under the guidance of the specification, a person skilled in the art can also make many forms without departing from the scope of protection of the claims of the present invention, all of which belong to the scope of protection of the present invention.

Claims

1. A homomorphic encryption model extraction and privacy protection method, characterized in that: include: The client creates a homomorphic encryption key pair; Based on the homomorphic encryption key pair, the SphinxE algorithm and the SphinxI algorithm are applied respectively to perform model training; Output the trained model; Among them, the SphinxE algorithm divides the model into two parts on the server according to the training requirements and applies different defense strategies. The SphinxI algorithm divides the model into two parts on the client according to the training requirements. One part is encrypted on the server, and the other part is transferred to the client without encryption.

2. The method for extracting and protecting privacy of a homomorphic encryption model according to claim 1, characterized in that: The SphinxE algorithm is specifically: Based on the homomorphic encryption key pair created by the client, the homomorphic encryption public key and model training requirements are sent to the server; The server divides the model M into two parts, M1 and M2, according to the training requirements, and applies different defense strategies to M1 and M2. The server initializes the parameters of the models M1 and M2, and encrypts the bias parameters of the model M1 and all the parameters of the model M2. The client randomly selects a batch of data, encrypts it with the homomorphic encryption public key, and sends it to the server; The server independently completes the forward propagation process and calculates the gradient corresponding to the loss function, the gradient corresponding to the weight component, and the gradient corresponding to the bias component for each data; Based on each data, the gradient corresponding to the loss function, the gradient corresponding to the weight component, and the gradient corresponding to the bias component are calculated, and the model is gradient descended; Repeatedly extract data and update the model until the set training rounds are reached, and output the trained model M.

3. The method for extracting and protecting privacy of a homomorphic encryption model according to claim 2, characterized in that: The sphinx scheme without differential privacy mechanism is used on M1 to encrypt only the bias component, and all parameters are encrypted on M2.

4. The method for extracting and protecting privacy of a homomorphic encryption model according to claim 2, characterized in that: The training requirements include model structure, learning rate, batch size, number of training rounds, and loss function.

5. The method for extracting and protecting privacy of a homomorphic encryption model according to claim 2, characterized in that: Based on each data, the gradient corresponding to the loss function, the gradient corresponding to the weight component, and the gradient corresponding to the bias component are calculated. The steps for gradient descent of the model are as follows: The server calculates the average gradient of each batch for the bias parameters of model M1 and all parameters of model M2; The server updates all encryption parameters. In the tth round of training, the bias components of models M1 and M2 are gradient-descended to obtain the gradients of the weight parameters of models M1 and M2. The server sends the gradient of the weight parameters of model M1 to the client; The client decrypts and calculates the average gradient of each batch, and sends the calculation result back to the server; The server updates the weight components of model M1 and performs gradient descent on the weight components of model M1.

6. The method for extracting and protecting privacy of a homomorphic encryption model according to claim 1, characterized in that: The specific SphinxI algorithm is: Based on the homomorphic encryption key pair created by the client and the homomorphic encryption public key, the client divides the model M into two parts, M1 and M2, sends the training requirements of model M1 to the server, and initializes model M2 locally; The server initializes the parameters of model M1 according to the training requirements and encrypts the bias parameters of model M1; The client randomly selects a batch of data, encrypts it with the homomorphic encryption public key PK, and sends it to the server; The server independently completes the forward propagation process of model M1 and sends the calculation results to the client; The client decrypts the calculation result of the server, uses the calculation result to complete the forward propagation process of model M2, and calculates the loss function to complete the reverse propagation process of model M2; The client encrypts the input gradient of model M2 using the homomorphic encryption public key and sends it to the server; The server calculates the average gradient of each batch for all parameters of model M1; Perform model gradient descent based on the input gradient of model M2 and the average gradient of all parameters of model M1 per batch; Repeatedly extract data and update the model until the set training round is reached. The server outputs the trained model M1 and the client outputs the trained model M2.

7. The method for extracting and protecting privacy of a homomorphic encryption model according to claim 6, characterized in that: Based on the input gradient of model M2 and the average gradient of each batch of all parameters of model M1, the model gradient descent is performed as follows; In the tth round of training, the bias components of models M1 and M2 are gradient descended; The server sends the gradient of the weight parameters of model M1 to the client; The client decrypts and calculates the average gradient of each batch and sends the calculation result to the server; The server updates the weight components of model M1 and performs gradient descent on the weight components of model M1.

8. Extraction and privacy protection system of homomorphic encryption model, characterized in that: include: Creation module: The client creates a homomorphic encryption key pair; Training module: Apply SphinxE algorithm and SphinxI algorithm based on homomorphic encryption key pairs; Output module: output the trained model; Among them, the SphinxE algorithm divides the model into two parts on the server according to the training requirements and applies different defense strategies. The SphinxI algorithm divides the model into two parts on the client according to the training requirements. One part is encrypted on the server, and the other part is transferred to the client without encryption.

9. A computer 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, the steps of the method for extracting and protecting privacy of the homomorphic encryption model as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for extracting and protecting privacy of a homomorphic encryption model as described in any one of claims 1 to 7 are implemented.