Quantum classical hybrid model training method and device, medium and electronic device
By adopting asynchronous parallel computing method in quantum classical hybrid models, multiple subsets of training data are asynchronously allocated and calculated, the problem of slow training speed in the existing technology is solved, and more efficient computing resource utilization and training speed improvement is achieved.
Patent Information
- Application Number
- CN202311549712.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-17
- Publication Date
- 2025-05-20
AI Technical Summary
In the existing quantum classical hybrid model training methods, calculations must be performed alternately between classical computing nodes and quantum computing nodes, and between classical computing nodes and classical computing nodes, resulting in slower training speed.
The asynchronous parallel method is used to calculate multiple subsets of data obtained by splitting the same set of training data. The specific steps include: assigning the calculation results to an idle classical or quantum computing node, updating the parameters of the computing node until the preset training times or accuracy is met.
Through asynchronous parallel computing, the overall model is blocked by the calculations of different computing nodes, the utilization level of computing resources is improved, and the training speed of quantum classical hybrid models is significantly accelerated.
Smart Images

Figure CN120020829A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of quantum computing, and particularly relates to a method, device, medium, and electronic device for training a quantum-classical hybrid model. Background Art
[0002] A quantum-classical hybrid model is a composite model that combines classical algorithms and quantum algorithms. The quantum-classical hybrid model usually consists of two parts: classical computing nodes and quantum computing nodes. Parameter optimization algorithms can be used to iteratively update the parameters of classical programs on classical computing nodes and the parameters of quantum programs on quantum computing nodes, so that the model gradually converges to the optimal state.
[0003] However, in existing methods for training quantum-classical hybrid models, for the same data subset obtained by splitting a set of training data, calculations must be alternately performed between classical computing nodes and quantum computing nodes, and between classical computing nodes and classical computing nodes, resulting in a slow training speed.
[0004] Application Content
[0005] The purpose of this application is to provide a method, device, medium, and electronic device for training a quantum-classical hybrid model, aiming to improve the training speed of the quantum-classical hybrid model.
[0006] An embodiment of this application provides a method for training a quantum-classical hybrid model, and the method includes:
[0007] When obtaining a first calculation result, allocate the first calculation result to an idle classical computing node to obtain a third calculation result and a fourth calculation result, where the first calculation result is obtained by the quantum computing node using a second calculation result, and the second calculation result is obtained by a classical computing node calculating a data subset obtained by splitting a set of training data;
[0008] When obtaining a fourth calculation result, allocate the fourth calculation result to the quantum computing node to obtain a fifth calculation result;
[0009] When obtaining a fifth calculation result, allocate the fifth calculation result to an idle classical computing node to obtain a sixth calculation result;
[0010] Update the parameters corresponding to the classical computing node and / or the parameters corresponding to the quantum computing node using the calculation results corresponding to a set of training data.
[0011] Optionally, the step of allocating the first calculation result to an idle classical computing node to obtain a third calculation result and a fourth calculation result includes:
[0012] Allocate the first calculation result to an idle classical computing node to obtain a third calculation result corresponding to the first calculation result;
[0013] When obtaining a third calculation result, allocate the third calculation result to an idle classical computing node to obtain a fourth calculation result corresponding to the third calculation result.
[0014] Optionally, the method further includes:
[0015] Obtain a second calculation result corresponding to a set of training data;
[0016] Allocate the obtained second calculation results to the quantum computing nodes in sequence to obtain a first calculation result.
[0017] Optionally, the quantum-classical hybrid model is a machine learning model;
[0018] After updating the parameters corresponding to the classical computing node and / or the parameters corresponding to the quantum computing node, the method further includes:
[0019] Determine whether the training of the quantum-classical hybrid model meets a preset number of training times or a preset calculation accuracy;
[0020] If not, obtain a new set of training data, and return to execute the step of obtaining all the second calculation results corresponding to a set of training quantities until a trained quantum-classical hybrid model is obtained.
[0021] Optionally, the quantum computing node includes a variational quantum circuit, and the parameters corresponding to the quantum computing node include the parameters in the variational quantum circuit;
[0022] Each classical computing node includes a first classical neural network module and a second classical neural network module;
[0023] The parameters corresponding to the classical computing node include the parameters in the first classical neural network module and the parameters in the second classical neural network module.
[0024] Optionally, the first calculation result is obtained by the quantum computing node performing forward calculation on the second calculation result using the variational quantum circuit;
[0025] The second calculation result is obtained by a classical computing node performing forward calculation on a data subset split from a set of training data using the first classical neural network module.
[0026] Optionally, the third calculation result is obtained by a classical calculation node performing forward calculation on the first calculation result using a second classical neural network module;
[0027] The fourth calculation result is obtained by a classical calculation node performing backward calculation on the third calculation result using a second classical neural network module;
[0028] The fifth calculation result is obtained by the quantum calculation node performing backward calculation on the fourth calculation result using the variational quantum circuit,
[0029] The sixth calculation result is obtained by a classical calculation node performing backward calculation on the fifth calculation result using the first classical neural network module.
[0030] Another embodiment of the present application provides a quantum-classical hybrid model training device, and the device includes:
[0031] A first acquisition module, configured to, when obtaining a first calculation result, allocate the first calculation result to an idle classical calculation node, and obtain a third calculation result and a fourth calculation result, where the first calculation result is obtained by the quantum calculation node using a second calculation result, and the second calculation result is obtained by a classical calculation node calculating a data subset obtained by splitting a set of training data;
[0032] A second acquisition module, configured to, when obtaining a fourth calculation result, allocate the fourth calculation result to the quantum calculation node to obtain a fifth calculation result;
[0033] A third acquisition module, configured to, when obtaining a fifth calculation result, allocate the fifth calculation result to an idle classical calculation node to obtain a sixth calculation result;
[0034] An update module, configured to update corresponding parameters in the classical calculation node and / or the quantum calculation node by using calculation results corresponding to a set of training data.
[0035] Another embodiment of the present application provides a storage medium, in which a computer program is stored, and the computer program is configured to execute the method described in any one of the above when running.
[0036] Another embodiment of the present application provides an electronic device, including a memory and a processor, a computer program is stored in the memory, and the processor is configured to run the computer program to execute the method described in any one of the above.
[0037] The present application provides a method for training a quantum-classical hybrid model. The classical computing nodes and the quantum computing nodes calculate multiple data subsets obtained by splitting the same set of training data in an asynchronous parallel manner. For any data subset, when the calculation result corresponding to the previous computing node is obtained, it can be allocated to the next computing node without waiting for the previous computing node to complete the calculation of the remaining data subsets, avoiding the blocking of the overall model by the calculations of different nodes in the hybrid model and improving the utilization level of the computing resources of quantum and classical devices. Compared with the existing methods for training quantum-classical hybrid models, the method for training a quantum-classical hybrid model provided in the embodiments of the present application greatly improves the training speed of the quantum-classical hybrid model. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a hardware structure block diagram of a computer terminal for a method for training a quantum-classical hybrid model provided in an embodiment of the present application;
[0039] Figure 2 is a schematic flowchart of a method for training a quantum-classical hybrid model provided in an embodiment of the present application;
[0040] Figure 3 is an exemplary schematic diagram of an operation process of a quantum-classical hybrid machine learning model provided in an embodiment of the present application;
[0041] Figure 4 is a schematic flowchart of another method for training a quantum-classical hybrid model provided in an embodiment of the present application;
[0042] Figure 5 is a schematic flowchart of a method for training a quantum-classical hybrid machine learning model provided in an embodiment of the present application;
[0043] Figure 6 is a schematic structural diagram of a device for training a quantum-classical hybrid model provided in an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application and should not be construed as limiting the present application.
[0045] Figure 1 is a network block diagram of a quantum-classical hybrid model training system provided in an embodiment of the present application. The quantum-classical hybrid model training system may include a network 110, a server 120, a wireless device 130, a client 140, a storage 150, a classical computing unit 160, a quantum computing unit 170, and may also include additional memories, classical processors, quantum processors, and other devices not shown.
[0046] The network 110 is a medium for providing communication links between various devices and computers connected together within the quantum-classical hybrid model training system, including but not limited to the Internet, intranet, local area network, mobile communication network, and their combinations. The connection method can use wired, wireless communication links, fiber optic cables, etc.
[0047] The server 120, wireless device 130, and client 140 are conventional data processing systems, which may contain data and have application programs or software tools for performing conventional computing processes. The client 140 can be a personal computer or a network computer, so the data can also be provided by the server 120. The wireless device 130 can be a smart phone, tablet, laptop, smart wearable device, etc. The storage unit 150 may include a database 151, which can be configured to store data such as qubit parameters, quantum logic gate parameters, quantum circuits, quantum programs, etc.
[0048] The classical computing unit 160 (quantum computing unit 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 162 (memory 172) for storing classical data (quantum data). The classical data (quantum data) can be a boot file, an operating system image, and an application program 163 (application program 173). The application program 163 (application program 173) can be used to implement a quantum algorithm compiled according to the quantum-classical hybrid model training method provided by the embodiments of the present application.
[0049] Any data or information stored or generated in the classical computing unit 160 (quantum computing unit 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner. Similarly, any application program executed by it can also be configured to be executed in another classical (quantum) processing system in a similar manner.
[0050] It should be noted that a real quantum computer has a hybrid structure, which at least includes Figure 1 two major parts: the classical computing unit 160, which is responsible for performing classical computing and control; and the quantum computing unit 170, which is responsible for running quantum programs to implement quantum computing.
[0051] The above-mentioned classical computing unit 160 and quantum computing unit 170 can be integrated into one device or distributed among two different devices. For example, the first device including the classical computing unit 160 runs a classical computer operating system, on which quantum application development tools and services are provided, as well as the storage and network services required for quantum applications. Users develop quantum programs through the quantum application development tools and services thereon, and distribute the quantum programs to the second device including the quantum computing unit 170 through the network services thereon. The second device runs a quantum computer operating system, and parses and compiles the code of the quantum program into instructions that can be recognized and executed by the quantum processor 170 through the quantum computer operating system. The quantum processor 170 implements the quantum algorithm corresponding to the quantum program according to the instructions.
[0052] The computing unit of the classical processor 161 in the classical computing unit 160 is based on CMOS transistors on a silicon chip. This computing unit is not restricted by time and coherence, that is, this computing unit is not restricted by the usage duration and is available at any time. In addition, in a silicon chip, the number of such computing units is also sufficient. Currently, the number of computing units in a classical processor 161 is in the thousands. The sufficient number of computing units and the fixed computing logic that can be selected by CMOS transistors, for example: AND logic. When operating with CMOS transistors, a large number of CMOS transistors are combined with limited logic functions to achieve the operation effect.
[0053] The basic computing unit of the quantum processor 171 in the quantum computing unit 170 is a qubit. The input of a qubit is restricted by coherence and also by the coherence time, that is, a qubit is restricted by the usage duration and is not available at any time. Making full use of qubits within their available usage duration is a key problem in quantum computing. In addition, the number of qubits in a quantum computer is one of the representative indicators of the performance of a quantum computer. Each qubit realizes the computing function through the logic function configured on demand. Given the limited number of qubits, and the logic functions in the field of quantum computing are diverse, such as: Hadamard gate (H gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), X gate, RY gate, RZ gate, CNOT gate, CR gate, iSWAP gate, Toffoli gate, etc. When performing quantum computing, it is necessary to combine a limited number of qubits with diverse logic function combinations to achieve the operation effect.
[0054] Based on these differences, the design of classical logic functions acting on CMOS transistors and the design of quantum logic functions acting on qubits are significantly and essentially different; when designing classical logic functions acting on CMOS transistors, the individuality of CMOS transistors does not need to be considered, such as the individual identification of the CMOS transistor in the silicon chip, its position, and the available duration of each CMOS transistor. Therefore, the classical algorithms composed of classical logic functions only express the arithmetic relationships of the algorithms and do not express the dependence of the algorithms on individual CMOS transistors.
[0055] However, when designing quantum logic functions acting on qubits, the individuality of qubits needs to be considered, such as the individual identification of the qubit in the quantum chip, its position, the relationship with surrounding qubits, and the available duration of each qubit. Therefore, the quantum algorithms composed of quantum logic functions not only express the arithmetic relationships of the algorithms but also express the dependence of the algorithms on individual qubits.
[0056] Exemplarily:
[0057] Quantum algorithm one: H1, H2, CNOT(1, 3)H3, CNOT(2, 3);
[0058] Quantum algorithm two: H1, H2, CNOT(1, 2), H3, CNOT(2, 3);
[0059] Among them, 1 / 2 / 3 respectively represent three sequentially connected qubits Q1, Q2, Q3 or interconnected qubits Q1, Q2, Q3;
[0060] An exemplary explanation of how quantum algorithms are affected by the coherence time of qubits is as follows:
[0061] Define the execution duration of a single-qubit logic gate as t, and the execution time of one two-qubit logic gate acting on adjacent qubits as 2t; then:
[0062] When Q1, Q2, and Q3 are interconnected with each other, the calculation of quantum algorithm one requires 6t and is carried out in 4 time periods. The required duration of each time period is t, 2t, t, 2t respectively. The operations performed within each time period are: H1, H2; CNOT(1, 3); H3; CNOT(2, 3);
[0063] The calculation of quantum algorithm one requires 5t and is carried out in 3 time periods. The required duration of each time period is t, 2t, 2t respectively. The operations performed within each time period are: H1, H2, H3; CNOT(1, 2); CNOT(2, 3);
[0064] When Q1, Q2, and Q3 are connected in sequence, Quantum Algorithm 1 needs to be equivalent to: H1, H2; swap(1, 2), CNOT(2, 3), swap(1, 2); H3; CNOT(2, 3). The calculation of the equivalent Quantum Algorithm 1 takes 10t and is divided into 4 time periods, and the duration required for each time period is t, 6t, t, and 2t respectively. The operations performed within each time period are: H1, H2; swap(1, 2), CNOT(2, 3), swap(1, 2); H3; CNOT(2, 3).
[0065] Therefore, the design of the quantum logic function acting on qubits (including the design of whether to use qubits and the design of the usage efficiency of each qubit) is the key to improving the computing performance of quantum computers and requires special design. This is also the uniqueness of quantum algorithms based on quantum logic functions, which is essentially and significantly different from classical algorithms based on classical logic functions.
[0066] The quantum-classical hybrid model is a hybrid model that combines quantum algorithms and classical algorithms. This model can utilize the advantages of quantum computing to handle complex computing tasks. It uses the capabilities of quantum computing to accelerate the training and inference processes. Training the quantum-classical hybrid model is an essential link in the model development and application process. Through training, the model can learn patterns from the data, improve prediction accuracy, optimize model parameters, and enhance generalization ability.
[0067] Applying distributed computing to the training of the quantum-classical hybrid model can effectively accelerate the training process and improve the performance of the model. During the training process, the data is distributed to multiple classical computing nodes and quantum computing nodes, and these nodes are run in parallel for training. Through distributed computing, large-scale data sets can be processed simultaneously to achieve the hybrid optimization of the model, while optimizing both the classical and quantum parts. Thus, the training process is accelerated. However, in the current distributed quantum-classical hybrid model training methods, for the same set of training data, the classical computing nodes and quantum computing nodes, as well as between classical computing nodes, must alternate in computing, resulting in a slow training speed. Based on this, this application proposes a quantum-classical hybrid model training method, device, medium, and electronic device, aiming to improve the training speed of the quantum-classical hybrid model.
[0068] See Figure 2 , Figure 2 which is a schematic flowchart of a quantum-classical hybrid model training method provided by an embodiment of this application, and may include the following steps:
[0069] S201, when obtaining a first calculation result, allocate the first calculation result to an idle classical computing node, and obtain a third calculation result and a fourth calculation result. Herein, the first calculation result is obtained by the quantum computing node using a second calculation result, and the second calculation result is obtained by a classical computing node calculating a data subset split from a set of training data.
[0070] A computing node is a server or computer in a computing cluster used to execute computing tasks. A computing node includes components such as a microprocessor, memory, and an Ethernet controller, and is used to run a specific operating system and software so that multiple computing nodes can work together to complete large-scale computing tasks.
[0071] A classical computing node is the basic unit for executing computing tasks in a classical computer. It is usually composed of a central processing unit (CPU), memory, and other related hardware, and is used to execute program instructions and store data. Classical computing nodes use binary bits (bits) to represent and process data and perform algorithm operations using classical computing methods.
[0072] A quantum computing node is the basic unit for executing computing tasks in a quantum computer. Different from classical computers, quantum computing nodes use qubits to represent and process data. Qubits can simultaneously be in a superposition of multiple states and perform parallel computing, thus having a higher computing ability than classical computers in certain specific problems.
[0073] Training data is the input data used to train a model. These data can be raw data, experimental data, observational data, or preprocessed data, depending on the specific problem and model type.
[0074] In the embodiments of the present application, multiple data subsets split from a set of training data are allocated to multiple classical computing nodes and quantum computing nodes for asynchronous parallel computing, and larger-scale data sets can be processed simultaneously. Each classical computing node and quantum computing node can perform calculations independently, effectively utilizing the computing resources on multiple nodes, thereby accelerating the entire training process, achieving a high degree of parallelism that cannot be achieved by traditional serial computing methods, and greatly improving the training speed of the quantum-classical hybrid model.
[0075] S202, when obtaining a fourth calculation result, allocate the fourth calculation result to the quantum computing node to obtain a fifth calculation result.
[0076] In the embodiments of the present application, expressions similar to "when obtaining an A calculation result, allocate the A calculation result to a B computing node to obtain a C calculation result" have the following meanings:
[0077] Send or transfer the calculation results of A to the B computing node so that the B computing node can access and use these data. The allocation process is completed through network communication, data transfer protocols, or direct shared storage, etc. After receiving the calculation results of A, the B computing node will perform corresponding calculations or processing on the calculation results of A using classical or quantum programs on the B computing node and obtain the C calculation results.
[0078] S203, when obtaining a fifth calculation result, allocate the fifth calculation result to an idle classical computing node to obtain a sixth calculation result;
[0079] S204, use the calculation results corresponding to a set of training data to update the parameters corresponding to the classical computing node and / or the parameters corresponding to the quantum computing node.
[0080] The method for updating the parameters corresponding to the classical computing node and / or the parameters corresponding to the quantum computing node can be: by calculating the gap between the expected output and the actual operation result of the classical neural network module and the variational quantum circuit during each operation, obtain the loss function of the model, such as mean square error or cross entropy, etc., and through the operation of the derivative chain rule, calculate the gradient of each parameter in the classical neural network module and / or the variational quantum circuit with respect to the overall model, as well as the gradient of each data subset with respect to the overall model. Finally, use the gradient descent algorithm to update the parameters, for example, use the Adam algorithm, Adagrad algorithm, etc. for updating.
[0081] The Adam (Adaptive Moment Estimation) algorithm is an extended form of the stochastic gradient descent algorithm, and designs independent adaptive learning rates for different parameters by calculating the first-order moment estimation and second-order moment estimation of the gradient.
[0082] The Adagrad (Adaptive Gradient) algorithm is a gradient descent method with an adaptive learning rate. For each parameter, the Adagrad algorithm initializes a variable to 0, and then, when updating the parameter each time, it will accumulate the square of the gradient of this parameter to this variable. Then, divide the global learning rate by the square root of the sum of the accumulated gradient squares as the learning rate of this parameter.
[0083] For example, the following formula can be used to calculate the gradient of the parameter W in a certain node with respect to the overall model Loss The gradient of the data subset X with respect to the overall model Loss
[0084]
[0085]
[0086] Where y represents the calculation result corresponding to the data subset X at this node.
[0087] In an embodiment of the present application, the step of allocating the first calculation result to an idle classical computing node to obtain a third calculation result and a fourth calculation result includes:
[0088] Allocating the first calculation result to an idle classical computing node to obtain a third calculation result corresponding to the first calculation result;
[0089] When obtaining a third calculation result, allocating the third calculation result to an idle classical computing node to obtain a fourth calculation result corresponding to the third calculation result.
[0090] In an embodiment of the present application, the method further includes:
[0091] Obtaining a second calculation result corresponding to a set of training data;
[0092] Sequentially allocating the obtained second calculation results to the quantum computing node to obtain a first calculation result.
[0093] Sequentially allocating the obtained second calculation results to the quantum computing node to obtain a first calculation result means: allocating the second calculation results corresponding to each data subset obtained by splitting a set of data to the quantum computing node in a preset order, and using the quantum computing node to calculate the second calculation results corresponding to each data subset in the preset order to obtain the first calculation results corresponding to each data subset. The preset order depends on actual needs, and the present application does not limit this.
[0094] In an embodiment of the present application, the second calculation result corresponding to the set of training data includes the calculation results corresponding to all data subsets.
[0095] In an embodiment of the present application, when obtaining a second calculation result, allocating the second calculation result to the quantum computing node to obtain a first calculation result corresponding to the second calculation result.
[0096] Taking 4 data subsets (subset 1 to subset 4) obtained by splitting a set of data as an example, the processing process of a set of training data of the quantum-classical hybrid model is further described below, where the quantum-classical hybrid model includes 4 classical computing nodes (classical node 1 to classical node 4) and 1 quantum computing node (quantum node).
[0097] For ease of explanation, in the present application, the order of calculations of each computing node in the quantum-classical hybrid model is represented by "time steps". The calculation steps corresponding to time step 1 are before those corresponding to time step 2, and the calculation steps corresponding to time step 2 are before those corresponding to time step 3, and so on.
[0098] It should be particularly noted that in the following description of the embodiments, for ease of explanation, each data subset and its corresponding calculation result will only be assigned to a corresponding classical computing node. However, in actual applications, the relationship between the data subsets, their corresponding calculation results, and the classical computing nodes may not be a one-to-one correspondence, as shown in the following table:
[0099] Time step Subset 1 Subset 2 Subset 3 Subset 4 Time step 1 Classical node 1 Classical node 2 Classical node 3 Classical node 4 Time step 2 Quantum node Time step 3 Classical node 1 Quantum node Time step 4 Classical node 1 Classical node 2 Quantum node Time step 5 Classical node 2 Classical node 3 Quantum node Time step 6 Quantum node Classical node 3 Classical node 4 Time step 7 Classical node 1 Quantum node Classical node 4 Time step 8 Classical node 2 Quantum node Time step 9 Classical node 3 Quantum node Time step 10 Classical node 4
[0100] Time step 1: Assign subsets 1 to 4 to classical nodes 1 to 4, respectively, to obtain the second calculation results corresponding to subsets 1 to 4;
[0101] Time step 2: Assign the second calculation result corresponding to subset 1 to the quantum node to obtain the first calculation result corresponding to subset 1;
[0102] Time step 3: Assign the first calculation result corresponding to subset 1 to classical node 1 to obtain the third calculation result corresponding to subset 1; assign the second calculation result corresponding to subset 2 to the quantum node to obtain the first calculation result corresponding to subset 2;
[0103] Time step 4: Assign the third calculation result corresponding to subset 1 to classical node 1 to obtain the fourth calculation result corresponding to subset 1; assign the first calculation result corresponding to subset 2 to classical node 2 to obtain the third calculation result corresponding to subset 2; assign the second calculation result corresponding to subset 3 to the quantum node to obtain the first calculation result corresponding to subset 3;
[0104] Time step 5: Assign the third calculation result corresponding to subset 2 to classical node 2 to obtain the fourth calculation result corresponding to subset 2; assign the first calculation result corresponding to subset 3 to classical node 3 to obtain the third calculation result corresponding to subset 3; assign the second calculation result corresponding to subset 4 to the quantum node to obtain the first calculation result corresponding to subset 4;
[0105] Time step 6: Assign the third calculation result corresponding to subset 3 to classical node 3 to obtain the fourth calculation result corresponding to subset 3; assign the first calculation result corresponding to subset 4 to classical node 4 to obtain the third calculation result corresponding to subset 4; assign the fourth calculation result corresponding to subset 1 to the quantum node to obtain the fifth calculation result corresponding to subset 1;
[0106] Time step 7: Assign the fifth calculation result corresponding to subset 1 to classical node 1 to obtain the sixth calculation result corresponding to subset 1; assign the third calculation result corresponding to subset 4 to classical node 4 to obtain the fourth calculation result corresponding to subset 4; assign the fourth calculation result corresponding to subset 2 to the quantum node to obtain the fifth calculation result corresponding to subset 2.
[0107] Time step 8: Assign the fifth calculation result corresponding to subset 2 to classical node 2 to obtain the sixth calculation result corresponding to subset 2; assign the fourth calculation result corresponding to subset 3 to the quantum node to obtain the fifth calculation result corresponding to subset 3.
[0108] Time step 9: Assign the fifth calculation result corresponding to subset 3 to classical node 3 to obtain the sixth calculation result corresponding to subset 3; assign the fourth calculation result corresponding to subset 4 to the quantum node to obtain the fifth calculation result corresponding to subset 4.
[0109] Time step 10: Assign the fifth calculation result corresponding to subset 4 to classical node 4 to obtain the sixth calculation result corresponding to subset 4.
[0110] So far, the processing of a set of training data for the quantum-classical hybrid model is completed.
[0111] In an embodiment of the present application, the quantum-classical hybrid model is a machine learning model.
[0112] After updating the parameters corresponding to the classical computing node and / or the parameters corresponding to the quantum computing node, the method further includes:
[0113] Determine whether the training of the quantum-classical hybrid model meets a preset number of training times or a preset calculation accuracy.
[0114] If not, obtain a new set of training data, and return to execute the step of obtaining all the second calculation results corresponding to a set of training quantities until a trained quantum-classical hybrid model is obtained.
[0115] In an embodiment of the present application, the quantum computing node includes a variational quantum circuit, and the parameters corresponding to the quantum computing node include the parameters in the variational quantum circuit.
[0116] Each classical computing node includes a first classical neural network module and a second classical neural network module.
[0117] The parameters corresponding to the classical computing node include the parameters in the first classical neural network module and the parameters in the second classical neural network module.
[0118] A quantum-classical hybrid machine learning model is a machine learning model that includes a classical neural network module and a variational quantum circuit. The classical neural network module runs on a classical computing node, and the variational quantum circuit runs on a quantum computing node. The core idea of the quantum-classical hybrid machine learning model is to utilize the special properties of quantum computing, such as quantum superposition states and quantum parallel computing, to improve the efficiency and accuracy of machine learning, and to use the advantages of quantum computing to solve some problems with high computational complexity, thereby improving the performance of the machine learning model.
[0119] The classical neural network module is an artificial neural network model that mimics biological neural networks. Based on classical physical principles, it uses classical bits for data storage and processing, uses classical logic gate circuits for step-by-step calculations, and realizes various computational tasks through logical operations and algorithm designs. It simulates the way of connection and information transmission between neurons in the human brain. The classical neural network model consists of multiple neurons. Each neuron interacts with other neurons through connection weights and converts the input signal into an output signal through an activation function. In the classical neural network module, there are some parameters that need to be learned and optimized. These parameters determine the structure and function of the classical neural network module. By training, the values of the parameters can be adjusted, thereby changing the response of the classical neural network module to the input data and the output results.
[0120] A variational quantum circuit refers to a quantum circuit composed of parameterized quantum logic gates. When solving a problem, the variational quantum circuit represents the solution space of the problem, and the variables of the problem are represented by the parameters of the quantum logic gates. By adjusting the parameters of these quantum logic gates, a highly adjustable quantum circuit is constructed, enabling the circuit to perform different transformations on the input data, thereby being able to handle various different problems. Moreover, different from traditional quantum circuits, the variational quantum circuit uses a variational optimization algorithm to find the optimal parameters that can minimize the loss of the problem, thereby obtaining an approximate solution to the problem, greatly improving the computational efficiency.
[0121] By inputting multiple data subsets obtained by splitting a set of training data into the quantum-classical hybrid machine learning model and running the quantum-classical hybrid machine learning model, after each run, update the parameters of the classical neural network module and the parameters of the variational quantum circuit based on the running results of the model. After multiple iterative updates, the optimal parameters of the classical neural network module and the variational quantum circuit can be obtained, enabling the quantum-classical hybrid machine learning model to achieve the best performance and prediction ability, thereby completing the training of the quantum-classical hybrid machine learning model.
[0122] In an embodiment of the present application, the first calculation result is obtained by the quantum computing node performing forward calculation on the second calculation result using the variational quantum circuit;
[0123] The second calculation result is obtained by a classical computing node performing forward calculation on a data subset obtained by splitting a set of training data using the first classical neural network module.
[0124] Forward calculation is to pass the training data through each layer of the neural network, layer by layer from the input layer to the output layer, and finally obtain the forward calculation results of each classical neural network module and variational quantum circuit. During the forward calculation process, each layer of the neural network performs a calculation, takes the forward calculation result output by the previous layer as the input, performs operations through the activation function and weight parameters, and then passes it to the next layer.
[0125] Backward calculation is to start from the forward calculation result of the last layer in the forward calculation, layer by layer from the network output layer to the input layer, and finally obtain the backward calculation results of each classical neural network module and variational quantum circuit. During the backward calculation process, each layer of the neural network also performs a calculation, takes the backward calculation result output by the previous layer or the forward calculation result of the last layer in the forward calculation as the input, performs operations through the activation function and weight parameters, and then passes it to the next layer.
[0126] During the backward calculation process, although the forward calculation result is passed layer by layer from the network output layer to the input layer, the operation of the network is not the inverse process of the forward calculation. Therefore, when the quantum computing node performs backward calculation using the third calculation result, the output of the quantum computing node is the fourth calculation result, rather than the first calculation result.
[0127] In an embodiment of the present application, the third calculation result is obtained by a classical computing node performing forward calculation on the first calculation result using the second classical neural network module;
[0128] The fourth calculation result is obtained by a classical computing node performing backward calculation on the third calculation result using the second classical neural network module;
[0129] The fifth calculation result is obtained by the quantum computing node performing backward calculation on the fourth calculation result using the variational quantum circuit,
[0130] The sixth calculation result is obtained by a classical computing node performing backward calculation on the fifth calculation result using the first classical neural network module.
[0131] Participate Figure 3 , Figure 3FIG. 0 is an exemplary diagram of the operation process of a quantum-classical hybrid machine learning model provided by an embodiment of the present application. The operation process of the quantum-classical hybrid machine learning model is executed in a classical computing node and a quantum computing node corresponding to any data subset obtained by splitting a set of training data in the quantum-classical hybrid machine learning model. Below, taking Figure 3 as an example, the operation process of a quantum-classical hybrid machine learning model provided by an embodiment of the present application will be described:
[0132] Allocate any data subset to the classical computing node. The classical computing node uses the first classical neural network module to perform forward calculation on the data subset and outputs a second calculation result;
[0133] Allocate the second calculation result to the quantum computing node. The quantum computing node uses the variational quantum circuit to perform forward calculation on the second calculation result and outputs a first calculation result;
[0134] Allocate the first calculation result to the classical computing node. The classical computing node uses the second classical neural network module to perform forward calculation on the first calculation result and outputs a third calculation result;
[0135] Allocate the third calculation result to the classical computing node. The classical computing node uses the second classical neural network module to perform backward calculation on the third calculation result and outputs a fourth calculation result;
[0136] Allocate the fourth calculation result to the quantum computing node. The quantum computing node uses the variational quantum circuit to perform backward calculation on the fourth calculation result and outputs a fifth calculation result;
[0137] Allocate the fifth calculation result to the classical computing node. The classical computing node uses the first classical neural network module to perform backward calculation on the fifth calculation result and outputs a sixth calculation result.
[0138] It should be noted specifically that Figure 3 the arrow pointing from the second classical neural network module to the second classical network module and labeled with "third calculation result" represents the forward calculation process.
[0139] Below, taking 4 data subsets (subset 1 to subset 4) obtained by splitting a set of data as an example, the processing process of a set of training data of the quantum-classical hybrid machine learning model will be further described. The quantum-classical hybrid machine learning model includes 4 classical computing nodes (classical node 1 to classical node 4) and 1 quantum computing node (quantum node). The 4 classical computing nodes all include a first classical neural network module (classical 1) and a second classical neural network module (classical 2), and the quantum computing node includes a variational quantum circuit.
[0140] For the convenience of description, in this application, the order of operation of the classical neural network module and the variational quantum circuit on each computing node in the quantum-classical hybrid machine learning model is represented by "time steps". The operation steps corresponding to time step 1 are before the operation steps corresponding to time step 2, and the operation steps corresponding to time step 2 are before the operation steps corresponding to time step 3, and so on.
[0141] It should be specifically noted that in the following description of the embodiments, for the convenience of description, each data subset and its corresponding calculation result will only be assigned to a corresponding classical computing node. However, in actual applications, the relationship between the data subset and its corresponding calculation result and the classical computing node may not be a one-to-one correspondence.
[0142]
[0143] Time step 1: All classical nodes perform forward calculations on subsets 1 to 4 using the first classical neural network module, and respectively obtain the second calculation results corresponding to subsets 1 to 4;
[0144] Time step 2: The quantum node performs a forward calculation on the second calculation result corresponding to subset 1 using the variational quantum circuit to obtain the first calculation result corresponding to subset 1;
[0145] Time step 3: Classical node 1 performs a forward calculation on the first calculation result corresponding to subset 1 using the second classical neural network module to obtain the third calculation result corresponding to subset 1; the quantum node performs a forward calculation on the second calculation result corresponding to subset 2 using the variational quantum circuit to obtain the first calculation result corresponding to subset 2;
[0146] Time step 4: Classical node 1 performs a backward calculation on the third calculation result corresponding to subset 1 using the second classical neural network module to obtain the fourth calculation result corresponding to subset 1; classical node 2 performs a forward calculation on the first calculation result corresponding to subset 2 using the second classical neural network module to obtain the third calculation result corresponding to subset 2; the quantum node performs a forward calculation on the second calculation result corresponding to subset 3 using the variational quantum circuit to obtain the first calculation result corresponding to subset 3;
[0147] Time step 5: Classical node 2 performs a backward calculation on the third calculation result corresponding to subset 2 using the second classical neural network module to obtain the fourth calculation result corresponding to subset 2; classical node 3 performs a forward calculation on the first calculation result corresponding to subset 3 using the second classical neural network module to obtain the third calculation result corresponding to subset 3; the quantum node performs a forward calculation on the second calculation result corresponding to subset 4 using the variational quantum circuit to obtain the first calculation result corresponding to subset 4;
[0148] Time step 6: Classical node 3 uses the second classical neural network module to perform a backward calculation on the third calculation result corresponding to subset 3 to obtain the fourth calculation result corresponding to subset 3; Classical node 4 uses the second classical neural network module to perform a forward calculation on the first calculation result corresponding to subset 4 to obtain the third calculation result corresponding to subset 4; The quantum node uses the variational quantum circuit to perform a backward calculation on the fourth calculation result corresponding to subset 1 to obtain the fifth calculation result corresponding to subset 1;
[0149] Time step 7: Classical node 1 uses the first classical neural network module to perform a backward calculation on the fifth calculation result corresponding to subset 1 to obtain the sixth calculation result corresponding to subset 1; Classical node 4 uses the second classical neural network module to perform a backward calculation on the third calculation result corresponding to subset 4 to obtain the fourth calculation result corresponding to subset 4; The quantum node uses the variational quantum circuit to perform a backward calculation on the fourth calculation result corresponding to subset 2 to obtain the fifth calculation result corresponding to subset 2;
[0150] Time step 8: Classical node 2 uses the first classical neural network module to perform a backward calculation on the fifth calculation result corresponding to subset 2 to obtain the sixth calculation result corresponding to subset 2; The quantum node uses the variational quantum circuit to perform a backward calculation on the fourth calculation result corresponding to subset 3 to obtain the fifth calculation result corresponding to subset 3;
[0151] Time step 9: Classical node 3 uses the first classical neural network module to perform a backward calculation on the fifth calculation result corresponding to subset 3 to obtain the sixth calculation result corresponding to subset 3; The quantum node uses the variational quantum circuit to perform a backward calculation on the fourth calculation result corresponding to subset 4 to obtain the fifth calculation result corresponding to subset 4;
[0152] Time step 10: Classical node 4 uses the first classical neural network module to perform a backward calculation on the fifth calculation result corresponding to subset 4 to obtain the sixth calculation result corresponding to subset 4.
[0153] Thus, the processing process of a set of training data of the quantum-classical hybrid machine learning model is completed.
[0154] It should be noted that, in practical applications, the quantum-classical hybrid model (including the quantum-classical hybrid machine learning model) may include multiple quantum computing nodes. In this illustrative case, only one quantum computing node is included for the convenience of explanation.
[0155] See Figure 4 , Figure 4 which is the flowchart of another quantum-classical hybrid model training method provided by the embodiments of the present application. Taking Figure 4 as an example, the process of another quantum-classical hybrid model training method provided by the embodiments of the present application is described as follows:
[0156] Split a set of training data into multiple data subsets, and on the classical computing nodes and quantum computing nodes of the quantum-classical hybrid model, perform the following processing on each data subset respectively:
[0157] Allocate the data subset to an idle classical computing node to obtain a second computing result;
[0158] Allocate the second computing result to the quantum computing node to obtain a first computing result;
[0159] Allocate the first computing result to an idle classical computing node to obtain a third computing result;
[0160] Allocate the third computing result to an idle classical computing node to obtain a fourth computing result;
[0161] Allocate the fourth computing result to the quantum computing node to obtain a fifth computing result;
[0162] Allocate the fifth computing result to an idle classical computing node to obtain a sixth computing result;
[0163] Based on the first to sixth computing results corresponding to all data subsets, update the parameters corresponding to the classical computing nodes and quantum computing nodes in the quantum-classical hybrid model.
[0164] See Figure 5 , Figure 5 which is a schematic flowchart of a method for training a quantum-classical hybrid machine learning model provided by an embodiment of the present application. Below, taking Figure 5 as an example, describe the process of a method for training a quantum-classical hybrid machine learning model provided by an embodiment of the present application:
[0165] Split a set of training data into multiple data subsets, and on the classical computing nodes and quantum computing nodes of the quantum-classical hybrid machine learning model, perform the following processing on each data subset respectively:
[0166] Allocate the data subset to an idle classical computing node, and the classical computing node performs forward calculation on the data subset using the first classical neural network module to obtain a second computing result;
[0167] Allocate the second computing result to the quantum computing node, and the quantum computing node performs forward calculation on the second computing result using the variational quantum circuit to obtain a first computing result;
[0168] Allocate the first computing result to an idle classical computing node, and the classical computing node performs forward calculation on the first computing result using the second classical neural network module to obtain a third computing result;
[0169] Allocate the third calculation result to an idle classical computing node, and the classical computing node performs reverse calculation on the third calculation result by using the second classical neural network module to obtain a fourth calculation result;
[0170] Allocate the fourth calculation result to the quantum computing node, and the quantum computing node performs forward calculation on the fourth calculation result by using the variational quantum circuit to obtain a fifth calculation result;
[0171] Allocate the fifth calculation result to an idle classical computing node, and the classical computing node performs reverse calculation on the fifth calculation result by using the first classical neural network module to obtain a sixth calculation result;
[0172] Based on the first to sixth calculation results corresponding to all data subsets, update the parameters corresponding to the first classical neural network module in the classical computing node and the parameters corresponding to the variational quantum circuit in the quantum computing node in the quantum-classical hybrid machine learning model.
[0173] In an embodiment of the present application, the quantum-classical hybrid model is a Variational Quantum Eigensolver (VQE). The classical node is used to minimize the eigenvalue of the quantum node to obtain the optimized parameters in the quantum node. The variational quantum circuit included in the quantum node is used to perform quantum calculation by using the optimized parameters to obtain the eigenvalue.
[0174] The Variational Quantum Eigensolver (VQE) is an algorithm that uses quantum computing to approximately solve the energy of a quantum system. The VQE algorithm combines classical optimization algorithms and quantum computing, and approximates the ground state energy or low-excitation state energy of the system by iteratively optimizing the parameters of the quantum circuit. The basic idea of the VQE algorithm is to construct a variational quantum circuit in the quantum node and use a classical optimization algorithm to optimize the parameters in the circuit. In each iteration, the classical node calculates an estimated value of an eigenvalue and then passes this estimated value to the quantum node to measure the eigenvalue of the system by executing the variational quantum circuit.
[0175] In an embodiment of the present application, the Variational Quantum Eigensolver is applied to quantum chemistry.
[0176] In an embodiment of the present application, the quantum-classical hybrid model is the Quantum Approximate Optimization Algorithm (QAOA). The classical node is used to maximize or minimize the objective function of the problem and obtain the optimized parameters in the quantum node. The variational quantum circuit included in the quantum node is used to perform quantum calculation by using the optimized parameters to obtain the solution of the problem.
[0177] The Quantum Approximate Optimization Algorithm (QAOA) is an optimization algorithm based on quantum computing. Its core idea is to construct a parameterized quantum circuit to represent the solution space of the problem, and use a classical optimization algorithm to optimize the parameters of the circuit, so as to find the optimal solution of the problem. By iteratively optimizing the parameters and measuring the qubits to approximate the optimal solution of the objective function, QAOA can achieve good results in some combinatorial optimization problems.
[0178] In an embodiment of the present application, the quantum approximate optimization algorithm is used to solve combinatorial optimization problems.
[0179] See Figure 6 , Figure 6 which is a schematic structural diagram of a quantum-classical hybrid model training device provided by an embodiment of the present application. Corresponding to the process shown in Figure 2 , the device includes:
[0180] A first obtaining module 601, configured to, when obtaining a first calculation result, allocate the first calculation result to an idle classical calculation node, and obtain a third calculation result and a fourth calculation result, where the first calculation result is obtained by the quantum calculation node using a second calculation result, and the second calculation result is obtained by a classical calculation node calculating a data subset split from a set of training data;
[0181] A second obtaining module 602, configured to, when obtaining a fourth calculation result, allocate the fourth calculation result to the quantum calculation node to obtain a fifth calculation result;
[0182] A third obtaining module 603, configured to, when obtaining a fifth calculation result, allocate the fifth calculation result to an idle classical calculation node to obtain a sixth calculation result;
[0183] An updating module 604, configured to update the corresponding parameters in the classical calculation node and / or the quantum calculation node by using the calculation results corresponding to a set of training data.
[0184] In some embodiments of the present invention, the step of allocating the first calculation result to an idle classical calculation node and obtaining a third calculation result and a fourth calculation result may include:
[0185] Allocating the first calculation result to an idle classical calculation node to obtain a third calculation result corresponding to the first calculation result;
[0186] When obtaining a third calculation result, allocate the third calculation result to an idle classical computing node, and obtain a fourth calculation result corresponding to the third calculation result.
[0187] In some embodiments of the present invention, the method may include:
[0188] Obtain a second calculation result corresponding to a set of training data;
[0189] Sequentially allocate the obtained second calculation results to the quantum computing node to obtain a first calculation result.
[0190] In some embodiments of the present invention, the quantum-classical hybrid model may be a machine learning model. After updating the parameters corresponding to the classical computing node and / or the parameters corresponding to the quantum computing node, the method may include:
[0191] Determine whether the training of the quantum-classical hybrid model meets a preset number of training times or a preset calculation accuracy;
[0192] If not, obtain a new set of training data, and return to execute the step of obtaining all the second calculation results corresponding to a set of training quantities until a trained quantum-classical hybrid model is obtained.
[0193] In some embodiments of the present invention, the quantum computing node may include a variational quantum circuit, and the parameters corresponding to the quantum computing node may include the parameters in the variational quantum circuit;
[0194] Each classical computing node may include a first classical neural network module and a second classical neural network module;
[0195] The parameters corresponding to the classical computing node may include the parameters in the first classical neural network module and the parameters in the second classical neural network module.
[0196] In some embodiments of the present invention, the first calculation result may be obtained by the quantum computing node performing forward calculation on the second calculation result using the variational quantum circuit;
[0197] The second calculation result may be obtained by a classical computing node performing forward calculation on a data subset split from a set of training data using the first classical neural network module.
[0198] In some embodiments of the present invention, the third calculation result may be obtained by a classical computing node performing forward calculation on the first calculation result using the second classical neural network module;
[0199] The fourth calculation result may be obtained by a classical calculation node performing a reverse calculation on the third calculation result by using the second classical neural network module;
[0200] The fifth calculation result may be obtained by the quantum calculation node performing a reverse calculation on the fourth calculation result by using the variational quantum circuit,
[0201] The sixth calculation result may be obtained by a classical calculation node performing a reverse calculation on the fifth calculation result by using the first classical neural network module.
[0202] Regarding the specific functions and effects achieved by the quantum-classical hybrid model training device, reference may be made to other embodiments of this specification for comparative explanation, which will not be elaborated here. Each module in the quantum-classical hybrid model training device may be implemented in whole or in part by software, hardware, and their combination. Each module may be embedded in the processor of the computer device in hardware form or be independent of it, or may be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each above module.
[0203] An embodiment of the present application further provides a storage medium, in which a computer program is stored, and the computer program is configured to execute the steps in any one of the above method embodiments when running.
[0204] Specifically, in this embodiment, the above storage medium may include, but is not limited to: USB flash drive, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disk, magnetic disk, or optical disc and other media that can store computer programs.
[0205] Another embodiment of the present application further provides an electronic device, including a memory and a processor, a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0206] Specifically, the above electronic device may further include a transmission device and an input / output device, where the transmission device is connected to the above processor, and the input / output device is connected to the above processor.
[0207] Specifically, in this embodiment, the above processor may be configured to execute the following steps through a computer program:
[0208] S1. When obtaining a first calculation result, allocate the first calculation result to an idle classical computing node, and obtain a third calculation result and a fourth calculation result, where the first calculation result is obtained by the quantum computing node using a second calculation result, and the second calculation result is obtained by a classical computing node calculating a data subset obtained by splitting a set of training data;
[0209] S2. When obtaining a fourth calculation result, allocate the fourth calculation result to the quantum computing node to obtain a fifth calculation result;
[0210] S3. When obtaining a fifth calculation result, allocate the fifth calculation result to an idle classical computing node to obtain a sixth calculation result;
[0211] S4. Update the parameters corresponding to the classical computing node and / or the parameters corresponding to the quantum computing node by using the calculation results corresponding to a set of training data.
[0212] Specifically, for the specific examples in this embodiment, reference may be made to the examples described in the above embodiments and optional implementation manners, and details are not described herein again.
[0213] The structure, features, and effects of the present application have been described in detail based on the embodiments shown in the drawings. The above are only the preferred embodiments of the present application, but the present application is not limited to the scope defined by the drawings. Any changes made according to the concept of the present application, or equivalent embodiments modified to equivalent changes, still within the spirit covered by the specification and drawings, shall be within the protection scope of the present application.
Claims
1. A quantum classical hybrid model training method, characterized in that: The quantum-classical hybrid model includes a quantum computing node and a plurality of classical computing nodes, and the method includes: When a first calculation result is obtained, the first calculation result is assigned to an idle classical computing node to obtain a third calculation result and a fourth calculation result, wherein the first calculation result is obtained by the quantum computing node using the second calculation result, and the second calculation result is obtained by a classical computing node calculating a data subset obtained by splitting a set of training data; When a fourth calculation result is obtained, the fourth calculation result is distributed to the quantum computing node to obtain a fifth calculation result; When a fifth calculation result is obtained, the fifth calculation result is allocated to an idle classic computing node to obtain a sixth calculation result; Utilizing the calculation results corresponding to a set of training data, the parameters corresponding to the classical computing nodes and / or the parameters corresponding to the quantum computing nodes are updated.
2. The method according to claim 1, characterized in that: The step of allocating the first computing result to an idle classic computing node to obtain a third computing result and a fourth computing result includes: Allocating the first computing result to an idle classic computing node to obtain a third computing result corresponding to the first computing result; When a third calculation result is obtained, the third calculation result is allocated to an idle classic computing node to obtain a fourth calculation result corresponding to the third calculation result.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Obtaining a second calculation result corresponding to a set of training data; The obtained second calculation results are distributed to the quantum computing nodes in sequence to obtain the first calculation results.
4. The method according to claim 3, characterized in that The quantum classical hybrid model is a machine learning model; After updating the parameters corresponding to the classical computing nodes and / or the parameters corresponding to the quantum computing nodes, the method further includes: Determining whether the training of the quantum-classical hybrid model meets a preset number of training times or a preset calculation accuracy; If not, a new set of training data is obtained, and the step of obtaining all second calculation results corresponding to a set of training data is returned to the previous step until a trained quantum classical hybrid model is obtained.
5. The method according to claim 3, characterized in that The quantum computing node includes a variational quantum circuit, and the parameters corresponding to the quantum computing node include parameters in the variational quantum circuit; Each classical computing node includes a first classical neural network module and a second classical neural network module; The parameters corresponding to the classical computing nodes include parameters in the first classical neural network module and parameters in the second classical neural network module.
6. The method according to claim 4, characterized in that The first calculation result is obtained by the quantum computing node performing forward calculation on the second calculation result using the variational quantum circuit; The second calculation result is obtained by a classic computing node using the first classic neural network module to perform forward calculation on a data subset obtained by splitting a set of training data.
7. The method according to claim 4, characterized in that The third calculation result is obtained by a classical computing node performing forward calculation on the first calculation result using a second classical neural network module; The fourth calculation result is obtained by a classical computing node performing reverse calculation on the third calculation result using a second classical neural network module; The fifth calculation result is obtained by the quantum computing node performing reverse calculation on the fourth calculation result using the variational quantum circuit, The sixth calculation result is obtained by a classic computing node using the first classic neural network module to reversely calculate the fifth calculation result.
8. A quantum classical model hybrid training device, characterized in that: The device comprises A first obtaining module is used for, when obtaining a first calculation result, assigning the first calculation result to an idle classical computing node, and obtaining a third calculation result and a fourth calculation result, wherein the first calculation result is obtained by the quantum computing node using the second calculation result, and the second calculation result is obtained by a classical computing node calculating a data subset obtained by splitting a set of training data; A second obtaining module is used for, when a fourth calculation result is obtained, distributing the fourth calculation result to the quantum computing node to obtain a fifth calculation result; A third obtaining module is used for, when a fifth calculation result is obtained, allocating the fifth calculation result to an idle classic computing node to obtain a sixth calculation result; The update module is used to update corresponding parameters in the classical computing nodes and / or quantum computing nodes using the calculation results corresponding to a set of training data.
9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.