Ciphertext handwritten recognition neural network training method and system based on mode component homomorphism

By using the modular component homomorphic encryption library and structural optimization in the ciphertext neural network, the problems of bandwidth consumption and low efficiency in ciphertext neural network training are solved, efficient and secure ciphertext neural network training is achieved, and data privacy is ensured. protection.

CN118570815AActive Publication Date: 2024-08-30BEIJING ELECTRONICS SCI & TECH INST

Patent Information

Application Number
CN202410797639.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-08-30
Estimated Expiration
2044-06-20

AI Technical Summary

Technical Problem

In the training phase of machine learning, especially the ciphertext neural network training of deep neural networks, there are problems such as high bandwidth consumption, low efficiency, noise issues and insufficient security, which results in low efficiency of ciphertext neural network training and difficulty in implementation.

Method used

An encryption library based on modular component homomorphism is used to encrypt and preprocess MNIST handwritten data, and a ciphertext neural network with a depth of 9 layers is constructed. By optimizing the structure of the convolution layer, activation layer and pooling layer, blind multiplication operations are reduced. The derivative-expanded Lagrangian interpolation polynomial is used as the activation function to implement forward propagation and back propagation, and the weight values ​​are updated in the back propagation to prevent overfitting.

Benefits of technology

It significantly improves the training efficiency of ciphertext neural network, ensures the protection of data privacy, and realizes efficient and accurate neural network training in an encrypted state, solving the problems of bandwidth consumption and low efficiency in ciphertext training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570815A
    Figure CN118570815A
Patent Text Reader

Abstract

The invention discloses a modular component homomorphism-based ciphertext handwritten form recognition neural network training method and system. The method comprises the steps of performing encryption preprocessing on a plaintext data set of an MNIST handwritten form by using a modular component homomorphism encryption library; a ciphertext neural network with the depth of 9 layers is constructed, and adaptation transformation of a mode component homomorphic encryption library is carried out on the ciphertext neural network; training the ciphertext neural network by using the ciphertext data, wherein the ciphertext training based on homomorphic encryption comprises forward propagation and back propagation; wherein in the propagation process of the reverse neural network, the gradient is calculated and reversely transmitted back, the weight value and the offset value are updated, and a regularization parameter is adopted to prevent overfitting; gradient descent and parameter updating are completed, and a trained ciphertext handwritten recognition neural network model is obtained. According to the method, the neural network is efficiently and accurately trained in the encryption domain, the method is successfully applied to a handwritten form recognition task, the ciphertext training efficiency is remarkably improved, and meanwhile protection of data privacy is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of privacy protection in machine learning, and more specifically to a neural network training method and system for ciphertext handwriting recognition based on modular component homomorphism. Background Art

[0002] Machine learning privacy protection scenarios refer to the potential privacy leakage risks in machine learning, which require the design of adaptive privacy protection strategies to fully understand specific privacy protection scenarios. Due to the development stage of machine learning technology, the training mode of the model used, the different data distribution of training and prediction data sets, and the trust of the participants, different privacy protection demand scenarios are jointly determined.

[0003] In a centralized learning environment, the processing stage of the data set constitutes a typical privacy protection scenario, because without proper security measures, a large amount of raw plaintext data can easily cause privacy leakage during the collection and centralized storage process. The model training stage under the current distributed learning architecture is also a key privacy protection scenario. The participating parties need to store the data locally and collaboratively build a global model by exchanging model parameters or gradient information. However, even if the data itself is not directly exchanged, there may be a risk of privacy leakage due to information interaction during the training process.

[0004] The complete life cycle of machine learning can be divided into two major stages: the model training stage and the prediction stage. In scenarios such as patient-centered online medical systems and cloud-based online financial services, every reasoning and decision of the machine learning system may touch upon the user's sensitive information. Targeted protection measures need to be taken in view of the operational characteristics and technical requirements of each of these two stages.

[0005] For example, in the application context of deep neural networks, homomorphic encryption technology is more often deployed in the prediction stage. This is because the nature of deep learning determines that its computing process is extremely dependent on the super computing resources and high-speed transmission capabilities of the cloud; even in an unencrypted state, training deep learning models already places extremely high demands on hardware performance, requiring efficient computing power and huge data processing throughput. However, although homomorphic encryption technology can perform calculations while keeping the data encrypted, it inevitably adds additional computing complexity and communication costs, and the ciphertext parameters will expand exponentially, which greatly limits its practical application in the deep learning training stage.

[0006] Therefore, seeking to achieve efficient and secure homomorphic encryption schemes during the training phase is a major open challenge in the field of privacy protection in machine learning.

[0007] For example, in the field of MNIST handwritten digit recognition ciphertext neural network training, there are still the following shortcomings:

[0008] 1. Bandwidth consumption. Since the convolutional layer in the ciphertext neural network training needs to perform a large number of homomorphic multiplication operations, and the bandwidth consumption of the fully homomorphic encryption algorithm mainly depends on the number of modular bases. With each activation layer, the number of modular bases will double, and the size of the ciphertext model parameters will also be multiplied, resulting in an increasing bandwidth occupied by the ciphertext neural network training.

[0009] 2. Low efficiency. Through feature dimensionality reduction, the ciphertext data set is preprocessed before ciphertext training, the data set is cropped and rescaled in the plaintext data domain, and then the input is encrypted using the homomorphic library. Although the features of the training data can be reduced, due to the reduction of feature points, more iterations are required during the training process to ensure the accuracy of the network, which in turn leads to an order of magnitude increase in training time, resulting in the inefficiency of ciphertext neural network training being too low and unable to be put into practical use.

[0010] 3. Noise problem. As the ciphertext parameters increase, the noise generated by deep homomorphic ciphertext multiplication will also increase. If the number of modular bases is insufficient, the ciphertext will exceed the decryption range and cannot be successfully decrypted, resulting in the failure of ciphertext neural network training.

[0011] 4. Security issues. Since the current ciphertext neural network will not infer the final model parameters due to the leakage of the first few convolutional layers, in order to improve the efficiency of ciphertext training, the first few convolutional layers of the neural network are built in plaintext state, which is not actually ciphertext training in a completely ciphertext state.

[0012] Therefore, in the field of MNIST handwritten digit recognition ciphertext neural network training, how to overcome the above shortcomings has become an urgent problem to be solved by practitioners in the field. Summary of the invention

[0013] In view of this, the present invention provides a neural network training method and system for ciphertext handwriting recognition based on modular component homomorphism, which can at least partially solve the above technical problems.

[0014] In order to achieve the above object, the present invention adopts the following technical solution:

[0015] In a first aspect, an embodiment of the present invention provides a neural network training method for ciphertext handwriting recognition based on modular component homomorphism, comprising the following steps:

[0016] S1. Use the modular component homomorphic encryption library to perform encryption preprocessing on the plaintext data set of MNIST handwriting and convert the plaintext data into ciphertext data.

[0017] S2. Construct a 9-layer ciphertext neural network, and perform adaptation and transformation of the modular component homomorphic encryption library on the ciphertext neural network;

[0018] S3, using the ciphertext data to train the ciphertext neural network, wherein the ciphertext training based on homomorphic encryption includes forward propagation and reverse propagation; wherein, in the propagation process of the reverse neural network, the gradient is calculated and reversely transmitted back, the weight value and the bias value are updated, and a regularization parameter is used to prevent overfitting;

[0019] S4. Complete gradient descent and parameter update to obtain the trained neural network model for ciphertext handwriting recognition.

[0020] Furthermore, the step S2 specifically includes:

[0021] Construct a 9-layer ciphertext neural network, including 3 convolutional layers, 3 activation layers, 2 pooling layers and 1 fully connected layer; according to the order of input image to output image category, the first convolutional layer, the first activation layer, the first pooling layer, the second convolutional layer, the second activation layer, the second pooling layer, the third convolutional layer, the third activation layer, and the fully connected layer are connected in sequence;

[0022] Use the modular component homomorphic encryption library to perform homomorphic addition and homomorphic multiplication operations in the convolutional layer, and use the connection table to reduce the number of blind multiplication operations;

[0023] Replace the max pooling layer with an average pooling layer and convert the division by 4 operation to a homomorphic multiplication by 0.25;

[0024] The activation function layer is optimized, the Lagrange interpolation polynomial with derivative expansion is used to approximate the activation function, and an approximate polynomial activation layer is set after each convolution layer.

[0025] Furthermore, in step S3, the ciphertext training based on homomorphic encryption includes forward propagation and back propagation, specifically including:

[0026] S31, in the forward propagation process, a convolution operation is performed by looping through each convolution kernel of the current layer and each output feature map of the previous layer, and a nonlinear mapping is performed to obtain an output value;

[0027] S32. During the back propagation process, each feature map of the previous layer is traversed in a loop, the error is calculated, and the weights and bias values ​​are updated.

[0028] Furthermore, the step S31 specifically includes:

[0029] 1) Convolutional layer forward propagation: In the convolutional layer, loop through each convolution kernel of the current layer, and perform convolution operations by looping through each output feature map of the previous layer;

[0030] If a connection table is used, determine whether the current convolution kernel has a connection with a feature map of the previous layer. If not, skip the feature map.

[0031] For each valid connection, call the ValidConvolution function, perform homomorphic multiplication on the weight of the convolution kernel and the ciphertext data, then perform homomorphic addition on the ciphertext result and the bias of the convolution kernel to obtain the convolution result and save it to the feature map of the current layer;

[0032] 2) Activation layer forward propagation: In the activation layer, a square activation function is used to perform homomorphic power operations on the ciphertext input to obtain the output value after activation;

[0033] 3) Pooling layer forward propagation: In the average pooling layer, the data in the pooling window is multiplied by 0.25 through homomorphic multiplication to obtain the average value;

[0034] 4) Forward propagation of the fully connected layer: In the fully connected layer, all feature maps of the current layer are homomorphically multiplied with all feature maps of the previous layer, and then the ciphertext result and the bias are homomorphically added to obtain the final output value.

[0035] Furthermore, the step S32 specifically includes:

[0036] (1) Back propagation of the fully connected layer: In the fully connected layer, loop through each feature map of the previous layer, set its error to 0, and calculate the error of the feature map of the previous layer based on the error of the current layer and the connection weight between the current layer and the previous layer;

[0037] (2) Convolution layer back propagation: In the convolution layer, determine whether there is a connection table. If so, determine whether the current convolution kernel has a connection relationship with a feature map of the previous layer. If so, calculate the error of the convolution kernel and perform ValidConvolution with the corresponding feature map of the previous layer to obtain the gradient of the convolution kernel.

[0038] After calculating the error, multiply it by the derivative of the corresponding activation function to update the error of the feature map;

[0039] For each effectively connected feature map, sum its errors to get the total error and add it to the corresponding error;

[0040] (3) Pooling layer back propagation: In the average pooling layer, the data in the pooling window is multiplied by 0.25 through homomorphic multiplication to obtain the average value, and the error is propagated;

[0041] (4) Weight update: In the fully connected layer and convolutional layer, the gradient of the connection weight between the current layer and the previous layer is updated, the product of the error of each neuron in the current layer and the output of the neuron in the previous layer is calculated, and the bias value of the current layer is updated at the same time. Regularization parameters are used to prevent overfitting.

[0042] Furthermore, in step S3, the weight value updating formula is as follows:

[0043] Weight update formula:

[0044] new_weight=old_weight-learning_rate*(gradient+Lambda*old_weight)

[0045] In the formula, new_weight represents the new weight; old_weight represents the old weight; learning_rate represents the learning rate; gradient represents the gradient; Lambda represents the regularization parameter.

[0046] In a second aspect, an embodiment of the present invention further provides a neural network training system for ciphertext handwriting recognition based on modular component homomorphism, comprising:

[0047] The encryption preprocessing module uses the modular component homomorphic encryption library to perform encryption preprocessing on the plaintext data set of MNIST handwriting and convert the plaintext data into ciphertext data;

[0048] Construct and transform a network module to construct a 9-layer ciphertext neural network, and adapt the ciphertext neural network to the modular component homomorphic encryption library;

[0049] A training module uses the ciphertext data to train the ciphertext neural network, and the ciphertext training based on homomorphic encryption includes forward propagation and back propagation; wherein, in the propagation process of the reverse neural network, the gradient is calculated and back-propagated, the weight value and the bias value are updated, and the regularization parameter is used to prevent overfitting; the gradient descent and parameter update are completed to obtain the trained ciphertext handwriting recognition neural network model.

[0050] In a third aspect, an embodiment of the present invention further provides a computer device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0051] Memory, used to store computer programs;

[0052] The processor, when used to execute the program stored in the memory, can implement the neural network training method for ciphertext handwriting recognition based on modular component homomorphism as described in any one of the first aspects.

[0053] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes a neural network training method for ciphertext handwriting recognition based on modular component homomorphism as described in any one of the first aspects.

[0054] The descriptions of the second to fourth aspects of the present invention can refer to the detailed description of the first aspect; and the beneficial effects of the descriptions of the second to fourth aspects can refer to the analysis of the beneficial effects of the first aspect, which will not be repeated here.

[0055] It can be seen from the above technical solution that compared with the prior art:

[0056] 1. The present invention proposes a neural network training method for ciphertext handwriting recognition based on modular component homomorphism. The training of the MNIST handwriting recognition neural network under ciphertext is realized by designing the structure of the ciphertext neural network to adapt to the modular component homomorphic encryption library, designing the network layer function and optimizing the approximation of the neural network excitation function.

[0057] 2. Based on the method of the present invention, the function of preprocessing the input data ciphertext of the ciphertext neural network training process by the domestic modular component homomorphic encryption library is expanded. By setting the modular cardinality and redundant modular projection, the degree of ciphertext expansion is controlled, the size of the memory occupied by the ciphertext is adjusted, and the bandwidth is reduced.

[0058] 3. The accuracy, efficiency and security of the whole process of forward propagation, back propagation, gradient descent and parameter update of the ciphertext neural network training based on the modular component homomorphic encryption library were verified. At the same time, the training efficiency of the MNIST handwriting recognition neural network under ciphertext was improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0060] Figure 1 A flow chart of the neural network training method for ciphertext handwriting recognition based on modular component homomorphism provided by the present invention.

[0061] Figure 2 This is a schematic diagram of the ciphertext neural network structure provided by the present invention.

[0062] Figure 3A block diagram of a neural network training system for ciphertext handwriting recognition based on modular component homomorphism provided by the present invention;

[0063] Figure 4 This is a structural block diagram of the computer device provided by the present invention. DETAILED DESCRIPTION

[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. 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] Embodiment 1:

[0066] The embodiment of the present invention discloses a neural network training method for ciphertext handwriting recognition based on modular component homomorphism, comprising the following steps:

[0067] S1. Use the modular component homomorphic encryption library to perform encryption preprocessing on the plaintext data set of MNIST handwriting and convert the plaintext data into ciphertext data.

[0068] S2. Construct a 9-layer ciphertext neural network, and adapt the ciphertext neural network to the modular homomorphic encryption library; in this process, design and select the appropriate number of modular bases to ensure the security and accuracy of encryption calculations. In particular, the selection of the number of modular bases ensures that the expected security level can be achieved while achieving efficient calculations.

[0069] S3, using the ciphertext data to train the ciphertext neural network, wherein the ciphertext training based on homomorphic encryption includes forward propagation and reverse propagation; wherein, in the propagation process of the reverse neural network, the gradient is calculated and reversely transmitted back, the weight value and the bias value are updated, and a regularization parameter is used to prevent overfitting;

[0070] S4. Complete gradient descent and parameter update to obtain the trained neural network model for ciphertext handwriting recognition.

[0071] For example: suppose there is an image of the MNIST handwritten number "5", and a neural network needs to be trained to recognize it while protecting privacy.

[0072] 1. Use the more parallel CMP-FHE library to encrypt image data. Assume that the original pixel value is [0, 255, 128, ...], and the encrypted value is [E(0), E(255), E(128), ...].

[0073] 2. Build a neural network: Create a 9-layer neural network and adapt the convolutional layer, pooling layer, and activation layer to homomorphic encryption.

[0074] 3. Forward propagation:

[0075] The convolution layer performs homomorphic convolution on each convolution kernel; the activation layer performs square activation; the pooling layer: calculates the average pooling; the fully connected layer performs homomorphic operations to obtain the final output.

[0076] 4. Back propagation and weight update:

[0077] The fully connected layer calculates the error and updates the weights. The convolution layer calculates the gradient of the convolution kernel based on the error and weight, and updates the error of the feature map. The pooling layer transfers the error, calculates and updates the parameters of the pooling layer. The weights are updated, and the new weights are calculated using the formula.

[0078] After multiple epochs of training, the neural network model was successfully trained in the encrypted state and has the ability to recognize the handwritten number "5" while ensuring data privacy.

[0079] The present invention realizes efficient and accurate training of neural networks in the encryption domain through a ciphertext neural network training method based on a modular component homomorphic encryption library, and has successfully applied it to handwriting recognition tasks, significantly improving the efficiency of ciphertext training while ensuring the protection of data privacy.

[0080] The present invention mainly makes adaptive improvements to the domestic modular component homomorphic encryption library. In order to reduce the data preprocessing time in the early stage of ciphertext neural network training, the domestic modular component homomorphic encryption library is expanded to preprocess the input data ciphertext of the ciphertext neural network training process. At the same time, the ciphertext training process of a deeper neural network is explored. Based on the domestic modular component homomorphic encryption library, the 9-layer ciphertext neural network for MNIST handwriting recognition is adapted and transformed. By optimizing the network construction, the design of network layer functions, and the replacement of nonlinear excitation functions, the training efficiency of the ciphertext neural network is successfully improved by 5 times, and the accuracy, practicality and security of the ciphertext neural network based on the domestic modular component homomorphic encryption library are verified.

[0081] Reference Figure 2As shown, step S2 of the embodiment of the present invention constructs a neural network with a depth of 9 layers, which consists of 3 convolutional layers, 3 activation function layers, 2 average pooling layers and 1 fully connected layer. For the convolutional layer in the MNIST handwriting network, the addition and multiplication of the modular component homomorphism are homomorphically replaced, and a connection table is introduced in the convolutional layer of the ciphertext neural network. The response of neurons to the input image is reduced by local connection, and it is not necessary to connect to all neurons in the previous layer like the fully connected layer, so as to reduce the number of blind multiplication operations in the convolutional layer in the ciphertext neural network training, and greatly shorten the training time; for the maximum pooling layer in the MNIST handwriting network, it is replaced with an average pooling layer, and the division by 4 in the average pooling layer is converted into a semi-blind multiplication calculation multiplied by 0.25; for the activation layer in the MNIST handwriting network, the number of modular bases of the modular component homomorphic encryption library adopted in the embodiment of the present invention will double when passing through the activation layer. In addition, the square activation layer is optimized, and only an approximate polynomial activation layer is added after each convolutional layer, and no square activation layer is added after the average pooling layer and the fully connected layer. At the same time, the Lagrange interpolation polynomial approximation activation function with derivative expansion is selected.

[0082] In steps S3-S4, during the forward propagation and back propagation process in the ciphertext training based on homomorphic encryption:

[0083] 1. In the forward convolution layer, each convolution kernel of the current layer will be looped through first, and then each output feature map of the previous layer will be looped through. If a connection table is used, it will determine whether the current convolution kernel is connected to a feature map of the previous layer. If not, the feature map will be skipped. For each valid connection, the function will call the ValidConvolution function, blindly multiply the weight of the convolution kernel and the ciphertext data input, and then blindly add the ciphertext result and the offset of the convolution kernel, and save the convolution result to a shared feature map pMap of the current layer. Then, for each output feature map of the current layer, each element is looped through and nonlinear mapping is performed to obtain the final output value.

[0084] Among them, the ValidConvolution function indicates that the convolution kernel operates in the image, with (i, j) as the starting point and (n, m) as the offset, and calculates the index of the input value of the convolution kernel at this position; with (0, 0) as the starting point and (n, m) as the offset, calculates the index of the weight parameter of the convolution kernel, and directly calculates the dot product of the input data and the convolution kernel.

[0085] In the forward activation function layer, if the square of x is used as the activation function, a blind power operation is performed on the ciphertext input; in the forward average pooling layer, the data scale is pooled, a semi-blind multiplication operation is performed, and the mean activation is obtained by multiplying by 0.25; in the forward fully connected layer, all pMaps of the current layer are blindly multiplied with all pMaps of the previous layer, and then the ciphertext result and the offset of the convolution kernel are blindly added. Among them, pMap is the output data of the convolution layer, and each convolution kernel will perform convolution calculation on the input data to obtain a feature map.

[0086] 2. In the reverse fully connected layer, loop through each feature map of the previous layer, set its error to 0, and calculate the error of the corresponding feature map of the previous layer based on the error of the current layer and the connection weight between the current layer and the previous layer; in the reverse convolution layer, it is also necessary to determine whether there is a connection table. If a connection table is used, determine whether the current convolution kernel and a feature map of the previous layer are connected. If so, calculate the error of this layer; if not, skip the feature map. After calculating the error, multiply it by the derivative of the corresponding activation function to update the error of the feature map; in the reverse average pooling layer, perform scale pooling of the data, perform semi-blind multiplication, and multiply by 0.25 to obtain the mean activation.

[0087] 3. In the reverse fully connected layer, update the gradient of the connection weights between the current layer and the previous layer, calculate the error of the jth neuron in the current layer and the output of the ith neuron in the previous layer, and update the bias value of the current layer; the value range of j and i is 0 to the number of neurons in the current layer. In the reverse convolution layer, for each convolution kernel in the current layer, perform ValidConvolution on the corresponding error and the corresponding feature map of the previous layer to obtain the gradient of the convolution kernel. For each feature map of the current layer, sum the errors to obtain the total error, which is then added to the corresponding error. In the reverse average pooling layer, no gradient and parameter update calculation is required. Gradient descent and parameter update refer to the process of calculating and back-propagating the gradient in the reverse neural network according to the above propagation process, updating the weight value, the gradient of the weight loss function, and the bias. At the same time, regularization parameters are introduced to prevent overfitting. The formula for weight update is:

[0088] new_weight=old_weight-learning_rate*(gradient+Lamba*old_weight)

[0089] That is, the new weight is equal to the difference between the old weight and the regularization parameter multiplied by the old weight, plus the gradient, and then multiplied by the learning rate.

[0090] The ciphertext handwriting recognition neural network training method based on modular component homomorphism provided in the embodiment of the present invention has the following advantages:

[0091] 1. A ciphertext neural network training scheme based on modular component homomorphic encryption is proposed. By utilizing the properties of the modular component homomorphic library, the reasonable application of the modular component homomorphic encryption library, the optimized design of network inter-layer functions, and the approximation method of the excitation function, the accuracy of the data can be effectively guaranteed when the neural network is trained in an encrypted state. These technical features work together to ensure the accuracy of the ciphertext data to four decimal places while retaining 6 decimal places of accuracy; the ciphertext data can be error-free while retaining 9 decimal places of accuracy.

[0092] 2. Under the premise of ensuring accuracy, the RT-HCNN network designed based on the self-designed modular component homomorphic encryption library ensures that the ciphertext neural network training can achieve the expected security level while being efficient in calculation by reasonably selecting the number of modular bases and optimizing the number of threads in parallel computing. Considering that the RT-HCNN network designed based on the self-designed modular component homomorphic encryption library must make the number of threads a multiple of the CUDA thread bundle and at the same time satisfy the multiple of the thread warp and 3 redundant modular projections, 96 modular bases are selected, so a security level of 192 bits can be ensured. The number of modular bases selected for this ciphertext neural network training is larger, and even if there is a situation where not all are traversed, a security level of at least 192 bits can be guaranteed.

[0093] 3. In the early stage of training, the ciphertext data preprocessing process is separated from the training process to reduce the data preprocessing time in the early stage of ciphertext neural network training. At the same time, the ciphertext is sent as multiple obfuscated images, which not only ensures the security of the original data, but also reduces the bandwidth of the ciphertext data set.

[0094] 4. The present invention no longer considers pre-processing the training set in the plaintext data domain, but uses the more parallel CMP-FHE library to encrypt the plaintext data before neural network training. The network structure has a deeper number of layers than the neural network structure such as Crypto-Nets. Although the training time of a Mini-batch has increased, it only takes 5 Epochs to achieve model convergence, which can significantly shorten the training time and successfully improve the training efficiency of the ciphertext neural network by 5 times.

[0095] Embodiment 2:

[0096] The embodiment of the present invention also provides a neural network training system for ciphertext handwriting recognition based on modular component homomorphism, referring to Figure 3 As shown, including:

[0097] The encryption preprocessing module uses the modular component homomorphic encryption library to perform encryption preprocessing on the plaintext data set of MNIST handwriting and convert the plaintext data into ciphertext data;

[0098] Construct and transform a network module to construct a 9-layer ciphertext neural network, and adapt the ciphertext neural network to the modular component homomorphic encryption library;

[0099] A training module uses the ciphertext data to train the ciphertext neural network, and the ciphertext training based on homomorphic encryption includes forward propagation and back propagation; wherein, in the propagation process of the reverse neural network, the gradient is calculated and back-propagated, the weight value and the bias value are updated, and the regularization parameter is used to prevent overfitting; the gradient descent and parameter update are completed to obtain the trained ciphertext handwriting recognition neural network model.

[0100] In this embodiment, the encryption preprocessing module performs encryption preprocessing on the plaintext data through the modular component homomorphic encryption library to ensure the privacy protection of the data throughout the training process. The data is calculated in an encrypted state to effectively prevent the leakage of sensitive information. Construct and transform the network module: By adapting the modular component homomorphic encryption library, the network structure and calculation method are optimized so that the ciphertext neural network can run efficiently in an encrypted state. At the same time, the appropriate number of modular bases (such as 96 modular bases) is selected to ensure the security level of the calculation (192 bits), and even if there is an incomplete traversal, a high security level can still be guaranteed. In the forward propagation of the training module, the optimized homomorphic addition, multiplication and excitation function approximation methods ensure the calculation accuracy. While retaining the accuracy of 6 decimal places, the accuracy of the ciphertext data after the four decimal places can be guaranteed; while retaining the accuracy of 9 decimal places, the ciphertext data can be error-free. In the back propagation, efficient weight and bias value updates are achieved through gradient calculation and update. The introduction of regularization parameters prevents overfitting and ensures that the model maintains good generalization ability during the training process.

[0101] Although the training time of a single Mini-batch has increased, the overall training time is greatly shortened and the training efficiency is improved by 5 times because the model convergence can be achieved in only 5 Epochs.

[0102] The ciphertext handwriting recognition neural network training system based on modular component homomorphism provided by the present invention realizes the organic combination of privacy protection, efficient computing and high-precision training through reasonable design and optimization. The encryption preprocessing, adaptive deep network structure and optimized training process enable the system to efficiently and accurately complete the training of the ciphertext neural network while ensuring data security, achieving the expected technical effect.

[0103] Embodiment 3:

[0104] Based on the same inventive concept, the present invention also provides a computer device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0105] Memory, used to store computer programs;

[0106] The processor, when used to execute the program stored in the memory, can implement the neural network training method for ciphertext handwriting recognition based on modular component homomorphism as in Example 1.

[0107] like Figure 4 As shown, the electronic device may include: a processor 41, a communication interface 42, a memory 43 and a communication bus 44, wherein the processor 41, the communication interface 42 and the memory 43 communicate with each other via the communication bus 44. The processor 41 may call the logic instructions in the memory 43 to execute a neural network training method for ciphertext handwriting recognition based on modular component homomorphism, the method comprising:

[0108] S1. Use the modular component homomorphic encryption library to perform encryption preprocessing on the plaintext data set of MNIST handwriting and convert the plaintext data into ciphertext data.

[0109] S2. Construct a 9-layer ciphertext neural network, and perform adaptation and transformation of the modular component homomorphic encryption library on the ciphertext neural network;

[0110] S3, using the ciphertext data to train the ciphertext neural network, wherein the ciphertext training based on homomorphic encryption includes forward propagation and reverse propagation; wherein, in the propagation process of the reverse neural network, the gradient is calculated and reversely transmitted back, the weight value and the bias value are updated, and a regularization parameter is used to prevent overfitting;

[0111] S4. Complete gradient descent and parameter update to obtain the trained neural network model for ciphertext handwriting recognition.

[0112] In addition, the logic instructions in the above-mentioned memory 43 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0113] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0114] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A neural network training method for ciphertext handwriting recognition based on modular component homomorphism, characterized in that: The following steps are involved: S1. Use the modular component homomorphic encryption library to perform encryption preprocessing on the plaintext data set of MNIST handwriting and convert the plaintext data into ciphertext data. S2. Construct a 9-layer ciphertext neural network, and perform adaptation and transformation of the modular component homomorphic encryption library on the ciphertext neural network; S3, using the ciphertext data to train the ciphertext neural network, wherein the ciphertext training based on homomorphic encryption includes forward propagation and reverse propagation; wherein, in the propagation process of the reverse neural network, the gradient is calculated and reversely transmitted back, the weight value and the bias value are updated, and a regularization parameter is used to prevent overfitting; S4. Complete gradient descent and parameter update to obtain the trained neural network model for ciphertext handwriting recognition.

2. According to claim 1, a neural network training method for ciphertext handwriting recognition based on modular component homomorphism is characterized in that: The step S2 specifically includes: Construct a 9-layer ciphertext neural network, including 3 convolutional layers, 3 activation layers, 2 pooling layers and 1 fully connected layer; according to the order of input image to output image category, the first convolutional layer, the first activation layer, the first pooling layer, the second convolutional layer, the second activation layer, the second pooling layer, the third convolutional layer, the third activation layer, and the fully connected layer are connected in sequence; Use the modular component homomorphic encryption library to perform homomorphic addition and homomorphic multiplication operations in the convolutional layer, and use the connection table to reduce the number of blind multiplication operations; Replace the max pooling layer with an average pooling layer and convert the division by 4 operation to a homomorphic multiplication by 0.25; The activation function layer is optimized, the Lagrange interpolation polynomial with derivative expansion is used to approximate the activation function, and an approximate polynomial activation layer is set after each convolution layer.

3. The method for training a neural network for ciphertext handwriting recognition based on modular component homomorphism according to claim 1, characterized in that: In step S3, the ciphertext training based on homomorphic encryption includes forward propagation and back propagation, specifically including: S31, in the forward propagation process, a convolution operation is performed by looping through each convolution kernel of the current layer and each output feature map of the previous layer, and a nonlinear mapping is performed to obtain an output value; S32. During the back propagation process, each feature map of the previous layer is traversed in a loop, the error is calculated, and the weights and bias values ​​are updated.

4. The method for training a neural network for ciphertext handwriting recognition based on modular component homomorphism according to claim 3, characterized in that: The step S31 specifically includes: 1) Convolutional layer forward propagation: In the convolutional layer, loop through each convolution kernel of the current layer, and perform convolution operations by looping through each output feature map of the previous layer; If a connection table is used, determine whether the current convolution kernel has a connection with a feature map of the previous layer. If not, skip the feature map. For each valid connection, call the ValidConvolution function, perform homomorphic multiplication on the weight of the convolution kernel and the ciphertext data, then perform homomorphic addition on the ciphertext result and the bias of the convolution kernel to obtain the convolution result and save it to the feature map of the current layer; 2) Activation layer forward propagation: In the activation layer, a square activation function is used to perform homomorphic power operations on the ciphertext input to obtain the output value after activation; 3) Pooling layer forward propagation: In the average pooling layer, the data in the pooling window is multiplied by 0.25 through homomorphic multiplication to obtain the average value; 4) Forward propagation of the fully connected layer: In the fully connected layer, all feature maps of the current layer are homomorphically multiplied with all feature maps of the previous layer, and then the ciphertext result and the bias are homomorphically added to obtain the final output value.

5. The method for training a neural network for ciphertext handwriting recognition based on modular component homomorphism according to claim 3, characterized in that: The step S32 specifically includes: (1) Back propagation of the fully connected layer: In the fully connected layer, loop through each feature map of the previous layer, set its error to 0, and calculate the error of the feature map of the previous layer based on the error of the current layer and the connection weight between the current layer and the previous layer; (2) Convolution layer back propagation: In the convolution layer, determine whether there is a connection table. If so, determine whether the current convolution kernel has a connection relationship with a feature map of the previous layer. If so, calculate the error of the convolution kernel and perform ValidConvolution with the corresponding feature map of the previous layer to obtain the gradient of the convolution kernel. After calculating the error, multiply it by the derivative of the corresponding activation function to update the error of the feature map; For each effectively connected feature map, sum its errors to get the total error and add it to the corresponding error; (3) Pooling layer back propagation: In the average pooling layer, the data in the pooling window is multiplied by 0.25 through homomorphic multiplication to obtain the average value, and the error is propagated; (4) Weight update: In the fully connected layer and convolutional layer, the gradient of the connection weight between the current layer and the previous layer is updated, the product of the error of each neuron in the current layer and the output of the neuron in the previous layer is calculated, and the bias value of the current layer is updated at the same time. Regularization parameters are used to prevent overfitting.

6. The method for training a neural network for ciphertext handwriting recognition based on modular component homomorphism according to claim 1, characterized in that: In step S3, the weight value is updated as follows: Weight update formula: new_weight=old_weight-learning_rate*(gradient+Lambda*old_weight) In the formula, new_weight represents the new weight; old_weight represents the old weight; learning_rate represents the learning rate; gradient represents the gradient; Lambda represents the regularization parameter.

7. A neural network training system for ciphertext handwriting recognition based on modular component homomorphism, characterized in that: include: The encryption preprocessing module uses the modular component homomorphic encryption library to perform encryption preprocessing on the plaintext data set of MNIST handwriting and convert the plaintext data into ciphertext data; Construct and transform a network module to construct a 9-layer ciphertext neural network, and adapt the ciphertext neural network to the modular component homomorphic encryption library; A training module uses the ciphertext data to train the ciphertext neural network, and the ciphertext training based on homomorphic encryption includes forward propagation and back propagation; wherein, in the propagation process of the reverse neural network, the gradient is calculated and back-propagated, the weight value and the bias value are updated, and the regularization parameter is used to prevent overfitting; the gradient descent and parameter update are completed to obtain the trained ciphertext handwriting recognition neural network model.

8. A computer device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; The processor, when used to execute the program stored in the memory, can implement a neural network training method for ciphertext handwriting recognition based on modular component homomorphism as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, enable the processor to execute a neural network training method for ciphertext handwriting recognition based on modular component homomorphism according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Handwriting recognition method based on encrypted neural network

    CN110490128A

  • Fully homomorphic encryption deep learning reasoning method and system based on FPGA

    CN112699384A

  • Signature recognition model creating method and device

    CN114863443A

  • Method and system for implementing binary convolutional neural network based on homomorphic encryption

    CN115860094A

  • Secure Multi-Party Learning and Inferring Insights Based on Encrypted Data

    US20200252198A1

Cited By

  • Homomorphic encrypted data identification method and device, electronic equipment and medium

    CN119646458A