Data classification method, device, equipment and medium based on distributed quantum computing
By using distributed quantum computing and quantum -bit cutting technology in quantum computing, large -scale data sets are divided into multiple sets of sub -data and constructing two -layer quantum neural networks for parallel operations, solving the problem of insufficient quantum computing resources, realizing efficient efficiency And high -precision data classification.
Patent Information
- Application Number
- CN202411407320.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-10
AI Technical Summary
The insufficient number and stability of quantum bits in current quantum computers limits the effective execution of large-scale quantum neural network algorithms, resulting in low execution efficiency or low classification accuracy when processing large-scale data sets and complex models.
Put forward a data classification method based on distributed quantum computing. By dividing the data to be predicted into multiple sets of sub -data, and constructing two layers of quantum neural networks for parallel operations, using quantum bit cutting technology to optimize computing resources to improve computing efficiency and accurate accuracy sex.
Through data cutting and quantum bit cutting technology, the calculation burden of a single quantum line is reduced, the calculation efficiency and accuracy are improved, and the parallel processing capacity of quantum computing is made to achieve high -precision prediction of data classification.
Smart Images

Figure CN118917431B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of quantum computing technology, and in particular to a data classification method, apparatus, computing device, and computer-readable storage medium based on distributed quantum computing. Background Art
[0002] Data classification is a basic task in the field of machine learning and data mining, which aims to classify data samples into different categories. Common classification applications include spam detection, disease diagnosis, image classification, etc. Traditional methods for solving classification problems usually rely on classical algorithms, such as support vector machines (SVM), logistic regression, neural networks, etc. However, as the size and complexity of data increase, classical algorithms may encounter performance bottlenecks when dealing with high-dimensional and complex pattern recognition tasks.
[0003] Quantum algorithms provide a new way of computing by utilizing the principles of quantum mechanics, such as quantum superposition and quantum entanglement, and demonstrate the potential to far surpass classical algorithms in certain specific fields. The application of quantum algorithms in classification problems has shown significant advantages. For example, quantum neural networks (QNNs) accelerate the training process and improve classification accuracy by utilizing quantum computing resources. Variational quantum algorithms (VQA), such as variational quantum feature solvers (VQE) and quantum approximate optimization algorithms (QAOA), are also widely used in optimization and classification tasks. However, the number and stability of quantum bits of current quantum computers have not yet met the requirements for large-scale applications, which directly limits the effective execution of large-scale quantum neural network algorithms. This is mainly manifested in the lack of quantum computing resources, which leads to low execution efficiency or low classification accuracy of quantum algorithms when processing large-scale data sets and complex models. Summary of the invention
[0004] In view of the technical problems existing in the prior art, the present application proposes a method for data classification based on distributed quantum computing, comprising: dividing the data to be predicted into multiple groups of sub-data; constructing a first quantum neural network according to the result of the division, wherein the first quantum neural network includes multiple first computing nodes corresponding to the multiple groups of sub-data respectively, and each first computing node runs a first quantum circuit for classification; inputting the multiple groups of sub-data into the first quantum neural network, wherein each group of sub-data is assigned to the first quantum circuit in the corresponding first computing node for parallel operation, so as to obtain a first expected value of each first computing node in the Z basis; constructing a second quantum neural network according to the result output by the first quantum neural network, wherein the second quantum neural network includes multiple second computing nodes divided by quantum bit cutting, and each second computing node runs a second quantum circuit for classification; inputting multiple first expected values into the second quantum neural network, wherein each first expected value is assigned to the second quantum circuit in the corresponding second computing node for parallel operation, so as to obtain a second expected value of the second computing node in a specific basis; and determining the classification label of the data to be predicted according to the product result of the multiple second expected values.
[0005] The method as described above, inputting multiple groups of sub-data into the first quantum neural network, each group of sub-data is assigned to the first quantum circuit in the corresponding first computing node for parallel operation, so as to obtain the first expected value of each first computing node under the Z basis, including: applying the parameterization Ry (α i ) gate to perform encoding operation, the α i is the i-th unit data in the sub-data, each unit data in the sub-data is represented by 1 quantum bit; the encoded quantum bit executes one or more parameterized circuits, the parameterized circuit includes a parameterized Ry gate and a CNOT gate, and the CNOT gate acts between adjacent quantum bits; the parameterized Ry gate operation is performed on the last quantum bit, and then the expected value of the last quantum bit is measured as the first expected value.
[0006] According to the method described above, the second quantum circuit calculates the second expected value according to at least one first expected value and the density matrix of the cut quantum bits.
[0007] The method as described above, inputting a plurality of first expected values into the second quantum neural network, each first expected value being assigned to a second quantum circuit in a corresponding second computing node for parallel operation, so as to obtain a second expected value of the second computing node under a specific basis, comprises: applying Ry (E Zi ) gate to perform encoding operation, the E Ziis the i-th first expected value; the encoded quantum bit executes one or more parameterized circuits, wherein the parameterized circuits include parameterized Ry gates and CNOT gates, and the CNOT gates act between adjacent quantum bits; and the second expected values of the plurality of second quantum circuits are measured, wherein the second expected values are obtained based on the density matrix, observables or eigenvectors of the cut quantum bits.
[0008] According to the method described above, a plurality of first expected values are input into the second quantum neural network, and each first expected value is assigned to a second quantum circuit in a corresponding second computing node for parallel operation to obtain a second expected value of the second computing node under a specific basis, including: inputting at least one first expected value into a first type of subcircuit in the second quantum circuit to calculate a second expected value; inputting at least one first expected value into a second type of subcircuit in the second quantum circuit to calculate a second expected value; and deriving the second expected value of the second computing node under a specific basis based on the second expected value of the first type of subcircuit and the second expected value of the second type of subcircuit.
[0009] According to the method described above, at least one first expected value is input into the first type of subcircuit in the second quantum circuit to calculate the second expected value, including: performing quantum tomography on the cut quantum bits to obtain a density matrix of the cut quantum bits, wherein the density matrix is expressed by the following formula:
[0010] ;
[0011] Among them, ρ s represents the density matrix of the cut quantum bit s, c i represents the eigenvalue prepared by the ith measurement, represents the trace operation, O i represents the observable prepared by the i-th measurement, represents the eigenvector prepared by the i-th measurement;
[0012] The reduced density matrix of the first type of subcircuit is calculated according to the density matrix of the cut quantum bits, and the reduced density matrix is expressed by the following formula:
[0013] ;
[0014] Among them, ρ (1) represents the density matrix of the first type of subcircuit, c i represents the eigenvalue prepared by the ith measurement, represents the trace operation, O i represents the observable prepared by the i-th measurement, Represents a tensor product operation;
[0015] The second expected value of the first type of sub-line under its observable value is measured, and the second measured value is expressed by the following formula:
[0016] ;
[0017] in, is the second expected value of the first type of sub-line, represents the trace operation, ρ (1) represents the density matrix of the first type of subcircuits, represents the observable quantity of the first type of sub-circuit, represents the tensor product operation, O i represents the observable prepared by the i-th measurement.
[0018] According to the method described above, at least one first expected value is input into the second type of subcircuit in the second quantum circuit to calculate the second expected value, including: inputting the eigenvector of the cut quantum bit into the second type of subcircuit; measuring the second expected value of the second type of subcircuit under different eigenvectors respectively, and the second expected value is expressed by the following formula:
[0019] ;
[0020] in, is the second expected value of the second type of sub-line, represents the trace operation, represents the eigenvector prepared by the i-th measurement, represents the density matrix of the second type of sub-circuits, P s represents the observable quantity of quantum bit s, represents the observable quantity of the second type of sub-circuit, Represents a tensor product operation.
[0021] The method described above determines the classification label of the data to be predicted based on the product result of multiple second expected values, including: respectively calculating the two second expected values E of the last two quantum bits of the second type of sub-circuit Z-1 and the second expected value E Z-2 ; According to the second expected value E Z-1 and the second expected value E Z-2 The size of determines the classification label of the data to be predicted; the second expected value E is calculated using the following formula Z-1 and the second expected value E Z-2 :
[0022] ;
[0023] Among them, E Z-2 is the second expected value of the second-to-last qubit in the second type of subcircuit, E Z-1is the second expected value of the penultimate qubit, c i represents the eigenvalue prepared by the ith measurement, is the expected value prepared for the ith measurement in the first type of sub-circuit, Prepare the expectation value of the penultimate qubit for the ith measurement of the second-type subcircuit, Prepare the expectation value of the penultimate qubit for the i-th measurement of the second type of subcircuit.
[0024] According to another aspect of the present application, a data classification device based on distributed quantum computing is proposed, including: a data partitioning module, used to divide the data to be predicted into multiple groups of sub-data; a first quantum neural network building module, used to construct a first quantum neural network according to the result of the partition, the first quantum neural network includes multiple first computing nodes corresponding to the multiple groups of sub-data, each of which runs a first quantum circuit for classification; a first expected value calculation module, used to input multiple groups of sub-data into the first quantum neural network, each group of sub-data is assigned to the first quantum circuit in the corresponding first computing node for parallel operation, so as to obtain a first expected value of each first computing node under the Z basis; a second quantum neural network building module, used to construct a second quantum neural network according to the result output by the first quantum neural network, the second quantum neural network includes multiple second computing nodes divided by quantum bit cutting, each of which runs a second quantum circuit for classification; a second expected value calculation module, used to input multiple first expected values into the second quantum neural network, each first expected value is assigned to the second quantum circuit in the corresponding second computing node for parallel operation, so as to obtain a second expected value of the second computing node under a specific basis; a classification module, used to determine the classification label of the data to be predicted according to the product result of the multiple second expected values.
[0025] As described above, the first quantum circuit comprises: an encoding circuit for applying a rotating gate Ry (α i ), the α i is the i-th unit data in the sub-data, each unit data in the sub-data is represented by 1 quantum bit; the parameterized circuit includes one or more layers of quantum gates, each layer of quantum gates includes a parameterized Ry gate and a CNOT gate, and the CNOT gate acts between adjacent quantum bits; the parameterized Ry gate acts on the last quantum circuit; the measurement unit acts on the last quantum circuit and is used to measure the expected value of the last quantum bit as the first expected value.
[0026] As described above, the second quantum circuit includes: a first type of subcircuit and a second type of subcircuit, wherein the first type of subcircuit includes: an encoding circuit for applying Ry (E Zi) door, the E Zi is the i-th first expected value; a parameterized quantum circuit, comprising one or more layers of quantum gates, each layer of quantum gates comprising parameterized Ry gates and CNOT gates, the CNOT gates acting between adjacent quantum bits; a measurement unit, acting on the last quantum circuit, for measuring the expected values in the I basis, X basis, Y basis and Z basis respectively.
[0027] The quantum circuit described above, the second sub-circuit includes: a coding circuit, in which the eigenvector of the cut quantum bit is input into the first quantum circuit in the coding circuit, and the n-1 circuits in the coding circuit apply Ry (E Zi ) door, the E Zi is the expected value of the i-th first quantum circuit; the parameterized quantum circuit includes multiple layers of quantum gates, each layer of quantum gates includes parameterized Ry gates and CNOT gates, and the CNOT gates act between adjacent quantum bits; the parameterized Ry gates act on the last two quantum circuits respectively; the measurement unit acts on the last two quantum circuits respectively, and is used to measure the expected values of the last two quantum circuits in the Z basis respectively and ; Among them, using the expected value and expected value of the first type of line and Determine the classification label of the data to be predicted.
[0028] According to another aspect of the present application, a computing device is proposed, comprising: a processor; and a memory storing a computer program, wherein when the computer program is executed by the processor, the data classification method based on distributed quantum computing as described above is implemented.
[0029] According to another aspect of the present application, a computer-readable storage medium is provided, wherein computer instructions are stored in the computer-readable storage medium. When the computer instructions are executed by a processor, the data classification method based on distributed quantum computing as described above is implemented.
[0030] This application reduces the computational burden of a single quantum circuit by cutting data. Quantum bit cutting further optimizes the use of computing resources and improves computing efficiency and accuracy. In addition, multiple quantum circuits can perform calculations at the same time, making full use of the parallel processing capabilities of quantum computing and reflecting the advantages of distributed computing. Moreover, through the deep learning processing of the two-layer quantum neural network, high-precision prediction of data classification can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Below, the preferred embodiments of the present application will be further described in detail with reference to the accompanying drawings, wherein:
[0032] Figure 1The invention relates to a method for data classification based on distributed quantum computing according to an embodiment of the present application.
[0033] Figure 2 yes Figure 1 Flowchart of the method for calculating the first expected value in step S130.
[0034] Figure 3 yes Figure 1 Flowchart of the method for calculating the second expected value in step S150.
[0035] Figure 4 It is a flow chart of a method for calculating a second expected value for a first type of sub-circuit and a second type of sub-circuit according to an embodiment of the present application.
[0036] Figure 5 The invention relates to a quantum circuit for predicting data classification based on a hybrid cutting distributed quantum algorithm according to an embodiment of the present application.
[0037] Figure 6 This is a data cutting diagram according to an embodiment of the present application.
[0038] Figure 7 It is a schematic diagram of a quantum circuit structure for solving an image binary classification problem based on a hybrid fitting algorithm according to an embodiment of the present application.
[0039] Figure 8 This is a schematic diagram of the first quantum circuit structure according to an embodiment of the present application.
[0040] Fig. 9 This is a quantum circuit diagram of a second-layer quantum neural network according to an embodiment of the present application.
[0041] Fig.10 This is a schematic diagram of the quantum bit cutting process according to an embodiment of the present application.
[0042] Fig.11 This is a schematic diagram of a first type of sub-circuit structure according to an embodiment of the present application.
[0043] Fig.12 This is a schematic diagram of a second type of sub-circuit structure according to an embodiment of the present application.
[0044] Fig.13 It is a bar chart of classification accuracy and cutting times of various classification schemes according to an embodiment of the present application.
[0045] Fig.14 It is a line graph of the classification accuracy of the hybrid cutting algorithm according to an embodiment of the present application.
[0046] Fig.15 It is a histogram of training information of various classification schemes according to an embodiment of the present application.
[0047] Fig.16 It is a histogram of segmentation node information of multiple classification schemes according to an embodiment of the present application.
[0048] Fig.17 It is a structural principle block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0050] In the following detailed description, reference may be made to the various specification drawings that are part of the present application and are used to illustrate specific embodiments of the present application. In the accompanying drawings, similar reference numerals describe substantially similar components in different figures. The various specific embodiments of the present application are described below in sufficient detail so that a person of ordinary skill in the art with relevant knowledge and skills in the art can implement the technical solutions of the present application. It should be understood that other embodiments may also be used or structural, logical or electrical changes may be made to the embodiments of the present application.
[0051] The distributed quantum computing algorithm of this application is: an innovative computing model that combines distributed computing with quantum computing. Its goal is to work together to solve complex problems through multiple nodes with quantum processing capabilities and with the help of classical or quantum communication methods. Given the limited number of quantum bits in current quantum computers, this directly limits the scale of problems it can solve. In the noisy intermediate-scale quantum (NISQ) era, the use of distributed quantum computing can significantly improve the performance of quantum computers in dealing with practical problems, thereby effectively overcoming the limitations of existing NISQ computers due to insufficient quantum bits.
[0052] Data cutting in this application is a technique for cutting a large data set into multiple smaller parts for data processing, analysis and modeling. In big data processing and distributed computing environments, cutting a large data set into multiple small pieces and distributing them on different computing nodes for parallel processing can improve computing efficiency and processing power.
[0053] The quantum bit cutting of this application is: a technology for distributed quantum computing, which aims to decompose a large-scale quantum circuit into multiple small-scale sub-circuits so that it can be run on current medium-scale quantum computers. The bit cutting process can be briefly described as: first, all the quantum information of the cut bit is obtained through quantum tomography, and then the corresponding quantum state is prepared using this information as the input of the corresponding bit in the subsequent sub-circuit. Finally, the output results of these sub-circuits are combined by classical post-processing to obtain the same effect as directly running the original large-scale circuit.
[0054] Figure 1 The present invention relates to a hybrid cutting algorithm, which includes data cutting and quantum bit cutting. The method includes:
[0055] S110, dividing the data to be predicted into multiple groups of sub-data;
[0056] S120, constructing a first quantum neural network according to the division result, wherein the first quantum neural network includes a plurality of first computing nodes corresponding to the plurality of groups of sub-data, respectively, and a first quantum circuit for classification is run in each of the first computing nodes;
[0057] S130, inputting multiple groups of sub-data into the first quantum neural network, each group of sub-data is assigned to a first quantum circuit in a corresponding first computing node for parallel operation, so as to obtain a first expected value of each first computing node in a Z basis;
[0058] S140, constructing a second quantum neural network according to the result output by the first quantum neural network, wherein the second quantum neural network includes a plurality of second computing nodes divided by quantum bit cutting, and a second quantum circuit for classification is run in each second computing node;
[0059] S150, inputting a plurality of first expected values into the second quantum neural network, each first expected value being assigned to a second quantum circuit in a corresponding second computing node for parallel operation, so as to obtain a second expected value of the second computing node under a specific basis;
[0060] S160, determining a classification label of the data to be predicted according to a product result of the multiple second expected values.
[0061] This scheme uses two technologies, data cutting and bit cutting, when classifying the data to be predicted. Among them, multiple groups of sub-data after cutting are processed in parallel through multiple first quantum circuits of multiple computing nodes in the first layer of quantum neural network. The purpose of this is to reduce the amount of data that needs to be processed by a single quantum circuit and improve the overall computing efficiency. The data to be predicted is cut into multiple groups of sub-data. Then, each group of sub-data is input into a first quantum circuit for calculation, and each quantum circuit outputs a first expected value. These first expected values represent preliminary calculation results.
[0062] The quantum circuit in the second-layer quantum neural network is bit-cut into multiple second quantum circuits with multiple computing nodes, and the processing results of the first quantum circuit are processed in parallel. The second expected values of multiple second quantum circuits under specific bases are measured to classify the data to be predicted. Among them, the specific bases include I base, X base, Y base and Z base. Bit cutting can reduce the number of quantum bits in a large-scale quantum circuit by splitting it, thus solving the problem of large-scale quantum circuits.
[0063] This application reduces the computational burden of a single quantum circuit by cutting data. The cutting of quantum bits further optimizes the use of computing resources and improves computing efficiency and accuracy. In addition, multiple quantum circuits can perform calculations at the same time, making full use of the parallel processing capabilities of quantum computing and reflecting the advantages of distributed computing. Moreover, through the deep learning processing of the two-layer quantum neural network, high-precision prediction of data classification can be achieved.
[0064] Figure 2 yes Figure 1 The method flow chart of calculating the first expected value in step S130 is as follows: Figure 2 As shown, the method includes:
[0065] S131, apply parameterization Ry(α) to the initialized qubits i ) gate to perform encoding operation, the α i is the i-th unit data in the sub-data, and each unit data in the sub-data is represented by 1 quantum bit;
[0066] S132, executing one or more parameterized circuits on the encoded quantum bits, wherein the parameterized circuits include parameterized Ry gates and CNOT gates, and the CNOT gates act between adjacent quantum bits;
[0067] S133, performing a parameterized Ry gate operation on the last quantum bit, and then measuring the expected value of the last quantum bit as the first expected value.
[0068] The Ry gate is a rotation gate in quantum computing. By rotating the quantum bit, the classical data (sub-data) can be mapped to the quantum state, thereby realizing the initialization and data encoding of the quantum bit. By using the unit data of the sub-data as the parameter of the parameterized Ry gate, the rotation angle can be flexibly adjusted to adapt to different data distribution and computing requirements. The encoded quantum bit executes one or more parameterized circuits, which include parameterized Ry gates and CNOT gates. In practical applications, the number of times the parameterized circuit is executed can be flexibly adjusted to improve the flexibility and efficiency of the calculation. By measuring the last quantum bit, the output result of the entire quantum circuit can be obtained. Since the last quantum bit has been processed by multiple parameterized Ry gates and CNOT gates, the information it carries already contains the calculation results of the entire quantum circuit. By measuring its expected value, an accurate calculation result can be obtained, thereby achieving the completion of the quantum computing task.
[0069] According to an embodiment of the present application, when the second-layer quantum neural network is cut into multiple second quantum circuits, different cutting methods achieve different efficiencies. The time complexity of simulating any quantum-classical algorithm quantum circuit by distributed quantum algorithm is:
[0070] ;
[0071] Among them, K is the number of cuts, N is the number of "measurement-preparation" channels in a single cut, n is the total number of quantum bits, and m is the total number of quantum gates. For simulation accuracy.
[0072] The efficiency of distributed quantum circuits based on bit cutting is determined by the following three factors:
[0073] 1. Number of cuts K: The time complexity increases exponentially with the number of cuts K;
[0074] 2. Number of “measurement-preparation” channels N: The time complexity increases with the number of “measurement-preparation” channels N;
[0075] 3. The minimum value d of the maximum number of quantum bits in a node opt :The optimal cut should have the global minimum maximum number of node qubits d opt .Right now:
[0076] d opt =argmin(ds1,ds2,…ds k+1 ).
[0077] In order to maximize the efficiency of distributed quantum circuits, the number of cuts k and the number of “measurement-preparation” channels N should be as small as possible, and the maximum number of quantum bits at the node d optAs little as possible.
[0078] According to one embodiment of the present application, the second quantum circuit calculates the second expected value based on at least one first expected value and the density matrix of the cut quantum bit. The cut quantum bit is about to be split and multiple computing nodes share the information of the cut quantum bit, such as the density function information of the split quantum bit.
[0079] Figure 3 yes Figure 1 Flowchart of the method for calculating the second expected value in step S150. Figure 3 As shown,
[0080] Step S151, apply Ry (E Zi ) gate to perform encoding operation, the E Zi is the i-th first expected value;
[0081] Step S152, executing one or more parameterized circuits on the encoded quantum bits, wherein the parameterized circuits include parameterized Ry gates and CNOT gates, and the CNOT gates act between adjacent quantum bits;
[0082] Step S153, measuring second expected values of the plurality of second quantum circuits, where the second expected values are obtained based on the density matrix of the cut quantum bits, observables or eigenvectors of observables.
[0083] By encoding the qubit using the Ry gate, the first expected value can be effectively mapped into the quantum state of the qubit, thus providing initial data for subsequent calculations. By measuring the density matrix and observables of the qubit, the state information of the quantum system can be obtained, thereby evaluating the results of the quantum calculation. By measuring the eigenvectors of the observables, the properties and expected values of the quantum state can be further accurately determined, thereby obtaining high-precision calculation results.
[0084] According to one embodiment of the present application, a plurality of first expected values are input into the second quantum neural network, and each first expected value is assigned to a second quantum circuit in a corresponding second computing node for parallel operation to obtain a second expected value of the second computing node under a specific basis, including: inputting at least one first expected value into a first type of subcircuit in the second quantum circuit to calculate a second expected value; inputting at least one first expected value into a second type of subcircuit in the second quantum circuit to calculate a second expected value; and deriving the second expected value of the second computing node under a specific basis based on the second expected value of the first type of subcircuit and the second expected value of the second type of subcircuit.
[0085] The second quantum circuit includes a first type of subcircuit and a second type of subcircuit. The first type of subcircuit calculates the second expected value based on the objective measurement of the cut quantum bit, and the second type of subcircuit calculates the second expected value based on the eigenvector of the cut quantum bit. The second expected value of the first type of subcircuit and the second type of subcircuit is used together to restore the expected value of the original quantum circuit (the second layer of quantum neural network). It should be understood by those skilled in the art that any quantum circuit that can calculate the second expected value can be applied to the scheme of the present application, and the specific structure of the first type of subcircuit and the second type of subcircuit is not limited.
[0086] Figure 4 1 is a flow chart of a method for calculating the second expected value of a first type of sub-circuit and a second type of sub-circuit according to an embodiment of the present application. Figure 4 As shown, the method includes:
[0087] S410, performing quantum tomography on the cut quantum bits to obtain a density matrix of the cut quantum bits, wherein the density matrix is expressed by the following formula:
[0088] ;
[0089] Among them, ρ s represents the density matrix of the cut quantum bit s, c i represents the eigenvalue prepared by the ith measurement, represents the trace operation, O i represents the observable prepared by the i-th measurement, represents the eigenvector prepared by the i-th measurement;
[0090] S420, calculating a reduced density matrix of the first type of subcircuit according to the density matrix of the cut quantum bits, wherein the reduced density matrix is expressed by the following formula:
[0091] ;
[0092] Among them, ρ (1) represents the density matrix of the first type of subcircuit, c i represents the eigenvalue prepared by the ith measurement, represents the trace operation, O i represents the observable prepared by the i-th measurement, Represents a tensor product operation;
[0093] S430, measuring a second expected value of the first type of sub-line under its observable value, wherein the second measured value is expressed by the following formula:
[0094] ;
[0095] in, is the second expected value of the first type of sub-line, represents the trace operation, ρ (1) represents the density matrix of the first type of subcircuits, represents the observable quantity of the first type of sub-circuit, represents the tensor product operation, O i represents the observable prepared by the i-th measurement;
[0096] S440, inputting the eigenvector of the cut quantum bit into the second type of sub-circuit;
[0097] S450, measuring the second expected values of the second type of sub-lines under different eigenvectors respectively, wherein the second expected values are expressed by the following formula:
[0098] ;
[0099] in, is the second expected value of the second type of sub-line, represents the trace operation, represents the eigenvector prepared by the i-th measurement, represents the density matrix of the second type of sub-circuits, P s represents the observable quantity of quantum bit s, represents the observable quantity of the second type of sub-circuit, Represents a tensor product operation.
[0100] Quantum tomography is an important quantum information processing technology. By statistically analyzing the measurement data of a quantum system, the density matrix of the quantum state can be reconstructed to obtain the complete information of the system. By performing partial trace operations on the density matrix of the cut quantum bits, the quantum information of the subsystem can be extracted, providing a basis for further calculations. By measuring the expected value under different eigenvectors, more comprehensive quantum system information can be obtained, thereby more accurately describing and calculating the system. By measuring the expected value, the statistical average result of the quantum system under specific conditions can be obtained, which can be used to calculate the expected value of the original quantum circuit.
[0101] This application uses quantum tomography technology, quantum circuit operation and expected value measurement to achieve accurate description and classification prediction of quantum systems. According to the product results of multiple second expected values, the classification label of the data to be predicted is determined specifically including:
[0102] Calculate the two second expected values E of the last two qubits of the second type of subcircuit respectively Z-1 and the second expected value E Z-2 ;
[0103] According to the second expected value E Z-1 and the second expected value E Z-2The size of determines the classification label of the data to be predicted;
[0104] The second expected value E is calculated using the following formula: Z-1 and the second expected value E Z-2 :
[0105] ;
[0106] Among them, E Z-2 is the second expected value of the second-to-last qubit in the second type of subcircuit, E Z-1 is the second expected value of the penultimate qubit, c i represents the eigenvalue prepared by the ith measurement, is the expected value prepared for the ith measurement in the first type of sub-circuit, Prepare the expectation value of the penultimate qubit for the ith measurement of the second-type subcircuit, Prepare the expectation value of the penultimate qubit for the i-th measurement of the second type of subcircuit.
[0107] Figure 5 It is a quantum circuit for predicting data classification based on a hybrid cutting distributed quantum algorithm according to an embodiment of the present application. The quantum circuit 100 includes: a data partitioning module 101, which is used to divide the data to be predicted in the data set to be predicted into multiple groups of sub-data; a first quantum neural network building module 102, which is used to construct a first quantum neural network according to the result of the partition, and the first quantum neural network includes multiple first computing nodes corresponding to the multiple groups of sub-data, and each first computing node runs a first quantum circuit 1021 for classification; a first expected value calculation module 103, which is used to input multiple groups of sub-data into the first quantum neural network, and each group of sub-data is assigned to the first quantum circuit in the corresponding first computing node for parallel operation to obtain the first expected value of each first computing node under the Z basis; a second The quantum neural network building module 104 is used to construct a second quantum neural network according to the output of the first quantum neural network, wherein the second quantum neural network includes a plurality of second computing nodes divided by quantum bit cutting, and a second quantum circuit 1041 for classification is run in each second computing node; the second expected value calculation module 105 is used to input a plurality of first expected values into the second quantum neural network, and each first expected value is assigned to a second quantum circuit in a corresponding second computing node for parallel operation to obtain a second expected value of the second computing node under a specific basis; the classification module 106 is used to determine the classification label of the data to be predicted according to the product result of the plurality of second expected values.
[0108] The above describes the implementation method and advantages of the embodiments of the present application through multiple embodiments. This application describes in detail the specific processing process of the embodiments of the present application with specific examples. This application uses the MNIST handwritten digits 3 and 6 as the data set to be predicted. Each data sample in the data set is The two-dimensional array is presented in the form of a two-dimensional array, where the value range of the array elements is an integer between [0, 255]. In the setting of the label, [0. 1.] is used to represent the number 6, and the label [1. 0.] represents the number 3. The quantum circuit of this application is used to solve the image binary classification problem of the data to be predicted in the data set.
[0109] Figure 6 Schematic diagram of data cutting according to an embodiment of the present application. Figure 6 As shown, each data sample to be predicted is a The pixel value is represented by alpha_i, i from 1 to 25. In order to fully utilize the advantages of distributed quantum computing, the 25 pixels of the data sample are cut into 5 groups (as shown after data cutting), namely the 1st to 5th, 6th to 10th, 11th to 15th, 16th to 20th, and 21st to 25th pixels, and 5 computing nodes (first quantum circuit) are used to encode these 5 groups of pixels (sub-data) respectively.
[0110] Figure 7 Schematic diagram of a quantum circuit structure for solving the image binary classification problem based on a distributed quantum algorithm according to an embodiment of the present application. Figure 7 As shown, the quantum circuit includes a first layer of quantum neural network and a second layer of quantum neural network. The first layer of quantum neural network is used to process the processed data, and the second layer of quantum neural network is used to further process the processing results of the first layer of quantum neural network.
[0111] In the first layer of quantum neural network, 5 nodes (first quantum circuit) are used to encode 25 pixels. Each node consists of 5 quantum bits, and its circuit structure is as follows: Figure 8 Taking the first computing node as an example, the structures of other nodes can be derived similarly.
[0112] like Figure 8 As shown, the first quantum circuit includes:
[0113] Encoding circuit 801, used to apply the revolving gate Ry (α i ), the α i is the i-th unit data in the sub-data, and each unit data in the sub-data is represented by 1 quantum bit;
[0114] The parameterized circuit 802 includes one or more layers of quantum gates, each layer of quantum gates includes a parameterized Ry gate and a CNOT gate, and the CNOT gate acts between adjacent quantum bits;
[0115] Parameterized Ry gate 803, acting on the last quantum circuit;
[0116] The measuring unit 804 acts on the last quantum circuit and is used to measure the expected value of the last quantum bit.
[0117] Among them, angle encoding is selected as the encoding circuit, and the values of 5 groups of pixels are used as the angles of the Ry gate and passed into the encoding circuit. The training circuit is designed as a 3-layer hardware efficient simulation (HEA) circuit, in which the last layer of Ry gate is an Ry gate acting on the last quantum bit. Then, the expected value (first expected value) of the last bit of each node in the Z basis is calculated so as to be passed into the second layer of the neural network.
[0118] It is important to emphasize that the expected values of these five computing nodes can be obtained through parallel calculations on five quantum computers, and this process can be regarded as the process of distributed quantum algorithm computing. This method makes full use of the advantages of parallelism and distributed computing of quantum computing, and significantly improves computing efficiency.
[0119] The first expected value calculated by the first layer of quantum neural network is input into the second layer of quantum neural network. Fig. 9 : is a quantum circuit diagram of the second layer quantum neural network according to an embodiment of the present application. Fig. 9 As shown, the quantum circuit diagram of the second-layer quantum neural network is a 5-bit quantum circuit diagram. This design can effectively process quantum information while maintaining the simplicity and efficiency of the network structure. According to the above rules 1-3, to achieve the requirement of maximizing efficiency, the quantum circuit of the second-layer quantum neural network is cut into two 3-bit nodes. Both nodes are a group of nodes generated by a 5-bit node after uniform bit cutting. Among them, the 5 bits first pass through a layer of angle coding circuit composed of Ry gates. The parameters of the Ry gates are the expected values of the last bits of each of the 5 nodes in the first layer of the neural network under the Z basis. .Depend on Fig. 9 It can be seen that bit cutting occurs in bit The quantum circuits of the second-layer quantum neural network are divided into the first type of sub-circuits and the second type of sub-circuits.
[0120] Any 2D Hermite matrix can be represented as a linear combination of Pauli matrices. The density function of the cut quantum bits is It can be decomposed as follows:
[0121] (1)
[0122] Where ρ represents the density function, represents a trace operation, and I, X, Y, and Z represent the I-basis, X-basis, Y-basis, and Z-basis, respectively.
[0123] Among them, the Pauli matrix has the following spectral decomposition relationship:
[0124]
[0125] and
[0126]
[0127] The coefficients of the orthogonal basis can be obtained by measuring the expectation of the corresponding observable, that is, .
[0128] Complete observables required for quantum tomography , eigenvector and eigenvalues The corresponding relationship is:
[0129]
[0130] The establishment of bit cutting is based on the fact that the linear combination of the eight “measurement-preparation” channels in formula (1) can achieve the following identity mapping:
[0131]
[0132] Among them, c i represents the eigenvalue prepared by the ith measurement, represents the trace operation, ρ represents the density matrix, O i represents the observable prepared by the i-th measurement, represents the eigenvector prepared by the i-th measurement.
[0133] Therefore, inserting a complete set of "measurement-preparation" channels at any time or on any bit in the line will not affect the output of the line and is equivalent to the unit operator I acting on that bit.
[0134] The following will further introduce how to calculate the expected value based on bit cutting. This process can be simply divided into two steps: cutting and calculation.
[0135] Bit cutting of n-bit line: Fig.10 As shown, the line is cut into two sub-lines, represented by blue and gray. Fig.10 The bits cut in The two red triangles facing in different directions represent an observable and the eigenvector of the observable. In the original circuit, the first s-1 bits are taken as a whole and written as the subscript , the next ns bits are treated as another whole and written as subscript .
[0136] Calculation of expected value after bit cutting: Assume that the original line needs to be solved for Expected value ,in . Decompose an n-bit circuit into an s-bit sub-circuit (1) and another n-s+1-bit sub-circuit (2) by bit cutting. The corresponding expected value calculation process is as follows:
[0137] 1. Yes The bit is subjected to quantum tomography to obtain its density matrix
[0138] ;
[0139] Among them, ρ s represents the density matrix of the cut quantum bit s, c i represents the eigenvalue prepared by the ith measurement, represents the trace operation, O i represents the observable prepared by the i-th measurement, represents the eigenvector prepared by the i-th measurement.
[0140] 2. Calculate the reduced density matrix of subcircuit (1)
[0141] ;
[0142] Among them, ρ (1) represents the density matrix of subcircuit (1), c i represents the eigenvalue prepared by the ith measurement, represents the trace operation, O i represents the observable prepared by the i-th measurement, Represents a tensor product operation.
[0143] 3. Measurement sub-circuit (1) About Expected value
[0144] ;
[0145] in, is the second expected value of sub-circuit (1), represents the trace operation, ρ (1) represents the density matrix of the first type of subcircuits, represents the observable quantity of the first type of sub-circuit, represents the tensor product operation, O i represents the observable prepared by the i-th measurement.
[0146] 4. Measurement of sub-circuit (2) Expected value , the first bit input corresponds to the state Then measured. At this time, The expression is:
[0147] ;
[0148] in, is the second expected value of line (2), represents the trace operation, represents the eigenvector prepared by the i-th measurement, represents the density matrix of the second type of sub-circuits, P s represents the observable quantity of quantum bit s, P [(s+1)…n] represents the observable quantity of line (2), Represents a tensor product operation.
[0149] 5. Original route about The expected value of can be obtained by combining the expected value results of the two sub-circuits after bit cutting:
[0150] ;
[0151] in, is the expected value of the original line, c i represents the eigenvalue prepared by the ith measurement, is the second expected value of sub-circuit (1), is the second expected value of sub-line (2).
[0152] In summary, after bit cutting, the original line can be obtained Expected value .
[0153] Using the above method, the expected value of each split node can be calculated, and the expected value of the original quantum circuit can be obtained based on the expected values of multiple nodes.
[0154] The structure of the line (first type of sub-line) of the first node after cutting is as follows Fig.11 As shown, the first type of sub-circuit includes:
[0155] Encoding circuit 1101, used to apply Ry (E Zi ) door, the E Zi is the i-th first expected value;
[0156] The parameterized quantum circuit 1102 includes one or more layers of quantum gates, each layer of quantum gates includes a parameterized Ry gate and a CNOT gate, and the CNOT gate acts between adjacent quantum bits;
[0157] The measurement unit 1103 acts on the last quantum circuit and is used to measure the expected values in the I basis, X basis, Y basis and Z basis respectively.
[0158] The 4 expected values in the I basis, X basis, Y basis, and Z basis are pre-multiplied by the corresponding eigenvalues to obtain a set of 8 expected values:
[0159] , corresponding to 8 measurements in 8 “measurement-preparation” cycles.
[0160] The structure of the line of the second node after cutting (the second type of sub-line) is as follows Fig.12 As shown, the second type of sub-circuit includes:
[0161] Coding circuit 1201, inputs the eigenvector of the cut quantum bit into the first quantum circuit in the coding circuit, and the n-1 circuits in the coding circuit apply Ry (E Zi ) door, the E Zi is the expected value of the i-th first quantum circuit;
[0162] The parameterized quantum circuit 1202 includes multiple layers of quantum gates, each layer of quantum gates includes parameterized Ry gates and CNOT gates, and the CNOT gates act between adjacent quantum bits;
[0163] The parameterized Ry gate 1203 acts on the last two quantum circuits respectively;
[0164] The measurement unit 1204 acts on the last two quantum circuits respectively to measure the expectation values E of the last two quantum circuits in the Z basis respectively. Z-1 and E Z-2 ;
[0165] Among them, through Prepare 8 eigenstates of the first bit of the second node respectively This corresponds to 8 preparations in 8 “measurement-preparation”. And, in each eigenstate, calculate the expectation of the last two bits of the second node in the Z basis.
[0166] Finally, using E Z-1 and E Z-2 Determine the classification label of the data to be predicted. Z-1 and E Z-2 It can be calculated using the following formula:
[0167] ;
[0168] Among them, E Z-2 is the second expected value of the second-to-last qubit in the second type of subcircuit, E Z-1 is the second expected value of the penultimate qubit, c i represents the eigenvalue prepared by the ith measurement, is the expected value prepared for the ith measurement in the first type of sub-circuit, Prepare the expectation value of the penultimate qubit for the ith measurement of the second-type subcircuit, Prepare the expectation value of the penultimate qubit for the i-th measurement of the second type of subcircuit.
[0169] like > , which means the predicted classification label is [1, 0], otherwise it is [0, 1].
[0170] In the quantum circuit of data classification predicted by the hybrid cutting distributed quantum algorithm in this application, the parameters of the parameterized quantum gate (such as the Ry gate) need to be trained and optimized using training samples. Through the two-layer quantum neural network in the quantum circuit, the output label of each training sample can be obtained. Then, according to the difference between the actual label and the output label, the classical optimizer (such as Adam) is further used to optimize all the parameters in the quantum neural network and return a new set of parameters.
[0171] For the binary classification problem of images, this application proposes a distributed variational quantum computing method based on hybrid cutting. This method can not only effectively solve the above binary classification problem, but also meet the technical requirements of the NISQ era, and demonstrates its efficiency and practicality in dealing with complex problems.
[0172] By repeating the above classification method for each training sample, iterative training is continued until the parameters converge to the set threshold. This process ensures the stability and reliability of the model. Ultimately, a quantum neural network or parameterized quantum circuit with fixed parameters is obtained.
[0173] For a given training data set, necessary preprocessing is required, including two main steps:
[0174] (1) Randomly shuffling the data set: This step allows the model to better generalize samples that it has not encountered, thereby improving the effect of the optimization algorithm. By randomly shuffling the data set, it is ensured that the model will not be affected by the order of the data during training, thereby enhancing the robustness of the model.
[0175] (2) Data normalization: Divide the value of each pixel by 255 and convert it to a floating point number between [0, 1]. This step is to adjust the data to a uniform scale to facilitate better learning and processing by the model. Through normalization, the convergence speed of the model can be accelerated and the performance of the model can be improved.
[0176] In order to verify that the present application has made great progress in classification accuracy and training efficiency compared with other solutions, the hybrid segmentation quantum algorithm of the present application is compared with the classical algorithm technology solution, the original quantum algorithm technology solution and the bit cutting 999 technology solution in solving the image binary classification problem. The specific contents are as follows:
[0177] The classical algorithm is a traditional computing method that solves the image binary classification problem based on classical computers and classical computing theory.
[0178] The original quantum algorithm uses pure quantum computing methods to solve the image binary classification problem, using the properties of quantum mechanics (such as superposition and entanglement) to perform calculations.
[0179] The bit cutting 999 scheme is a solution to the binary classification problem of classified images based on quantum bit cutting technology. In this scheme, the 25-bit quantum circuit is cut into three 9-bit quantum circuits.
[0180] Fig.13 is a bar chart of classification accuracy and cutting times of various classification schemes according to an embodiment of the present application. Fig.13 It can be seen that the classification accuracy of the original quantum algorithm is 0%. This shows that in the experiment, the original quantum algorithm did not achieve effective classification results on this task. The classification accuracy of the bit cutting algorithm is 92.8%. This shows that the bit cutting algorithm has a higher accuracy on this task. The classification accuracy of the hybrid cutting algorithm is 95.5%. The hybrid cutting algorithm performs best in classification accuracy, significantly better than the bit cutting algorithm and the original quantum algorithm, showing its advantage in accuracy.
[0181] The number of cuts for the original quantum algorithm is 0. The original quantum algorithm did not perform any cuts on this task. The number of cuts for the bit-cut algorithm is 2. This indicates that the bit-cut algorithm needs to perform two cuts when processing the task. The number of cuts for the hybrid-cut algorithm is 1. The hybrid-cut algorithm only needs to perform one cut, showing that it is more efficient in this regard, probably due to combining the advantages of classical and quantum computing.
[0182] Fig.14 is a line graph of the classification accuracy of the hybrid cutting algorithm according to an embodiment of the present application. Fig.14It can be seen that with the increase in the number of training rounds, the classification accuracy of each training generally shows a stable or slightly improved trend. After the second training, the classification accuracy basically stabilized and remained above 94%. The hybrid cutting algorithm showed a high and stable classification accuracy after multiple rounds of training, especially in the fourth training, reaching a maximum value of 95.5%. This shows that the algorithm has good accuracy and stability when dealing with classification problems. The technical solution of this application can be specifically implemented through quantum computing software (such as PyQPanda and VQNet).
[0183] Fig.15 is a histogram of training information for various classification schemes according to an embodiment of the present application. Fig.15 It can be seen that the number of trainable parameters of the original algorithm, bit cutting algorithm and hybrid cutting algorithm are 100, 56 and 100 respectively; the number of training rounds of the original algorithm, bit cutting algorithm and hybrid cutting algorithm are 1, 2 and 2 respectively; the single round training time of the original algorithm, bit cutting algorithm and hybrid cutting algorithm is greater than 24 hours, 900 seconds and 153 seconds respectively; the total training time of the original algorithm, bit cutting algorithm and hybrid cutting algorithm is greater than 24 hours, 1800 seconds and 306 seconds respectively.
[0184] As can be seen from the above, the technical solution of the present application achieves efficient training. The single-round training time of the technical solution of the present application is only about 2 minutes and 30 seconds, and the entire training process can be completed after 2 rounds of training (total time is about 5 minutes). In contrast, if a traditional 25-qubit quantum neural network is used for training, a single round of training may take more than 24 hours, which significantly demonstrates the significant improvement in training efficiency of the present invention.
[0185] Fig.16 is a histogram of segmentation node information according to various classification schemes of an embodiment of the present application. Fig.16 It can be seen that the number of computing nodes of the original algorithm, bit-cut algorithm and hybrid cutting algorithm are 1, 3 and 7 respectively; the maximum number of quantum bits of the nodes of the original algorithm, bit-cut algorithm and hybrid cutting algorithm are 25, 9 and 5 respectively; the maximum number of quantum gates of the nodes of the original algorithm, bit-cut algorithm and hybrid cutting algorithm are 197, 55 and 33 respectively; the maximum quantum circuit depth of the nodes of the original algorithm, bit-cut algorithm and hybrid cutting algorithm are 33, 18 and 15 respectively.
[0186] As can be seen from the above, in the technical solution of the present application, a single computing node only needs to use 5 qubits at most, and the maximum quantum circuit depth of the node is only 15. In addition, only single-qubit gates and CNOT gates between adjacent qubits need to be executed in the quantum circuit, and there is no need to execute multi-qubit gates. These features greatly simplify the complexity of the experiment and make the solution easier to implement in physical experiments.
[0187] In another aspect, the present invention also provides a computing device, see Fig.17 , Fig.17 1 is a block diagram of the structural principle of a computing device according to an embodiment of the present invention. Fig.17 As shown, the computing device includes a processor 601 and a memory 602 storing computer program instructions; when the processor 601 executes the computer program instructions, the method for predicting data classification based on the hybrid cutting distributed quantum algorithm in the aforementioned embodiment is implemented.
[0188] Specifically, the processor 601 may include a central processing unit (CPU) or a graphics processing unit (GPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of an embodiment of the present invention. The memory 602 may include a memory for data or instructions. For example, the memory 602 may be at least one of the following: a hard disk drive (HDD), a read-only memory (ROM), a random access memory (RAM), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, a universal serial bus (USB) drive, or other physical / tangible memory storage device. For another example, the memory 602 includes a removable or non-removable (or fixed) medium. For another example, the memory 602 may be inside or outside the integrated gateway disaster recovery device. The memory 602 may be a non-volatile solid-state memory. In other words, typically the memory 602 includes a tangible (non-transitory) computer-readable storage medium (such as a memory device) encoded with executable instructions, wherein when the stored executable instructions are executed by the processor 601 (such as executed by one or more processors), the method of simulating the electronic structure of a material based on a quantum neural network in an embodiment of the present invention can be implemented.
[0189] In one example, Fig.17 The computing device shown may also include a communication interface 603 and a bus 610. The processor 601, the memory 602, and the communication interface 603 are connected and communicate with each other via the bus 610. The communication interface 603 is mainly used to implement communication between modules, devices, units, and / or devices in the electronic device.
[0190] The bus 610 includes hardware, software or both, and can couple the components of the online data traffic billing device to each other. For example, the bus may include at least one of the following: an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-side bus (FSB), a hypertransport (HT) interconnect, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnect, a low pin count (LPC) bus, a memory bus, a microchannel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable bus. The bus 610 may include one or more buses. Although the embodiments of the present invention describe or show a specific bus, the embodiments of the present invention may consider any suitable bus or interconnection method.
[0191] On the other hand, 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 aforementioned data classification method based on distributed quantum computing is implemented.
[0192] The flowchart and / or block diagram of the method and system of the embodiment of the present invention are described above by way of example, and various aspects of the related aspects are described. It should be understood that each box or combination thereof in the flowchart and / or block diagram can be implemented by computer program instructions, or by dedicated hardware that performs specified functions or actions, or by a combination of dedicated hardware and computer instructions. For example, these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to form a machine that enables these instructions executed by such a processor to enable the implementation of the functions / actions specified in each box or combination thereof in the flowchart and / or block diagram. Such a processor can be a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit.
[0193] The functional blocks shown in the structural block diagram of the embodiment of the present invention can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc.; when implemented in software, it is a program or code segment used to perform the required task. The program or code segment can be stored in a memory, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0194] The above embodiments are only used to illustrate the present application, and are not intended to limit the present application. Ordinary technicians in the relevant technical field may make various changes and modifications without departing from the scope of the present application. Therefore, all equivalent technical solutions should also fall within the scope disclosed in the present application.
Claims
1. A data classification method based on distributed quantum computing, characterized in that: include: Dividing the data to be predicted into multiple groups of sub-data; According to the result of the division, a first quantum neural network is constructed, wherein the first quantum neural network includes a plurality of first computing nodes corresponding to the plurality of groups of sub-data, respectively, and a first quantum circuit for classification is run in each of the first computing nodes; Inputting multiple groups of sub-data into the first quantum neural network, each group of sub-data is assigned to a first quantum circuit in a corresponding first computing node for parallel operation, so as to obtain a first expected value of each first computing node in a Z basis; According to the result output by the first quantum neural network, a second quantum neural network is constructed, wherein the second quantum neural network includes a plurality of second computing nodes divided by quantum bit cutting, and a second quantum circuit for classification is run in each second computing node; Inputting a plurality of first expected values into the second quantum neural network, each first expected value is assigned to a second quantum circuit in a corresponding second computing node for parallel operation to obtain a second expected value of the second computing node under a specific basis; Determining a classification label of the data to be predicted according to a product result of the multiple second expected values; Wherein, inputting a plurality of first expected values into the second quantum neural network comprises: Inputting at least one first expected value into a first type of subcircuit in a second quantum circuit to calculate a second expected value, wherein the cut quantum bits are subjected to quantum tomography to obtain a density matrix of the cut quantum bits, and a reduced density matrix of the first type of subcircuit is calculated based on the density matrix of the cut quantum bits, and a second expected value of the first type of subcircuit under its observable quantity is measured; Input at least one first expected value into a second type of subcircuit in a second quantum circuit to calculate a second expected value, wherein an eigenvector of a cut quantum bit is input into the second type of subcircuit, and second expected values of the second type of subcircuit under different eigenvectors are measured respectively; Based on the second expected value of the first type of sub-wire and the second expected value of the second type of sub-wire, a second expected value of the second computing node under the specific basis is derived.
2. The method according to claim 1, characterized in that Inputting multiple groups of sub-data into the first quantum neural network, each group of sub-data is assigned to a first quantum circuit in a corresponding first computing node for parallel operation, so as to obtain a first expected value of each first computing node in a Z basis, including: Apply the parameterization Ry(α) to the initialized qubits i ) gate to perform encoding operation, the α i is the i-th unit data in the sub-data, and each unit data in the sub-data is represented by 1 quantum bit; Execute one or more parameterized circuits on the encoded quantum bits, wherein the parameterized circuits include parameterized Ry gates and CNOT gates, wherein the CNOT gates act between adjacent quantum bits; A parameterized Ry gate operation is performed on the last qubit, and then the expected value of the last qubit is measured as the first expected value.
3. The method according to claim 1, characterized in that The second quantum circuit calculates a second expected value according to at least one first expected value and a density matrix of cut quantum bits.
4. The method according to claim 1, characterized in that: Inputting a plurality of first expected values into the second quantum neural network, each first expected value is assigned to a second quantum circuit in a corresponding second computing node for parallel operation to obtain a second expected value of the second computing node under a specific basis, including: Apply Ry(E to the initialized qubits Zi ) gate to perform encoding operation, the E Zi is the i-th first expected value; Execute one or more parameterized circuits on the encoded quantum bits, wherein the parameterized circuits include parameterized Ry gates and CNOT gates, wherein the CNOT gates act between adjacent quantum bits; The second expected values of the plurality of second quantum circuits are measured, where the second expected values are obtained based on the density matrix of the cut quantum bits, the observables or the eigenvectors of the observables.
5. The method according to claim 1, characterized in that The density matrix is expressed using the following formula: Among them, ρ s represents the density matrix of the cut quantum bit s, c i represents the eigenvalue prepared by the i-th measurement, Tr(·) represents the trace operation, O i represents the observable prepared by the i-th measurement, |ψ i ><ψ i | represents the eigenvector prepared by the i-th measurement; The reduced density matrix is expressed using the following formula: Among them, ρ (1) represents the density matrix of the first type of sub-circuit, c i represents the eigenvalue prepared by the i-th measurement, Tr(·) represents the trace operation, O i represents the observable prepared by the i-th measurement, Represents a tensor product operation; The second expected value is expressed by the following formula: in, is the second expected value of the first type of sub-circuit, Tr(·) represents the trace operation, ρ (1) represents the density matrix of the first type of sub-circuit, P [1...(s-1)] represents the observable quantity of the first type of sub-circuit, represents the tensor product operation, O i represents the observable prepared by the i-th measurement.
6. The method according to claim 1, characterized in that The second expected value is expressed by the following formula: in, is the second expected value of the second type of sub-circuit, Tr(·) represents the trace operation, |ψ i ><ψ i | represents the eigenvector prepared by the i-th measurement, ρ[(s+1)...n] represents the density matrix of the second type of sub-circuit, P s represents the observable quantity of quantum bit s, P [(s+1)...n] represents the observable quantity of the second type of sub-circuit, Represents a tensor product operation.
7. The method according to claim 1, characterized in that Determining the classification label of the data to be predicted according to the product result of the multiple second expected values includes: Calculate the two second expected values E of the last two qubits of the second type of subcircuit respectively Z-1 and the second expected value E Z-2 ; According to the second expected value E Z-1 and the second expected value E Z-2 The size of determines the classification label of the data to be predicted; The second expected value E is calculated using the following formula: Z-1 and the second expected value E Z-2 : Among them, E Z-2 is the second expected value of the second-to-last qubit in the second type of subcircuit, E Z-1 is the second expected value of the penultimate qubit, c i represents the eigenvalue prepared by the ith measurement, is the expected value prepared for the ith measurement in the first type of sub-circuit, Prepare the expectation value of the penultimate qubit for the ith measurement of the second-type subcircuit, Prepare the expectation value of the penultimate qubit for the i-th measurement of the second type of subcircuit.
8. A data classification device based on distributed quantum computing, characterized in that: include: A data partitioning module, used for partitioning the data to be predicted into multiple groups of sub-data; A first quantum neural network building module is used to build a first quantum neural network according to the division result, wherein the first quantum neural network includes a plurality of first computing nodes corresponding to the plurality of groups of sub-data, and a first quantum circuit for classification is run in each first computing node; A first expected value calculation module, used for inputting multiple groups of sub-data into the first quantum neural network, each group of sub-data is assigned to a first quantum circuit in a corresponding first computing node for parallel operation, so as to obtain a first expected value of each first computing node in a Z basis; A second quantum neural network building module is used to build a second quantum neural network according to the output of the first quantum neural network, wherein the second quantum neural network includes a plurality of second computing nodes divided by quantum bit cutting, and a second quantum circuit for classification is run in each second computing node; A second expected value calculation module, used for inputting a plurality of first expected values into the second quantum neural network, each first expected value is assigned to a second quantum circuit in a corresponding second computing node for parallel operation, so as to obtain a second expected value of the second computing node under a specific basis; A classification module, used for determining a classification label of the data to be predicted according to a product result of a plurality of second expected values; Wherein, the second expected value calculation module includes: A first calculation unit is used to input at least one first expected value into a first type of subcircuit in a second quantum circuit to calculate a second expected value, wherein the cut quantum bits are subjected to quantum tomography to obtain a density matrix of the cut quantum bits, a reduced density matrix of the first type of subcircuit is calculated according to the density matrix of the cut quantum bits, and a second expected value of the first type of subcircuit under its observable quantity is measured; A second calculation unit is used to input at least one first expected value into a second type of subcircuit in the second quantum circuit to calculate a second expected value, wherein the eigenvector of the cut quantum bit is input into the second type of subcircuit, and the second expected value of the second type of subcircuit under different eigenvectors is measured respectively; The expected value deriving unit is used to derive the second expected value of the second computing node under a specific basis based on the second expected value of the first type of sub-circuit and the second expected value of the second type of sub-circuit.
9. The device according to claim 8, characterized in that The first quantum circuit comprises: The encoding circuit is used to apply the revolving gate Ry(α i ), the α i is the i-th unit data in the sub-data, and each unit data in the sub-data is represented by 1 quantum bit; A parameterized circuit includes one or more layers of quantum gates, each layer of quantum gates includes a parameterized Ry gate and a CNOT gate, and the CNOT gate acts between adjacent quantum bits; Parameterized Ry gate, acting on the last quantum circuit; The measuring unit acts on the last quantum circuit and is used to measure the expected value of the last quantum bit as the first expected value.
10. The device according to claim 8, characterized in that The first type of sub-circuits include: Encoding circuit, used to apply Ry(E Zi ) door, the E Zi is the i-th first expected value; A parameterized quantum circuit includes one or more layers of quantum gates, each layer of quantum gates includes a parameterized Ry gate and a CNOT gate, and the CNOT gate acts between adjacent quantum bits; The measurement unit acts on the last quantum circuit and is used to measure the expected values in the I basis, X basis, Y basis and Z basis respectively.
11. The device according to claim 10, characterized in that The second type of sub-circuits include: The encoding circuit inputs the eigenvector of the cut quantum bit in the first quantum circuit in the encoding circuit, and the n-1 circuits in the encoding circuit apply Ry(E Zi ) door, the E Zi is the expected value of the i-th first quantum circuit; Parameterized quantum circuit, including multiple layers of quantum gates, each layer of quantum gates includes parameterized Ry gates and CNOT gates, and CNOT gates act between adjacent quantum bits; Parameterized Ry gates act on the last two quantum circuits respectively; The measurement unit acts on the last two quantum circuits respectively to measure the expectation values of the last two quantum circuits in the Z basis. and Among them, using the expected value and expected value of the first type of line and Determine the classification label of the data to be predicted.
12. A computing device, characterized in that: include: processor; A memory storing a computer program, which, when executed by a processor, implements the data classification method based on distributed quantum computing according to any one of claims 1 to 7.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by the processor, the data classification method based on distributed quantum computing described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Quantum image recognition method and device
CN114792378A
Quantum computing task processing method and device and quantum computer operating system
CN115511089A
Image classification method and system, electronic equipment and storage medium
CN117437494A