WO2024046136A1 - 量子神经网络的训练方法及训练装置 - Google Patents

量子神经网络的训练方法及训练装置 Download PDF

Info

Publication number
WO2024046136A1
WO2024046136A1 PCT/CN2023/113488 CN2023113488W WO2024046136A1 WO 2024046136 A1 WO2024046136 A1 WO 2024046136A1 CN 2023113488 W CN2023113488 W CN 2023113488W WO 2024046136 A1 WO2024046136 A1 WO 2024046136A1
Authority
WO
WIPO (PCT)
Prior art keywords
quantum
neural network
network model
simulated
quantum neural
Prior art date
Application number
PCT/CN2023/113488
Other languages
English (en)
French (fr)
Inventor
窦猛汉
方圆
王晶
Original Assignee
本源量子计算科技(合肥)股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN202211068194.XA external-priority patent/CN117709391A/zh
Priority claimed from CN202211061102.5A external-priority patent/CN117669758A/zh
Priority claimed from CN202211068147.5A external-priority patent/CN117709415A/zh
Application filed by 本源量子计算科技(合肥)股份有限公司 filed Critical 本源量子计算科技(合肥)股份有限公司
Publication of WO2024046136A1 publication Critical patent/WO2024046136A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • G06N10/20Models of quantum computing, e.g. quantum circuits or universal quantum computers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology

Definitions

  • the present application relates to the field of communication technology, and more specifically to a training method and training device for a quantum neural network.
  • Quantum Neural Network Due to the advantages of the Quantum Neural Network (QNN) model in terms of computing power, we are currently seeking to use the quantum neural network model to implement quantum computing simulations, but only a well-trained quantum neural network model can achieve the corresponding functions. However, there is currently no better method for training quantum neural network models to implement quantum computing simulations.
  • QNN Quantum Neural Network
  • This application provides a training method and training device for a quantum neural network. Each aspect involved in this application is introduced below.
  • a quantum neural network training method includes: constructing a quantum neural network model for simulation training of a system to be simulated, and initializing parameters of the quantum neural network model; running the quantum neural network model.
  • Network model obtain the final quantum state corresponding to the parameters of the quantum neural network model; determine the loss function or the energy expectation of the system to be simulated based on the final quantum state; based on the loss function or the energy of the system to be simulated Desire, determine whether the termination condition of the quantum neural network model is met; if not, update the parameters of the quantum neural network model until the termination condition is met, and obtain the trained quantum neural network model.
  • a second aspect provides a training device for a quantum neural network, including a module that executes the method described in any one of the first aspects.
  • a third aspect provides a storage medium in which a computer program is stored, wherein the computer program is configured to execute the method according to any one of the first aspects when running.
  • 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 perform any one of the first aspects. Methods.
  • This application trains a neural network model through quantum computing, and uses a loss function or energy expectation to determine whether the training of the model meets the termination conditions, which helps to realize quantum computing simulation using quantum neural networks.
  • Figure 1 is a hardware structure block diagram of a computer terminal applicable to the embodiment of the present application.
  • Figure 2 is a schematic flowchart of a quantum neural network training method provided by an embodiment of the present application.
  • Figure 3 is a schematic flowchart of a quantum neural network training method provided in Embodiment 1 of the present application.
  • FIG. 4 is a schematic diagram of a preset proposed circuit provided in Embodiment 1 of the present application.
  • Figure 5 is a schematic flowchart of a quantum neural network training method provided in Embodiment 2 of the present application.
  • Figure 6 is a schematic diagram of a quantum circuit isomorphic to the proposed method provided in Embodiment 2 of the present application.
  • Figure 7 is a schematic diagram of a partial structure of a quantum neural network provided in Embodiment 2 of the present application.
  • Figure 8 is a schematic flowchart of a quantum neural network training method provided in Embodiment 3 of the present application.
  • Figure 9 is a schematic structural diagram of a quantum neural network training device provided in Embodiment 4 of the present application.
  • Figure 10 is a schematic structural diagram of a quantum neural network training device provided in Embodiment 5 of the present application.
  • Figure 11 is a schematic structural diagram of a quantum neural network training device provided in Embodiment 6 of the present application.
  • the quantum neural network (QNN) model is a neural network model based on the principles of quantum mechanics, which can use larger information Capacity and efficient parallel computing capabilities can better solve the bottleneck problems currently encountered.
  • Quantum computing simulation is a simulation calculation that uses numerical calculations and computer science to simulate the laws of quantum mechanics. As a simulation program, it uses the high-speed computing power of computers to depict the space-time evolution of quantum states based on the basic laws of quantum bits in quantum mechanics. . Using quantum computing simulation, we can obtain the minimum eigenvalue and corresponding eigenvector of a matrix, and we can also obtain the ground state energy of the Hamiltonian of closed physics and its corresponding quantum state.
  • quantum neural networks Due to the advantages of quantum neural networks in computing power, we are currently seeking to use quantum neural networks to implement quantum computing simulations. However, only a well-trained quantum neural network can achieve the corresponding functions. However, there is currently no better method for training quantum neural networks. Used to implement quantum computing simulations.
  • this application provides a quantum neural network training method.
  • the neural network model is trained through quantum computing, and the loss function or energy expectation is used to determine whether the training of the model meets the termination conditions, which is helpful to realize the use of quantum neural networks.
  • Networks perform quantum computing simulations.
  • the quantum neural network training method provided by the embodiments of this application can be applied to electronic devices, such as computer terminals, specifically ordinary computers, quantum computers, etc.
  • Quantum computer is a type of physical device that follows the laws of quantum mechanics to perform high-speed mathematical and logical operations, store and process quantum information. When a device processes and calculates quantum information and runs quantum algorithms, it is a quantum computer. Quantum computers have become a key technology under research because of their ability to process mathematical problems more efficiently than ordinary computers. For example, they can speed up the time to crack an RSA key from hundreds of years to hours.
  • Figure 1 is a hardware structure block diagram of a computer terminal suitable for the quantum neural network training method according to the embodiment of the present application.
  • the computer terminal may include one or more (only one is shown in Figure 1) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data.
  • the above-mentioned computer terminal may also include a transmission device 106 for communication functions and an input and output device 108.
  • Figure 1 is only illustrative, and it does not limit the structure of the above-mentioned computer terminal.
  • the computer terminal may also include more or fewer components than shown in FIG. 1 , or have a different configuration than that shown in FIG. 1 .
  • the memory 104 can be used to store software programs and modules of application software, such as program instructions/modules corresponding to the quantum neural network training method in the embodiment of the present application.
  • the processor 102 executes the software programs and modules stored in the memory 104 by running them.
  • Various functional applications and data processing implement the above methods.
  • Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • the memory 104 may further include memory located remotely relative to the processor 102, and these remote memories may be connected to the computer terminal through a network. Examples of the above-mentioned networks include but are not limited to the Internet, intranets, local area networks, mobile communication networks and combinations thereof.
  • the transmission device 106 is used to receive or send data via a network.
  • Specific examples of the above-mentioned network may include a wireless network provided by a communication provider of the computer terminal.
  • the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station to communicate with the Internet.
  • the transmission device 106 may be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.
  • RF Radio Frequency
  • Quantum computing is a new computing model that follows the laws of quantum mechanics to control quantum information units for calculation.
  • the most basic principle of quantum computing is the quantum mechanical state superposition principle.
  • the quantum mechanical state superposition principle allows the state of a quantum information unit to be Being in a superposition state of multiple possibilities makes quantum information processing have greater potential in terms of efficiency than classical information processing.
  • a quantum system contains several particles that move according to the laws of quantum mechanics. The system is said to be in a certain quantum state in the state space. For chemical molecules, quantum chemical simulations can be realized to provide research support for quantum computing.
  • a real quantum computer is a hybrid structure, which consists of two parts: one part is a classical computer, responsible for performing classical calculations and control; the other part is a quantum device, responsible for running quantum programs to achieve quantum computing.
  • a quantum program is a sequence of instructions written in a quantum language such as QRunes that can be run on a quantum computer. It supports quantum logic gate operations and ultimately realizes quantum computing.
  • a quantum program is a series of instruction sequences that operate quantum logic gates in a certain time sequence.
  • Quantum computing simulation is a process in which a virtual architecture (i.e., quantum virtual machine) built with the resources of ordinary computers is used to realize the simulated operation of quantum programs corresponding to specific problems. Often, a quantum program corresponding to a specific problem needs to be constructed.
  • the quantum program referred to in the embodiments of this application is a program written in a classical language that represents qubits and their evolution, in which qubits, quantum logic gates, etc. related to quantum computing are represented by corresponding classical codes.
  • quantum circuits are also called quantum logic circuits. They are the most commonly used universal quantum computing model. They represent circuits that operate on qubits under an abstract concept. Its components include qubits, circuits (timelines) , and various quantum logic gates, and finally the results often need to be read out through quantum measurement operations.
  • a quantum program as a whole corresponds to a total quantum circuit.
  • the quantum program described in this application refers to the total quantum circuit, where the total number of qubits in the total quantum circuit is the same as the total number of qubits in the quantum program. It can be understood as: a quantum program can be composed of quantum circuits, measurement operations for qubits in the quantum circuit, registers to save measurement results, and control flow nodes (jump instructions).
  • a quantum circuit can contain dozens, hundreds or even thousands of Tens of thousands of quantum logic gate operations.
  • the execution process of a quantum program is a process of executing all quantum logic gates in a certain time sequence. It should be noted that timing is the time sequence in which a single quantum logic gate is executed.
  • Quantum logic gates are the basis of quantum circuits.
  • Quantum logic gates include single-bit quantum logic gates, such as Hadamard gates (H gates, Hadamard gates), Pauli-X gates ( X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), RX gate, RY gate, RZ gate, etc.; two-bit or multi-bit quantum logic gates, such as CNOT gate, CR gate , CZ door, iSWAP door, Toffoli door, etc.
  • Quantum logic gates are generally represented by unitary matrices, which are not only matrix forms, but also operations and transformations. Generally, the effect of a quantum logic gate on a quantum state is calculated by multiplying the unitary matrix on the left by the matrix corresponding to the right vector of the quantum state.
  • the basic unit of information is a bit, and a bit has two states: 0 and 1.
  • the most common physical implementation method is to represent these two states through the high and low levels.
  • the basic unit of information is a qubit.
  • a qubit also has two states, 0 and 1, recorded as
  • the state of the qubit will collapse to a certain state (eigenstate, here
  • 2 1, and
  • Quantum state which refers to the state of qubits, generally needs to be described by a set of orthogonal and complete basis vectors.
  • the commonly used calculation basis is expressed in binary in quantum algorithms (or quantum programs). For example, a group of qubits is q0, q1, q2, which represents the 0th, 1st, and 2nd qubits. The order from high to low is q2q1q0.
  • the quantum state of this group of qubits is 2 3 calculation bases.
  • Superposition state 8 calculation bases refer to:
  • the quantum state is a superposition state composed of various basis vectors. When the probability amplitude of other basis is 0, it is in one of the determined basis vectors.
  • Hermitian matrix In quantum mechanics, all measurable mechanical quantities can be described by a Hermitian matrix.
  • the definition of a Hermitian matrix is that the transposed conjugate of the matrix is the matrix itself, that is: Such a matrix is usually called a measurement operator.
  • Non-zero operators will have at least one eigenvalue ⁇ that is not 0 and a corresponding eigenstate
  • ⁇ >
  • all quantum operations can be described by a unitary matrix.
  • the definition of a unitary matrix is that the transposed conjugate of the matrix is the inverse of the matrix, that is:
  • unitary operators are also called quantum logic gates in quantum computing.
  • Figure 2 is a schematic flowchart of the neural network training method according to the embodiment of the present application, including steps S201-S205.
  • step S201 a quantum neural network model used for simulation training of the system to be simulated is constructed, and parameters of the quantum neural network model are initialized.
  • step S202 run the quantum neural network model to obtain the final quantum state corresponding to the initialization parameters.
  • step S203 the loss function or the energy expectation of the system to be simulated is determined based on the final quantum state.
  • step S204 based on the loss function or the energy expectation of the system to be simulated, it is determined whether the termination condition of the quantum neural network model is met.
  • step S205 if not, update the parameters of the quantum neural network model until the termination condition is met, and obtain the trained quantum neural network model.
  • Embodiment 1 The following describes in detail the neural network training method of the embodiment of the present application from different angles through different embodiments, including Embodiment 1, Embodiment 2 and Embodiment 3.
  • Figure 3 is a schematic flowchart of the training method of the quantum neural network in Embodiment 1, which may include steps S301-S305.
  • S301 Construct a quantum neural network model and initialize parameters of the quantum neural network model.
  • constructing a quantum neural network model may include: constructing a quantum neural network model based on the system to be simulated and the preset proposed circuit.
  • the system to be simulated is a system that requires quantum computing simulation using quantum neural networks.
  • the system to be simulated can be an equation, a molecule, or other systems.
  • Simulation is a method of evolving a prepared initial state onto a quantum circuit. Different simulation methods may lead to different structures of quantum neural networks.
  • the structure of a quantum neural network may vary depending on the system to be simulated and the simulation method. different.
  • constructing a quantum neural network model based on the system to be simulated and the preset proposed circuit may include:
  • the Hamiltonian is the sum of the kinetic energy of all particles plus the potential energy of the particles associated with the system. For different situations or numbers of particles, the Hamiltonian is different because it includes the sum of the kinetic energy of the particles and the potential energy function corresponding to this situation, generally represented by H.
  • H the potential energy function corresponding to this situation
  • the Hamiltonian corresponds to the Hamiltonian operator.
  • the Hamiltonian will be expressed as The weighted summation form of Pauli operator ⁇ X, Y, Z, I ⁇ , where the number of Zhang multiplier terms is the target number of qubits:
  • c k is the weight coefficient
  • is the Pauli operator
  • M is the number of target qubits.
  • the corresponding quantum logic gate is used as a qubit to evolve the initial state into the quantum neural network.
  • the number of qubits in the quantum neural network can be the target number of qubits.
  • the proposed method can be selected according to different situations.
  • the selected proposed method can be unitary coupled cluster operator (Unitary Coupled Cluster, UCC), and the corresponding proposed formula is:
  • the matrix operator corresponding to the quantum circuit is, That is to say, P i is the generator.
  • the proposed design method can also be ADAPT (adaptive derivative-assembled pseudo-Trotter), which can be regarded as an improvement based on UCC.
  • the proposed design method can also be HE (Hardware Efficient, hardware efficient), SP (Symmetry Preserved, symmetry preservation), etc.
  • the number of layers of the proposed scheme (the depth of the proposed scheme) in the quantum neural network that has not yet been trained is related to the target number of qubits.
  • the initial number of layers can be the target number of qubits.
  • the neural network constructed according to the proposed method can contain entangled quantum circuits, and the depth of the proposed method can be the number of isomorphic entangled quantum circuits.
  • FIG 4 is a schematic diagram of a preset proposed circuit provided by an embodiment of the present application.
  • the preset proposed circuit may include: a first proposed circuit module and A second proposed circuit module, wherein the first proposed circuit module is composed of an RX gate, an RZ gate and a CNOT gate that act on the last two qubits in sequence. It consists of an RX gate, an RZ gate, and a CNOT gate that acts on adjacent qubits.
  • Initializing the parameters of the quantum neural network model may include: determining initial values of the parameters of the quantum neural network model according to a preset probability density function.
  • the parameter value can be set based on experience, or a value can be selected based on an algorithm as the initial value of the parameter.
  • initializing the parameters of the quantum neural network may include: initializing the parameters according to a preset probability density function.
  • the probability density function may be selected based on the actual situation, or may be determined based on the mapping relationship between the probability density function and the preset design method.
  • the initialized parameter values can be randomly selected from the function values of the probability density function, or they can be selected according to certain rules.
  • the probability density function can be a uniformly distributed probability density function. According to the properties of a uniformly distributed probability density function, the initial value of the parameter is 1/(b-a). For example, b is 2 ⁇ , a is 0, and the initialized The parameter value is 1/2 ⁇ .
  • S302 Select a set of standard orthonormal bases, and apply the quantum neural network model to the standard orthonormal bases respectively to obtain the final quantum state corresponding to the standard orthogonal bases, where the final quantum state
  • the number is the same as the number of basis vectors contained in the orthonormal basis.
  • the quantum neural network by operating the quantum neural network on a set of orthogonal initial states (the standard orthonormal basis can be taken as
  • the loss function in the quantum neural network model is generally composed of the energy of each output quantum state
  • the weighted sum of the expectation value is given.
  • the loss function is determined through the following formula:
  • the is the loss function
  • the 2 n is the number of basis vectors contained in the orthonormal basis
  • the ⁇ k is the weight corresponding to the kth basis vector in the orthonormal basis
  • the ⁇ k is the weight corresponding to the kth basis vector in the orthonormal basis.
  • H is the Hamiltonian corresponding to the system to be simulated.
  • S304 Based on the loss function, determine whether the optimization termination condition of the quantum neural network model is met, where the optimization termination condition is that the value of the loss function converges to a fixed value.
  • the loss function judging whether the optimization termination condition of the quantum neural network model is met is actually to judge whether the quantum neural network has been trained well.
  • the value satisfied by the loss function converges to a fixed value, for example, the value of the loss function converges to zero or For other values, you will get the trained quantum neural network model, that is, the Variational Quantum Eigensolver (VQE) model based on the quantum neural network.
  • VQE Variational Quantum Eigensolver
  • the value of the loss function will become smaller and smaller, that is, the difference between the value of the current loss function and the value of the previous loss function will also become smaller and smaller.
  • the purpose of optimization is to make the loss function The value converges to a fixed value.
  • the difference between the value of the current loss function and the value of the previous loss function is within the preset range, indicating that the value of the loss function is approximately equal to the ground state energy of the system to be simulated. There is a difference between subsequent research based on this and subsequent research based on the ground state energy. Not much.
  • the optimization is terminated. At this time, the quantum neural network model is optimized.
  • the preset accuracy mentioned here can be determined by the accuracy that the optimization wants to achieve. For example, if the accuracy is 10 -5 , the preset range can be (0, 10 -5 ).
  • the quantum neural network model has not been optimized yet and needs to continue to be optimized. At this time, the parameters need to be updated and a new round of optimization is entered.
  • the parameters of the quantum neural network model there are many ways to update the parameters of the quantum neural network model, as long as the value of the loss function converges. For example, you can set a fixed value and use the difference or sum of the current parameter value and the fixed value as the new parameter value; you can also Through the value of the current loss function and the value of the previous loss function, the weight of the parameter value reduction is determined, and the parameter value is updated based on the weight reduction.
  • the loss function and the selected optimizer are used to obtain new parameter values, and the parameters are updated based on the new parameter values.
  • the optimizer guides the parameters of the loss function to update the appropriate size in the right direction, so that the updated parameters keep the loss function value approaching the global minimum.
  • can be set when configuring the quantum neural network.
  • updating the parameters of the quantum neural network model may include:
  • the quantum circuit is isomorphic to the proposed method, that is, adding The number of layers of the quantum neural network, the added quantum circuit is structured after the current proposed method, and the new parameter values are the parameters in the constructed quantum circuit.
  • this application first constructs a quantum neural network model, initializes the parameters of the quantum neural network model, selects a set of standard orthonormal bases, and applies the quantum neural network model to the standard orthonormal bases respectively to obtain the corresponding
  • the loss function is determined based on the final quantum state and the preset weights. Based on the loss function, it is judged whether the optimization termination conditions of the quantum neural network model are met. If not, the parameters of the quantum neural network model are updated until the optimization termination conditions are met. Obtain an optimized quantum neural network model.
  • Figure 5 is a schematic flow chart of the quantum neural network training method in Embodiment 2, which may include steps S501-S505.
  • S501 Construct a quantum neural network based on the system to be simulated and the selected design method.
  • the system to be simulated is a system that requires quantum computing simulation using quantum neural networks.
  • the system to be simulated can be an equation, a molecule, or other systems.
  • the hypothesis is a method of evolving a prepared initial state, such as
  • the structure of the quantum neural network may also be different.
  • the structure of the quantum neural network may be different depending on the system to be simulated and the design method.
  • building a quantum neural network based on the system to be simulated and the selected design method may include:
  • a quantum neural network is constructed.
  • the Hamiltonian is the sum of the kinetic energy of all particles plus the potential energy of the particles associated with the system. For different situations or numbers of particles, the Hamiltonian is different because it includes the sum of the kinetic energy of the particles and the potential energy function corresponding to this situation, generally represented by H.
  • the Hamiltonian corresponds to the Hamiltonian operator.
  • the Hamiltonian is expressed as a weighted summation form of the Pauli operator ⁇ X, Y, Z ⁇ , where the tensor multiplier is the target qubit number:
  • c k is the weight coefficient
  • is the Pauli operator
  • M is the target number of qubits.
  • the corresponding quantum logic gate is used as a qubit, and the initial state is evolved into the quantum neural network.
  • the number of qubits in the quantum neural network can be greater than or equal to the target number of qubits.
  • the proposed method can be selected according to different situations.
  • the selected proposed method can be unitary coupled cluster operator (Unitary Coupled Cluster, UCC), and the corresponding proposed formula is:
  • the matrix operator corresponding to the quantum circuit is, That is to say, P i is the generator.
  • the proposed method can also be ADAPT (Adaptive Derivative-Assembled Pseudo-Trotter), which can be regarded as an improvement based on UCC.
  • the proposed design method can also be HE (Hardware Efficient, hardware efficient), SP (Symmetry Preserved, symmetry preservation), etc.
  • the number of layers of the proposed scheme (the depth of the proposed scheme) in the quantum neural network that has not yet been trained is related to the target number of qubits.
  • the initial number of layers can be the target number of qubits.
  • the neural network constructed according to the proposed method can contain entangled quantum circuits, and the depth of the proposed method can be the number of isomorphic entangled quantum circuits.
  • the parameter value can be set based on experience, or a value can be selected as the initial value of the parameter based on an algorithm.
  • initializing the parameters of the quantum neural network may include:
  • the initial values of the parameters of the quantum neural network are determined.
  • the probability density function can be selected based on the actual situation, or can be determined based on the mapping relationship between the probability density function and the proposed design method.
  • the parameters mentioned here can be more than one. When there is more than one parameter, they can be initialized separately.
  • the initial value can be a value randomly selected from the function value of the probability density function, or a value selected according to certain rules, and the selected initial value can be assigned to the parameter.
  • the probability density function can be a uniformly distributed probability density function. According to the properties of a uniformly distributed probability density function, the initial value of the parameter is 1/(b-a). For example, b is 2 ⁇ , a is 0, and the initialized parameter value is 1/2 ⁇ .
  • the initial state of the system to be simulated will simulate evolution in the quantum neural network to obtain the final quantum state.
  • the initial state can be
  • is the parameter in the quantum neural network (that is, this parameters (mentioned in the application embodiment)).
  • the loss function is generally determined by the expected value of the final quantum state relative to the Hamiltonian of the system to be simulated. Specifically, in the embodiment of this application, it can be expressed in the following form:
  • quantum expectation estimation means that the Hamiltonian H of multi-electron systems, Heisenberg models (Heisenberg models), quantum Ising models (Ising models) and other systems can be expanded into the sum of multiple sub-terms, that is:
  • h is a real number
  • is the Pauli operator
  • i, j, k represent the subspace on which the Hamiltonian quantum term acts.
  • ⁇ * and ⁇ are orthogonal and normalized, and the right side of the equation can also be expanded into this form:
  • the measurement of the expectation of each sub-term can be carried out on the quantum neural network, using The classical processor sums up each expectation.
  • the measurement line of each subitem can be used to obtain the expected value of each subitem.
  • the measurement line of each subitem can be the quantum logic gate required to simulate the subitem acting on the quantum Obtained on bits.
  • Determining whether the calculation termination condition is met is actually to determine whether the quantum neural network has been trained.
  • the trained quantum neural network will be obtained, that is, the VQE based on the quantum neural network.
  • determining whether the training termination condition is met based on the loss function may include:
  • the method may also include:
  • the value of the loss function will become smaller and smaller, that is, the difference between the value of the current loss function and the value of the previous loss function will also become smaller and smaller.
  • the purpose of training is to make the value of the loss function smaller and smaller. approaching the ground state energy.
  • the difference between the value of the current loss function and the value of the previous loss function is within the preset range, indicating that the value of the loss function is approximately equal to the ground state energy. Based on this, the subsequent research is not much different from the subsequent research based on the ground state energy.
  • the training will be terminated, and the quantum neural network will be trained at this time.
  • the preset range mentioned here can be determined by the accuracy desired for training. For example, if the accuracy is 10 -5 , the preset range can be (0, 10 -5 ).
  • the difference is not within the preset range, it is necessary to determine that the number of parameter updates has reached the preset value. If it has not been reached, S504 will be executed. If it has been reached, it means that the existing proposed design method may not be able to obtain a trained quantum neural network. It is necessary Choose a new scenario and train again.
  • the purpose of setting the default value is to avoid endless training when factors such as unreasonable selection of the proposed design method that affect training convergence occur.
  • the default value can be set empirically, such as 50, or calculated based on an algorithm.
  • the parameters need to be updated to enter a new round of training.
  • the value of the loss function determines the weight of the parameter value reduction, and updates the parameter value based on the reduction weight.
  • updating the parameters may include:
  • the parameters are updated.
  • the optimizer guides the parameters of the loss function to update the appropriate size in the right direction, so that the updated parameters keep the loss function value approaching the global minimum.
  • the optimizer mentioned here can be SGD (Stochastic Gradient Descent, stochastic gradient descent method), BGD (Batch Gradient Descent, batch gradient descent), MBGD (Mini-Batch Gradient Descent, small batch gradient descent), NAG (Nesterov Accelerated Gradient) , Newton momentum gradient descent), Momentum (momentum gradient descent), Adagrad (Adaptive gradient algorithm, adaptive learning rate gradient descent), RMSProp and Adma.
  • Adma absorbs the advantages of Adagrad and momentum gradient descent algorithms, which can not only adapt to sparse gradients (that is, natural language and computer vision problems), but also alleviate the problem of gradient oscillation.
  • RMSProp has made small improvements based on AdaGrad.
  • the optimizer uses the loss function to calculate the gradient of parameter descent.
  • the specific calculation method is related to the type of optimizer.
  • the optimizer calculates the loss function through forward propagation, and then, under the dynamic graph mechanism, back propagates according to the loss function to obtain the gradient of parameter descent.
  • updating the parameters may include updating the parameters based on the new parameter values, may include:
  • the quantum circuit is isomorphic to the proposed method, that is, the added quantum The number of layers of the neural network.
  • the new parameter values are the values of the parameters in the constructed quantum circuit.
  • the constructed quantum circuit can further be said to be a quantum circuit isomorphic to the above-mentioned entangled quantum circuit.
  • the quantum circuit may include: an RY gate acting on each qubit, a CNOT gate acting on adjacent qubits, and a CNOT gate acting on the first and last qubits. .
  • the quantum circuit includes a CNOT gate that acts on the first adjacent qubit, and acts on the first adjacent qubit.
  • the CNOT gates of the first and fourth qubits act on the RY gate on each qubit.
  • Each RY gate contains parameters, that is, the rotation angle of the RY gate is the parameter.
  • Quantum circuits change depending on how they are designed.
  • part of the structure of the quantum neural network can be shown in Figure 7.
  • the structure in the dotted box is the structure corresponding to the proposed design method.
  • the dotted box represents one layer.
  • the proposed design in the initial quantum neural network The number of layers of the method can be equal to the number of qubits. Specifically, the number of layers is set according to the expression of the Hamiltonian corresponding to the system to be simulated. The number of layers can increase as the number of training times of the quantum neural network increases.
  • the present invention first constructs a quantum neural network based on the system to be simulated and the selected design method; then initializes the parameters of the quantum neural network; then, runs the quantum neural network to obtain the final quantum state corresponding to the initialization parameters; Then, based on the loss function, it is determined whether the training termination condition is met, where the loss function includes the final quantum state; finally, the parameters are updated to satisfy the training termination condition, and a trained quantum neural network is obtained.
  • quantum computing a new quantum neural network training method is provided, and the loss function is used to determine whether to update parameters for quantum neural network training, thereby realizing the use of quantum neural networks for quantum computing simulation and filling the gap in related technologies. blank.
  • Figure 8 is a schematic flowchart of the quantum neural network training method in Embodiment 3.
  • the training method is based on distributed VQE and may include steps S801-S806.
  • the system to be simulated is a system that needs to use distributed VQE for quantum computing simulation.
  • the system to be simulated can be an equation, a molecule, or other systems.
  • the system to be simulated is a composite system and can be composed of multiple subsystems.
  • the system to be simulated can be decomposed to obtain multiple subsystems, that is, the system to be simulated can be expressed as a combination of multiple subsystems.
  • Quantum entanglement and separability are properties of the quantum states of composite systems.
  • the subsystem can be obtained by decomposing the system to be simulated in advance, or it can be obtained from other equipment, or it can be obtained by currently decomposing the system to be simulated.
  • obtaining the subsystem of the system to be simulated may include:
  • the system to be simulated is decomposed using the Schmidt decomposition method to obtain subsystems of the system to be simulated.
  • Schmidt decomposition is a way of decomposing the system to be simulated.
  • the following is an example of dividing the system to be simulated into two subsystems, A and B, and explains the Schmidt decomposition in detail through the formula:
  • ⁇ k is the Schmidt coefficient
  • ⁇ k d kk
  • the number of non-zero ⁇ k is called the Schmidt rank of
  • k B > are a set of orthonormal states of subsystems A and B respectively.
  • Schmidt decomposition of the system to be simulated is used. Assuming that the decomposed subsystem contains N/2 qubits, the trial wave function of the system to be simulated can be expressed as:
  • S is a self-defined constant that can be determined based on Schmidt rank.
  • N is the number of qubits in the system to be simulated.
  • U( ⁇ ) is a subsystem
  • V( ⁇ ) is another subsystem
  • ⁇ and ⁇ are respectively Corresponds to the parameters in the subsystem.
  • the custom constant S can be determined according to the intensity of entanglement between subsystems.
  • its ground state has weak entanglement between subsystems, and its Schmidt The lower rank can be accurately and efficiently simulated by a smaller custom constant S. Therefore, the value of the custom constant S can be set smaller.
  • the value of the custom constant S can be set The bigger one.
  • corresponding parameter-containing subcircuits are constructed according to their properties.
  • the constructed parameter-containing subcircuits may be the same.
  • constructing parameter-containing subcircuit corresponding to each subsystem separately may include:
  • a parameter-containing subcircuit is constructed in the following way:
  • the proposed quantum circuit is combined with a preset number of the entangled quantum circuits to obtain the parameter-containing quantum circuit corresponding to the subsystem.
  • the Hamiltonian is the sum of the kinetic energy of all particles plus the potential energy of the particles associated with the system. For different situations or numbers of particles, the Hamiltonian is different because it includes the sum of the kinetic energy of the particles and the potential energy function corresponding to this situation, generally represented by H.
  • the physical quantities of classical mechanics become corresponding operators, and the Hamiltonian corresponds to the Hamiltonian operator.
  • the Hamiltonian corresponding to the system to be simulated can be obtained based on the mechanical analysis of the system to be simulated, or it can be determined based on the properties of the system to be simulated and the Hamiltonian corresponding to such a system. Of course, it can also be obtained in other ways.
  • the Hamiltonian corresponding to the system to be simulated can be hard-coded. Specifically, it can be constructed into a weighted summation form of the Pauli operator. Based on this, the Hamiltonian corresponding to each subsystem can also be constructed. quantity.
  • the system to be simulated is decomposed into multiple subsystems.
  • the Hamiltonian will also be decomposed into multiple subsystems. Taking the system to be simulated as being decomposed into two subsystems A and B as an example, the Hamiltonian corresponding to the system to be simulated can be expressed as:
  • t is the evolution time
  • c t is the weight coefficient
  • c t is the weight coefficient
  • c t is the weight coefficient
  • the number of tensor multipliers of the Hamiltonian in the form of the Pauli operator can be used as the number of qubits.
  • the Hamiltonian there are other ways to use the Hamiltonian to determine the number of qubits. For example, according to the Hamiltonian The order of the equivalent unitary matrix determines the number of qubits.
  • the hypothesis is a method of evolving a prepared initial state, such as
  • the structure of the proposed quantum circuit may also be different.
  • the proposed method can be selected according to different situations.
  • the selected proposed method can be unitary coupled cluster operator (Unitary Coupled Cluster, UCC), and the corresponding proposed formula is:
  • the matrix operator corresponding to the quantum circuit is, That is to say, P i is the generator.
  • the proposed method can also be ADAPT (Adaptive Derivative-Assembled Pseudo-Trotter), which can be regarded as an improvement based on UCC.
  • ADAPT Adaptive Derivative-Assembled Pseudo-Trotter
  • the proposed design method can also be HE (Hardware Efficient, hardware efficient), SP (Symmetry Preserved, symmetry preservation), etc.
  • an entangled quantum circuit In order to evolve the initial state to the final quantum state, an entangled quantum circuit needs to be constructed. Specifically, quantum logic gates with entanglement are added to act on the qubits to obtain an entangled quantum circuit.
  • the entangled quantum circuit contains quantum logic with parameters.
  • the number of gates and entangled quantum circuits constructed can be preset. After obtaining the proposed quantum circuit and the entangled quantum circuit, connect the proposed quantum circuit and the preset number of entangled quantum circuits in sequence to obtain the parameter-containing quantum circuit.
  • the parameter value can be set based on experience, or a value can be selected as the initial value of the parameter based on an algorithm.
  • the same initial value can be set, or different initial values can be set.
  • initializing the parameters in each parameter-containing subcircuit may include:
  • an initial value is determined according to a preset probability density function, and the initial value is used as the value of a parameter in the parameter-containing sub-circuit.
  • the probability density function can be selected based on the actual situation, or can be determined based on the mapping relationship between the probability density function and the proposed design method. When there is more than one parameter, they can be initialized separately. The initialized parameter values can be randomly selected from the function values of the probability density function, or they can be selected according to certain rules.
  • the probability density function can be a uniformly distributed probability density function. According to the properties of a uniformly distributed probability density function, the initial value of the parameter is 1/(b-a). For example, b is 2 ⁇ , a is 0, and the initialized parameter value is 1/2 ⁇ .
  • the quantum expectation estimation algorithm can be used to calculate the energy expectation of the final quantum on the Hamiltonian corresponding to the subsystem.
  • the so-called quantum expectation estimation means that the Hamiltonian H of multi-electron systems, Heisenberg models (Heisenberg models), quantum Ising models (Ising models) and other systems can be expanded into the sum of multiple sub-terms, that is:
  • h is a real number
  • is the Pauli operator
  • i, j, k represent the subspace on which the Hamiltonian quantum term acts.
  • ⁇ * and ⁇ are orthogonal and normalized, and the right side of the equation can also be expanded into this form:
  • the energy expectation value of the subsystem can be obtained.
  • a classical processor can be used to sum up each energy expectation.
  • the energy expectation of each sub-item can be obtained by using the measurement circuit of each sub-item.
  • the measurement circuit of each sub-item can be obtained by applying the quantum logic gate required to simulate the sub-item on the qubit.
  • the energy expectation of the system to be simulated can be obtained based on the relationship between the Hamiltonian corresponding to the system to be simulated and the Hamiltonian corresponding to the subsystem.
  • obtaining the energy expectation of the system to be simulated based on the final quantum states of all subsystems may include:
  • the energy expectation of the subsystem is obtained based on the final quantum state of the subsystem
  • the energy expectation of the system to be simulated is obtained based on the constructed energy expectation matrix of the system to be simulated.
  • the energy expectation matrix of the system to be simulated can be constructed based on the Hamiltonian corresponding to the decomposed system to be simulated. More specifically, the weight coefficient is determined based on the Hamiltonian corresponding to the decomposed system to be simulated, and based on the energy expectation of the subsystem The relationship constructs the Hamiltonian energy expectation matrix. When the energy expectation of the subsystem is obtained, the energy expectation matrix can be used to obtain the energy expectation of the system to be simulated. For example, if the system to be simulated includes two subsystems and the qubits of both subsystems are N/2, the energy expectation matrix constructed can be:
  • the energy expectation of unified A is the energy expectation of subsystem B.
  • the existing traditional VQE simulates the system to be simulated as a whole, while the distributed VQE simulates the subsystems of the system to be simulated separately, that is, using distributed strategies to perform quantum simulation.
  • the upper limit of S is Then the upper limit of the dimension of the Hamiltonian corresponding to the subsystem is The upper limit of the dimension of the expected matrix M is also This is still much smaller than the dimension 2 N * 2 N of the unitary matrix corresponding to the Hamiltonian of the system to be simulated. Therefore, the efficiency of distributed VQE is better than the existing traditional VQE.
  • the simulation termination condition is to minimize the energy expectation in a limited number of simulations, that is, to obtain the target ground state energy. Based on the above energy expectation matrix, obtaining the target ground state energy can be expressed as:
  • E tar is the target ground state energy
  • E( ⁇ , ⁇ ) is the energy expectation of the system to be simulated.
  • E( ⁇ , ⁇ ) is the minimum eigenvalue of M( ⁇ , ⁇ ), which can be calculated through the classical algorithm. Ask for it.
  • the simulation termination condition can include two conditions.
  • the first condition is to determine whether the energy expectation is the pre-obtained ground state energy, or is consistent with the ground state. Whether the energy difference is within a preset range can also be determined by determining whether the difference between the currently obtained energy expectation and the previously obtained energy expectation is within a preset accuracy range.
  • the ground state energy obtained in advance can be obtained by using the classical method to obtain the ground state energy of the system to be simulated.
  • the Schmitt rank must also be obtained by using the classical method to serve as the benchmark for the quantum simulation method provided by the embodiments of the present application. refer to.
  • the quantum computing simulation is completed.
  • the second condition needs to be judged, that is, whether the number of parameter updates is equal to the preset value. If it is equal to , indicating that in the finite number of simulations, the calculation has not converged, and there needs to be a problem in some previous steps.
  • you can choose a new design method reconstruct the subcircuit containing parameters, and then simulate. If it is less than, it means that the energy expectation does not meet the simulation termination condition.
  • the parameters in the parameter-containing subcircuit need to be updated to regain the final quantum state of the subsystem.
  • updating the parameters in each parameter-containing subcircuit includes:
  • a quantum circuit isomorphic to the entangled quantum circuit in the corresponding parameter-containing subcircuit is constructed and inserted in the parameter-containing subcircuit.
  • the optimizer can be used to obtain new parameter values. During the deep learning backpropagation process, the optimizer guides the parameters to update the appropriate size in the right direction, so that the updated parameters allow the energy expectation to continuously approach the global situation. Minimum.
  • the optimizer mentioned here can be SGD (Stochastic Gradient Descent, stochastic gradient descent method), BGD (Batch Gradient Descent, batch gradient descent), MBGD (Mini-Batch Gradient Descent, small batch gradient descent), NAG (Nesterov Accelerated Gradient) , Newton momentum gradient descent), Momentum (momentum gradient descent), Adagrad (Adaptive gradient algorithm, adaptive learning rate gradient descent), RMSProp and Adma.
  • Adma absorbs the advantages of Adagrad and momentum gradient descent algorithms, which can not only adapt to sparse gradients (that is, natural language and computer vision problems), but also alleviate the problem of gradient oscillation.
  • RMSProp has made small improvements based on AdaGrad.
  • the optimizer calculates the gradient of parameter descent.
  • the specific calculation method is related to the type of optimizer.
  • the parameter update formula corresponding to the optimizer is used to obtain new parameter values.
  • Distributed VQE runs much faster than traditional VQE. Taking two subsystems of the same qubit as an example, distributed VQE only needs to simulate the unitary transformation of two N/2 qubits, while traditional VQE needs to simulate N qubits.
  • the unitary transformation of bits reduces the dimension of the simulated unitary matrix through separate simulations and reduces the time and space consumption required for simulation. Therefore, it is much more efficient in both time and space.
  • the method provided by the embodiments of this application divides the entire system into different subsystems for quantum computing simulation. Through this distributed strategy, quantum algorithms that exceed the number of hardware qubits can be run, expanding the computing range of the NISQ device.
  • this application first obtains the subsystems of the system to be simulated; then constructs the parameter-containing subcircuit corresponding to each subsystem; and then Initialize the parameters in each of the parameter-containing quantum circuits; run each of the parameter-containing quantum circuits to obtain the final quantum state of the corresponding subsystem; obtain the system to be simulated based on the final quantum states of all the subsystems
  • the energy expectation in response to the energy expectation not meeting the simulation termination condition, update the parameters in each of the parameter-containing sub-circuits, and return to execute each of the parameter-containing sub-circuits to obtain the final quantum of the corresponding subsystem status steps.
  • An embodiment of the present application provides a quantum neural network training device, which includes a module that executes the method described in any one of Embodiment 1, Embodiment 2, and Embodiment 3.
  • the quantum neural network training device provided by the embodiments of the present application will be described in detail below with reference to Embodiment 4, Embodiment 5, and Embodiment 6 respectively.
  • Figure 9 is a schematic structural diagram of a quantum neural network training device provided in Embodiment 4.
  • it can include a building module 901, obtain Module 902, determination module 903, judgment module 904, update module 905.
  • Building module 901 used to build a quantum neural network model and initialize the parameters of the quantum neural network model
  • Obtaining module 902 is used to select a set of orthonormal bases, and apply the quantum neural network model to the orthonormal bases respectively to obtain the final quantum state corresponding to the orthonormal bases, where,
  • the number of final quantum states is the same as the number of basis vectors contained in the standard orthonormal basis;
  • the determination module 903 is used to determine the loss function according to the final quantum state and the preset weight
  • the judgment module 904 is used to judge whether the optimization termination condition of the quantum neural network model is satisfied based on the loss function, wherein the optimization termination condition is that the value of the loss function converges to a fixed value;
  • the update module 905 is used to update the parameters of the quantum neural network model until the optimization termination condition is met and obtain an optimized quantum neural network model if not.
  • the building blocks include:
  • the building unit is used to build a quantum neural network model based on the system to be simulated and the preset proposed circuit.
  • the building units include:
  • the determination subunit is used to determine the target number of qubits for constructing the quantum neural network model based on the number of tensor multipliers corresponding to the Hamiltonian of the system to be simulated;
  • the construction subunit is used to construct a quantum neural network model including the target number of qubits according to the preset proposed circuit.
  • the building blocks include:
  • the first determination unit is used to determine the initial values of the quantum neural network model parameters according to the preset probability density function.
  • the determination module includes:
  • the second determination unit is used to determine the loss function through the following formula:
  • the is the loss function
  • the 2 n is the number of basis vectors contained in the orthonormal basis
  • the ⁇ k is the weight corresponding to the kth basis vector in the orthonormal basis
  • the ⁇ k is the weight corresponding to the kth basis vector in the orthonormal basis.
  • H is the Hamiltonian corresponding to the system to be simulated.
  • the update module includes:
  • a replacement unit for replacing parameters in the current quantum neural network model with newly generated parameters for replacing parameters in the current quantum neural network model with newly generated parameters
  • a construction unit is used to use the newly generated parameters to construct a quantum circuit with the same structure as the preset proposed circuit, and insert it into the current quantum neural network model.
  • this application first constructs a quantum neural network model, initializes the parameters of the quantum neural network model, selects a set of standard orthogonal bases, and applies the quantum neural network model to the standard orthogonal bases respectively to obtain the standard
  • the final quantum state corresponding to the orthogonal basis determines the loss function based on the final quantum state and the preset weight. Based on the loss function, it is judged whether the optimization termination conditions of the quantum neural network model are met. If not, the parameters of the quantum neural network model are updated until Satisfy the optimization termination conditions and obtain an optimized quantum neural network model.
  • the application scope of the quantum neural network model is broadened and the depth of the quantum circuit is reduced. and the number of qubits, which is conducive to the realization of quantum computing simulations of high-dimensional complex physical systems using quantum neural network models.
  • Figure 10 is a schematic structural diagram of a quantum neural network training device provided in the fifth embodiment, corresponding to the quantum neural network training method provided in the second embodiment shown in Figure 5.
  • the device includes a building module 1001 , initialization module 1002, acquisition module 1003, judgment module 1004, update module 1005.
  • Building module 1001 is used to construct a quantum neural network based on the system to be simulated and the selected design method
  • Initialization module 1002 used to initialize the parameters of the quantum neural network
  • the judgment module 1004 is used to judge whether the training termination condition is met based on a loss function, wherein the loss function is constructed according to the final quantum state;
  • the update module 1005 is configured to update the parameters when the judgment result of the judgment module 1004 is no, so as to satisfy the training termination condition and obtain a trained quantum neural network.
  • the building module 1001 can be specifically used for:
  • a quantum neural network is constructed.
  • the initialization module 1002 can be specifically used to:
  • the initial values of the parameters of the quantum neural network are determined.
  • the judgment module 1003 can be specifically used to:
  • the device may also include:
  • the selection module is used to select a new proposed method when the number of parameter updates reaches the preset value, and return to the execution building module 1001.
  • the update module 1005 may include:
  • an obtaining unit configured to obtain new parameter values using the loss function and the selected optimizer
  • An update unit configured to update the parameter based on the new parameter value.
  • the update unit can be specifically used for:
  • the quantum circuit includes: an RY gate acting on each qubit, a CNOT gate acting on adjacent qubits, and a CNOT gate acting on the first and last qubits.
  • this application first constructs a quantum neural network based on the system to be simulated and the selected design method; then initializes the parameters of the quantum neural network; then runs the quantum neural network to obtain the final quantum state corresponding to the initialization parameters; Then, based on the loss function, it is determined whether the training termination condition is met, where the loss function includes the final quantum state; finally, the parameters are updated to satisfy the training termination condition, and a trained quantum neural network is obtained.
  • quantum computing a new quantum neural network training method is provided, and the loss function is used to determine whether to update parameters to train the quantum neural network, thereby realizing the use of quantum neural networks for quantum computing simulation and filling the gaps in related technologies. .
  • Figure 11 is a schematic structural diagram of a quantum neural network training device provided in Embodiment 6, corresponding to the training method of quantum neural network provided in Embodiment 3 shown in Figure 8.
  • the device includes a first acquisition method.
  • the first obtaining module 1101 is used to obtain the subsystem of the system to be simulated
  • the construction module 1102 is used to construct the parameter-containing subcircuit corresponding to each of the subsystems;
  • the second acquisition module 1104 is used to run each parameter-containing subcircuit to obtain the final quantum state of the corresponding subsystem
  • the third obtaining module 1105 is used to obtain the energy expectation of the system to be simulated based on the final quantum states of all the subsystems;
  • the update module 1106 is configured to update the parameters in each parameter-containing subcircuit in response to the energy expectation not meeting the simulation termination condition, and return to execute the second acquisition module 1104.
  • the first acquisition module 1101 is specifically used to:
  • the system to be simulated is decomposed using the Schmidt decomposition method to obtain subsystems of the system to be simulated.
  • the built module 1102 is specifically used for:
  • a parameter-containing subcircuit is constructed in the following way:
  • the proposed quantum circuit is combined with a preset number of the entangled quantum circuits to obtain the parameter-containing quantum circuit corresponding to the subsystem.
  • the initialization module 11011 is specifically used to:
  • an initial value is determined according to a preset probability density function, and the initial value is used as the value of a parameter in the parameter-containing sub-circuit.
  • the third acquisition module 1105 is specifically used for:
  • the energy expectation of the subsystem is obtained based on the final quantum state of the subsystem
  • the energy expectation of the system to be simulated is obtained based on the constructed energy expectation matrix of the system to be simulated.
  • the update module 1106 is specifically used to:
  • a quantum circuit isomorphic to the entangled quantum circuit in the corresponding parameter-containing subcircuit is constructed and inserted in the parameter-containing subcircuit.
  • this application first obtains the subsystems of the system to be simulated; then constructs the parameter-containing subcircuit corresponding to each subsystem; then initializes the parameters in each parameter-containing subcircuit; and runs each parameter-containing subcircuit.
  • Quantum circuit obtain the final quantum state of the corresponding subsystem; based on the final quantum state of all the subsystems, obtain the energy expectation of the system to be simulated; in response to the energy expectation not meeting the simulation termination condition, update each parameters in the parameter-containing sub-circuit, and return to the step of running each of the parameter-containing sub-circuit to obtain the final quantum state of the corresponding subsystem.
  • Embodiments of the present application also provide a storage medium in which a computer program is stored, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
  • the above-mentioned storage medium may be configured to store a computer program for performing the following steps, including steps S201-S205.
  • step S201 a quantum neural network model used for simulation training of the system to be simulated is constructed, and parameters of the quantum neural network model are initialized.
  • step S202 run the quantum neural network model to obtain the final quantum state corresponding to the initialization parameters.
  • step S203 the loss function or the energy expectation of the system to be simulated is determined based on the final quantum state.
  • step S204 based on the loss function or the energy expectation of the system to be simulated, it is determined whether the termination condition of the quantum neural network model is met.
  • step S205 if not, update the parameters of the quantum neural network model until the termination condition is met, and obtain the trained quantum neural network model.
  • the above-mentioned storage medium may include but is not limited to: U disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), mobile Various media such as hard drives, magnetic disks, or optical disks that can store computer programs.
  • ROM read-only memory
  • RAM random access memory
  • mobile Various media such as hard drives, magnetic disks, or optical disks that can store computer programs.
  • An embodiment of the present application also 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 perform any of the above method embodiments. A step of.
  • the above-mentioned electronic device may further include a transmission device and an input-output device, wherein the transmission device is connected to the above-mentioned processor, and the input-output device is connected to the above-mentioned processor.
  • the above-mentioned processor may be configured to perform the following steps through a computer program, including steps S201-S205.
  • step S201 a quantum neural network model used for simulation training of the system to be simulated is constructed, and parameters of the quantum neural network model are initialized.
  • step S202 run the quantum neural network model to obtain the final quantum state corresponding to the initialization parameters.
  • step S203 the loss function or the energy expectation of the system to be simulated is determined based on the final quantum state.
  • step S204 based on the loss function or the energy expectation of the system to be simulated, it is determined whether the termination condition of the quantum neural network model is met.
  • step S205 if not, update the parameters of the quantum neural network model until the termination condition is met, and obtain the trained quantum neural network model.
  • the termination conditions of the type include: judging whether the termination conditions are met based on the loss function; or judging whether the termination conditions are met based on the energy expectation of the system to be simulated.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Biomedical Technology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Mathematics (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

提供了一种量子神经网络的训练方法及训练装置。该方法包括:构建用于待模拟系统模拟训练的量子神经网络模型,并初始化所述量子神经网络模型的参数;运行所述量子神经网络模型,获得所述量子神经网络模型的参数对应的最终量子态;基于所述最终量子态确定损失函数或者所述待模拟系统的能量期望;基于所述损失函数或所述待模拟系统的能量期望,判断是否满足所述量子神经网络模型的终止条件;若否,更新所述量子神经网络模型的参数,直至满足所述终止条件,获得训练后的量子神经网络模型。本申请通过量子计算方式对神经网络模型进行训练,并利用损失函数或能量期望判断模型的训练是否满足终止条件,有助于实现利用量子神经网络进行量子计算模拟。

Description

量子神经网络的训练方法及训练装置
本申请要求于2022年8月31日提交中国专利局、申请号为202211061102.5、申请名称为“一种量子神经网络模型的优化方法及装置”的中国专利申请的优先权,要求于2022年8月31日提交中国专利局、申请号为202211068194.X、申请名称为“一种量子神经网络训练方法、装置、存储介质及电子装置”的中国专利申请的优先权,要求于2022年8月31日提交中国专利局、申请号为202211068147.5、申请名称为“基于分布式VQE的量子模拟方法、装置及存储介质”的中国专利申请的优先权,这些专利的全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,并且更为具体地涉及一种量子神经网络的训练方法及训练装置。
背景技术
因量子神经网络(Quantum Neural Network,QNN)模型在计算能力方面的优势,目前正在寻求利用量子神经网络模型实现量子计算模拟,但训练好的量子神经网络模型才能实现相应功能。然而,目前并没有较好的训练量子神经网络模型的方法,用来实现量子计算模拟。
发明内容
本申请提供一种量子神经网络的训练方法及训练装置。下面对本申请涉及的各个方面进行介绍。
第一方面,提供了一种量子神经网络的训练方法,所述方法包括:构建用于待模拟系统模拟训练的量子神经网络模型,并初始化所述量子神经网络模型的参数;运行所述量子神经网络模型,获得所述量子神经网络模型的参数对应的最终量子态;基于所述最终量子态确定损失函数或者所述待模拟系统的能量期望;基于所述损失函数或所述待模拟系统的能量期望,判断是否满足所述量子神经网络模型的终止条件;若否,更新所述量子神经网络模型的参数,直至满足所述终止条件,获得训练后的量子神经网络模型。
第二方面,提供了一种量子神经网络的训练装置,包括执行如第一方面中任一项所述方法的模块。
第三方面,提供了一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行如第一方面中任一项所述的方法。
第四方面,提供了一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行如第一方面中任一项所述的方法。
本申请通过量子计算方式对神经网络模型进行训练,并利用损失函数或能量期望判断模型的训练是否满足终止条件,有助于实现利用量子神经网络进行量子计算模拟。
附图说明
图1是本申请实施例适用的计算机终端的硬件结构框图。
图2是本申请实施例提供的一种量子神经网络的训练方法的流程示意图。
图3是本申请实施例一提供的一种量子神经网络的训练方法的流程示意图。
图4是本申请实施例一提供的一种预设拟设线路示意图。
图5为本申请实施例二提供的一种量子神经网络的训练方法的流程示意图。
图6为本申请实施例二提供的一种与拟设方式同构的量子线路示意图。
图7为本申请实施例二提供的一种量子神经网络部分结构的示意图。
图8为本申请实施例三提供的一种量子神经网络的训练方法的流程示意图。
图9是本申请实施例四提供的一种量子神经网络的训练装置的结构示意图。
图10为本申请实施例五提供的一种量子神经网络的训练装置的结构示意图。
图11为本申请实施例六提供的一种量子神经网络的训练装置的结构示意图。
具体实施方式
下面将结合附图,对本申请中的技术方案进行描述。
随着大数据时代的到来以及摩尔定律走到了物理极限,量子神经网络方法孕育而生,量子神经网络(Quantum Neural Network,QNN)模型是基于量子力学原理的神经网络模型,可以以更大的信息容量和高效的并行计算能力,可以更好的解决目前遇到的瓶颈问题。
量子计算模拟是一个借助数值计算和计算机科学来仿真遵循量子力学规律的模拟计算,作为一个仿真程序,它依据量子力学的量子比特的基本定律,利用计算机的高速计算能力,刻画量子态的时空演化。利用量子计算模拟,可以获得一个矩阵的最小本征值和对应的本征向量,还可以获得封闭物理的哈密顿量的基态能量及其对应的量子态。
因量子神经网络在计算能力方面的优势,目前正在寻求利用量子神经网络实现量子计算模拟,但训练好的量子神经网络才能实现相应功能,然而,目前并没有较好的训练量子神经网络的方法,用来实现量子计算模拟。
针对上述问题本申请提供了一种量子神经网络的训练方法,通过量子计算方式对神经网络模型进行训练,并利用损失函数或能量期望判断模型的训练是否满足终止条件,有助于实现利用量子神经网络进行量子计算模拟。
本申请实施例提供的量子神经网络的训练方法可以应用于电子设备,如计算机终端,具体如普通电脑、量子计算机等。
量子计算机是一类遵循量子力学规律进行高速数学和逻辑运算、存储及处理量子信息的物理装置。当某个装置处理和计算的是量子信息,运行的是量子算法时,它就是量子计算机。量子计算机因其具有相对普通计算机更高效的处理数学问题的能力,例如,能将破解RSA密钥的时间从数百年加速到数小时,故成为一种正在研究中的关键技术。
下面以运行在计算机终端上为例对其进行详细说明。图1为本申请实施例的量子神经网络的训练方法适用的计算机终端的硬件结构框图。如图1所示,计算机终端可以包括一个或多个(图1中仅示出一个)处理器102(处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)和用于存储数据的存储器104,可选地,上述计算机终端还可以包括用于通信功能的传输装置106以及输入输出设备108。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述计算机终端的结构造成限定。例如,计算机终端还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。
存储器104可用于存储应用软件的软件程序以及模块,如本申请实施例的量子神经网络的训练方法对应的程序指令/模块,处理器102通过运行存储在存储器104内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至计算机终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
传输装置106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括计算机终端的通信供应商提供的无线网络。在一个实例中,传输装置106包括一个网络适配器(Network Interface Controller,NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输装置106可以为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。
量子计算是一种遵循量子力学规律调控量子信息单元进行计算的新型计算模式,其中,量子计算基于的最基本的一个原理为量子力学态叠加原理,量子力学态叠加原理使得量子信息单元的状态可以处于多种可能性的叠加状态,从而使得量子信息处理从效率上相比于经典信息处理具有更大潜力。一个量子系统包含若干粒子,这些粒子按照量子力学的规律运动,称此系统处于态空间的某种量子态,而对于化学分子来说,可以实现量子化学模拟,为量子计算提供研究支持。
需要说明的是,真正的量子计算机是混合结构的,它包含两大部分:一部分是经典计算机,负责执行经典计算与控制;另一部分是量子设备,负责运行量子程序进而实现量子计算。而量子程序是由量子语言如QRunes语言编写的一串能够在量子计算机上运行的指令序列,实现了对量子逻辑门操作的支持,并最终实现量子计算。具体的说,量子程序就是一系列按照一定时序操作量子逻辑门的指令序列。
在实际应用中,因受限于量子设备硬件的发展,通常需要进行量子计算模拟以验证量子算法、量子应用等等。量子计算模拟即借助普通计算机的资源搭建的虚拟架构(即量子虚拟机)实现特定问题对应的量子程序的模拟运行的过程。通常,需要构建特定问题对应的量子程序。本申请实施例所指量子程序,即是经典语言编写的表征量子比特及其演化的程序,其中与量子计算相关的量子比特、量子逻辑门等等均有相应的经典代码表示。
量子线路作为量子程序的一种体现方式,也称量子逻辑电路,是最常用的通用量子计算模型,表示在抽象概念下对于量子比特进行操作的线路,其组成包括量子比特、线路(时间线),以及各种量子逻辑门,最后常需要通过量子测量操作将结果读取出来。
不同于传统电路是用金属线所连接以传递电压信号或电流信号,在量子线路中,线路可看成是由时间所连接,亦即量子比特的状态随着时间自然演化,在这过程中按照哈密顿运算符的指示,一直到遇上 逻辑门而被操作。
一个量子程序整体上对应有一条总的量子线路,本申请所述量子程序即指该条总的量子线路,其中,该总的量子线路中的量子比特总数与量子程序的量子比特总数相同。可以理解为:一个量子程序可以由量子线路、针对量子线路中量子比特的测量操作、保存测量结果的寄存器及控制流节点(跳转指令)组成,一条量子线路可以包含几十上百个甚至千上万个量子逻辑门操作。量子程序的执行过程,就是对所有的量子逻辑门按照一定时序执行的过程。需要说明的是,时序即单个量子逻辑门被执行的时间顺序。
需要说明的是,经典计算中,最基本的单元是比特,而最基本的控制模式是逻辑门,可以通过逻辑门的组合来达到控制电路的目的。类似地,处理量子比特的方式就是量子逻辑门。使用量子逻辑门,能够使量子态发生演化,量子逻辑门是构成量子线路的基础,量子逻辑门包括单比特量子逻辑门,如Hadamard门(H门,阿达马门)、泡利-X门(X门)、泡利-Y门(Y门)、泡利-Z门(Z门)、RX门、RY门、RZ门等等;两比特或多比特量子逻辑门,如CNOT门、CR门、CZ门、iSWAP门、Toffoli门等等。量子逻辑门一般使用酉矩阵表示,而酉矩阵不仅是矩阵形式,也是一种操作和变换。一般量子逻辑门在量子态上的作用是通过酉矩阵左乘以量子态右矢对应的矩阵进行计算的。
本领域技术人员可以理解的是,在经典计算机中,信息的基本单元是比特,一个比特有0和1两种状态,最常见的物理实现方式是通过电平的高低来表示这两种状态。在量子计算中,信息的基本单元是量子比特,一个量子比特也有0和1两种状态,记为|0>和|1>,但它可以处于0和1两种状态的叠加态,可表示为其中,a、b为表示|0>态、|1>态振幅(概率幅)的复数,这是经典比特不具备的。测量后,量子比特的状态会塌缩至一个确定的状态(本征态,此处为|0>态、|1>态),其中,塌缩至|0>的概率是|a|2,塌缩至|1>的概率是|b|2,|a|2+|b|2=1,|>为狄拉克符号。
量子态,即指量子比特的状态,一般需要使用一组正交完备的基向量描述,其通常使用的计算基在量子算法(或称量子程序)中用二进制表示。例如,一组量子比特为q0、q1、q2,表示第0位、第1位、第2位量子比特,从高位到低位排序为q2q1q0,该组量子比特的量子态为23个计算基的叠加态,8个计算基是指:|000>、|001>、|010>、|011>、|100>、|101>、|110>、|111>,每个计算基与量子比特位对应一致,如|000>态,000从高位到低位对应q2q1q0。简言之,量子态是各基向量组成的叠加态,当其他基的概率幅为0时,即处于其中一个确定的基向量。
在量子力学中,所有的可测量的力学量都可以用一个厄密矩阵来描述,厄密矩阵的定义是,该矩阵的转置共轭即是该矩阵本身,即有:这样的矩阵通常称之为测量算符,非零算符都会有至少一个不为0的本征值λ以及与之对应的本征态|ψ>,满足H|ψ>=λ|ψ>,如果算符H的本征值对应的是某一个体系的能级分布,那么这样的算符也可以称其为哈密顿量(Hamiltonian)。
根据含时薛定谔方程,从一个态|ψ(t=0)>开始演化到另一个态|ψ(t=T)>是利用酉算符完成的,即U(0,T)|ψ(t=0)>=|ψ(t=T)>,其中,哈密顿量和酉算符的关系是,如果一个量子态在某个系统下自然演化,描述该系统的能量即哈密顿量,则酉算符可以由哈密顿量写出:
当系统从时间0开始,且哈密顿量不随时间变化时,酉算符即U=exp(-iHt)。在封闭系统的量子计算中,除测量外,所有的量子操作都可以用一个酉矩阵来描述,酉矩阵的定义是,该矩阵的转置共轭即是该矩阵的逆,即有:一般来说,酉算符在量子计算中也称之为量子逻辑门。
下面对本申请实施例的神经网络的训练方法做进一步描述,图2是本申请实施例的神经网络的训练方法的流程示意图,包括步骤S201-S205。
在步骤S201,构建用于待模拟系统模拟训练的量子神经网络模型,并初始化量子神经网络模型的参数。
在步骤S202,运行量子神经网络模型,获得初始化参数对应的最终量子态。
在步骤S203,基于最终量子态确定损失函数或者待模拟系统的能量期望。
在步骤S204,基于损失函数或待模拟系统的能量期望,判断是否满足量子神经网络模型的终止条件。
在步骤S205,若否,更新量子神经网络模型的参数,直至满足终止条件,获得训练后的量子神经网络模型。
在一种可能的实现方式中,基于损失函数或待模拟系统的能量期望,判断是否满足量子神经网络模型的终止条件,包括:基于损失函数,判断是否满足终止条件;或基于待模拟系统的能量期望,判断是否满足终止条件。
下面通过不同的实施例从不同的角度对本申请实施例的神经网络的训练方法进行详细描述,包括实施例一、实施例二和实施例三。
实施例一
参见图3,图3为实施例一中量子神经网络的训练方法的流程示意图,可以包括步骤S301-S305。
S301:构建量子神经网络模型,并初始化所述量子神经网络模型的参数。
具体的,构建量子神经网络模型,可以包括:根据待模拟系统和预设拟设线路,构建量子神经网络模型。
待模拟系统是需要利用量子神经网络进行量子计算模拟的系统,待模拟系统可以是方程,也可以是分子,还可以是其他系统。拟设是一种将制备好的初态演化到量子线路上的方法,拟设方式不同,量子神经网络的结构也可能不同,量子神经网络的结构随着待模拟系统和拟设方式不同可能有所不同。
在本申请的一些可能的实施方式中,根据待模拟系统和预设拟设线路,构建量子神经网络模型,可以包括:
1.根据待模拟系统对应哈密顿量的张乘项数,确定构建量子神经网络模型的目标量子比特数;
2.根据预设拟设线路,构建包含所述目标量子比特数的量子神经网络模型。
哈密顿量是所有粒子的动能的总和加上与系统相关的粒子的势能。对于不同的情况或数量的粒子,哈密顿量是不同的,因为它包括粒子的动能之和以及对应于这种情况的势能函数,一般用H表示。在量子力学中,经典力学的物理量变为相应的算符,哈密顿量对应的正是哈密顿算符通常来说,为了能在量子设备上处理量子计算模拟问题,哈密顿量会被表示为泡利算符{X,Y,Z,I}的加权求和形式,其中,张乘项数是目标量子比特数:
其中,ck为权重系数,σ为泡利算子,M为目标量子比特的数量。
在确定拟设方式后,将对应的量子逻辑门作为在量子比特上,将初态演化到量子神经网络中,具体的,量子神经网络中的量子比特数量可以为目标量子比特数。拟设方式可以根据不同的情况进行选择,示例性的,选择的拟设方式可以是酉耦合簇算符(Unitary Coupled Cluster,UCC),对应拟设公式为:
其中,量子线路对应的矩阵算子其中,即为拟设,Pi为生成元。
拟设方式还可以为ADAPT(adaptive derivative-assembled pseudo-Trotter),可看作基于UCC的一种改进。当然,拟设方式还可以为HE(Hardware Efficient,硬件高效)、SP(Symmetry Preserved,对称保持)等等。在本申请实施例中,还未进行训练的量子神经网络中拟设方式的层数(拟设方式的深度)与目标量子比特数有关,具体的,初始层数可以为目标量子比特数量。更具体的,根据拟设方式构建的神经网络中可以包含纠缠量子线路,则拟设方式的深度可以是同构纠缠量子线路的数量。
在一种可选的实施方式中,参见图4,图4为本申请实施例提供的一种预设拟设线路示意图,所述预设拟设线路,可以包括:第一拟设线路模块和第二拟设线路模块,其中,所述第一拟设线路模块由依次作用于后两个量子比特的RX门、RZ门和CNOT门组成,所述第二拟设线路模块由依次作用于每个量子比特的RX门、RZ门、以及作用于相邻量子比特的CNOT门组成。
其中,初始化所述量子神经网络模型的参数,可以包括:根据预设的概率密度函数,确定所述量子神经网络模型参数的初始值。
具体的,在本申请实施例中,可以根据经验设置参数值,也可以根据算法选择数值作为参数的初始值。
在本申请一些可能的实施方式中,初始化所述量子神经网络的参数,可以包括:根据预设的概率密度函数,初始化所述参数。
需要说明的是,概率密度函数可以是根据实际情况选择,可以是根据概率密度函数和预设拟设方式之间的映射关系确定的。这里所说的参数可以不止一个,当参数不止一个时,可以分别初始化也可以同时初始化,在此不做限定。初始化的参数值可以从随机从概率密度函数的函数值中选择的数值,也可以按照一定的规则选择的数值。例如,概率密度函数可以是均匀分布的概率密度函数,根据均匀分布的概率密度函数的性质可知,参数的初始值为1/(b-a),示例性的,b为2π,a为0,初始化的参数值为1/2π。
S302:选择一组标准正交基,并将所述量子神经网络模型分别作用于所述标准正交基上,获得所述标准正交基对应的最终量子态,其中,所述最终量子态的个数与所述标准正交基所含基向量的个数相同。
具体的,通过作用量子神经网络在一组正交的初始态上(可以取标准正交基|0><0|、|0><1|、|1><0|、|1><1|),将得到标准正交基对应的最终量子态|ψ1(θ)>、|ψ2(θ)>、|ψ3(θ)>、|ψ4(θ)>。
S303:根据所述最终量子态及预设权重,确定损失函数。
具体的,在量子神经网络模型中的损失函数一般由每个输出量子态|ψk(θ)>关于哈密顿量H的能量 期望值(expectation value)的加权求和给出。可以默认权重向量
其中,通过以下算式,确定损失函数:
其中,所述为损失函数,所述2n为标准正交基所含基向量的个数,所述ωk为标准正交基中第k个基向量对应的权重,所述ψk为标准正交基中第k个基向量对应的最终量子态,所述H为待模拟系统对应哈密顿量。
S304:基于所述损失函数,判断是否满足所述量子神经网络模型的优化终止条件,其中,所述优化终止条件为所述损失函数的值收敛为固定值。
具体的,基于损失函数,判断是否满足量子神经网络模型的优化终止条件其实是判断量子神经网络是否已经训练好,当损失函数满足的值收敛为固定值时,例如损失函数的值收敛为零或者其他数值,就会得到训练好的量子神经网络模型,即基于量子神经网络的变分量子本征求解器(Variational Quantum Eigensolver,VQE)模型。
在一种可选的实施方式中,也可以判断当前损失函数的值与前一次得到的损失函数的值的差值是否满足预设的精度。随着量子神经网络模型的优化,损失函数的值会越来越小,即当前损失函数的值与前一次损失函数的值的差值也会越来越小,优化的目的是使损失函数的值收敛为固定值。当前损失函数的值和前一次损失函数的值差值在预设范围内,说明损失函数的值已经近似等于待模拟系统的基态能量,基于此对后续的研究与基于基态能量进行后续的研究差别不大,为了减少计算资源的浪费,则终止优化,此时量子神经网络模型就优化好了。这里所说的预设的精度可以由优化想要达到的精度确定的,比如精度为10-5,则预设范围可以为(0,10-5)。
S305:若否,更新所述量子神经网络模型的参数,直至满足所述优化终止条件,获得优化好的量子神经网络模型。
具体的,当损失函数的值未收敛为固定值,说明此时量子神经网络模型还没优化好,还需要继续优化,此时需要更新参数,进入到新一轮的优化。
其中,更新量子神经网络模型参数的方法有很多,只要使得损失函数的值收敛即可,例如,可以设置一个定值,将当前参数值与定值的差或和作为新的参数值;也可以通过当前损失函数的值与前一次损失函数的值,确定参数值减少的权重,基于减少权重,更新参数值。
在一种可选的实施方式中,利用损失函数和所选择的优化器,获得新的参数值,并基于新的参数值,更新参数。
具体的,优化器在深度学习反向传播过程中,指引损失函数的参数往正确的方向更新合适的大小,使得更新后的参数让损失函数值不断逼近全局最小。
利用损失函数和所选择的优化器,计算参数下降的梯度,具体的计算方法与优化器的类型有关,然后,在获得梯度之后,利用优化器对应的参数更新算式,获得新的参数值,示例性的,参数更新算式可以为:θi+1=θi-αgt,其中,θi为当前参数,θi+1为新的参数值,α为学习速率,gt为当前参数的梯度,α可以是在配置量子神经网络时设置的。
在另一种可选的实施方式中,更新所述量子神经网络模型的参数,可以包括:
利用新生成的参数替换当前所述量子神经网络模型中的参数;或
利用新生成的参数,构造与所述预设拟设线路结构相同的量子线路,并插设在当前所述量子神经网络模型中。
具体的,更新参数的方式有两种:一种是直接更新,另一种是现有的量子神经网络中的参数不变,在当前神经网络中与拟设方式同构的量子线路,即增加的量子神经网络的层数,所增加的量子线路在当前拟设方式结构之后,新的参数值是构造的量子线路中的参数。
可见,本申请首先构建量子神经网络模型,并初始化量子神经网络模型的参数,选择一组标准正交基,并将量子神经网络模型分别作用于标准正交基上,获得标准正交基对应的最终量子态,根据最终量子态及预设权重,确定损失函数,基于损失函数,判断是否满足量子神经网络模型的优化终止条件,若否,更新量子神经网络模型的参数,直至满足优化终止条件,获得优化好的量子神经网络模型,它通过获取标准正交基对应的最终量子态,并引入权重构造损失函数,拓宽量子神经网络模型的应用范围,并减少了量子线路的深度和量子比特数,有利于利用量子神经网络模型进行高维复杂物理系统的量子计算模拟的实现。
实施例二
参见图5,图5为实施例二中量子神经网络的训练方法的流程示意图,可以包括步骤S501-S505。
S501:根据待模拟系统和所选择的拟设方式,构建量子神经网络。
待模拟系统是需要利用量子神经网络进行量子计算模拟的系统,待模拟系统可以是方程,也可以是分子,还可以是其他系统。拟设是一种将制备好的初态,例如|ψ>(Hartree-Fock)演化到量子线路上的方法。拟设方式不同,量子神经网络的结构也可能不同,量子神经网的结构随着待模拟系统和拟设方式不同可能有所不同。
在本申请的一些可能的实施方式中,根据待模拟系统和所选择的拟设方式,构建量子神经网络,可以包括:
根据待模拟系统对应哈密顿量的张乘项数,确定构建量子神经网络的目标量子比特数;
根据所选择的拟设方式和所述目标量子比特数,构建量子神经网络。
哈密顿量是所有粒子的动能的总和加上与系统相关的粒子的势能。对于不同的情况或数量的粒子,哈密顿量是不同的,因为它包括粒子的动能之和以及对应于这种情况的势能函数,一般用H表示。在量子力学中,经典力学的物理量变为相应的算符,哈密顿量对应的正是哈密顿算符。通常来说,为了能在量子设备上处理量子计算模拟问题,哈密顿量会被表示为泡利算符{X,Y,Z}的加权求和形式,其中,张乘项数是目标量子比特数:
其中,ck为权重系数,σ为泡利算子,M为目标量子比特数。
在确定拟设方式后,将对应的量子逻辑门作为在量子比特上,将初态演化到量子神经网络中,具体的,量子神经网络中的量子比特数量可以大于等于目标量子比特数。拟设方式可以根据不同的情况进行选择,示例性的,选择的拟设方式可以是酉耦合簇算符(Unitary Coupled Cluster,UCC),对应拟设公式为:
其中,量子线路对应的矩阵算子其中,即为拟设,Pi为生成元。
拟设方式还可以为ADAPT(Adaptive Derivative-Assembled Pseudo-Trotter),可看作基于UCC的一种改进。当然,拟设方式还可以为HE(Hardware Efficient,硬件高效)、SP(Symmetry Preserved,对称保持)等等。在本申请实施例中,还未进行训练的量子神经网络中拟设方式的层数(拟设方式的深度)与目标量子比特数有关,具体的,初始层数可以为目标量子比特数量。更具体的,根据拟设方式构建的神经网络中可以包含纠缠量子线路,则拟设方式的深度可以是同构纠缠量子线路的数量。
S502:初始化所述量子神经网络的参数。
在本申请实施例中,可以根据经验设置参数值,也可以根据算法选择数值作为参数的初始值。
在本申请一些可能的实施方式中,初始化所述量子神经网络的参数,可以包括:
根据预设的概率密度函数,确定所述量子神经网络的参数的初始值。
需要说明的是,概率密度函数可以是根据实际情况选择,可以是根据概率密度函数和拟设方式之间的映射关系确定的。这里所说的参数可以不止一个,当参数不止一个时,可以分别初始化。初始值可以从随机从概率密度函数的函数值中选择的数值,也可以按照一定的规则选择的数值,将所选择的初始值赋值给参数
概率密度函数可以是均匀分布的概率密度函数,根据均匀分布的概率密度函数的性质可知,参数的初始值为1/(b-a),示例性的,b为2π,a为0,初始化的参数值为1/2π。
S503:运行所述量子神经网络,获得初始化参数对应的最终量子态。
当运行量子神经网络,待模拟系统的初态将在量子神经网络中模拟演化,得到最终量子态。通过作用量子神经网络U(θ)在初态上,初态可以为|0…0>,得到初始化参数对应的最终量子态|ψ(θ)>,θ是量子神经网络中的参数(即本申请实施例所说的参数)组成的向量。
S504:基于损失函数,判断是否满足训练终止条件,其中,所述损失函数根据所述最终量子态构造。
损失函数一般由最终量子态关于待模拟系统的哈密顿量的期望值决定的,具体的,在本申请实施例中,可以用以下形式表示:
其中,是损失函数,上述算式通过θ的变化,找到最小的损失函数的值,即寻找基态能量或最小的期望。
在获得最终量子态|ψ(θ)>后,利用量子期望估计算法来计算最终量子态|ψ(θ)>在待模拟系统对应的哈密顿量上的期望。所谓量子期望估计,是指对于多电子体系、Heisenberg模型(海森堡模型)、量子Ising模型(易辛模型)等体系的哈密顿量H可以展开成多个子项的和,即:
其中,h为实数,σ为泡利算子,α、β和γ∈(X,Y,Z,I),而i、j、k表示哈密顿量子项所作用的子空间。
由于可观测量是线性的,因此在利用下式计算待模拟系统的期望E时:
E=<ψ*|H|ψ>
其中,ψ*与ψ是正交归一的,等式右边也可以展开成这种形式:
由此可知,只须先对每个子项求期望,然后对各个期望求和,就能得到待模拟系统的期望值,需要说明的是,每个子项期望的测量可以在量子神经网络上进行,利用经典处理器对各个期望进行求和,具体的,可以利用每个子项的测量线路获得各个子项的期望值,每个子项的测量线路可以是将模拟该子项所需的量子逻辑门作用在量子比特上得到的。
判断是否满足计算终止条件,其实是判断量子神经网络是否已经训练好,当损失函数满足计算终止条件,就会得到训练好的量子神经网络,即基于量子神经网络的VQE。
在本申请实施例中,可以判断损失函数的值是否小于等于通过经典计算得到的基态能量,也可以判断当前损失函数的值与之前得到的损失函数的值的差值是否满足预设的精度,还可以是其他的方式。
在本申请一些可能的实施方式中,所述基于损失函数,判断是否满足训练终止条件,可以包括:
判断当前所述损失函数的值和前次损失函数的值的差值在预设范围内;
如果否,判断参数更新次数是否达到预设值;
如果未达到,执行更新所述参数,用以满足所述训练终止条件,从而获得训练好的量子神经网络的步骤;
当参数更新次数达到所述预设值,所述方法还可以包括:
选择新的拟设方式,并返回执行根据待模拟系统和所选择的拟设方式,构建量子神经网络的步骤。
随着量子神经网络的训练,损失函数的值会越来越小,即当前损失函数的值与前次损失函数的值的差值也会越来越小,训练的目的是使损失函数的值逼近基态能量。当前损失函数的值和前次损失函数的值差值在预设范围内,说明损失函数的值已经近似等于基态能量,基于此对后续的研究与基于基态能量进行后续的研究差别不大,为了减少计算资源的浪费,则终止训练,此时量子神经网络就训练好了。这里所说的预设范围可以由训练想要达到的精度确定的,比如精度为10-5,则预设范围可以为(0,10-5)。
如果差值不在预设范围内,此时需要判断参数更新次数达到预设值,如果没有达到,则执行S504,如果达到,说明现有的拟设方式可能不能获得训练好的量子神经网络,需要选择新的拟设方式,重新训练。预设值设置的目的是当拟设方式选择不合理等影响训练收敛等因素出现时,避免无休止地训练。预设值可以经验设置,比如50,也可以根据算法计算得到。
S505:更新所述参数,用以满足所述训练终止条件,从而获得训练好的量子神经网络。
当差值不在预设值范围内,且参数更新次数未达到预设值,说明此时量子神经网络还没训练好,还需要继续训练,此时需要更新参数,进入到新一轮的训练。更新参数的方法有多种多样,只要使得损失函数的值收敛即可,例如,可以设置一个固定值,将当前参数值与固定值的差值作为新的参数值;也可以通过当前与前一次损失函数的值,确定参数值减少的权重,基于减少权重,更新参数值。
在本申请一些可能的实施方式中,所述更新所述参数,可以包括:
利用所述损失函数和所选择的优化器,获得新的参数值;
基于所述新的参数值,更新所述参数。
优化器在深度学习反向传播过程中,指引损失函数的参数往正确的方向更新合适的大小,使得更新后的参数让损失函数值不断逼近全局最小。这里所说的优化器可以为SGD(Stochastic Gradient Descent,随机梯度下降法)、BGD(Batch Gradient Descent,批量梯度下降)、MBGD(Mini-Batch Gradient Descent,小批量梯度下降)、NAG(Nesterov Accelerated Gradient,牛顿动量梯度下降)、Momentum(动量梯度下降)、Adagrad(Adaptive gradient algorithm,自适学习率应梯度下降)、RMSProp和Adma任一种,具体的,可以根据待模拟系统、拟设方式、预设值等因素考虑,进行选择。Adma吸收了Adagrad和动量梯度下降算法的优点,既能适应稀疏梯度(即自然语言和计算机视觉问题),又能缓解梯度震荡的问题。RMSProp在AdaGrad基础上,做了小的改进。
优化器利用损失函数,计算参数下降的梯度,具体的计算方法与优化器的类型有关,然后,在获得 梯度之后,利用优化器对应的参数更新算式,获得新的参数值,示例性的,参数更新算式可以为:θi+1=θi-αgt,其中,θi为当前参数,θi+1为新的参数值,α为学习速率,gt为当前参数的梯度,α是在配置量子神经网络时设置的。
在本申请实施例中,优化器通过前向传播计算损失函数,然后在动态图机制下,根据损失函数,反向传播获得参数下降的梯度。
在本申请一些可能的实施方式中,所述更新所述参数,可以包括,所述基于所述新的参数值,更新所述参数,可以包括:
利用所述新的参数值替换当前所述量子神经网络中的参数的值;或
利用所述新的参数值,构造与所选择的拟设方式结构相同的量子线路,并插设在当前所述量子神经网络中。
更新参数的方式有两种:一种是直接替换,另一种是现有的量子神经网络中的参数值不变,在当前神经网络中与拟设方式同构的量子线路,即增加的量子神经网络的层数,所增加的量子线路在当前拟设方式结构之后,新的参数值是构造的量子线路中的参数的值。所构造的量子线路,进一步的说可以是与上述所说的纠缠量子线路同构的量子线路。
在本申请一些可能的实施方式中,所述量子线路可以包括:作用于每个量子比特的RY门、作用于相邻量子比特的CNOT门以及作用于第一个和最后一个量子比特的CNOT门。
示例性的,以4个量子比特为例,上述所说的与拟设方式同构的量子线路可以如图6所示,量子线路包含作用于先相邻量子比特的CNOT门,作用在第一个和第四个量子比特的CNOT门,作用于每个量子比特上的RY门,每个RY门都是含参的,即RY门的旋转角度就是参数。量子线路会随着拟设方式的变化而变化。在图6的基础上,量子神经网络的部分结构可以如图7所示,图中,虚线框中的结构就是拟设方式对应的结构,虚框代表一层,初始的量子神经网络中拟设方式的层数可以等于量子比特的数量,具体的,层数是根据待模拟系统对应的哈密顿量的表现形式设置的,层数可以随着量子神经网络的训练次数的增加而增加。
可见,本发明先根据待模拟系统和所选择的拟设方式,构建量子神经网络;再初始化所述量子神经网络的参数;然后,运行所述量子神经网络,获得初始化参数对应的最终量子态;再基于损失函数,判断是否满足训练终止条件,其中,所述损失函数包含所述最终量子态;最后,更新所述参数,用以满足所述训练终止条件,获得训练好的量子神经网络。通过量子计算方式,提供一种新的量子神经网络的训练方法,并利用损失函数判断是否更新参数来进行量子神经网络的训练,从而实现了利用量子神经网络进行量子计算模拟,填补了相关技术的空白。
实施例三
参见图8,图8为实施例三中的量子神经网络的训练方法的流程示意图,该训练方法基于分布式VQE,可以包括步骤S801-S806。
S801:获得待模拟系统的子系统。
待模拟系统是需要利用分布式VQE进行量子计算模拟的系统,待模拟系统可以是方程,也可以是分子,还可以是其他系统,具体的,待模拟系统是复合系统,可以由多个子系统组成,根据算法或规则,可以将待模拟系统分解,获得多个子系统,即待模拟系统可以表示为多个子系统的组合。量子纠缠性和可分性是复合系统的量子态的性质。子系统可以是预先分解待模拟系统得到的,还可以是从其他设备得到的,还可以是当前分解待模拟系统得到的。
在本申请的一些可能实施方式中,所述获得待模拟系统的子系统,可以包括:
利用施密特分解方法分解所述待模拟系统,获得所述待模拟系统的子系统。
在本申请实施例中,施密特分解是分解待模拟系统的一种方式。下面以将待模拟系统分为A、B两个子系统为例,通过公式对施密特分解进行详细说明:
对于任意处于待模拟系统AB上的纯态,有如下分解:
其中,|i>和|j>分别是子系统A、B上的计算基底,aij是分解得到的系数矩阵a中的元素。
对系数矩阵a运用奇异值分解(Singular Value Decomposition,SVD),得到a=udv,其中,u、v是酉矩阵,d是对角矩阵。那么,aij=∑kuikdkkvkj。基于此,上述的分解可以表示为:
形如的分解方式称为施密特分解,λk是施密特系数,λk=dkk,非零λk的数量称为|ψ>的施密特秩。|kA>和|kB>分别为子系统A、B的一组标准正交态。
基于上述分解原理,利用施密特分解待模拟系统,假设分解得到的子系统包含N/2个量子比特,则该待模拟系统的试探波函数可以表示为:
其中,S是一个自定义的常数,可以根据施密特秩确定,N是待模拟系统的量子比特数量,U(θ)是一个子系统,V(φ)是另一个子系统,θ、φ分别为对应子系统中的参数。
在本申请实施例中,自定义常数S可以根据子系统间的纠缠强弱确定,对于子系统间相互作用弱的哈密顿量而言,其基态在子系统间纠缠较弱,其施密特秩较低,可以被一个较小的自定义常数S精确且高效地模拟,因此,可以将自定义常数S的值设置的比较小。相反的,对于子系统间相互作用强的哈密顿量而言,其基态在子系统间纠缠较强,需要一个较大的自定义常数S来模拟,因此,可以将自定义常数S的值设置的大一点。
S802:分别构建每一所述子系统对应的含参量子线路。
针对不同的子系统,根据其性质,构建对应的含参量子线路,针对不同的子系统,构建的含参量子线路可能相同。
在本申请的一些可能实施方式中,分别构建每一所述子系统对应的含参量子线路,可以包括:
针对每一所述子系统,通过以下方式构建含参量子线路:
根据该子系统对应的哈密顿量,确定量子比特数量;
基于所确定的量子比特数量和选择的拟设方式,构建拟设量子线路;
构建纠缠量子线路;
组合所述拟设量子线路和预设数量个所述纠缠量子线路,以获得该子系统对应的含参量子线路。
哈密顿量是所有粒子的动能的总和加上与系统相关的粒子的势能。对于不同的情况或数量的粒子,哈密顿量是不同的,因为它包括粒子的动能之和以及对应于这种情况的势能函数,一般用H表示。在量子力学中,经典力学的物理量变为相应的算符,哈密顿量对应的正是哈密顿算符。待模拟系统对应的哈密顿量可以基于对待模拟系统进行力学分析得到的,也可以根据待模拟系统的性质和此类系统对应的哈密顿量确定的,当然还可以有其他的方式获得。在本申请实施例中,可以硬编码待模拟系统对应的哈密顿量,具体的,可以将其构造成泡利算符的加权求和形式,基于此,还可以构造各个子系统对应的哈密顿量。
待模拟系统分解为多个子系统,对应的,哈密顿量也会分解为多个,以待模拟系统分解为A、B两个子系统为例,待模拟系统对应的哈密顿量可以表示为:
其中,t是演化时间,ct是权重系数,是子系统A对应的哈密顿量,是子系统B对应的哈密顿量。
在本申请实施例中,可以将泡利算符形式的哈密顿量的张乘项数,作为量子比特数量,当然,也存在其他利用哈密顿量确定量子比特数量的方式,比如,根据哈密顿量等效的酉矩阵的阶数,确定量子比特数量。
拟设是一种将制备好的初态,例如|ψ>(Hartree-Fock)演化到量子线路上的方法。拟设方式不同,拟设量子线路的结构也可能不同。拟设方式可以根据不同的情况进行选择,示例性的,选择的拟设方式可以是酉耦合簇算符(Unitary Coupled Cluster,UCC),对应拟设公式为:
其中,量子线路对应的矩阵算子其中,即为拟设,Pi为生成元。
拟设方式还可以为ADAPT(Adaptive Derivative-Assembled Pseudo-Trotter),可看作基于UCC的一种改进。当然,拟设方式还可以为HE(Hardware Efficient,硬件高效)、SP(Symmetry Preserved,对称保持)等等。
为了将初态演化到最终量子态,还需要构建纠缠量子线路,具体的是添加具有纠缠作用的量子逻辑门作用在量子比特上,获得纠缠量子线路,纠缠量子线路中包含带有参数的量子逻辑门,构建的纠缠量子线路的数量可以是预先设置的。在获得拟设量子线路和纠缠量子线路后,依序连接拟设量子线路和预设数量个纠缠量子线路,得到含参量子线路。
S803:初始化每一所述含参量子线路中的参数。
在本申请实施例中,可以根据经验设置参数值,也可以根据算法选择数值作为参数的初始值。针对不同的含参量子线路,可以设置相同的初始值,也可以设置不同的初始值。
在本申请一些可能的实施方式中,初始化每一所述含参量子线路中的参数,可以包括:
针对每一所述含参量子线路,根据预设的概率密度函数,确定初始值,并将所述初始值作为该含参量子线路中的参数的值。
需要说明的是,概率密度函数可以是根据实际情况选择,可以是根据概率密度函数和拟设方式之间的映射关系确定的。当参数不止一个时,可以分别初始化。初始化的参数值可以从随机从概率密度函数的函数值中选择的数值,也可以按照一定的规则选择的数值。
概率密度函数可以是均匀分布的概率密度函数,根据均匀分布的概率密度函数的性质可知,参数的初始值为1/(b-a),示例性的,b为2π,a为0,初始化的参数值为1/2π。
S804:运行每一所述含参量子线路,获得对应的子系统的最终量子态。
当运行所有含参量子线路,子系统的初态将在含参量子线路中进行模拟演化,得到各子系统对应的最终量子态。
S805:基于所有所述子系统的最终量子态,获得所述待模拟系统的能量期望。
在各子系统对应的最终量子态后,可以利用量子期望估计算法来计算最终量子在子系统对应的哈密顿量上的能量期望。所谓量子期望估计,是指对于多电子体系、Heisenberg模型(海森堡模型)、量子Ising模型(易辛模型)等系统的哈密顿量H可以展开成多个子项的和,即:
其中,h为实数,σ为泡利算子,α、β和γ∈(X,Y,Z,I),而i、j、k表示哈密顿量子项所作用的子空间。
由于可观测量是线性的,因此在利用下式计算子系统的能量期望E时:
E=<ψ*|H|ψ>
其中,ψ*与ψ是正交归一的,等式右边也可以展开成这种形式:
由此可知,只须先对每个子项求能量期望,然后对各个能量期望求和,就能得到子系统的能量期望值,具体的,可以利用经典处理器对各个能量期望进行求和,具体的,可以利用每个子项的测量线路获得各个子项的能量期望,每个子项的测量线路可以是将模拟该子项所需的量子逻辑门作用在量子比特上得到的。在获得各子系统的能量期望,即可根据待模拟系统对应的哈密顿量与子系统对应的哈密顿量之间的关系,获得待模拟系统的能量期望。
在本申请一些可能的实施方式中,基于所有子系统的最终量子态,获得所述待模拟系统的能量期望,可以包括:
针对每一子系统,基于该子系统的最终量子态,获得该子系统的能量期望;
利用所有子系统的能量期望,基于构建的所述待模拟系统的能量期望矩阵,获得所述待模拟系统的能量期望。
待模拟系统的能量期望矩阵可以根据分解后的待模拟系统对应的哈密顿量构建,更具体的,根据分解后的待模拟系统对应的哈密顿量确定权重系数,并基于子系统的能量期望的关系构建哈密顿量能量期望矩阵,当获得子系统的能量期望,就可以利用能量期望矩阵获得待模拟系统的能量期望。以待模拟系统包括2个子系统,2个字系统的量子比特均为N/2为例,构建的能量期望矩阵可以为:
其中, 为子系 统A的能量期望,是子系统B的能量期望。
现有传统的VQE是将待模拟系统作为一个整体进行模拟,分布式VQE是将待模拟系统的子系统分别进行模拟,即利用分布式策略进行量子模拟。基于上述施密特分解可知,S的上限是则子系统对应的哈密顿量的维度上限为期望矩阵M的维度上限也为这仍然比待模拟系统对应的哈密顿量对应的酉矩阵的维度2N*2N要小的多,因此,分布式VQE的效率优于现有传统的VQE。
S806:响应于所述能量期望未满足模拟终止条件,更新每一所述含参量子线路中的参数,并且返回执行运行每一所述含参量子线路,获得对应的子系统的最终量子态的步骤。
模拟终止条件是在有限次的模拟中使得能量期望最小化,即获得目标基态能量,基于上述能量期望矩阵,获得目标基态能量可以表示为:
其中,Etar是目标基态能量,E(θ,φ)是待模拟系统的能量期望,基于上式可知,E(θ,φ)是M(θ,φ)的最小特征值,可以通过经典算法求得。
是否响应能量期望未满足模拟终止条件,前提是判断能量期望是否满足模拟终止条件,模拟终止条件可以包括两个条件,第一个条件是判断能量期望是否为预先得到的基态能量,或者与该基态能量的差值是否在预设范围内,还可以是判断当前得到的能量期望与前次得到的能量期望的差值是否在有预设精度范围内。需要说明的是,预先得到的基态能量,可以是利用经典方法获得待模拟系统的基态能量,利用经典方法获得还需获得施密特秩,以作为本申请实施例所提供的量子模拟方法的基准参考。
当得到的能量期望满足第一个条件,则完成量子计算模拟,当得到的能量期望不满足第一个条件,还需要判断第二个条件,即参数更新的次数是否等于预设值,如果等于,说明在有限次的模拟中,计算仍未收敛,需要是前面的一些步骤出现问题,此时可以选择新的拟设方式,重新构建含参量子线路,再进行模拟。如果小于,说明能量期望未满足模拟终止条件,此时需要更新含参量子线路中的参数,重新获得子系统的最终量子态。更新参数的方法有多种多样,只要使得待模拟系统的能量期望趋近基态能量即可,例如,可以设置一个固定值,将当前参数值与固定值的差值作为新的参数值;也可以通过当前与前次能量期望,确定参数值减少的权重,基于减少的权重,更新参数值。
在本申请的一些可能实施方式中,所述更新每一所述含参量子线路中的参数,包括:
利用新获得的参数值替换对应的含参量子线路中的参数的值;或
利用新获得的参数值,构造对应的含参量子线路中与纠缠量子线路同构的量子线路,并插设在该含参量子线路中。
更新参数的方式有两种:一种是直接替换,另一种是现有的含参量子线路中的参数值不变,针对一个含参量子线路,在该含参量子线路增加一个纠缠量子线路,新获得的参数值就是增加的纠缠量子线路的参数值。
在本申请实施例中,可以利用优化器获得新的参数值,优化器在深度学习反向传播过程中,指引参数往正确的方向更新合适的大小,使得更新后的参数让能量期望不断逼近全局最小。这里所说的优化器可以为SGD(Stochastic Gradient Descent,随机梯度下降法)、BGD(Batch Gradient Descent,批量梯度下降)、MBGD(Mini-Batch Gradient Descent,小批量梯度下降)、NAG(Nesterov Accelerated Gradient,牛顿动量梯度下降)、Momentum(动量梯度下降)、Adagrad(Adaptive gradient algorithm,自适学习率应梯度下降)、RMSProp和Adma任一种,具体的,可以根据待模拟系统、拟设方式、预设值等因素考虑,进行选择。Adma吸收了Adagrad和动量梯度下降算法的优点,既能适应稀疏梯度(即自然语言和计算机视觉问题),又能缓解梯度震荡的问题。RMSProp在AdaGrad基础上,做了小的改进。
优化器计算参数下降的梯度,具体的计算方法与优化器的类型有关,然后,在获得梯度之后,利用优化器对应的参数更新算式,获得新的参数值,示例性的,参数更新算式可以为:θi+1=θi-αgt,其中,θi为当前参数,θi+1为新的参数值,α为预设的学习速率,gt为当前参数的梯度。
分布式VQE的运行速度比传统的VQE快很多,以两个相同量子比特的子系统为例,分布式VQE只需模拟两个N/2量子比特的酉变换,而传统的VQE需要模拟N量子比特的酉变换,通过分别模拟的方式,降低了模拟的酉矩阵的维度,减少了模拟所需的时间和空间消耗,因此,无论在时间还是空间上都高效很多。
本申请实施例提供的方法,将整个系统分成不同的子系统进行量子计算模拟,通过这种分布式策略,可以运行超过硬件量子比特数的量子算法,使得NISQ设备的计算范围得以扩展。
可见,本申请先获得待模拟系统的子系统;然后分别构建每一所述子系统对应的含参量子线路;再 初始化每一所述含参量子线路中的参数;运行每一所述含参量子线路,获得对应的子系统的最终量子态;基于所有所述子系统的最终量子态,获得所述待模拟系统的能量期望;响应于所述能量期望未满足模拟终止条件,更新每一所述含参量子线路中的参数,并且返回执行运行每一所述含参量子线路,获得对应的子系统的最终量子态的步骤。通过分别对待模拟系统的子系统进行模拟,降低系统模拟时所使用的酉矩阵的维度,从而减少模拟时间,进而提高模拟效率。
上文结合图1至图8,详细描述了本申请的方法实施例,下面结合图9至图11,详细描述本申请的装置实施例。应理解,方法实施例的描述与装置实施例的描述相互对应,因此,未详细描述的部分可以参见前面方法实施例。
本申请实施例提供了一种量子神经网络的训练装置,该装置包括执行如实施例一、实施例二及实施例三中任一项所述方法的模块。下面分别结合实施例四、实施例五、实施例六来对本申请实施例提供的量子神经网络的训练装置进行详细说明。
实施例四
参见图9,图9为实施例四提供的一种量子神经网络的训练装置的结构示意图,与图3所示实施例一提供的量子神经网络的训练方法相对应,可以包括构建模块901、获得模块902、确定模块903、判断模块904、更新模块905。
构建模块901,用于构建量子神经网络模型,并初始化所述量子神经网络模型的参数;
获得模块902,用于选择一组标准正交基,并将所述量子神经网络模型分别作用于所述标准正交基上,获得所述标准正交基对应的最终量子态,其中,所述最终量子态的个数与所述标准正交基所含基向量的个数相同;
确定模块903,用于根据所述最终量子态及预设权重,确定损失函数;
判断模块904,用于基于所述损失函数,判断是否满足所述量子神经网络模型的优化终止条件,其中,所述优化终止条件为所述损失函数的值收敛为固定值;
更新模块905,用于若否,更新所述量子神经网络模型的参数,直至满足所述优化终止条件,获得优化好的量子神经网络模型。
具体的,所述构建模块,包括:
构建单元,用于根据待模拟系统和预设拟设线路,构建量子神经网络模型。
具体的,所述构建单元,包括:
确定子单元,用于根据待模拟系统对应哈密顿量的张乘项数,确定构建量子神经网络模型的目标量子比特数;
构建子单元,用于根据预设拟设线路,构建包含所述目标量子比特数的量子神经网络模型。
具体的,所述构建模块,包括:
第一确定单元,用于根据预设的概率密度函数,确定所述量子神经网络模型参数的初始值。
具体的,所述确定模块,包括:
第二确定单元,用于通过以下算式,确定损失函数:
其中,所述为损失函数,所述2n为标准正交基所含基向量的个数,所述ωk为标准正交基中第k个基向量对应的权重,所述ψk为标准正交基中第k个基向量对应的最终量子态,所述H为待模拟系统对应哈密顿量。
具体的,所述更新模块,包括:
替换单元,用于利用新生成的参数替换当前所述量子神经网络模型中的参数;或
构造单元,用于利用新生成的参数,构造与所述预设拟设线路结构相同的量子线路,并插设在当前所述量子神经网络模型中。
与现有技术相比,本申请首先构建量子神经网络模型,并初始化量子神经网络模型的参数,选择一组标准正交基,并将量子神经网络模型分别作用于标准正交基上,获得标准正交基对应的最终量子态,根据最终量子态及预设权重,确定损失函数,基于损失函数,判断是否满足量子神经网络模型的优化终止条件,若否,更新量子神经网络模型的参数,直至满足优化终止条件,获得优化好的量子神经网络模型,它通过获取标准正交基对应的最终量子态,并引入权重构造损失函数,拓宽量子神经网络模型的应用范围,并减少了量子线路的深度和量子比特数,有利于利用量子神经网络模型进行高维复杂物理系统的量子计算模拟的实现。
实施例五
参见图10,图10为实施例五提供的一种量子神经网络的训练装置的结构示意图,与图5所示实施例二提供的量子神经网络的训练方法相对应,所述装置包括构建模块1001、初始化模块1002、获得模块1003、判断模块1004、更新模块1005。
构建模块1001,用于根据待模拟系统和所选择的拟设方式,构建量子神经网络;
初始化模块1002,用于初始化所述量子神经网络的参数;
获得模块1003,用于运行所述量子神经网络,获得初始化参数对应的最终量子态;
判断模块1004,用于基于损失函数,判断是否满足训练终止条件,其中,所述损失函数根据所述最终量子态构造;
更新模块1005,用于在所述判断模块1004的判断结果为否时,更新所述参数,用以满足所述训练终止条件,获得训练好的量子神经网络。
在本申请一些可能的实施方式中,所述构建模块1001,可以具体用于:
根据待模拟系统对应哈密顿量的张乘项数,确定构建量子神经网络的目标量子比特数;
根据所选择的拟设方式和所述目标量子比特数,构建量子神经网络。
在本申请一些可能的实施方式中,所述初始化模块1002,可以具体用于:
根据预设的概率密度函数,确定所述量子神经网络的参数的初始值。
在本申请一些可能的实施方式中,所述判断模块1003,可以具体用于:
判断当前所述损失函数的值和前次损失函数的值的差值是否在预设范围内;
如果否,判断参数更新次数是否达到预设值;
如果未达到,执行更新模块1005;
所述装置还可以包括:
选择模块,用于当参数更新次数达到所述预设值,选择新的拟设方式,并返回执行构建模块1001。
在本申请一些可能的实施方式中,所述更新模块1005,可以包括:
获得单元,用于利用所述损失函数和所选择的优化器,获得新的参数值;
更新单元,用于基于所述新的参数值,更新所述参数。
在本申请一些可能的实施方式中,所述更新单元,可以具体用于:
利用所述新的参数值替换当前所述量子神经网络中的参数的值;或
利用所述新的参数值,构造与所选择的拟设方式结构相同的量子线路,并插设在当前所述量子神经网络中。
在本申请一些可能的实施方式中,所述量子线路包括:作用于每个量子比特的RY门、作用于相邻量子比特的CNOT门以及作用于第一个和最后一个量子比特的CNOT门。
可见,本申请先根据待模拟系统和所选择的拟设方式,构建量子神经网络;再初始化所述量子神经网络的参数;然后,运行所述量子神经网络,获得初始化参数对应的最终量子态;再基于损失函数,判断是否满足训练终止条件,其中,所述损失函数包含所述最终量子态;最后,更新所述参数,用以满足所述训练终止条件,获得训练好的量子神经网络。通过量子计算方式,提供一种新的量子神经网络训练方法,并利用损失函数判断是否更新参数来进行量子神经网络的训练,从而实现了利用量子神经网络进行量子计算模拟,填补了相关技术的空白。
实施例六
参见图11,图11为实施例六提供的一种量子神经网络的训练装置的结构示意图,与图8所示实施例三提供的量子神经网络的训练方法相对应,所述装置包括第一获得模块1101、构建模块1102、初始化模块1103、第二获得模块1104、第三获得模块1105、更新模块1106。
第一获得模块1101,用于获得待模拟系统的子系统;
构建模块1102,用于分别构建每一所述子系统对应的含参量子线路;
初始化模块1103,用于初始化每一所述含参量子线路中的参数;
第二获得模块1104,用于运行每一所述含参量子线路,获得对应的子系统的最终量子态;
第三获得模块1105,用于基于所有所述子系统的最终量子态,获得所述待模拟系统的能量期望;
更新模块1106,用于响应于所述能量期望未满足模拟终止条件,更新每一所述含参量子线路中的参数,并且返回执行所述第二获得模块1104。
在本申请的一些可能实施方式中,所述第一获得模块1101,具体用于:
利用施密特分解方法分解所述待模拟系统,获得所述待模拟系统的子系统。
在本申请的一些可能实施方式中,所构建模块1102,具体用于:
针对每一所述子系统,通过以下方式构建含参量子线路:
根据该子系统对应的哈密顿量,确定量子比特数量;
基于所确定的量子比特数量和选择的拟设方式,构建拟设量子线路;
构建纠缠量子线路;
组合所述拟设量子线路和预设数量个所述纠缠量子线路,以获得该子系统对应的含参量子线路。
在本申请的一些可能实施方式中,初始化模块11011,具体用于:
针对每一所述含参量子线路,根据预设的概率密度函数,确定初始值,并将所述初始值作为该含参量子线路中的参数的值。
在本申请的一些可能实施方式中,第三获得模块1105,具体用于:
针对每一子系统,基于该子系统的最终量子态,获得该子系统的能量期望;
利用所有子系统的能量期望,基于构建的所述待模拟系统的能量期望矩阵,获得所述待模拟系统的能量期望。
在本申请的一些可能实施方式中,所述更新模块1106,具体用于:
利用新获得的参数值替换对应的含参量子线路中的参数的值;或
利用新获得的参数值,构造对应的含参量子线路中与纠缠量子线路同构的量子线路,并插设在该含参量子线路中。
可见,本申请先获得待模拟系统的子系统;然后分别构建每一所述子系统对应的含参量子线路;再初始化每一所述含参量子线路中的参数;运行每一所述含参量子线路,获得对应的子系统的最终量子态;基于所有所述子系统的最终量子态,获得所述待模拟系统的能量期望;响应于所述能量期望未满足模拟终止条件,更新每一所述含参量子线路中的参数,并且返回执行运行每一所述含参量子线路,获得对应的子系统的最终量子态的步骤。通过分别对待模拟系统的子系统进行模拟,降低系统模拟时所使用的酉矩阵的维度,从而减少模拟时间,进而提高模拟效率。
本申请实施例还提供了一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。在一种可能的实现方式中,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的计算机程序,包括步骤S201-S205。
在步骤S201,构建用于待模拟系统模拟训练的量子神经网络模型,并初始化量子神经网络模型的参数。
在步骤S202,运行量子神经网络模型,获得初始化参数对应的最终量子态。
在步骤S203,基于最终量子态确定损失函数或者待模拟系统的能量期望。
在步骤S204,基于损失函数或待模拟系统的能量期望,判断是否满足量子神经网络模型的终止条件。
在步骤S205,若否,更新量子神经网络模型的参数,直至满足终止条件,获得训练后的量子神经网络模型。
在一种可能的实现方式中,基于损失函数或待模拟系统的能量期望,判断是否满足量子神经网络模型的终止条件,包括:基于损失函数,判断是否满足终止条件;或基于待模拟系统的能量期望,判断是否满足终止条件。
具体的,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。
本申请实施例还提供了一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行上述任一项中方法实施例中的步骤。
具体的,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。
在一种可能的实现方式中,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤,包括步骤S201-S205。
在步骤S201,构建用于待模拟系统模拟训练的量子神经网络模型,并初始化量子神经网络模型的参数。
在步骤S202,运行量子神经网络模型,获得初始化参数对应的最终量子态。
在步骤S203,基于最终量子态确定损失函数或者待模拟系统的能量期望。
在步骤S204,基于损失函数或待模拟系统的能量期望,判断是否满足量子神经网络模型的终止条件。
在步骤S205,若否,更新量子神经网络模型的参数,直至满足终止条件,获得训练后的量子神经网络模型。
在一种可能的实现方式中,基于损失函数或待模拟系统的能量期望,判断是否满足量子神经网络模 型的终止条件,包括:基于损失函数,判断是否满足终止条件;或基于待模拟系统的能量期望,判断是否满足终止条件。
以上依据图式所示的实施例详细说明了本申请的构造、特征及作用效果,以上所述仅为本申请的较佳实施例,但本申请不以图面所示限定实施范围,凡是依照本申请的构想所作的改变,或修改为等同变化的等效实施例,仍未超出说明书与图示所涵盖的精神时,均应在本申请的保护范围内。

Claims (28)

  1. 一种量子神经网络的训练方法,其特征在于,所述方法包括:
    构建用于待模拟系统模拟训练的量子神经网络模型,并初始化所述量子神经网络模型的参数;
    运行所述量子神经网络模型,获得所述量子神经网络模型的参数对应的最终量子态;
    基于所述最终量子态确定损失函数或者所述待模拟系统的能量期望;
    基于所述损失函数或所述待模拟系统的能量期望,判断是否满足所述量子神经网络模型的终止条件;
    若否,更新所述量子神经网络模型的参数,直至满足所述终止条件,获得训练后的量子神经网络模型。
  2. 根据权利要求1所述的训练方法,其特征在于,所述基于所述损失函数或所述待模拟系统的能量期望,判断是否满足所述量子神经网络模型的终止条件,包括:
    基于所述损失函数,判断是否满足所述终止条件;或
    基于所述待模拟系统的能量期望,判断是否满足所述终止条件。
  3. 根据权利要求1或2所述的训练方法,其特征在于,所述运行所述量子神经网络模型,获得所述量子神经网络模型的参数对应的最终量子态,包括:
    选择一组标准正交基,并将所述量子神经网络模型分别作用于所述标准正交基上,获得所述标准正交基对应的最终量子态,其中,所述最终量子态的个数与所述标准正交基所含基向量的个数相同。
  4. 根据权利要求2至3中任一项所述的训练方法,其特征在于,所述基于所述损失函数,判断是否满足所述终止条件,包括:
    根据所述最终量子态及预设权重,确定所述损失函数;
    基于所述损失函数,判断是否满足所述量子神经网络模型的所述终止条件,其中,所述终止条件为所述损失函数的值收敛为固定值。
  5. 根据权利要求1至4中任一项所述的训练方法,其特征在于,所述构建用于待模拟系统模拟训练的量子神经网络模型,包括:
    根据所述待模拟系统和预设拟设线路,构建所述量子神经网络模型。
  6. 根据权利要求5所述的训练方法,其特征在于,所述根据所述待模拟系统和预设拟设线路,构建所述量子神经网络模型,包括:
    根据所述待模拟系统对应哈密顿量的张乘项数,确定构建所述量子神经网络模型的目标量子比特数;
    根据所述预设拟设线路,构建包含所述目标量子比特数的所述量子神经网络模型。
  7. 根据权利要求5或6所述的训练方法,其特征在于,所述预设拟设线路,包括:
    第一拟设线路模块和第二拟设线路模块,其中,所述第一拟设线路模块由依次作用于后两个量子比特的RX门、RZ门和CNOT门组成,所述第二拟设线路模块由依次作用于每个量子比特的RX门、RZ门、以及作用于相邻量子比特的CNOT门组成。
  8. 根据权利要求4至7中任一项所述的训练方法,其特征在于,所述根据所述最终量子态及预设权重,确定所述损失函数,包括:
    通过以下算式,确定所述损失函数:
    其中,所述为损失函数,所述2n为标准正交基所含基向量的个数,所述ωk为标准正交基中第k个基向量对应的权重,所述ψk为标准正交基中第k个基向量对应的最终量子态,所述H为待模拟系统对应哈密顿量。
  9. 根据权利要求1至8中任一项所述的方法,其特征在于,所述更新所述量子神经网络模型的参数,包括:
    利用新生成的参数替换当前所述量子神经网络模型的参数;或
    利用所述新生成的参数,构造与所述预设拟设线路结构相同的量子线路,并插设在当前所述量子神经网络模型中。
  10. 根据权利要求1或2所述的训练方法,其特征在于,所述构建用于待模拟系统模拟训练的量子神经网络模型,包括:
    根据所述待模拟系统和所选择的拟设方式,构建所述量子神经网络模型。
  11. 根据权利要求10所述的训练方法,其特征在于,所述根据所述待模拟系统和所选择的拟设方 式,构建所述量子神经网络模型,包括:
    根据所述待模拟系统对应哈密顿量的张乘项数,确定构建所述量子神经网络模型的目标量子比特数;
    根据所述所选择的拟设方式和所述目标量子比特数,构建所述量子神经网络模型。
  12. 根据权利要求2、10、11中任一项所述的训练方法,其特征在于,所述基于所述损失函数,判断是否满足所述终止条件,包括:
    判断当前所述损失函数的值和前次损失函数的值的差值是否在预设范围内;
    如果否,判断所述量子神经网络模型的参数更新次数是否达到预设值;
    如果未达到,执行更新所述量子神经网络模型的参数,直至满足所述终止条件,获得训练后的量子神经网络模型的步骤;
    当所述量子神经网络模型的参数更新次数达到所述预设值,所述方法还包括:
    选择新的拟设方式,并返回执行所述根据所述待模拟系统和所选择的拟设方式,构建所述量子神经网络模型的步骤。
  13. 根据权利要求1、2及10至12中任一项所述的训练方法,其特征在于,所述更新所述量子神经网络模型的参数,包括:
    利用所述损失函数和所选择的优化器,获得新的参数值;
    基于所述新的参数值,更新所述量子神经网络模型的参数。
  14. 根据权利要求13所述的训练方法,其特征在于,所述基于所述新的参数值,更新所述量子神经网络模型的参数,包括:
    利用所述新的参数值替换当前所述量子神经网络模型的参数的值;或
    利用所述新的参数值,构造与所述所选择的拟设方式结构相同的量子线路,并插设在当前所述量子神经网络模型中。
  15. 根据权利要求14所述的训练方法,其特征在于,所述量子线路包括:作用于每个量子比特的RY门、作用于相邻量子比特的CNOT门以及作用于第一个和最后一个量子比特的CNOT门。
  16. 根据权利要求1至15中任一项所述的训练方法,其特征在于,所述初始化所述量子神经网络模型的参数,包括:
    根据预设的概率密度函数,确定所述量子神经网络模型参数的初始值。
  17. 根据权利要求1所述的训练方法,其特征在于,所述构建用于待模拟系统模拟训练的量子神经网络模型,并初始化所述量子神经网络模型的参数,包括:
    获得待模拟系统的子系统;
    分别构建每一所述子系统对应的含参量子线路;
    初始化每一所述含参量子线路中的参数。
  18. 根据权利要求1或17所述的训练方法,其特征在于,所述运行所述量子神经网络模型,获得所述量子神经网络模型的参数对应的最终量子态,包括:
    运行每一所述含参量子线路,获得对应的所述子系统的最终量子态。
  19. 根据权利要求1、17或18中任一项所述的训练方法,其特征在于,所述基于所述损失函数或所述待模拟系统的能量期望,判断是否满足所述量子神经网络模型的终止条件,包括:
    基于所有所述子系统的最终量子态,获得所述待模拟系统的能量期望;
    基于所述待模拟系统的能量期望,判断是否满足所述终止条件。
  20. 根据权利要求1、18至19中任一项所述的训练方法,其特征在于,所述更新所述量子神经网络模型的参数,直至满足所述终止条件,获得训练后的量子神经网络模型,包括:
    更新每一所述含参量子线路中的参数,并且返回执行运行每一所述含参量子线路,获得对应的所述子系统的最终量子态的步骤。
  21. 根据权利要求17至20中任一项所述的训练方法,其特征在于,所述获得待模拟系统的子系统,包括:
    利用施密特分解方法分解所述待模拟系统,获得所述待模拟系统的子系统。
  22. 根据权利要求17至21中任一项所述的训练方法,其特征在于,所述分别构建每一所述子系统对应的含参量子线路,包括:
    针对每一所述子系统,通过以下方式构建所述含参量子线路:
    根据该子系统对应的哈密顿量,确定量子比特数量;
    基于所确定的量子比特数量和选择的拟设方式,构建拟设量子线路;
    构建纠缠量子线路;
    组合所述拟设量子线路和预设数量个所述纠缠量子线路,以获得该子系统对应的所述含参量子线路。
  23. 根据权利要求17至22中任一项所述的训练方法,其特征在于,所述初始化每一所述含参量子线路中的参数,包括:
    针对每一所述含参量子线路,根据预设的概率密度函数,确定初始值,并将所述初始值作为该含参量子线路中的所述参数的值。
  24. 根据权利要求19至23中任一项所述的训练方法,其特征在于,所述基于所有所述子系统的所述最终量子态,获得所述待模拟系统的能量期望,包括:
    针对每一所述子系统,基于该子系统的所述最终量子态,获得该子系统的能量期望;
    利用所有子系统的能量期望,基于构建的所述待模拟系统的能量期望矩阵,获得所述待模拟系统的能量期望。
  25. 根据权利要求20至24中任一项所述的训练方法,其特征在于,所述更新每一所述含参量子线路中的参数,包括:
    利用新获得的参数值替换对应的含参量子线路中的所述参数的值;或
    利用所述新获得的参数值,构造所述对应的含参量子线路中与所述纠缠量子线路同构的量子线路,并插设在该含参量子线路中。
  26. 一种量子神经网络的训练装置,其特征在于,包括执行如权利要求1至25中任一项所述方法的模块。
  27. 一种存储介质,其特征在于,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行所述权利要求1至25中任一项所述的方法。
  28. 一种电子装置,包括存储器和处理器,其特征在于,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行所述权利要求1至25中任一项所述的方法。
PCT/CN2023/113488 2022-08-31 2023-08-17 量子神经网络的训练方法及训练装置 WO2024046136A1 (zh)

Applications Claiming Priority (6)

Application Number Priority Date Filing Date Title
CN202211068147.5 2022-08-31
CN202211068194.XA CN117709391A (zh) 2022-08-31 2022-08-31 一种量子神经网络训练方法、装置、存储介质及电子装置
CN202211061102.5A CN117669758A (zh) 2022-08-31 2022-08-31 基于分布式vqe的量子模拟方法、装置及存储介质
CN202211068147.5A CN117709415A (zh) 2022-08-31 2022-08-31 一种量子神经网络模型的优化方法及装置
CN202211061102.5 2022-08-31
CN202211068194.X 2022-08-31

Publications (1)

Publication Number Publication Date
WO2024046136A1 true WO2024046136A1 (zh) 2024-03-07

Family

ID=90100407

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/113488 WO2024046136A1 (zh) 2022-08-31 2023-08-17 量子神经网络的训练方法及训练装置

Country Status (1)

Country Link
WO (1) WO2024046136A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021243454A1 (en) * 2020-06-04 2021-12-09 1Qb Information Technologies Inc. Methods and systems for improving an estimation of a property of a quantum state
CN114202072A (zh) * 2021-10-14 2022-03-18 腾讯科技(深圳)有限公司 量子体系下的期望值估计方法及系统
CN114219076A (zh) * 2021-12-15 2022-03-22 北京百度网讯科技有限公司 量子神经网络训练方法及装置、电子设备和介质

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021243454A1 (en) * 2020-06-04 2021-12-09 1Qb Information Technologies Inc. Methods and systems for improving an estimation of a property of a quantum state
CN114202072A (zh) * 2021-10-14 2022-03-18 腾讯科技(深圳)有限公司 量子体系下的期望值估计方法及系统
CN114219076A (zh) * 2021-12-15 2022-03-22 北京百度网讯科技有限公司 量子神经网络训练方法及装置、电子设备和介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
QULEAF: "V2.4.0. Distributed variational quantum eigensolver based on Schmidt decomposition", PADDLEPADDLE/ QUANTUM, 1 January 2021 (2021-01-01), XP093145161, Retrieved from the Internet <URL:https://github.com/PaddlePaddle/Quantum/blob/master/tutorials/quantum_simulation/DistributedVQE_CN.ipynb> [retrieved on 20240325] *

Similar Documents

Publication Publication Date Title
EP3955173B1 (en) Training neural network accelerators using mixed precision data formats
CN114219076B (zh) 量子神经网络训练方法及装置、电子设备和介质
CN113935491B (zh) 量子体系的本征态获取方法、装置、设备、介质及产品
US20230267357A1 (en) Simulation method of quantum system, computing device and storage medium
Penkovsky et al. Efficient design of hardware-enabled reservoir computing in FPGAs
CN115169565B (zh) 一种小分子化学体系的哈密顿量模拟方法和装置
CN115345309A (zh) 系统特征信息的确定方法、装置、电子设备和介质
CN114511094B (zh) 一种量子算法的优化方法、装置、存储介质与电子装置
Liu et al. A novel policy gradient algorithm with PSO-based parameter exploration for continuous control
Yeter-Aydeniz et al. Collective neutrino oscillations on a quantum computer
Ballinas et al. Hybrid quantum genetic algorithm with adaptive rotation angle for the 0-1 Knapsack problem in the IBM Qiskit simulator
CN117709415A (zh) 一种量子神经网络模型的优化方法及装置
JP7265965B2 (ja) 機械学習装置および機械学習方法
WO2024046136A1 (zh) 量子神经网络的训练方法及训练装置
Amaya et al. Neurorobotic reinforcement learning for domains with parametrical uncertainty
CN114819163B (zh) 量子生成对抗网络的训练方法、装置、介质及电子装置
CN114512194A (zh) 用于量子化学模拟中获取目标体系试验态的方法及装置
CN117709391A (zh) 一种量子神经网络训练方法、装置、存储介质及电子装置
WO2024007919A1 (zh) 基于lbm的量子流动模拟方法、装置、介质及设备
WO2022143789A1 (zh) 量子预处理方法、装置、存储介质及电子装置
CN115618663B (zh) 一种网格方程与物理方程耦合的量子求解方法及装置
CN117669758A (zh) 基于分布式vqe的量子模拟方法、装置及存储介质
CN115700572B (zh) 一种网格方程与物理方程迭代的量子求解方法及装置
JP7361175B2 (ja) 計算装置、計算プログラム、記録媒体及び計算方法
Bai et al. Duality in deep reinforcement learning—Implementation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23859170

Country of ref document: EP

Kind code of ref document: A1