A method for updating circuit parameters of a variational quantum circuit and related apparatuses

CN118014090BActive Publication Date: 2026-10-20ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410141071.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-31
Publication Date
2026-10-20
Estimated Expiration
2044-01-31

AI Technical Summary

Technical Problem

但是在每一迭代步中优化变分参数时,若变分参数的更新步长的预设值较大,变分参数的调整就不够准确,相较于前一迭代步,当前迭代步的损失函数值可能难以降低;相应的,若该更新步长的预设值较小,又会导致损失函数下降缓慢,由此需要增加迭代步数,从而浪费了宝贵的量子计算资源

Benefits of technology

[0040]与现有技术相比,本发明提供的一种变分量子线路的线路参数更新方法及相关装置,每一迭代步中,可以在量子芯片上运行变分量子线路对应的量子操作,并测量该量子操作得到的量子态,获得当前的变分参数对应的损失函数值和损失函数梯度序列;若当前损失函数值不收敛,还可以响应当前损失函数值不收敛,基于该变分量子线路中针对当前迭代步确定的变分参数的更新步长,更新变分参数;其中,变分参数的更新量由当前迭代步的更新步长和损失函数梯度序列共同决定;更新步长基于前一迭代步的更新步长和当前迭代步的步长更新参数得到。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118014090B_ABST
    Figure CN118014090B_ABST
Patent Text Reader

Abstract

The application discloses a method for updating circuit parameters of a variational quantum circuit and related devices, and belongs to the technical field of quantum computing. The method comprises the following steps: in each iteration step, running a quantum operation corresponding to the variational quantum circuit on a quantum chip, measuring a quantum state obtained by the quantum operation, and obtaining a loss function value corresponding to a current variational parameter and a loss function gradient sequence; in response to the current loss function value not converging, updating the variational parameter based on an update step length of the variational parameter determined for the current iteration step; wherein the update amount of the variational parameter is determined by the update step length of the current iteration step and the loss function gradient sequence; and the update step length is obtained based on an update step length of a previous iteration step and a step length update parameter of the current iteration step. Since the update step length of each iteration step is dynamically adjusted based on the update step length of the previous iteration step, the numerical accuracy is relatively high, the loss function value can be gradually reduced in the iteration process, and the decline process of the loss function is accelerated, thereby reducing the time required for quantum computing, improving the computing efficiency, and saving quantum computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of quantum computing technology, specifically a method and device for adjusting the circuit parameters of a variable quantum circuit. Background Technology

[0002] A quantum computer is a physical device that performs high-speed mathematical and logical operations, stores and processes quantum information in accordance with the laws of quantum mechanics. When a device processes and calculates quantum information and runs quantum algorithms, it is a quantum computer. Because of its ability to process mathematical problems more efficiently than ordinary computers—for example, reducing the time to crack keys from hundreds of years to hours—quantum computers have become a key technology under research.

[0003] Quantum circuits, also known as quantum logic circuits, represent circuits that operate on qubits (qubits) in an abstract conceptual sense. Quantum algorithms, described by quantum circuit models, can manipulate quantum computers to process input states and output specific measurements. Variational quantum circuits (VQCs) are a type of flexible quantum circuit whose parameters can be optimized to suit specific computational tasks. The flexibility of VQCs makes them a core component of many applications in quantum computing, suitable for solving a variety of problems. For example, VQCs can be used for quantum state preparation, solving linear equations, implementing quantum approximation optimization algorithms, and constructing quantum neural networks.

[0004] In existing technologies, the variational parameters in variational quantum circuits need to be continuously optimized during iteration to gradually reduce the loss function value along its gradient direction. However, when optimizing the variational parameters in each iteration step, if the preset value of the update step size is large, the adjustment of the variational parameters will not be accurate enough, and the loss function value in the current iteration step may be difficult to reduce compared to the previous iteration step. Conversely, if the preset value of the update step size is small, the loss function will decrease slowly, thus requiring an increase in the number of iteration steps, which wastes valuable quantum computing resources. Summary of the Invention

[0005] The purpose of this invention is to provide a method and related apparatus for updating the circuit parameters of a variational quantum circuit. The method aims to set the update step size of the variational parameters for each iteration step, thereby not only allowing the loss function value to decrease along its gradient direction, but also accelerating the descent speed, reducing the time required for quantum computing, and improving computational efficiency.

[0006] One embodiment of the present invention provides a method for updating line parameters of a variable quantum line, the method comprising:

[0007] In each iteration step, the quantum operation corresponding to the variational quantum circuit is run on the quantum chip, and the quantum state obtained by the quantum operation is measured to obtain the loss function value and loss function gradient sequence corresponding to the current variational parameter;

[0008] In response to the current loss function value not converging, the variational parameters are updated based on the update step size of the variational parameters determined for the current iteration step in the variational quantum circuit; wherein, the update amount of the variational parameters is jointly determined by the update step size of the current iteration step and the gradient sequence of the loss function; the update step size is obtained based on the update step size of the previous iteration step and the step size update parameter of the current iteration step.

[0009] Optionally, updating the variational parameters based on the update step size of the variational parameters determined for the current iteration step in the variational quantum circuit includes:

[0010] Based on the update step size of the previous iteration, the step size update parameters of the current iteration, and the gradient sequence of the loss function corresponding to the current iteration, the experimental update amount of the current iteration is determined.

[0011] Based on the variational parameters determined in the previous iteration step and the experimental update amount in the current iteration step, determine the experimental variational parameters for the current iteration step.

[0012] Based on the relationship between the loss function value corresponding to the experimental variational parameters and the loss function value of the previous iteration step, the update step size and variational parameters of the current iteration step are updated.

[0013] Optionally, determining the experimental update amount for the current iteration step based on the update step size of the previous iteration step, the step size update parameters of the current iteration step, and the gradient sequence of the loss function corresponding to the current iteration step includes:

[0014] Based on the result of the four arithmetic operations between the update step size of the previous iteration step and the latest step size update parameter of the current iteration step, the experimental update step size of the current iteration step is determined.

[0015] The product of the experimental update step size and the gradient sequence of the loss function corresponding to the current iteration step is obtained as the experimental update amount for the current iteration step.

[0016] The step of determining the experimental variational parameters for the current iteration step based on the variational parameters determined in the previous iteration step and the experimental update amount for the current iteration step includes:

[0017] The difference between the variational parameter determined in the previous iteration step and the experimental update value in the current iteration step is calculated and used as the experimental variational parameter for the current iteration step.

[0018] Optionally, the step size update parameters include a first step size update sub-parameter with a fixed value and a second step size update sub-parameter with a variable value;

[0019] The determination of the experimental update step size for the current iteration step, based on the arithmetic operation result between the update step size of the previous iteration step and the latest step size update parameter of the current iteration step, includes:

[0020] The product of the update step size of the previous iteration, the first step update sub-parameter, and the second step update sub-parameter is used as the experimental update step size of the current iteration.

[0021] Optionally, updating the update step size and variational parameters of the current iteration step based on the relationship between the loss function value corresponding to the experimental variational parameters and the loss function value of the previous iteration step includes:

[0022] Determine whether the loss function value corresponding to the experimental variational parameter satisfies: the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, and / or the ratio of the loss function value corresponding to the experimental variational parameter to the loss function value of the previous iteration step is within a first preset value range;

[0023] Based on the judgment result, update the update step size and variational parameters of the current iteration step.

[0024] Optionally, updating the update step size and variational parameters of the current iteration step based on the judgment result includes:

[0025] If satisfied, the experimental update step size is used as the update step size determined by the current iteration step, the experimental variational parameter is used as the variational parameter determined by the current iteration step, and the second step size update sub-parameter is updated to the first preset value.

[0026] Optionally, the method further includes:

[0027] If not satisfied, the second step size update sub-parameter is updated to the product of the current second step size update sub-parameter and the second preset value;

[0028] Return to the step of multiplying the update step size of the previous iteration step, the first step size update sub-parameter, and the second step size update sub-parameter as the experimental update step size of the current iteration step, until the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, and / or the ratio of the loss function value of the previous iteration step is within a first preset value range.

[0029] Optionally, the quantum state obtained by the quantum operation is measured through a pre-constructed quantum state measurement circuit, which includes a loss function value measurement circuit.

[0030] In each iteration step, the sequence of gradients of the loss function is obtained based on the following steps:

[0031] For each variational parameter θ of the variational quantum circuit i Based on the preset difference step size ∈, the variational parameter is adjusted to θ. i +∈, and use the loss function value to measure the line to obtain a target loss function value after the variational parameter adjustment;

[0032] Calculate the quotient of each target difference and the preset difference step size ∈, and use it as a corresponding element in the gradient sequence of the loss function; wherein, the target difference is the difference between a target loss function value and the loss function value before the variational parameter adjustment.

[0033] Optionally, the quantum state obtained by the quantum operation is measured through a pre-constructed quantum state measurement circuit, which includes a loss function value measurement circuit and a loss function gradient measurement circuit.

[0034] The loss function gradient measurement circuit is used to measure each differential gradient term obtained by decomposing the loss function, and the differential gradient term is used to construct the gradient sequence of the loss function.

[0035] Another embodiment of the present invention provides a line parameter updating device for a variable quantum line, the device comprising:

[0036] The measurement module is used to run the quantum operation corresponding to the variational quantum circuit on the quantum chip in each iteration step, and measure the quantum state obtained by the quantum operation to obtain the loss function value and loss function gradient sequence corresponding to the current variational parameters.

[0037] An update module is used to respond to the current loss function value not converging by updating the variational parameters based on the update step size of the variational parameters determined for the current iteration step in the variational quantum circuit; wherein, the update amount of the variational parameters is jointly determined by the update step size of the current iteration step and the gradient sequence of the loss function; the update step size is obtained based on the update step size of the previous iteration step and the step size update parameter of the current iteration step.

[0038] Another embodiment of the present invention provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any of the above embodiments when running.

[0039] Another embodiment of the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the methods described in any of the above embodiments.

[0040] Compared with the prior art, the present invention provides a method and related apparatus for updating circuit parameters of a variable quantum circuit. In each iteration step, the quantum operation corresponding to the variable quantum circuit can be run on a quantum chip, and the quantum state obtained by the quantum operation can be measured to obtain the loss function value and loss function gradient sequence corresponding to the current variational parameter. If the current loss function value does not converge, the variational parameter can be updated based on the update step size of the variational parameter determined for the current iteration step in response to the non-convergence of the current loss function value. The update amount of the variational parameter is jointly determined by the update step size of the current iteration step and the loss function gradient sequence. The update step size is obtained by updating the parameter based on the update step size of the previous iteration step and the step size of the current iteration step.

[0041] In the solution provided in this embodiment, a quantum state is prepared by running quantum operations corresponding to the variable quantum circuit on a quantum chip. Based on the loss function value obtained by measuring this quantum state, if it is determined that the current loss function value does not converge, the update step size for the current iteration step can be adjusted based on the update step size of the previous iteration step and the update parameter of the current iteration step, thereby updating the variational parameters of the variable quantum circuit. Since the update step size of each iteration step is related to the previous iteration step, its numerical accuracy is relatively high, and the loss function can be gradually reduced during the iteration process. Furthermore, by reasonably setting the step size update parameter, the descent process of the loss function can be accelerated, thereby reducing the time required for quantum computing, improving computational efficiency, and saving quantum computing resources. Attached Figure Description

[0042] Figure 1 A network block diagram of a line parameter update system for a variable quantum line provided in an embodiment of the present invention;

[0043] Figure 2 A flowchart illustrating a method for updating line parameters of a variable quantum line, provided in an embodiment of the present invention;

[0044] Figure 3 This is a schematic diagram of a specific structure of a variable quantum circuit provided in an embodiment of the present invention;

[0045] Figure 4 This is a schematic diagram of a specific structure of a quantum state measurement circuit provided in an embodiment of the present invention;

[0046] Figure 5 A schematic diagram of a line parameter updating device for a variable quantum line provided in an embodiment of the present invention;

[0047] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0048] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0049] Figure 1 This is a network block diagram of a line parameter update system for a variable quantum line provided in an embodiment of the present invention. The line parameter update system for a variable quantum line may include a network 110, a server 120, a wireless device 130, a client 140, storage 150, a classical computing unit 160, a quantum computing unit 170, and may also include additional memory, a classical processor, a quantum processor, and other devices not shown.

[0050] Network 110 is a medium used to provide communication links between various devices and computers connected together within the system for updating the line parameters of variable quantum lines. These include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The connection method can be wired, wireless communication links, or fiber optic cables.

[0051] Server 120, wireless device 130, and client 140 are conventional data processing systems that may contain data and application programs or software tools that perform conventional computational processes. Client 140 may be a personal computer or a network computer, so the data may also be provided by server 120. Wireless device 130 may be a smartphone, tablet, laptop, smart wearable device, etc. Storage unit 150 may include database 151, which can be configured to store data such as qubit parameters, quantum logic gate parameters, quantum circuits, and quantum programs.

[0052] The classical computing unit 160 (quantum computing unit 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 162 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application program 163 (application program 173). The application program 163 (application program 173) may be used to implement a quantum algorithm compiled by the circuit parameter update method for variable quantum circuits provided in the embodiments of the present invention.

[0053] Any data or information stored or generated in the classical computing unit 160 (quantum computing unit 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application executed therein can also be configured to be executed in another classical (quantum) processing system in a similar manner.

[0054] It should be noted that a true quantum computer has a hybrid structure, which includes at least... Figure 1The system consists of two main parts: the classical computing unit 160, which is responsible for performing classical calculations and control; and the quantum computing unit 170, which is responsible for running quantum programs to achieve quantum computing.

[0055] The aforementioned classical computing unit 160 and quantum computing unit 170 can be integrated into a single device or distributed across two different devices. For example, a first device including the classical computing unit 160 runs a classical computer operating system, providing quantum application development tools and services, as well as the storage and network services required for quantum applications. Users develop quantum programs using the quantum application development tools and services on the second device, and send these quantum programs to a second device including the quantum computing unit 170 via the network services. The second device runs a quantum computer operating system, which parses and compiles the quantum program's code into instructions that the quantum processor 170 can recognize and execute. The quantum processor 170 then implements the quantum algorithm corresponding to the quantum program based on these instructions.

[0056] The computing units of the classic processor 161 within the classic computing unit 160 are based on CMOS transistors on a silicon chip. These computing units are not limited by time or coherence; that is, they are available at any time without time constraints. Furthermore, the number of such computing units in a silicon chip is sufficient; currently, a single classic processor 161 contains tens of thousands of computing units. Given this sufficient number and the fixed selectable computing logic of the CMOS transistors (e.g., AND logic), computational performance is achieved by combining a large number of CMOS transistors with a limited set of logic functions during operation.

[0057] In the quantum computing unit 170, the basic computing unit of the quantum processor 171 is the qubit. The input of a qubit is limited by coherence and coherence time; that is, a qubit is limited by its available usage time and is not always readily available. Making full use of qubits within their available usage time is a key challenge in quantum computing. Furthermore, the number of qubits in a quantum computer is one of the representative indicators of its performance. Each qubit performs computational functions through on-demand configured logical functions. Given the limited number of qubits and the diverse logical functions available in quantum computing, such as Hadamard gates (H gates), Pauli-X gates (X gates), Pauli-Y gates (Y gates), Pauli-Z gates (Z gates), X gates, RY gates, RZ gates, CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc., quantum computing requires combining a limited number of qubits with diverse logical function combinations to achieve computational effects.

[0058] Based on these differences, the design of classical logic functions applied to CMOS transistors and the design of quantum logic functions applied to qubits are significantly and fundamentally different. The design of classical logic functions applied to CMOS transistors does not need to consider the individuality of CMOS transistors. For example, the representation of a CMOS transistor in a silicon chip is its individual identifier, location, and usable time of each CMOS transistor. Therefore, classical algorithms composed of classical logic functions only express the operational relationship of the algorithm, not the algorithm's dependence on individual CMOS transistors.

[0059] Quantum logic functions applied to qubits need to consider the individuality of each qubit, such as its position within the quantum chip, its relationship with surrounding qubits, and the duration of its usable time. Therefore, quantum algorithms composed of quantum logic functions not only express the computational relationships within the algorithm but also its dependence on the individual qubits.

[0060] A quantum chip can include qubits and channels for controlling them. Quantum logic gates are implemented using analog signals. Different combinations of analog signals are applied to the qubits through these channels, thereby creating quantum circuits with different functions to process data. Therefore, the design of quantum logic functions in the qubits (including the design of whether qubits are used and the design of the efficiency of each qubit) is crucial for improving the computational performance of quantum computers and requires special design. This is the unique characteristic of quantum algorithms based on quantum logic functions, and it is fundamentally and significantly different from classical algorithms based on classical logic functions. The aforementioned design considerations for qubits are technical problems that ordinary computing devices do not need to consider or address.

[0061] The flexibility of variable quantum circuits makes them a universal tool in quantum computing, suitable for solving a variety of problems. For example, they can be used for quantum state preparation, solving linear equations, implementing quantum approximation optimization algorithms, and constructing quantum neural networks. In this embodiment, we mainly take the variable quantum circuit in a variable quantum linear solver as an example to specifically illustrate the dynamic update method for the update step size of the variational parameters provided in this scheme.

[0062] Solving linear equations is a common problem in many scientific and technological fields (e.g., fluid mechanics, finance, biology, chemistry). Research on how to quickly and accurately solve linear equations has demonstrated significant theoretical and applied value, leading to the development of many effective techniques and methods for solving linear equations. For example, in the field of CFD (Computational Fluid Dynamics), linear equations representing changes in fluid state can be constructed based on various discretization mathematical methods. This allows for numerical experiments, computer simulations, and analytical studies of fluid mechanics problems, including calculating the temperature, density, and other state information of the fluid at different locations in a steady state.

[0063] When simulating linear equations using classical computers, the complexity of classical algorithms increases exponentially with the size of the coefficient matrix, resulting in extremely time-consuming computation. Quantum computing, however, is a novel computing approach that utilizes quantum mechanics to construct a computational framework. In certain scenarios, quantum computing offers exponential speedups compared to optimal classical algorithms. Therefore, the computational advantages of quantum computers can be leveraged to simulate different systems, construct their linear equations, and obtain information about the system in a steady state by calculating the target solution under predetermined conditions.

[0064] To simulate a target system using quantum computing methods and solve the corresponding linear equations, the following steps are required: First, obtain the linear equation set Ax = b, where x represents a physical quantity to be determined in the target system. Then, simulate the target system and perform quantum state evolution using quantum computing methods to obtain the information of the physical quantity. Specifically, in one implementation, such as simulating a fluid system in the field of CFD, the linear equation set Ax = b can be used to represent the state changes of each grid cell in a discretized grid of the target fluid; where vector x represents the difference between the fluid state of each grid cell at the current time and the previous time; vector b represents the residual vector related to the fluid state and the coordinate information of the grid cell at the previous time; and matrix A represents the coefficient matrix related to the fluid state and the coordinate information of the grid cell at the previous time.

[0065] Furthermore, in the quantum computing simulation of this linear equation system, the information of the linear equation system can be encoded into qubits. Specifically, this involves encoding the coefficient matrix A and residual vector b of the linear equation system into corresponding quantum states. In one implementation, the information of the aforementioned classical data can be encoded into the Hamiltonian corresponding to the linear equation system, and Hamiltonian simulation can be used instead of converting the classical data into quantum states. That is, based on the coefficient matrix A and residual vector b, a Hamiltonian corresponding to the linear equation system Ax = b is constructed. The ground state (i.e., the lowest energy state) of this Hamiltonian corresponds to the solution of the linear equation system. When the loss function constructed based on this Hamiltonian reaches its minimum value, the solution of the linear equation system is determined.

[0066] Furthermore, a commonly used quantum circuit for quantum state encoding and iterative optimization of loss function is the aforementioned variable quantum circuit. The circuit parameters in the variable quantum circuit can include variational parameters and the update step size of the variational parameters. The variational parameters are the rotation angles of the parameterized quantum logic gates. In the quantum computing simulation of linear equation systems, by adjusting the rotation angles of the parameterized quantum logic gates, the corresponding loss function values ​​can be changed.

[0067] See Figure 2 , Figure 2 A method for updating line parameters of a variable quantum line provided in this embodiment of the invention includes the following steps:

[0068] Step 201: In each iteration step, the quantum operation corresponding to the variational quantum circuit is run on the quantum chip, and the quantum state obtained by the quantum operation is measured to obtain the loss function value and loss function gradient sequence corresponding to the current variational parameter.

[0069] Step 202: In response to the current loss function value not converging, update the variational parameters based on the update step size of the variational parameters determined for the current iteration step in the variational quantum circuit.

[0070] The update amount of the variational parameter is determined by the update step size of the current iteration step and the gradient sequence of the loss function; the update step size is obtained based on the update step size of the previous iteration step and the step size update parameter of the current iteration step.

[0071] Specifically, taking the variable quantum circuit in a variable quantum linear solver as an example, existing schemes for simulating the linear equation system corresponding to the target system using quantum computing mainly include the following steps: constructing the Hamiltonian, selecting the fitting method, obtaining the gradient of the loss function, quantum state tomography, and optimizing the fitting parameters. The form of the Hamiltonian corresponding to the linear equation system Ax = b is usually fixed; for example, the constructed Hamiltonian H can be... Where A is the coefficient matrix of the linear equation system. Let I be the transpose and conjugate matrix of A, I be the identity matrix, and b be the residual vector of the linear equation system, which has been normalized and satisfies the following condition:<b|b> =1.

[0072] Without loss of generality, it is assumed that the coefficient matrix A is a self-conjugate matrix; otherwise, in one implementation, it can be taken as... This allows the constructed system of linear equations C to be... A C x =C b It holds and satisfies matrix C A Self-conjugation allows the newly constructed linear equation system to be simulated using quantum computing, enabling the calculation of the solution x of the original linear equation system Ax=b.

[0073] Furthermore, as those skilled in the art know, the quality of the chosen simulation method determines the success and accuracy of the computation; therefore, the construction of the simulation is crucial. The simulation method required for quantum computation simulation of linear equation systems can be a parameterized quantum circuit, such as a variable quantum circuit containing multiple parametric quantum logic gates. The simulation parameters are the variational parameters in the variable quantum circuit. For example, the selected simulation method can be Hardware Efficient Ansatz (HEA), a highly versatile simulation method. In one embodiment, the specific structure of the variable quantum circuit corresponding to the HEA can be as follows: Figure 3 As shown, the portion of the quantum circuit within the dashed box represents a Layer of High-Efficiency Hardware Arrangement (HEA). This variable quantum circuit can be composed of multiple HEA layers, with each HEA layer containing parametric quantum logic gates called RY gates. For parametric quantum logic gates The rotation angle can be used to encode the quantum state of an approximate solution to a system of linear equations through multiple RY gates in each level of efficient hardware simulation layer.

[0074] The advantage of efficient hardware simulation lies in its ability to be dynamically adjusted, i.e., adding or removing simulation layers, and dynamically adjusting the number of bits and line depth. In another implementation, a simulation method with a fixed simulation structure can also be selected. This simulation method is generally used to simulate linear equation systems with fixed known dimensions, and because this simulation method is specifically configured, its solution efficiency is generally high.

[0075] The proposed parameters (i.e., variational parameters) in the above proposed method can be defined as θ = {θ1, ..., θ}. i ,…θ I}, where the number of proposed parameters is I, and thus this proposed method can be described as follows: That is, this hypothetical approach can realize the following quantum state evolution: U(θ)|0>=|φ>, and the above hypothetical approach can be simplified to U θ Therefore, the loss function constructed based on the Hamiltonian H can be defined as follows: in, For U θ The transpose and conjugate of the loss function L(θ) can be simplified to L.

[0076] Therefore, the quantum states of approximate solutions to the linear equation system can be prepared using the aforementioned variational quantum circuit. In order to continuously optimize the variational parameter θ during the iteration process so that the loss function L(θ) gradually decreases along the gradient direction, the commonly used schemes currently require obtaining the differential gradient of the loss function to construct the gradient sequence of the loss function, that is, to obtain the gradient of L(θ). This allows each variational parameter to be updated to θ. i =θ i -λg i Where gradient g is the update direction of variational parameter θ, and λ is the update step size of variational parameter θ.

[0077] In the solution provided by the embodiments of the present invention, the aforementioned loss function gradient sequence can be constructed in various ways. In one embodiment, the loss function L(θ) can first be decomposed on a Pauli basis to obtain multiple terms, and the terms generated by the above decomposition are then... The decomposition continues on the Pauliji. Ultimately, due to the... The terms generated by the decomposition are measurable, thus allowing the measurement and acquisition of each term of the differential gradient of the loss function L(θ) through multiple loss function gradient measurement paths. Then, the gradient sequence of the loss function g is constructed.

[0078] Correspondingly, in another implementation, multiple target loss function values ​​of the loss function L(θ) can be obtained solely through a loss function value measurement line. Each target loss function value is obtained by individually adjusting a corresponding variational parameter with a preset difference step size, and then measuring using the loss function value measurement line. Furthermore, multiple approximate derivatives d of the loss function can be obtained using a finite difference method. i This approximates the differential gradient of the loss function. Furthermore, based on the aforementioned multiple approximate derivatives d i A differential gradient sequence d is constructed, and this differential gradient sequence d is used as the gradient sequence g of the loss function.

[0079] The above-mentioned schemes, which directly measure and construct the gradient sequence of the loss function through multiple loss function gradient measurement lines, or approximate the differential gradient based on the difference method and then construct the difference gradient sequence as the gradient sequence of the loss function, will be explained in detail below and will not be repeated here.

[0080] Specifically, in one implementation, the quantum state measurement circuit used to obtain the loss function value corresponding to each approximate solution can be a Hadamard Test circuit, and the specific structure of the Hadamard Test circuit can be as follows: Figure 4 As shown in the figure, the qubit with an initial state of |0> is an auxiliary qubit, and the quantum state |φ> of the target qubit is the quantum state of the approximate solution of the linear equation system prepared by the above variable quantum circuit. By decomposing the loss function corresponding to the approximate solution prepared by the above variable quantum circuit on a Pauli basis, we can obtain:

[0081]

[0082] Then we can base the σ generated by the decomposition k The project constructs multiple controlled U gates, which, under the control of auxiliary qubits, act on the quantum state |φ> of the target qubit.

[0083] The Hadamard test is a commonly used method for measuring quantum states, which can be used to determine the quantum state |φ> relative to the reference state |σ. k The phase of the target qubit relative to the reference state is a key subroutine in many quantum algorithms, such as quantum phase estimation. The Hadamard Test works as follows: First, a Hadamard transform is applied to the control bit, and a controlled U-gate is applied to the quantum state; after applying the controlled U-gate, another Hadamard transform is applied to the control bit, and the result is measured on a standard basis. By repeating the Hadamard test multiple times and averaging the results, the phase of the target qubit relative to the reference state can be estimated.

[0084] Among them, it is necessary to observe <φ|σ k When |φ> has a real part, S=I, which is equivalent to having no effect. We only need to observe the auxiliary qubit; the probability of an observation being 0 minus the probability of an observation being 1 is <φ|σ. k The real part of |φ> needs to be observed. Similarly, the real part of <φ|σ needs to be observed. k When |φ〉 has the imaginary part, S=diag{1,-i}. We still only need to observe the auxiliary qubit; the probability of an observation being 0 minus the probability of an observation being 1 is <φ|σ k The imaginary part of |φ>. In the solution provided in this embodiment of the invention, the loss function value is a real number, so the above-mentioned S gate can be omitted.

[0085] Correspondingly, a quantum circuit for obtaining the gradient of the loss function can also be constructed based on the Hadamard Test circuit described above. This requires that the matrix form of the U-gate be based on each of the aforementioned differential gradients. The decomposition form is modified accordingly. The drawback of using the aforementioned quantum circuit to obtain the gradient of the loss function is that a large number of quantum circuits need to be constructed separately. Therefore, by performing multiple measurements based on the aforementioned Hadamard Test circuit, the loss function value and the loss function gradient sequence corresponding to the current variational parameters can be obtained.

[0086] Since the ground state of the Hamiltonian corresponds to the solution of the linear equation system, when the loss function constructed based on this Hamiltonian reaches its minimum, the quantum state prepared by the variable quantum circuit corresponds to the solution of the linear equation system. Therefore, we can first determine whether the current loss function value has converged. In one implementation, we can preset the convergence precision η of the loss function value. When the current loss function value reaches the preset convergence precision η, it can be considered that the loss function value has converged.

[0087] Furthermore, in each iteration step, if the current loss function value does not converge, the update step size for the current iteration step can be calculated based on the update step size of the previous iteration step and the update parameter of the current iteration step. This update parameter can be dynamically optimized in each iteration step to maintain a certain similarity between the update step sizes of adjacent iteration steps, thereby ensuring that the update step size maintains relatively high numerical accuracy during the update process. The update amount of the variational parameter, jointly determined by the update step size of the current iteration step and the gradient sequence of the loss function, allows the loss function value to gradually decrease during the iteration process. Moreover, this update parameter can be fine-tuned, gradually increasing the update step size; that is, the update amount can be gradually increased while satisfying the decrease in the loss function value, thereby accelerating the decrease in the loss function and reducing the number of iteration steps required for quantum computing, reducing the time required for quantum computing, improving computational efficiency, and saving quantum computing resources.

[0088] As can be seen, in the solution provided by this invention, a quantum state can be prepared by running quantum operations corresponding to the variable quantum circuit on a quantum chip. Based on the loss function value obtained by measuring this quantum state, if the current loss function value does not converge, the update step size for the current iteration step can be adjusted based on the update step size of the previous iteration step and the step size update parameter of the current iteration step, thereby updating the variational parameters of the variable quantum circuit. Since the update step size of each iteration step is related to the previous iteration step, its numerical accuracy is relatively high, and the loss function can be gradually reduced during the iteration process. Furthermore, by reasonably setting the step size update parameter, the descent process of the loss function can be accelerated, thereby reducing the time required for quantum computing, improving computational efficiency, saving quantum computing resources, and promoting the further development of quantum linear solvers running on real quantum chips.

[0089] As one embodiment of the present invention, updating the variational parameters based on the update step size of the variational parameters determined for the current iteration step in the variational quantum circuit may include the following steps:

[0090] Step 301: Based on the update step size of the previous iteration, the step size update parameters of the current iteration, and the gradient sequence of the loss function corresponding to the current iteration, determine the experimental update amount of the current iteration.

[0091] Step 302: Determine the experimental variational parameters for the current iteration step based on the variational parameters determined in the previous iteration step and the experimental update amount for the current iteration step.

[0092] In one implementation, step 301 may include the following steps:

[0093] Step 3011: Determine the experimental update step size for the current iteration step based on the result of the four arithmetic operations between the update step size of the previous iteration step and the latest step size update parameter of the current iteration step.

[0094] Step 3012: Obtain the product of the experimental update step size and the gradient sequence of the loss function corresponding to the current iteration step, and use it as the experimental update amount for the current iteration step.

[0095] Specifically, to ensure that the variational parameters in each iteration are optimized compared to the previous iteration (i.e., the loss function value in each iteration is smaller than the loss function value in the previous iteration), it may be necessary to perform multiple experimental adjustments to the variational parameters in each iteration. Therefore, in each iteration, the experimental variational parameter is the experimental value of the variational parameter that is continuously optimized in that iteration until its corresponding loss function value is smaller than the loss function value in the previous iteration. This value can then be used as the final variational parameter for that iteration.

[0096] Similarly, the experimental update step size is the experimental value of the update step size that is continuously optimized in this iteration step, corresponding to the experimental variational parameters. The experimental update step size that satisfies the above conditions can be used as the final update step size of this iteration step. Therefore, based on the experimental update step size of the current iteration step, the corresponding experimental update amount can be determined, and thus the experimental variational parameters of the current iteration step can be determined according to the variational parameters determined in the previous iteration step and the experimental update amount of the current iteration step.

[0097] In the solution provided by this embodiment of the invention, to further accelerate the decrease in the loss function value, a variable step size update parameter α can be preset. Thus, during the iteration process, the update parameter α is updated based on the latest step size of the current iteration step and the update step size λ of the previous iteration step. ref The result of the four arithmetic operations is compared with the update step size of the previous iteration step. The update step size of the current iteration step is then increased to obtain the experimental update step size of the current iteration step.

[0098] In one implementation, the step size update parameter α can be in the range of α > 1.0, thus allowing the acquisition of the update step size λ from the previous iteration. ref The product of the latest step size update parameter α and the current iteration step α is αλ ref The experimental update step size αλ is used as the experimental update step size for the current iteration step; and the differential gradient sequence d corresponding to this iteration step is obtained based on the differential method. This differential gradient sequence d is approximated as the gradient sequence g of the loss function, and the experimental update step size αλ is calculated. ref The product of the differential gradient sequence d and the differential gradient sequence d is the experimental update αλ for the current iteration step. ref d.

[0099] In one implementation, step 302 may include:

[0100] The difference between the variational parameter determined in the previous iteration step and the experimental update value in the current iteration step is calculated and used as the experimental variational parameter for the current iteration step.

[0101] This allows us to calculate the variational parameter θ determined in the previous iteration step. t With the update amount αλ of this experiment ref The difference θ of d t -αλ ref d is the experimental variational parameter for the current iteration step.

[0102] In another embodiment, the step size update parameter may include a first step size update sub-parameter with a fixed value and a second step size update sub-parameter with a variable value; step 3011 may be:

[0103] The product of the update step size of the previous iteration, the first step update sub-parameter, and the second step update sub-parameter is used as the experimental update step size of the current iteration.

[0104] That is, the step size update parameter α mentioned above can include a first step size update sub-parameter α1 with a fixed value and a second step size update sub-parameter α2 with a variable value, and the update step size λ of the previous iteration step can be used as the update step size. ref The product of the first step long update sub-parameter α1 and the second step long update sub-parameter α2 is used as the experimental update step size α1α2λ for the current iteration step. ref Wherein, the value of α1 can be in the range of α1>1.0, and the initial value of α2 can be 1. Therefore, based on the first step length update sub-parameter and the second step length update sub-parameter, the effect of amplifying the update step size during the iteration process can also be achieved, thereby accelerating the decrease of the loss function value; and since the second step length update sub-parameter is variable, it can be adjusted and optimized multiple times in each iteration step, so that the loss function value corresponding to that iteration step is minimized as much as possible.

[0105] Step 303: Based on the relationship between the loss function value corresponding to the experimental variational parameter and the loss function value of the previous iteration step, update the update step size and variational parameter of the current iteration step.

[0106] In one implementation, step 303 may include the following steps:

[0107] Step 3031: Determine whether the loss function value corresponding to the experimental variational parameter satisfies:

[0108] The loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, and / or the ratio of the loss function value corresponding to the experimental variational parameter to the loss function value of the previous iteration step is within a first preset value range.

[0109] Step 3032: Based on the judgment result, update the update step size and variational parameters of the current iteration step.

[0110] Step 3032 may include:

[0111] If satisfied, the experimental update step size is used as the update step size determined by the current iteration step, the experimental variational parameter is used as the variational parameter determined by the current iteration step, and the second step size update sub-parameter is updated to the first preset value.

[0112] If not satisfied, the second step size update sub-parameter is updated to the product of the current second step size update sub-parameter and the second preset value;

[0113] Return to the step of multiplying the update step size of the previous iteration step, the first step size update sub-parameter, and the second step size update sub-parameter as the experimental update step size of the current iteration step, until the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, and / or the ratio of the loss function value of the previous iteration step is within a first preset value range.

[0114] Specifically, if the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration, it indicates that the experimental variational parameter has an optimization effect on reducing the loss function value. Similarly, if the ratio of the loss function value corresponding to the experimental variational parameter to the loss function value of the previous iteration is within a first preset value range, it also indicates that the experimental variational parameter has an optimization effect on reducing the loss function value. For example, the aforementioned first preset value range can be [0.8-0.95], thereby allowing for a clearer and more accurate setting of the required reduction in the loss function value and a quantitative comparative analysis of the effect of reducing the loss function value.

[0115] Therefore, taking the example of determining whether the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, we will explain the update step size and update steps of the variational parameter for any iteration step.

[0116] In the above implementation, the experimental update step size α1α2λ of the current iteration step is obtained. ref Then, the current experimental variational parameter θ can be calculated. t -α1α2λ ref g allows adjustment of the variational quantum circuit based on the experimental variational parameters, and the loss function value can be obtained by measuring the circuit using the loss function value. The loss function value corresponding to the experimental variational parameters is then compared with the loss function value of the previous iteration.

[0117] If the loss function value corresponding to the variational parameter of the experiment is less than the loss function value of the previous iteration, it indicates that the variational parameter of the experiment has an optimization effect on reducing the loss function value, and the step size α1α2λ of the experiment can be updated. ref As the update step size determined in the current iteration step, the experimental variational parameter θ is used. t -α1α2λ refg is the variational parameter determined in the current iteration step. The update step size and variational parameter determined in the current iteration step can be used as initial values ​​for multiple experimental adjustments to the update step size and variational parameter in the next iteration step. The second step size update sub-parameter is updated to a first preset value. For example, the first preset value can be kept unchanged at 1. Thus, when the current loss function value converges, the target solution of the linear equation system can be determined. If it does not converge temporarily, the gradient sequence of the loss function for the next iteration step can be determined, and multiple experimental adjustments can be made based on the aforementioned determined update step size and update parameter in the next iteration step.

[0118] If the loss function value corresponding to the experimental variational parameter is not less than the loss function value of the previous iteration, it indicates that the current experimental variational parameter θ t -α1α2λ ref g has no effect on reducing the loss function value, so it is necessary to continue adjusting the experimental variational parameters and experimental update step size until the adjusted loss function value is less than the loss function value of the previous iteration step.

[0119] Due to the current experimental variational parameter θ t -α1α2λ ref g has no optimization effect on decreasing the loss function value, while the loss function gradient sequence is obtained through the loss function gradient measurement circuit, or approximated by the differential gradient sequence obtained through the difference method, both of which are relatively accurate; therefore, we can consider whether it is due to the update step size λ. ref If the step size is set improperly, and the first step update sub-parameter α1 further amplifies the experimental update step size, it may lead to an excessively large experimental update step size. This results in excessive changes in the experimental variational parameters, preventing the loss function value from decreasing. In one implementation, the second step update sub-parameter can be updated to the product of the current second step update sub-parameter and a second preset value. The second preset value can be a value between 0 and 1, allowing the experimental update step size to be greater than the update step size λ of the previous iteration during multiple adjustments. ref and less than λ ref The steps are varied to obtain a more reasonable experimental update step size.

[0120] For example, the initial value of the first step update sub-parameter α1 can be 1.2, and the initial value of the second step update sub-parameter α2 can be 1, with a second preset value of 0.5. Therefore, the experimental update step size obtained from the first adjustment can be 1.2 × 1 × λ. ref =1.2λ ref The update step size in this experiment is compared to the update step size λ of the previous iteration. ref The amplification effect was achieved, and thus the experimental variational parameter obtained from the first adjustment was θ. t -1.2λ refg. Then, if the loss function value L(θ) corresponding to the variational parameter of this experiment... t -1.2λ ref g) is less than the loss function value L(θ) of the previous iteration step. t If so, the step size of the experiment can be updated to 1.2λ. ref As the update step size determined in the current iteration step, the experimental variational parameter θ is used. t -1.2λ ref g is the variational parameter determined in the current iteration step.

[0121] If the loss function value corresponding to the variational parameter of the experiment is L(θ) t -1.2λ ref g) is not less than the loss function value L(θ) of the previous iteration step. t If this happens, the experimental update step size can be adjusted again. Specifically, the second step size update sub-parameter α2 is updated to the product of the current second step size update sub-parameter 1 and the second preset value 0.5, which is 1 × 0.5 = 0.5. Then, the process returns to the step of determining the experimental variational parameters for the current iteration step based on the variational parameters of the previous iteration step, the update step size of the previous iteration step, the gradient sequence of the loss function corresponding to the current iteration step, and the latest step size update parameters of the current iteration step. That is, in the second adjustment, the experimental update step size is changed to 1.2 × 0.5 × λ. ref =0.6λ ref The experimental update step size at this point is smaller than the update step size λ of the previous iteration. ref The experimental variational parameter obtained from the first adjustment is θ. t -0.6λ ref g, and then determine the loss function value L(θ) corresponding to the variational parameter of the experiment again. t -0.6λ ref g) Is it less than the loss function value L(θ) of the previous iteration step? t The above method allows for iterative adjustments to the experimental update step size and experimental variational parameters until the loss function value corresponding to the experimental variational parameters of the current iteration step is less than the loss function value of the previous iteration step.

[0122] In one implementation, the iterative update process of the variational parameters in each iteration step can be defined as the outer iteration; and the adjustment process of the experimental update step size and the experimental variational parameters within each iteration step can be defined as the inner iteration. The ultimate goal of the outer iteration is to continuously optimize the value of the variational parameters so that the loss function value gradually decreases; the ultimate goal of the inner iteration is to dynamically adjust the update step size of the variational parameters so that the loss function value decreases in each iteration step compared to the previous iteration step. The upper limit of the number of iterations for both the outer and inner iterations can be preset, denoted by the outer iteration parameter t. max and inner iteration parameter p max.

[0123] Therefore, within each iteration step, when the number of inner iterations reaches p... max If the quantum computation simulation of the current linear equation system fails, parameters such as the convergence precision η of the loss function value, the preset difference step size ∈, the first step size for updating sub-parameter α1, the second step size for updating sub-parameter α2, or the initial update step size λ0 can be reset. This can be done when the outer iteration count reaches t. max Alternatively, when the loss function value of a certain iteration step reaches the preset convergence accuracy η, the quantum computation simulation of the linear equation system can be stopped, and the quantum state prepared by the variable quantum circuit when the loss function value satisfies the preset convergence accuracy can be obtained. The approximate solution corresponding to the quantum state can be used as the target solution of the linear equation system.

[0124] As can be seen, the solution provided in this embodiment of the invention, by setting a fixed first-step update sub-parameter α1 and a variable second-step update sub-parameter α2, not only can the experimental update step size be gradually increased in each iteration step, thereby accelerating the decrease of the loss function value, but it can also perform more precise iterative processing on the experimental update step size and experimental variational parameters when the initial adjustment of the experimental variational parameters is not ideal, so that the loss function gradually decreases in each iteration step as much as possible, thus improving the success rate of simulating linear equation systems through quantum computing.

[0125] As one embodiment of the present invention, the quantum state obtained by the quantum operation is measured through a pre-constructed quantum state measurement circuit, which may include a loss function value measurement circuit and a loss function gradient measurement circuit.

[0126] The loss function gradient measurement circuit is used to measure each differential gradient term obtained by decomposing the loss function, and the differential gradient term is used to construct the gradient sequence of the loss function.

[0127] In this embodiment, a pre-constructed quantum state measurement circuit can be used to measure the quantum state obtained by running the quantum operation corresponding to the above-mentioned variable quantum circuit on the quantum chip. For example, the above-mentioned Hadamard Test circuit can be used to measure each differential gradient term obtained by decomposing the loss function, thereby constructing the loss function gradient sequence g.

[0128] Specifically, when simulating a system of linear equations using quantum computing, in order to obtain the gradient sequence g of the loss function, a large number of quantum circuits can be constructed to obtain each differential gradient g separately. i For example, when implementing this scheme, the loss function L(θ) first needs to be decomposed on a Pauli base, resulting in:

[0129]

[0130] Based on the above decomposition method, the following can be generated: and<b|A|φ> Three items, of which It can be further broken down into:

[0131]

[0132] Then take the above formula Decomposition on Pauliji yields:

[0133]

[0134] Where J = J(i) is U i (θ i The number of terms in the Pauliji decomposition. c j It is the coefficient of each term, σ j It is the Pauli basic unit. The advantage of the above decomposition method is that it is... The terms generated by the decomposition are measurable, thus allowing the terms of the gradient of the loss function L(θ) to be measured and obtained separately through multiple quantum circuits.

[0135] Then, assuming the Hamiltonian in the above scheme It can be graded on Pauliji as follows: The number of terms obtained from the decomposition is K; U in each of the terms obtained from the above decomposition i (θ i The number of terms decomposed on the Paulige scale is J; and the number of parameters proposed in the above-described scheme is I. Therefore, it can be obtained that when simulating the linear equation system corresponding to the target system using quantum computing in this embodiment, the total number of quantum circuits required to directly measure the differential gradient g of the loss function is O(IJK). The decomposition method in the above scheme greatly reduces the depth of each quantum circuit, but it also leads to an increase in the classical computational load used to calculate the decomposition process, resulting in a large total number of quantum circuits.

[0136] To reduce the number of quantum circuits required to simulate linear equations, multiple loss function values ​​obtained from the measurement circuit can be used to approximate the gradient using the idea of ​​difference approximation. The finite difference method is a numerical method for differential equations that approximates the derivative through finite differences to find approximate solutions to the differential equations.

[0137] Accordingly, as another embodiment of the present invention, the quantum state obtained by the quantum operation is measured by a pre-constructed quantum state measurement circuit, which may include a loss function value measurement circuit.

[0138] In each iteration step, the sequence of gradients of the loss function can be obtained based on the following steps:

[0139] Step 401, for each variational parameter θ of the variational quantum circuit i Based on the preset difference step size ∈, the variational parameter is adjusted to θ. i +∈, and use the loss function value to measure the line to obtain a target loss function value after the variational parameter adjustment.

[0140] Specifically, in one implementation, the loss function gradient sequence can be approximated by a differential gradient sequence calculated based on multiple loss function values. The differential gradient sequence includes multiple approximate gradients of the loss function obtained by performing differential operations on multiple loss function values, which are used to indicate the update direction of each variational parameter, i.e., the rotation direction of the parameterized quantum logic gate; the update step size is used to indicate the amount of change in the rotation angle of the parameterized quantum logic gate in each iteration step.

[0141] In each iteration step, the differential gradient sequence is determined based on the loss function value of the previous iteration step, the preset differential step size, and multiple target loss function values. Each target loss function value is obtained by individually adjusting the preset differential step size of a corresponding variational parameter and then measuring the loss function value using the measurement line.

[0142] Specifically, in the initial iteration step, the initial variational parameters θ = {θ1,…,θ2} can first be obtained by measuring the circuit using the aforementioned loss function values. i ,…θ I The corresponding initial loss function value L(θ1,…,θ) i ,…,θ I If, based on the initial loss function value, the initial iteration step does not meet the preset iteration termination condition (i.e., the initial loss function value does not converge), then the variational parameters need to be iterated repeatedly to gradually reduce the loss function value in each iteration step. The initial variational parameters can be arbitrary or empirical values ​​set by those skilled in the art; for example, the preset iteration termination condition can be a preset convergence accuracy η of the loss function value, where η = 10. -8 Or 10 -9 The number of iterations can be preset to 1000, 10000, etc., without specific limitations. Correspondingly, if the initial iteration step satisfies the preset iteration termination condition based on the initial loss function value, that is, when the initial loss function value has converged, the quantum state prepared by the current variable quantum circuit can be obtained, and the approximate solution corresponding to the quantum state can be used as the target solution of the target linear equation system.

[0143] If the initial iteration step does not meet the preset iteration termination condition, then in the subsequent first iteration step, each variational parameter θ can be adjusted based on the preset difference step size ∈. i Adjusted separately to θ i +∈, and after each adjustment, the above loss function value is used to measure the line to obtain a corresponding target loss function value. For example, the first variational parameter θ1 is adjusted to θ1+∈, thereby obtaining the corresponding target loss function value L1(θ1+∈), ..., the I-th variational parameter θ I Adjusted separately to θ I +∈, thus obtaining the corresponding target loss function value L. I (θ I +∈); thus obtaining a sequence of I target loss function values.

[0144] The preset difference step size ∈ represents the precision of approximating the gradient of the loss function using the difference method. When its value is too large, the low precision may make it difficult to achieve the target approximation effect, thus preventing the loss function value from decreasing. When its value is too small, the high precision will increase the number of iterations required. Therefore, the value of the preset difference step size ∈ needs to take into account the above specific situations. For example, it can be set to 10. -1 10 -3 Or 10 -5 etc., without making specific limitations here.

[0145] Step 402: Calculate the quotient of each target difference and the preset difference step size ∈, and use it as a corresponding element in the gradient sequence of the loss function;

[0146] The target difference is the difference between a target loss function value and the loss function value before variational parameter adjustment.

[0147] Furthermore, having obtained a sequence of I target loss function values, we can then calculate a target loss function value L for each value. i (θ i +∈) and the loss function value L(θ1,…,θ) before variational parameter adjustment. i ,…,θ I The difference between the target difference and the preset difference step size is used as the target difference value. Then, the quotient of each target difference value and the preset difference step size is calculated as the difference gradient sequence d = {d1, ...,d2}. i ,…d I The corresponding element d in} i ,Right now:

[0148]

[0149] The sequence element d iThen the corresponding term g in the differential gradient g of the approximate loss function i d i ≈g i Furthermore, as ∈→0, ‖dg‖→0. Therefore, the difference gradient sequence d can approximately represent the loss function gradient sequence g. Based on the product of the difference gradient sequence d and the update step size of the variational parameters, the variational parameters in each iteration step can be updated. Then, the loss function value for that iteration step is obtained, and it is determined whether the iteration step meets the preset iteration termination condition. Thus, the loss function value is gradually reduced through iterative iteration until the preset iteration termination condition is met, at which point the target solution of the linear equation system can be obtained.

[0150] As can be seen, in this embodiment, by reasonably setting the preset difference step size ∈, the differential gradient of the loss function can be approximated quickly and accurately using the difference method, thereby constructing a difference gradient sequence that approximately represents the loss function gradient sequence. Then, the product of the difference gradient sequence and the update step size of the variational parameters can be calculated, and the variational parameters in the variational quantum circuit can be updated iteratively to gradually reduce the loss function value until the preset iteration termination condition is met, thus obtaining the target solution of the linear equation system.

[0151] By obtaining multiple loss function values ​​for the linear equation system, multiple approximate derivatives of the loss function can be obtained through finite difference methods, thus approximating the differential gradient of the loss function. Therefore, a large number of loss function gradient measurement circuits are not required to obtain gradient information; only a small number of loss function value measurement circuits are needed to approximate the gradient. Consequently, the total number of quantum circuits required to simulate the linear equation system is reduced from O(IJK) to O(IK), and one less controlled σ is introduced in each running quantum circuit. j This not only significantly reduces the number of quantum circuits required to simulate linear equations, but also saves a large amount of quantum computing resources, reduces computation time, greatly improves computational efficiency, and promotes the further development of quantum linear solvers running on real quantum chips.

[0152] See Figure 5 , Figure 5 A line parameter updating device for a variable quantum line is provided in an embodiment of the present invention. The device includes:

[0153] The measurement module 501 is used to run the quantum operation corresponding to the variational quantum circuit on the quantum chip in each iteration step, and measure the quantum state obtained by the quantum operation to obtain the loss function value and loss function gradient sequence corresponding to the current variational parameters.

[0154] Update module 502 is used to update the variational parameters based on the update step size of the variational parameters determined for the current iteration step in the variational quantum circuit in response to the current non-convergence of the loss function value.

[0155] The update amount of the variational parameter is determined by the update step size of the current iteration step and the gradient sequence of the loss function; the update step size is obtained based on the update step size of the previous iteration step and the step size update parameter of the current iteration step.

[0156] The specific functions and effects of the aforementioned variable quantum line parameter update device can be explained by referring to other embodiments in this specification, and will not be repeated here. Each module in the variable quantum line parameter update device can be implemented entirely or partially through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in a computer device in hardware form, or it can be stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0157] Please see Figure 6 This specification also provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the line parameter update method for variable quantum circuits in any of the above embodiments. Please refer to [link to documentation]. Figure 6 The computer device can be a classical computer or a quantum computer.

[0158] This specification also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, causes the computer to perform the line parameter update method for the variable quantum line in any of the above embodiments.

[0159] This specification also provides a computer program product containing instructions that, when executed by a computer, cause the computer to perform the line parameter update method for variable quantum lines in any of the above embodiments.

[0160] It is understood that the specific examples in this specification are only intended to help those skilled in the art better understand the implementation methods described herein, and are not intended to limit the scope of the invention.

[0161] It is understood that in the various embodiments of this specification, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not limit the implementation process of the embodiments of this specification in any way.

[0162] It is understood that the various implementation methods described in this specification can be implemented individually or in combination, and the implementation methods in this specification are not limited in this respect.

[0163] Unless otherwise stated, all technical and scientific terms used in the embodiments of this specification have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this specification. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items. The singular forms "a," "the," and "the" as used in the embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0164] It is understood that the processor in the embodiments of this specification can be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this specification. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this specification can be directly implemented by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above methods.

[0165] It is understood that the memory in the embodiments of this specification may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM). It should be noted that the memory in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0166] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this specification.

[0167] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the aforementioned method implementations, and will not be repeated here.

[0168] In the several embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0169] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0170] In addition, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0171] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of this specification, in essence, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of software products. These computer software products are stored in a storage medium and include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this specification. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0172] The above description is merely a specific embodiment of this specification, but the scope of protection of this invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this specification should be included within the scope of protection of this specification. Therefore, the scope of protection of this invention should be determined by the scope of the claims.

Claims

1. A method for updating line parameters of a variable quantum line, characterized in that, The method includes: In each iteration step, the quantum operation corresponding to the variational quantum circuit is run on the quantum chip, and the quantum state obtained by the quantum operation is measured to obtain the loss function value and loss function gradient sequence corresponding to the current variational parameter; In response to the current loss function value not converging, the variational parameters are updated based on the update step size of the variational parameters determined for the current iteration step in the variational sub-path; wherein, the update amount of the variational parameters is jointly determined by the update step size of the current iteration step and the gradient sequence of the loss function; the update step size is obtained based on the update step size of the previous iteration step and the step size update parameter of the current iteration step; the step size update parameter includes a first step size update sub-parameter with a fixed value and a second step size update sub-parameter with a variable value; The step of updating the variational parameters based on the update step size of the variational parameters determined for the current iteration step in the variational quantum circuit includes: The product of the update step size of the previous iteration, the first step update sub-parameter, and the second step update sub-parameter is used as the experimental update step size of the current iteration, so as to amplify the update step size during the iteration process. Obtain the product of the experimental update step size and the gradient sequence of the loss function corresponding to the current iteration step, and use it as the experimental update amount of the current iteration step; calculate the difference between the variational parameter determined in the previous iteration step and the experimental update amount of the current iteration step, and use it as the experimental variational parameter of the current iteration step. Determine whether the loss function value corresponding to the experimental variational parameter satisfies: the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, and / or the ratio of the loss function value corresponding to the experimental variational parameter to the loss function value of the previous iteration step is within a first preset value range; If satisfied, the experimental update step size is used as the update step size determined by the current iteration step, the experimental variational parameter is used as the variational parameter determined by the current iteration step, and the second step size update sub-parameter is updated to the first preset value. If not satisfied, the second step size update sub-parameter is updated to the product of the current second step size update sub-parameter and the second preset value; and the process returns to the step of using the product of the update step size of the previous iteration step, the first step size update sub-parameter, and the second step size update sub-parameter as the experimental update step size of the current iteration step, until the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, and / or the ratio to the loss function value of the previous iteration step is within the first preset value range; the second preset value is a number between 0 and 1.

2. The method as described in claim 1, characterized in that, The quantum state obtained by the quantum operation is measured through a pre-constructed quantum state measurement circuit, which includes a loss function value measurement circuit. In each iteration step, the sequence of gradients of the loss function is obtained based on the following steps: For each variational parameter of the variational quantum circuit Based on the preset difference step size Adjust the variational parameter to The target loss function value after the variational parameter adjustment is obtained by measuring the line using the loss function value. Calculate each target difference with the preset difference step size. The quotient is used as a corresponding element in the gradient sequence of the loss function; wherein, the target difference is the difference between a target loss function value and the loss function value before variational parameter adjustment.

3. The method as described in claim 1, characterized in that, The quantum state obtained by the quantum operation is measured through a pre-constructed quantum state measurement circuit, which includes a loss function value measurement circuit and a loss function gradient measurement circuit. The loss function gradient measurement circuit is used to measure each differential gradient term obtained by decomposing the loss function, and the differential gradient term is used to construct the gradient sequence of the loss function.

4. A line parameter updating device for a variable quantum circuit, characterized in that, The device includes: The measurement module is used to run the quantum operation corresponding to the variational quantum circuit on the quantum chip in each iteration step, and measure the quantum state obtained by the quantum operation to obtain the loss function value and loss function gradient sequence corresponding to the current variational parameters. An update module is used to respond to the current non-convergence of the loss function value by updating the variational parameters based on the update step size of the variational parameters determined for the current iteration step in the variational sub-path; wherein, the update amount of the variational parameters is jointly determined by the update step size of the current iteration step and the gradient sequence of the loss function; the update step size is obtained based on the update step size of the previous iteration step and the step size update parameter of the current iteration step; the step size update parameter includes a first step size update sub-parameter with a fixed value and a second step size update sub-parameter with a variable value; The step of updating the variational parameters based on the update step size of the variational parameters determined for the current iteration step in the variational quantum circuit includes: The product of the update step size of the previous iteration, the first step update sub-parameter, and the second step update sub-parameter is used as the experimental update step size of the current iteration, so as to amplify the update step size during the iteration process. Obtain the product of the experimental update step size and the gradient sequence of the loss function corresponding to the current iteration step, and use it as the experimental update amount of the current iteration step; calculate the difference between the variational parameter determined in the previous iteration step and the experimental update amount of the current iteration step, and use it as the experimental variational parameter of the current iteration step. Determine whether the loss function value corresponding to the experimental variational parameter satisfies: the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, and / or the ratio of the loss function value corresponding to the experimental variational parameter to the loss function value of the previous iteration step is within a first preset value range; If satisfied, the experimental update step size is used as the update step size determined by the current iteration step, the experimental variational parameter is used as the variational parameter determined by the current iteration step, and the second step size update sub-parameter is updated to the first preset value. If not satisfied, the second step size update sub-parameter is updated to the product of the current second step size update sub-parameter and the second preset value; the second preset value is a number between 0 and 1; and the process returns to the step of using the product of the update step size of the previous iteration step, the first step size update sub-parameter, and the second step size update sub-parameter as the experimental update step size of the current iteration step, until the loss function value corresponding to the experimental variational parameter is less than the loss function value of the previous iteration step, and / or the ratio of the loss function value of the previous iteration step is within the first preset value range.

5. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1-3 when it is run.

6. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method described in any one of claims 1-3.

Citation Information

Patent Citations

  • Quantum variational method, apparatus, and storage medium for simulating quantum systems

    CN113710609A

  • Method and device for solving differential equation by using quantum circuit

    CN116738125A