Quantum homomorphic neural network construction method and encrypted image classification method

Through the combination of amplitude encoding, quantum one-time filling and homomorphic prosthetic modules of quantum homomorphic neural networks, combined with Adam optimizer and Pauli key encryption and decryption, the problems of low efficiency and reduced accuracy of classic encrypted image classification schemes are solved, and efficient and secure encrypted image classification is achieved.

CN116644778BActive Publication Date: 2025-08-26CENT SOUTH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310674764.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-08
Publication Date
2025-08-26
Estimated Expiration
2043-06-08

AI Technical Summary

Technical Problem

The existing classic encrypted image classification scheme has problems such as ciphertext expansion and low computing efficiency, resulting in low operating efficiency and reduced classification accuracy.

Method used

Quantum homomorphic neural network is adopted to achieve quantum homomorphic encryption through a combination of amplitude encoding, quantum one-time filling scheme, homomorphic prosthetic module and measurement module, combined with Adam optimizer for training and update, and use Pauli key and public key for encryption and decryption to achieve quantum homomorphic encryption.

Benefits of technology

On the basis of ensuring the security of encrypted images, the accuracy of classification prediction is not reduced, the data processing speed is improved, the difficulty of attacking the system is increased, and reliability and efficiency are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116644778B_ABST
    Figure CN116644778B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for constructing a quantum homomorphic neural network, comprising designing and determining parameter information of an encoding method of the quantum homomorphic neural network; training and updating the quantum homomorphic neural network; and using the trained quantum homomorphic neural network as a constructed quantum homomorphic neural network. The present invention also discloses an encrypted image classification method comprising the method for constructing the quantum homomorphic neural network. The present invention can ensure the security of the encrypted image without reducing the accuracy of the classification prediction; at the same time, the present invention utilizes the characteristics of the combination of quantum homomorphic encryption and quantum neural networks to increase the speed of data processing, and the proposed quantum homomorphic neural network key and parameter update strategy can increase the difficulty for attackers to attack the system, further improving the reliability of the present invention; therefore, the present invention has high reliability, good accuracy and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of quantum technology, and specifically relates to a method for constructing a quantum homomorphic neural network and an encrypted image classification method. Background Art

[0002] With the development of economy and technology and the improvement of people's living standards, machine learning technology has been widely used in people's production and life, bringing endless convenience to people's production and life. At present, machine learning technology has been widely used in common fields such as smart home, disease detection, and autonomous driving.

[0003] These services often require processing large amounts of image data. However, local clients often lack robust storage and computing resources, requiring them to outsource these data and computing tasks to remote cloud computing service providers. However, these images often contain sensitive user information, such as facial and medical images. In a cloud computing environment, these private images pose a risk of being leaked.

[0004] For this reason, encrypted image classification technology has emerged. Encrypted image classification is a key task in privacy-preserving machine learning in cloud computing. Users require cloud computing service providers to be "computable but invisible" to private image data. Consequently, research on encrypted image classification often employs a combination of homomorphic encryption and neural networks. Homomorphic encryption allows for intelligent analysis of encrypted image data, allowing cloud service providers to obtain valuable analytical results without decrypting the original image data or learning models, thus ensuring data collaboration between organizations that lack mutual trust.

[0005] However, the current classic encrypted image classification scheme using homomorphic encryption technology has disadvantages in terms of ciphertext expansion and computational efficiency. Therefore, existing schemes of this type generally have problems such as low operating efficiency and reduced classification accuracy. Summary of the Invention

[0006] One of the objectives of the present invention is to provide a method for constructing a quantum homomorphic neural network with high reliability, good accuracy and high efficiency.

[0007] A second object of the present invention is to provide an encrypted image classification method that includes the construction method of the quantum homomorphic neural network.

[0008] The method for constructing the quantum homomorphic neural network provided by the present invention comprises the following steps:

[0009] S1. Design and determine the parameter information of the encoding method of the quantum homomorphic neural network;

[0010] S2. Based on the parameter information determined in step S1, training and updating the quantum homomorphic neural network;

[0011] S3. Use the trained quantum homomorphic neural network obtained in step S2 as the constructed quantum homomorphic neural network.

[0012] The design and determination of parameter information of the encoding method of the quantum homomorphic neural network described in step S1 specifically includes the following steps:

[0013] The constructed quantum homomorphic neural network includes an encoder module, an encryption and decryption module, a homomorphic simulation module, and a measurement module;

[0014] The encoder is used to encode classical data into quantum states; for image data, amplitude coding is used for encoding; the amplitude coding is expressed as where |φ> is the quantum state after amplitude coding, i is the binary subscript, and x i is the amplitude value of the i-th quantum state, |i> is the quantum state represented in binary;

[0015] The encryption and decryption module adopts a quantum one-time filling scheme; the quantum one-time filling scheme is composed of a set Composition, where X a is the X quantum gate, Z b is the Z quantum gate, a is the key acting on the X quantum gate, b is the key acting on the Z quantum gate, and n is the key length; the plaintext quantum state |φ> is encrypted by the encryption quantum circuit composed of the X gate and the Z gate to obtain the ciphertext quantum state |ψ>; the encryption process is expressed as:

[0016]

[0017] In the formula represents the tensor product; is the X gate acting on the i-th quantum bit; is the Z gate acting on the i-th quantum bit;

[0018] The processing process of the homomorphic simulation module is expressed as in is the output variable of the homomorphic pseudomodule, L is the quantum gate subscript, U irepresents a quantum gate from the set {RY(θ),CNOT}, where RY(θ) is a quantum rotation gate with parameter θ and CNOT is a controlled NOT gate; first, the RY gate is applied to the qubit and the phase of each qubit is rotated by a set angle; then, all qubits are processed simultaneously using several iterative k circuits to obtain the output variable of the final homomorphic hypothetical module; the iterative k circuit includes: applying a CNOT gate to each qubit to entangle the qubit; then, applying two RY gates to each qubit again to rotate it.

[0019] The processing of the measurement module is expressed as Where E is the output of the measurement module, is the final quantum state, H is the Hamiltonian to be measured, is the output variable of the homomorphic simulated module, and |φ> is the initial quantum state.

[0020] Step S2, based on the parameter information determined in step S1, trains and updates the quantum homomorphic neural network, specifically including the following steps:

[0021] The error between the input probability and the target is calculated using the following loss function: For each measurement value E i ,

[0022] The corresponding loss is calculated as:

[0023]

[0024] Where l(E i ,c) is the loss between the measured value and the target value; E i is a one-dimensional vector; c and j are E i The position equal to 1;

[0025] The Adam optimizer is used to optimize the parameters: the update rule of the Adam optimizer is expressed as

[0026]

[0027]

[0028] Where lr t is the learning rate of the tth iteration; learning_rate is the set learning rate; β2 is the second parameter set; β1 is the first parameter set; θ' is the updated parameter; θ is the parameter before the update; m t is the first momentum matrix; v t is the second momentum matrix; ε is a very small number;

[0029] In quantum homomorphic encryption, there are:

[0030]

[0031]

[0032]

[0033] Where RY(θ k ) is the parameter θ k revolving door; θ k is the rotation angle; c k is the parameter calculated based on the key; is the exclusive OR operation; CNOT is the controlled NOT gate; is the tensor product;

[0034] The following steps are used for Pauli key homomorphic encryption: Use the public key pk to encrypt the Pauli key Perform homomorphic encryption: the i-th key a i Pad with zeros to get a one-dimensional vector Randomly generate a set of one-dimensional vectors consisting of 0 and 1 And multiply it with the public key pk; add the results to get the encrypted Pauli key Enc pk (a i ), Enc pk (a i ) is expressed as Then, the i-th key b i Pad with zeros to get a one-dimensional vector Randomly generate a set of one-dimensional vectors consisting of 0 and 1 And multiply it with the public key pk; then add the result to get the encrypted Pauli key Enc pk (b i ), Enc pk (b i ) is expressed as Finally, the two sets of keys are combined to obtain the encrypted Pauli key

[0035] The following steps are used to perform Pauli key update: If the quantum gate CNOT acts on the i-th control qubit and the j-th target qubit, then calculate:

[0036]

[0037]

[0038] Where Enc pk (a i ′) is the key a i Updated encryption key; Enc pk (bi ′) is the key b i Updated encryption key;

[0039] The following steps are used to update the parameters of the homomorphic pseudo-module: If the quantum gate RY(θ k ) acts on the i-th quantum bit, first calculate Enc pk (c i )for Next, calculate the encrypted power exponential vector Then Decrypt and get the decrypted power exponent vector Then each power exponent c k and the corresponding parameter θ k Calculate and get the updated parameters Finally, calculate the updated parameter vector Thus we get the quantum homomorphic pseudo circuit

[0040] The present invention also discloses an encrypted image classification method including the method for constructing the quantum homomorphic neural network, comprising the following steps:

[0041] A. The server side uses the aforementioned quantum homomorphic neural network construction method to construct a quantum homomorphic neural network model and uses plaintext images for training;

[0042] B. The client constructs two sets of keys: the first set of keys is the Pauli key, and the second set of keys is the public key and private key used to encrypt and decrypt the Pauli key;

[0043] C. The client encrypts the plaintext quantum state and Pauli key and sends them to the server;

[0044] D. The server updates the parameters and Pauli key of the quantum homomorphic neural network based on the received data, and sends the updated Pauli key to the client;

[0045] E. The server predicts the encrypted image and sends the prediction result to the client;

[0046] F. The client decrypts the received Pauli key and prediction result;

[0047] G. The client completes the classification of the encrypted image based on the decryption result.

[0048] The server side described in step A adopts the method for constructing a quantum homomorphic neural network to construct a quantum homomorphic neural network model and uses plaintext images for training, specifically comprising the following steps:

[0049] The server side adopts the method for constructing a quantum homomorphic neural network to construct a quantum homomorphic neural network model;

[0050] Processing the acquired plaintext image to obtain a standardized column vector; the processing includes image cropping, image downsampling, conversion to grayscale value operation and standardization operation;

[0051] Amplitude coding: Using the encoder in the quantum homomorphic neural network model, the obtained normalized column vector is encoded onto the quantum bit to obtain the plaintext quantum state;

[0052] The obtained plaintext quantum state is input into the constructed quantum homomorphic neural network model to train the constructed quantum homomorphic neural network model.

[0053] The client in step B constructs two sets of keys: the first set of keys is the Pauli key, and the second set of keys is the public key and private key used to encrypt and decrypt the Pauli key. Specifically, the steps include:

[0054] By sampling the discrete Gaussian distribution over the integers, we get The private key sk is obtained as in, is the sampled vector, t i is the element in the vector, ← is the sampling symbol, χ n is a discrete Gaussian distribution over the integers, The group of addition modulo q of length n+1 is formed;

[0055] Randomly generated matrix and error vector Where B is a randomly generated matrix of size n×N, is a group of addition modulo q of size n×N, is the error vector;

[0056] Calculated for in is a one-dimensional vector;

[0057] Finally, and -B form a matrix of n+1 columns to obtain the public key pk.

[0058] The client in step C encrypts the plaintext quantum state and the Pauli key, specifically comprising the following steps:

[0059] Encrypt the plaintext quantum state: use quantum one-time pad method and Pauli key The plaintext quantum state |φ> is encrypted to obtain the ciphertext quantum state |ψ>; the encryption method is expressed as:

[0060]

[0061] In the formula represents the tensor product; is the X gate acting on the i-th quantum bit; is the Z gate acting on the i-th quantum bit;

[0062] Encrypt the Pauli key: Use the public key pk to encrypt the Pauli key Perform homomorphic encryption to obtain the encrypted Pauli key The encryption method is expressed as:

[0063]

[0064] Among them, Enc pk (a i ) is the i-th encryption key; is a one-dimensional vector, and a i is the i-th key; is a one-dimensional vector consisting of 0 and 1,

[0065] The private key sk is saved by the client.

[0066] The server side described in step D updates the parameters of the quantum homomorphic neural network and the Pauli key based on the received data, specifically including the following steps:

[0067] The server encrypts the Pauli key based on the trained quantum homomorphic neural network model. Perform homomorphic updates; quantum homomorphic operations are expressed as:

[0068]

[0069]

[0070]

[0071] Where RY(θ k ) is the parameter θ k revolving door; θ k is the rotation angle; c k is the power exponent calculated based on the key; is the exclusive OR operation; CNOT is the controlled NOT gate; is the tensor product;

[0072] Update the parameters of the quantum homomorphic neural network: the server side simulates the output variables of the module based on the homomorphic The quantum operations involved in the homomorphic update of the coefficients of the quantum neural network parameters: If the quantum gate RY(θk ) acts on the i-th quantum bit, then calculate Enc pk (c i )for And calculate the encrypted power exponential vector Send to the client; the client uses the private key sk to decrypt Send back to the server; the server completes the parameter update of the quantum homomorphic neural network and obtains the quantum homomorphic simulated circuit

[0073] Update of encrypted Pauli keys: The server sets up circuits based on quantum homomorphism The quantum homomorphic operations involved in updating the encrypted Pauli key If the quantum gate CNOT acts on the i-th control qubit and the j-th target qubit, then calculate:

[0074]

[0075]

[0076] Where Enc pk (a i ′) is the key a i Updated encryption key; Enc pk (b i ′) is the key b i Updated encryption key;

[0077] Finally, the updated encrypted Pauli key is obtained

[0078] The server side in step E predicts the encrypted image and sends the prediction result to the client side, which specifically includes the following steps:

[0079] The server inputs the ciphertext quantum state |ψ> into the current quantum homomorphic neural network model to obtain the ciphertext predicted quantum state |ψ′>, and sends the ciphertext predicted quantum state |ψ′> to the client.

[0080] The client in step F decrypts the received Pauli key and prediction result, specifically including the following steps:

[0081] The client uses the private key sk to encrypt the updated Pauli key Decrypt and get the Pauli key in plain text The decryption process is expressed as:

[0082] a i ′=[[ <Enc pk (a i ′),sk>]q ]2

[0083] Where a i ′ is the key a i Updated key; Enc pk (a i ′) is the key a i Updated encryption key; <Enc pk (a i ′),sk> is Enc pk (a i ′) and the inner product of sk; [] q is an integer modulo q; []2 is an integer modulo 2;

[0084] Using Pauli key in plain text Decrypt the ciphertext predicted quantum state |ψ′> to obtain the plaintext predicted quantum state |ψ″>; the decryption process is expressed as

[0085]

[0086] In the formula is the Z gate acting on the i-th quantum bit; is the X gate acting on the i-th quantum bit; Design a circuit for quantum homomorphism; is a continuous tensor product.

[0087] The quantum homomorphic neural network construction method and encrypted image classification method provided by the present invention can ensure the security of the encrypted image without reducing the accuracy of classification prediction. At the same time, the present invention utilizes the characteristics of combining quantum homomorphic encryption and quantum neural networks to improve the speed of data processing. The proposed quantum homomorphic neural network key and parameter update strategy can increase the difficulty for attackers to attack the system, further improving the reliability of the present invention. Therefore, the present invention has high reliability, good accuracy and high efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] Figure 1 The figure is a schematic flow chart of the method for constructing the present invention.

[0089] Figure 2 Schematic diagram of the process flow of the classification method of the present invention. DETAILED DESCRIPTION

[0090] like Figure 1 The figure shows a flow chart of the construction method of the present invention: The construction method of the quantum homomorphic neural network disclosed in the present invention comprises the following steps:

[0091] S1. Design and determine the parameter information of the encoding method of the quantum homomorphic neural network; specifically, the following steps are included:

[0092] The constructed quantum homomorphic neural network includes an encoder module, an encryption and decryption module, a homomorphic simulation module, and a measurement module;

[0093] The encoder is used to encode classical data into quantum states; for image data, amplitude coding is used for encoding; the amplitude coding is expressed as where |φ> is the quantum state after amplitude coding, i is the binary subscript, and x i is the amplitude value of the i-th quantum state, and |i> is the quantum state represented in binary. For image data, amplitude coding can use fewer qubits to encode more image information, and is superior to other coding methods in terms of the number of required qubits and circuit complexity.

[0094] The encryption and decryption module adopts the quantum one-time pad (QOTP) scheme; the quantum one-time pad scheme is composed of a set Composition, where X a is the X quantum gate, Z b is the Z quantum gate, a is the key acting on the X quantum gate, b is the key acting on the Z quantum gate, and n is the key length; the plaintext quantum state |φ> is encrypted by the encryption quantum circuit composed of the X gate and the Z gate to obtain the ciphertext quantum state |ψ>; the encryption process is expressed as:

[0095]

[0096] In the formula represents the tensor product; is the X gate acting on the i-th quantum bit; is the Z gate acting on the i-th quantum bit;

[0097] The processing process of the homomorphic simulation module is expressed as in is the output variable of the homomorphic pseudomodule, L is the quantum gate subscript, U i represents a quantum gate from the set {RY(θ),CNOT}, where RY(θ) is a quantum rotation gate with parameter θ and CNOT is a controlled NOT gate. First, an RY gate is applied to the qubits to rotate the phase of each qubit by a set angle. Then, all qubits are processed simultaneously using several iterative k circuits to obtain the final output variable of the homomorphic pseudo-module. The iterative k circuits include: applying a CNOT gate to each qubit to entangle the qubits; then, applying two RY gates to each qubit again to rotate it.

[0098] The processing of the measurement module is expressed as Where E is the output of the measurement module, is the final quantum state, H is the Hamiltonian to be measured, is the output variable of the homomorphic pseudomodule, |φ> is the initial quantum state;

[0099] S2. Based on the parameter information determined in step S1, the quantum homomorphic neural network is trained and updated; specifically, the following steps are included:

[0100] The error between the input probability and the target is calculated using the following loss function: For each measurement value E i , the corresponding loss is calculated as:

[0101]

[0102] Where l(E i ,c) is the loss between the measured value and the target value; E i is a one-dimensional vector; c and j are E i The position equal to 1;

[0103] The Adam optimizer is used to optimize the parameters: the update rule of the Adam optimizer is expressed as

[0104]

[0105]

[0106] Where lr t is the learning rate of the tth iteration; learning_rate is the set learning rate; β2 is the second parameter set; β1 is the first parameter set; θ' is the updated parameter; θ is the parameter before the update; m t is the first momentum matrix; v t is the second momentum matrix; ε is a very small number;

[0107] In quantum homomorphic encryption, there are:

[0108]

[0109]

[0110]

[0111] Where RY(θ k ) is the parameter θ k revolving door; θ k is the rotation angle; c k is the power exponent calculated based on the key; is the exclusive OR operation; CNOT is the controlled NOT gate; is the tensor product;

[0112] The following steps are used for Pauli key homomorphic encryption: Use the public key pk to encrypt the Pauli key Perform homomorphic encryption: the i-th key a i Pad with zeros to get a one-dimensional vector Randomly generate a set of one-dimensional vectors consisting of 0 and 1 And multiply it with the public key pk; add the results to get the encrypted Pauli key Enc pk (a i ), Enc pk (a i ) is expressed as Then, the i-th key b i Pad with zeros to get a one-dimensional vector Randomly generate a set of one-dimensional vectors consisting of 0 and 1 And multiply it with the public key pk; then add the result to get the encrypted Pauli key Enc pk (b i ), Enc pk (b i ) is expressed as Finally, the two sets of keys are combined to obtain the encrypted Pauli key

[0113] The following steps are used to perform Pauli key update: If the quantum gate CNOT acts on the i-th control qubit and the j-th target qubit, then calculate:

[0114]

[0115]

[0116] Where Enc pk (a i ′) is the key a i Updated encryption key; Enc pk (b i ′) is the key b i Updated encryption key;

[0117] The following steps are used to update the parameters of the homomorphic pseudo-module: If the quantum gate RY(θ k ) acts on the i-th quantum bit, first calculating Next, calculate the encrypted power exponential vector Then Decrypt and get the decrypted power exponent vector Then each power exponent c k and the corresponding parameter θ kCalculate and get the updated parameters Finally, calculate the updated parameter vector Thus we get the quantum homomorphic pseudo circuit

[0118] S3. Use the trained quantum homomorphic neural network obtained in step S2 as the constructed quantum homomorphic neural network.

[0119] like Figure 2 The figure shows a flow chart of the classification method of the present invention: the encrypted image classification method disclosed in the present invention, which includes the method for constructing the quantum homomorphic neural network, comprises the following steps:

[0120] A. The server side uses the aforementioned method for constructing a quantum homomorphic neural network to construct a quantum homomorphic neural network model and uses plaintext images for training. Specifically, the steps include:

[0121] The server side adopts the method for constructing a quantum homomorphic neural network to construct a quantum homomorphic neural network model;

[0122] Processing the acquired plaintext image to obtain a standardized column vector; the processing includes image cropping, image downsampling, conversion to grayscale value operation and standardization operation;

[0123] Amplitude coding: Using the encoder in the quantum homomorphic neural network model, the obtained normalized column vector is encoded onto the quantum bit to obtain the plaintext quantum state;

[0124] Input the obtained plaintext quantum state into the constructed quantum homomorphic neural network model to train the constructed quantum homomorphic neural network model;

[0125] In specific implementation, for example, to classify handwritten images of 0 and 1, the 28×28 plaintext image is first preprocessed, cropped to 20×20, downsampled to 4×4, and then its grayscale value is normalized and converted into a column vector; the column vector is then encoded onto 4 quantum bits through an amplitude encoder to obtain a plaintext quantum state; the plaintext quantum state is input into a quantum homomorphic neural network model with 3 circuit layers, and the Pauli Z operator measurement is performed on the 2nd and 3rd quantum bits to obtain the Hamiltonian measurement values ​​of the 2nd and 3rd quantum bits. Through repeated training of the quantum neural network, the final training result is that the image labeled "0" has a larger measurement value on the 2nd quantum bit, while the image labeled "1" has a larger Hamiltonian measurement value on the 3rd quantum bit;

[0126] B. The client constructs two sets of keys: the first set is the Pauli key, and the second set is the public key and private key used to encrypt and decrypt the Pauli key. The specific steps include the following:

[0127] By sampling the discrete Gaussian distribution over the integers, we get The private key sk is obtained as in, is the sampled vector, t i is the element in the vector, ← is the sampling symbol, χ n is a discrete Gaussian distribution over the integers, The group of addition modulo q of length n+1 is formed;

[0128] Randomly generated matrix and error vector Where B is a randomly generated matrix of size n×N, is a group of addition modulo q of size n×N, is the error vector;

[0129] Calculated for in is a one-dimensional vector;

[0130] Finally, and -B form a matrix of n+1 columns, thereby obtaining the public key pk;

[0131] C. The client encrypts the plaintext quantum state and Pauli key and sends them to the server. This process specifically includes the following steps:

[0132] Encrypt the plaintext quantum state: use quantum one-time pad method and Pauli key The plaintext quantum state |φ> is encrypted to obtain the ciphertext quantum state |ψ>; the encryption method is expressed as:

[0133]

[0134] In the formula represents the tensor product; is the X gate acting on the i-th quantum bit; is the Z gate acting on the i-th quantum bit;

[0135] Encrypt the Pauli key: Use the public key pk to encrypt the Pauli key Perform homomorphic encryption to obtain the encrypted Pauli key The encryption method is expressed as:

[0136]

[0137] Among them, Enc pk (a i ) is the i-th encryption key; is a one-dimensional vector, and a i is the i-th key; is a one-dimensional vector consisting of 0 and 1,

[0138] The private key sk is saved by the client;

[0139] D. The server updates the parameters and Pauli key of the quantum homomorphic neural network based on the received data, and sends the updated Pauli key to the client. This specifically includes the following steps:

[0140] The server encrypts the Pauli key based on the trained quantum homomorphic neural network model. Perform homomorphic updates; quantum homomorphic operations are expressed as:

[0141]

[0142]

[0143]

[0144] Where RY(θ k ) is the parameter θ k revolving door; θ k is the rotation angle; c k is the power exponent calculated based on the key; is the exclusive OR operation; CNOT is the controlled NOT gate; is the tensor product;

[0145] Update the parameters of the quantum homomorphic neural network: the server side simulates the output variables of the module based on the homomorphic The quantum operations involved in the homomorphic update of the coefficients of the quantum network parameters are: if the quantum gate RY(θ k ) acts on the i-th quantum bit, then calculate Enc pk (c i )for And calculate the encrypted power exponential vector Send to the client; the client uses the private key sk to decrypt Send back to the server; the server completes the parameter update of the quantum homomorphic neural network and obtains the quantum homomorphic simulated circuit

[0146] Update of encrypted Pauli keys: The server sets up circuits based on quantum homomorphism The quantum homomorphic operations involved in updating the encrypted Pauli key If the quantum gate CNOT acts on the i-th control qubit and the j-th target qubit, then calculate:

[0147]

[0148]

[0149] Where Enc pk (a i ′) is the key a i Updated encryption key; Enc pk (b i ′) is the key b i Updated encryption key;

[0150] Finally, the updated encrypted Pauli key is obtained

[0151] E. The server predicts the encrypted image and sends the prediction result to the client. This specifically includes the following steps:

[0152] The server inputs the ciphertext quantum state |ψ> into the current quantum homomorphic neural network model to obtain the ciphertext predicted quantum state |ψ′>, and sends the ciphertext predicted quantum state |ψ′> to the client;

[0153] F. The client decrypts the received Pauli key and prediction result. This process specifically includes the following steps:

[0154] The client uses the private key sk to encrypt the updated Pauli key Decrypt and get the Pauli key in plain text The decryption process is expressed as:

[0155] a i ′=[[Enc pk (a i ′),sk>] q ]2

[0156] Where a i ′ is the key a i Updated key; Enc pk (a i ′) is the key a i Updated encryption key; <Enc pk (a i ′),sk> is Enc pk (a i ′) and the inner product of sk; [] q is an integer modulo q; []2 is an integer modulo 2;

[0157] Using Pauli key in plain text Decrypt the ciphertext predicted quantum state |ψ′> to obtain the plaintext predicted quantum state |ψ″>; the decryption process is expressed as

[0158]

[0159] In the formula is the Z gate acting on the i-th quantum bit; is the X gate acting on the i-th quantum bit; Design a circuit for quantum homomorphism; is a continuous tensor product.

[0160] G. The client completes the classification of the encrypted image based on the decryption result. For example, to classify the handwritten images of "0" and "1", the client performs the Pauli Z measurement on the second and third qubits to obtain the Hamiltonian measurement value. If the Hamiltonian measurement value of the second qubit is larger, the classification label is "0", corresponding to the handwritten 0 image; if the Hamiltonian measurement value of the third qubit is larger, the classification label is "1", corresponding to the handwritten 1 image. Finally, the predicted classification result is obtained.

Claims

1. A method for constructing a quantum homomorphic neural network, comprising the following steps: S1. Design and determine the parameter information of the encoding method of the quantum homomorphic neural network; specifically, the following steps are included: The constructed quantum homomorphic neural network includes an encoder module, an encryption and decryption module, a homomorphic simulation module, and a measurement module; The encoder is used to encode classical data into quantum states; the image data is encoded using amplitude coding; the amplitude coding is expressed as where |φ> is the quantum state after amplitude coding, i is the binary subscript, and x i is the amplitude value of the i-th quantum state, |i> is the quantum state represented in binary; The encryption and decryption module adopts a quantum one-time filling scheme; the quantum one-time filling scheme is composed of a set Composition, where X a is the X quantum gate, Z b is the Z quantum gate, a is the key acting on the X quantum gate, b is the key acting on the Z quantum gate, and n is the key length; the plaintext quantum state |φ> is encrypted by the encryption quantum circuit composed of the X gate and the Z gate to obtain the ciphertext quantum state |ψ>; the encryption process is expressed as: In the formula represents the tensor product; is the X gate acting on the i-th quantum bit; Z ai is the Z gate acting on the i-th quantum bit; The processing process of the homomorphic simulation module is expressed as in is the output variable of the homomorphic pseudomodule, L is the quantum gate subscript, U i represents a quantum gate from the set {RY(θ),CNOT}, where RY(θ) is a quantum rotation gate with parameter θ and CNOT is a controlled NOT gate. First, the RY gate is applied to the qubits, rotating the phase of each qubit by a set angle. Then, all qubits are processed simultaneously using several iterative k circuits to obtain the final output variable of the homomorphic hypothetical module. The iterative k circuits include: Apply CNOT gates to each qubit to make it entangled; Then, two RY gates are applied again to each qubit for rotation; The processing of the measurement module is expressed as Where E is the output of the measurement module, is the final quantum state, H is the Hamiltonian to be measured, is the output variable of the homomorphic pseudomodule, |φ> is the initial quantum state; S2. Based on the parameter information determined in step S1, training and updating the quantum homomorphic neural network; S3. Use the trained quantum homomorphic neural network obtained in step S2 as the constructed quantum homomorphic neural network.

2. The method for constructing a quantum homomorphic neural network according to claim 1, characterized in that Step S2, based on the parameter information determined in step S1, trains and updates the quantum homomorphic neural network, specifically including the following steps: The error between the input probability and the target is calculated using the following loss function: For each measurement value E i , the corresponding loss is calculated as: Where l(E i ,c) is the loss between the measured value and the target value; E i is a one-dimensional vector; c and j are E i The position equal to 1; The Adam optimizer is used to optimize the parameters: the update rule of the Adam optimizer is expressed as Where lr t is the learning rate of the tth iteration; learning_rate is the set learning rate; β2 is the second parameter set; β1 is the first parameter set; θ' is the updated parameter; θ is the parameter before the update; m t is the first momentum matrix; v t is the second momentum matrix; ε is a very small number; In quantum homomorphic encryption, there are: Where RY(θ k ) is the parameter θ k revolving door; θ k is the rotation angle; c k is the parameter calculated based on the key; is the exclusive OR operation; CNOT is the controlled NOT gate; is the tensor product; The following steps are used for Pauli key homomorphic encryption: Use the public key pk to encrypt the Pauli key To perform homomorphic encryption, first, the i-th key a i Pad with zeros to get a one-dimensional vector Then randomly generate a set of one-dimensional vectors consisting of 0 and 1 And multiply it with the public key pk; Then add the results of the first two steps to get the encrypted Pauli key Enc pk (a i ), calculated as Similarly, Enc pk (b i ); Finally, the two sets of keys are combined to obtain the encrypted Pauli key The following steps are used to perform Pauli key update: If the quantum gate CNOT acts on the i-th control qubit and the j-th target qubit, then calculate: Where Enc pk (a i ′) is the key a i Updated encryption key; Enc pk (b i ′) is the key b i Updated encryption key; The following steps are used to update the parameters of the homomorphic pseudo-module: If the quantum gate RY(θ k ) acts on the i-th quantum bit, first calculate Enc pk (c i )for Next, calculate the encrypted power exponential vector Then decrypt it and get the decrypted power exponent vector Then each power exponent c k and the corresponding parameter θ k Calculate and get the updated parameters Finally, calculate the updated parameter vector Thus we get the quantum homomorphic pseudo circuit 3. A method for encrypted image classification comprising the method for constructing a quantum homomorphic neural network according to any one of claims 1 or 2, comprising the following steps: A. The server side uses the aforementioned quantum homomorphic neural network construction method to construct a quantum homomorphic neural network model and uses plaintext images for training; B. The client constructs two sets of keys: the first set of keys is the Pauli key, and the second set of keys is the public key and private key used to encrypt and decrypt the Pauli key; C. The client encrypts the plaintext quantum state and Pauli key and sends them to the server; D. The server updates the parameters and Pauli key of the quantum homomorphic neural network based on the received data, and sends the updated Pauli key to the client; E. The server predicts the encrypted image and sends the prediction result to the client; F. The client decrypts the received Pauli key and prediction result; G. The client completes the classification of the encrypted image based on the decryption result.

4. The encrypted image classification method according to claim 3, characterized in that The server side described in step A adopts the method for constructing a quantum homomorphic neural network to construct a quantum homomorphic neural network model and uses plaintext images for training, specifically comprising the following steps: The server side adopts the method for constructing a quantum homomorphic neural network to construct a quantum homomorphic neural network model; Processing the acquired plaintext image to obtain a standardized column vector; the processing includes image cropping, image downsampling, conversion to grayscale value operation and standardization operation; Amplitude coding: Using the encoder in the quantum homomorphic neural network model, the obtained normalized column vector is encoded onto the quantum bit to obtain the plaintext quantum state; The obtained plaintext quantum state is input into the constructed quantum homomorphic neural network model to train the constructed quantum homomorphic neural network model.

5. The encrypted image classification method according to claim 4, characterized in that The client in step B constructs two sets of keys: the first set of keys is the Pauli key, and the second set of keys is the public key and private key used to encrypt and decrypt the Pauli key. Specifically, the steps include: By sampling the discrete Gaussian distribution over the integers, we get The private key sk is obtained as in, is the sampled vector, t i is the element in the vector, ← is the sampling symbol, χ n is a discrete Gaussian distribution over the integers, The group of addition modulo q of length n+1 is formed; Randomly generated matrix and error vector Where B is a randomly generated matrix of size n×N, is a group of addition modulo q of size n×N, is the error vector; Calculated for in is a one-dimensional vector; Finally, and -B form a matrix of n+1 columns to obtain the public key pk.

6. The encrypted image classification method according to claim 5, characterized in that The client in step C encrypts the plaintext quantum state and the Pauli key, specifically comprising the following steps: Encrypt the plaintext quantum state: use quantum one-time pad method and Pauli key The plaintext quantum state |φ> is encrypted to obtain the ciphertext quantum state |ψ>; the encryption method is expressed as: In the formula represents the tensor product; is the X gate acting on the i-th quantum bit; is the Z gate acting on the i-th quantum bit; encrypt the Pauli key: use the public key pk to encrypt the Pauli key Perform homomorphic encryption to obtain the encrypted Pauli key The encryption method is expressed as: Among them, Enc pk (a i ) is the i-th encryption key; is a one-dimensional vector, and a i is the i-th key; is a one-dimensional vector consisting of 0 and 1, The private key sk is saved by the client.

7. The encrypted image classification method according to claim 6, characterized in that The server side described in step D updates the parameters of the quantum homomorphic neural network and the Pauli key based on the received data, specifically including the following steps: The server encrypts the Pauli key based on the trained quantum homomorphic neural network model. Perform homomorphic updates; quantum homomorphic operations are expressed as: Where RY(θ k ) is the parameter θ k revolving door; θ k is the rotation angle; c k is the power exponent calculated based on the key; is the exclusive OR operation; CNOT is the controlled NOT gate; is the tensor product; Update the parameters of the quantum homomorphic neural network: the server side simulates the output variables of the module based on the homomorphic The quantum operations involved in the homomorphic update of the coefficients of the quantum neural network parameters: If the quantum gate RY(θ k ) acts on the i-th quantum bit, then calculate Enc pk (c i )for And calculate the encrypted power exponential vector Send to the client; the client uses the private key sk to decrypt Send back to the server; the server completes the parameter update of the quantum homomorphic neural network and obtains the quantum homomorphic simulated circuit Update of encrypted Pauli keys: The server sets up circuits based on quantum homomorphism The quantum homomorphic operations involved in updating the encrypted Pauli key If the quantum gate CNOT acts on the i-th control qubit and the j-th target qubit, then calculate: Where Enc pk (a i ′) is the key a i Updated encryption key; Enc pk (b i ′) is the key b i Updated encryption key; Finally, the updated encrypted Pauli key is obtained 8. The encrypted image classification method according to claim 7, characterized in that The server side in step E predicts the encrypted image and sends the prediction result to the client side, which specifically includes the following steps: The server inputs the ciphertext quantum state |ψ> into the current quantum homomorphic neural network model to obtain the ciphertext predicted quantum state |ψ′>, and sends the ciphertext predicted quantum state |ψ′> to the client.

9. The encrypted image classification method according to claim 8, characterized in that The client in step F decrypts the received Pauli key and prediction result, specifically including the following steps: The client uses the private key sk to encrypt the updated Pauli key Decrypt and get the Pauli key in plain text The decryption process is expressed as: a′ i =[[ <Enc pk (a′ i ),sk>] q ]2 Where a′ i Key a i Updated key; Enc pk (a′ i ) is the key a i Updated encryption key; <Enc pk (a′ i ),sk> is Enc pk (a′ i ) and the inner product of sk; [] q is an integer modulo q; []2 is an integer modulo 2; Using Pauli key in plain text Decrypt the ciphertext predicted quantum state |ψ′> to obtain the plaintext predicted quantum state |ψ″>; the decryption process is expressed as In the formula is the Z gate acting on the i-th quantum bit; is the X gate acting on the i-th quantum bit; Design a circuit for quantum homomorphism; is a continuous tensor product.

Citation Information

Patent Citations

  • Quantum image recognition method and device

    CN114792378A

  • Classification using quantum neural networks

    US20200342345A1