Quantum computing method and apparatus, device, chip, medium, and program product

Through the natural gradient descent algorithm with memory, combined with the historical round of metric matrix update parameters, the numerical instability caused by the pathological QFI matrix in variable component quantum algorithm is solved, and faster convergence and higher computational accuracy are achieved.

WO2025139174A1PCT designated stage expired Publication Date: 2025-07-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Application Number
PCT/CN2024/123025
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-25
Filing Date
2024-09-30
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

In the existing variable component quantum algorithms, the gradient descent scheme has problems such as local optimal solutions, high noise sensitivity and gradient disappearance, especially the pathological QFI matrix leads to instability in numerical calculations, affecting optimization efficiency.

Method used

The natural gradient descent algorithm with memory is used to determine the j-th round measurement matrix by combining the first j-1 round measurement matrix, and adaptive QFI updates are performed to optimize the geometric structure and parameter correlation of the parameter space to reduce matrix pathological problems.

Benefits of technology

It improves the stability and accuracy of quantum computing, reduces calculation errors, speeds up the convergence speed of the loss function, and improves the calculation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024123025_03072025_PF_FP_ABST
    Figure CN2024123025_03072025_PF_FP_ABST
Patent Text Reader

Abstract

A quantum computing method and apparatus, a device, a chip, a medium, and a program product, relating to the technical field of quantum. The method comprises: acquiring a loss function corresponding to a first quantum circuit (210); in the process of iteratively updating a first parameter in the first quantum circuit on the basis of the loss function to enable the eigenstate of the first quantum circuit to approach a ground state, on the basis of metric matrices determined in previous j-1 rounds of iterative updating processes of the first parameter, determining a j-th metric matrix applied to a j-th round of iterative updating process of the first parameter (220); and performing a j-th round of gradient descent iterative updating on the first parameter on the basis of the loss function and the j-th metric matrix until an iterative updating requirement is met, to obtain the iteratively updated first parameter as a second parameter, and obtaining a second quantum circuit on the basis of the second parameter (230).
Need to check novelty before this filing date? Find Prior Art

Description

Quantum computing methods, devices, equipment, chips, media and program products

[0001] This application claims priority to Chinese patent application number 202311812386.1, filed on December 25, 2023, entitled “Quantum computing methods, devices, equipment, storage media and program products,” the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of quantum technology, and in particular to a quantum computing method, apparatus, device, chip, medium, and program product. Background Art

[0003] In variational quantum algorithms (VQA), gradient descent is a commonly used optimization method for adjusting parameters in parameterized quantum circuits to minimize an objective function. Although widely used in VQA, this method still suffers from issues such as local optimal solutions, high noise sensitivity, and vanishing gradients.

[0004] In related technologies, the gradient descent algorithm is optimized by adopting the natural gradient descent method and multiplying the gradient by the matrix inverse of the quantum Fisher Information (QFI). This improves the optimization efficiency by better considering the local similarity and curl of the quantum state space.

[0005] However, the above method needs to consider the QFI matrix and invert the QFI matrix. In practical problems and experiments, the QFI matrix is ​​almost always ill-conditioned, that is, the rows or columns of the QFI matrix are almost linearly related. This makes the inverse of the QFI matrix very sensitive during numerical calculation and easily affected by rounding errors, resulting in poor numerical calculation stability and large errors in the process of inverting the QFI matrix.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a quantum computing method, apparatus, device, chip, medium, and program product that can improve the stability of quantum computing. The technical solution is as follows.

[0008] In one aspect, a quantum computing method is provided, wherein the method is performed by a computer device, and the method comprises:

[0009] Obtaining a loss function corresponding to a first quantum circuit, where the first quantum circuit includes a first parameter, the first parameter being used to indicate a rotation angle of a quantum gate in the first quantum circuit, and the loss function being used to determine an energy prediction loss value of the first quantum circuit based on the first parameter;

[0010] In a process of iteratively updating a first parameter in the first quantum circuit based on the loss function so that an eigenstate of the first quantum circuit approaches a ground state, determining a j-th metric matrix applied in a j-th round of iterative updating of the first parameter based on a metric matrix determined in a previous j-1 round of iterative updating of the first parameter, where j>1, the metric matrix is ​​used to indicate a gradient descent amplitude of the first parameter;

[0011] Performing a j-th round of gradient descent iterative update on the first parameter based on the loss function and the j-th metric matrix until an iterative update requirement is met, obtaining the iteratively updated first parameter as the second parameter, and adjusting the rotation angle of the quantum gate based on the second parameter to obtain a second quantum circuit.

[0012] In another aspect, a quantum computing device is provided, comprising:

[0013] an acquisition module, configured to acquire a loss function corresponding to a first quantum circuit, wherein the first quantum circuit includes a first parameter, the first parameter being used to indicate a rotation angle of a quantum gate in the first quantum circuit, and the loss function being used to determine an energy prediction loss value of the first quantum circuit based on the first parameter;

[0014] a processing module, configured to determine, in a process of iteratively updating a first parameter in the first quantum circuit based on the loss function so that an eigenstate of the first quantum circuit approaches a ground state, a j-th metric matrix applied in a j-th round of iterative updating of the first parameter based on a metric matrix determined in a previous j-1 round of iterative updating of the first parameter, where j>1, and the metric matrix is ​​used to indicate a gradient descent amplitude of the first parameter;

[0015] The processing module is further configured to perform a j-th round of gradient descent iterative update on the first parameter based on the loss function and according to the j-th metric matrix until an iterative update requirement is met, obtain the iteratively updated first parameter as the second parameter, and adjust the rotation angle of the quantum gate based on the second parameter to obtain a second quantum circuit.

[0016] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the quantum computing method as described in any of the above-mentioned embodiments of the present application.

[0017] On the other hand, a quantum chip is provided, comprising a second quantum circuit obtained by executing any of the quantum computing methods described in the above embodiments of the present application.

[0018] On the other hand, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the quantum computing method as described in any of the above-mentioned embodiments of the present application.

[0019] In another aspect, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the quantum computing method described in any of the above embodiments.

[0020] The beneficial effects of the technical solutions provided in the embodiments of the present application include at least:

[0021] When iteratively updating the first parameter of the first quantum circuit through the loss function, in the iterative update process of the current round, the metric matrix used in the iterative update process of the historical round is determined, and then the loss function is used on the determined metric matrix to realize the gradient descent iterative update of the first parameter until the iterative update requirements are met, and the second quantum circuit is updated. Since the metric matrix of the historical round is incorporated into the update of the first parameter in each round, the contribution of the historical steps in the gradient descent iterative update process is averaged, the variance of the calculated quantum Fisher information is reduced, the convergence speed of the loss function is accelerated, the stability of the calculation results is improved, the calculation error is reduced, and the accuracy and efficiency of the quantum calculation are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] FIG1 is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;

[0023] FIG2 is a flow chart of a quantum computing method provided by an exemplary embodiment of the present application;

[0024] FIG3 is a flow chart of a method for determining a metric matrix provided by an exemplary embodiment of the present application;

[0025] FIG4 is a flow chart of a parameter updating method provided by an exemplary embodiment of the present application;

[0026] FIG5 is a schematic diagram of a first quantum circuit structure provided by an exemplary embodiment of the present application;

[0027] FIG6 is a schematic diagram showing a performance comparison provided by an exemplary embodiment of the present application;

[0028] FIG7 is a schematic diagram of a first quantum circuit structure provided by an exemplary embodiment of the present application;

[0029] FIG8 is a schematic diagram showing a performance comparison provided by an exemplary embodiment of the present application;

[0030] FIG9 is a block diagram of a quantum computing device provided by an exemplary embodiment of the present application;

[0031] FIG10 is a block diagram of a quantum computing device module provided by an exemplary embodiment of the present application;

[0032] FIG11 is a structural block diagram of a terminal provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0033] Before introducing the embodiments of the present application, some terms involved in the present application are first explained.

[0034] 1. Quantum computing: A computing method based on quantum logic, where the basic unit of data storage is the quantum bit (qubit).

[0035] 2. Qubit: The basic unit of quantum computing. Traditional computers use 0 and 1 as the basic units of binary. However, quantum computing can process both 0 and 1 simultaneously, allowing the system to be in a linear superposition of 0 and 1: |ψ>=α|0>+β|1>, where α and β represent the complex probability amplitude of the system at 0 and 1. Their squared modulus |α| 2 ,|β| 2 represent the probabilities of being 0 and 1 respectively.

[0036] 3. Hamiltonian: A Hermitian-conjugated matrix that describes the total energy of a quantum system. Hamiltonian is a physics term and an operator that describes the total energy of a system, usually denoted by H.

[0037] 4. Quantum state: In quantum mechanics, a quantum state is a microscopic state determined by a set of quantum numbers.

[0038] 5. Eigenstates: In quantum mechanics, the possible values ​​of a mechanical quantity are the complete set of eigenvalues ​​of its operator. The state described by the eigenfunction is called the eigenstate of that operator. In its own eigenstate, the mechanical quantity takes a definite value, namely the eigenvalue belonging to that eigenstate. For a Hamiltonian matrix H, the solution that satisfies the equation H|ψ〉 = E|ψ〉 is called an eigenstate of H |ψ〉, with an eigenenergy E. The ground state corresponds to the lowest-energy eigenstate of the quantum system.

[0039] 6. Quantum Circuit: Also known as a quantum circuit, this is a representation of a quantum universal computer, representing the hardware implementation of a corresponding quantum algorithm or program within a quantum gate model. If a quantum circuit includes adjustable parameters for controlling quantum gates, it is called a parameterized quantum circuit (PQC) or a variational quantum circuit (VQC), both of which are synonymous.

[0040] 7. Quantum gate: In quantum computing, especially in the computing model of quantum circuits, a quantum gate (or quantum logic gate) is a basic quantum circuit that operates a small number of quantum bits.

[0041] 8. Noisy Intermediate-Scale Quantum (NISQ): This represents the current stage of quantum computing development and a key research focus. While limited by scale and noise, quantum computing at this stage cannot be used as a general-purpose computing engine, it can already achieve results that surpass the most powerful classical computers for some problems. This is often referred to as quantum advantage.

[0042] 9. Variational Quantum Algorithm (VQA): This algorithm typically uses an adjustable parameterized quantum circuit, whose parameters can be optimized through classical computing. By iteratively adjusting these parameters, the algorithm can gradually approach the optimal solution to the problem. This iterative optimization process can use classical optimization algorithms such as gradient descent. Variational quantum algorithms have a wide range of applications in solving optimization problems, such as in chemical calculations for simulating molecular structure and reaction dynamics, and in machine learning for training quantum neural networks. Although the practical application of variational quantum algorithms still faces many challenges, such as noise and error correction, they represent a promising approach that can leverage the potential of quantum computers to solve complex optimization problems.

[0043] 10. Variational Quantum Eigensolver (VQE): This approach uses variational circuits (i.e., PQC / VQC) to estimate the ground-state energy of a specific quantum system. It is a typical quantum-classical hybrid computing paradigm with widespread applications in quantum chemistry.

[0044] 11. Variational Optimization: For a function whose input is multiple variables and whose output is a scalar (called a loss function or objective function), the process of minimizing the output scalar by adjusting the input variables is called variational optimization. The method of adjusting the input variables in this process is called an optimizer or optimization scheme.

[0045] 12. Gradient Descent: The most representative local optimizer in variational optimization. For a scalar loss function, this optimization technique minimizes the loss function by updating the input variables in the opposite direction of the derivative of the loss function with respect to the variable. Mathematically, Δθ = -λg, where λ is the learning rate and g is the vector of derivatives of the loss function with respect to the input parameter θ.

[0046] 13. Quantum Fisher Information (QFI): A key concept in quantum mechanics, it measures the sensitivity and information content of a quantum state. It provides information about the parameters of a quantum state, including their precision and distinguishability. In quantum mechanics, we can describe a system using parameterized quantum states, where the parameters can be arbitrary physical quantities. Quantum Fisher Information measures the impact of changes in the quantum state on the measurement outcome under given parameters. It can be used to assess the sensitivity of a quantum state, that is, its sensitivity to changes in the parameters. Mathematically, considering the parameterized quantum state |ψ(θ)>, the corresponding QFI matrix is ​​given. Quantum Fisher Information has a wide range of applications in quantum measurement, quantum estimation, and quantum information processing. It plays an important role in tasks such as quantum parameter estimation, quantum state reconstruction, and quantum communication. By maximizing quantum Fisher Information, quantum measurement schemes can be optimized and the efficiency and accuracy of quantum information processing can be improved.

[0047] 14. Natural Gradient Descent: For each parameter update in the variational optimization problem, the gradient is multiplied by the matrix inverse of the quantum Fisher information. This optimization can better take into account the local similarity and curl of the quantum state space, making the optimization more efficient. Mathematically, for the natural gradient descent update of the input parameters, Δθ = -λQFI -1 g, where λ is the learning rate and g is the derivative vector of the loss function with respect to the parameters θ.

[0048] 15. Ill-conditioned matrices: Ill-conditioned matrices are characterized by a large condition number (condition number), meaning the ratio of the largest singular value to the smallest singular value is large. The condition number measures the stability and numerical sensitivity of a matrix when solving linear equations or performing matrix inversion operations. A large condition number indicates significant variation in the singular values, with the smallest singular value approaching zero. This can lead to numerical instability in matrix inversion.

[0049] In VQA, gradient descent is a commonly used optimization method for adjusting parameters in a parameterized quantum circuit to minimize an objective function. Specifically, the gradient descent scheme performs the following steps in each iteration: Step 1: Calculate the gradient of the objective function with respect to the parameters in the parameterized quantum circuit; Step 2: Update the parameters based on the direction of the gradient and the learning rate (i.e., step size); Step 3: Repeat steps 1 and 2 until a predetermined stopping condition is reached (e.g., the maximum number of iterations is reached or the magnitude of the gradient is small enough).

[0050] Although gradient descent is widely used in variational quantum algorithms, it also has some drawbacks: Local optimal solutions: Gradient descent can get stuck in local optimal solutions and fail to find the global optimal solution. This is because gradient descent only guarantees the optimal solution for the current position, not the global optimal solution. High noise sensitivity: Quantum computing is subject to noise and errors, which can affect the calculation and update of gradients. Gradient descent is very sensitive to noise and errors, which can lead to instability and inefficiency in parameter updates. Vanishing gradients: In some cases, gradient descent can encounter the problem of vanishing gradients. Vanishing gradients occur when the gradient value becomes very small, causing parameter updates to slow or stagnate. In summary, gradient descent is a commonly used optimization method in variational quantum algorithms, but it also suffers from drawbacks such as local optimal solutions, noise sensitivity, vanishing gradients, and high computational cost. In particular, in quantum simulation and quantum machine learning problems, gradient descent, because it does not account for the curvature of the state space introduced by the wave function parameterization, has low optimization efficiency and is prone to getting stuck in local minima. These problems can theoretically be largely alleviated by natural gradient descent.

[0051] Natural gradient descent (NGD) requires consideration of the QFI matrix and the inversion of this matrix. However, in practical problems and experiments, the QFI matrix is ​​almost always ill-conditioned. This makes the inversion of this matrix numerically unstable or even infeasible, significantly impacting the application of NGD. A more direct mitigation solution is to add a very small positive diagonal matrix to the QFI matrix before each inversion. However, this solution lacks adaptability, and a weak correction may still cause numerical stability issues. A stronger correction will change the true value and physical meaning of the QFI, causing optimization deviations.

[0052] The quantum computing method provided in the embodiment of the present application proposes a natural gradient descent algorithm with memory. By determining the jth metric matrix based on the first j-1 metric matrices, a natural gradient descent scheme combined with adaptive memory QFI update is implemented, thereby achieving the following advantages: (1) Considering the geometric structure of the parameter space: Natural gradient descent takes into account the geometric structure of the parameter space, which is equivalent to the evolution in imaginary time, rather than relying solely on the size and direction of the gradient. It uses the metric matrix (QFI) to adjust the direction and size of the gradient to better adapt to the geometric characteristics of the parameter space. This can improve the efficiency and stability of parameter updates. (2) Considering the correlation of parameters: Natural gradient descent takes into account the correlation between parameters, rather than simply updating each parameter independently. It uses the inverse of the metric matrix to adjust the gradient to take into account the correlation between parameters. This can reduce the redundancy and conflict of parameter updates and improve the optimization effect. (3) Alleviating the matrix ill-conditioning problem: Through the memory update mechanism, this scheme basically solves the serious matrix ill-conditioning problem in the standard natural gradient descent scheme. The memory mechanism can offset the influence of the matrix condition number and reduce the instability of numerical calculations and the accumulation of errors. (4) Faster convergence speed: Since natural gradient descent takes into account the geometric structure and correlation of the parameter space, it can usually achieve faster convergence speed with the same number of iterations. This means that with the same computing resources, this scheme can find the optimized solution faster. Taking the rotation angle of the quantum gate as an example of the quantized parameter to be solved, the optimization goal for the quantum circuit is to make the eigenstate of the quantum circuit approach the ground state. The parameter is updated by natural gradient descent with memory to obtain the solution of the parameter. The quantum circuit can adjust the rotation angle of the quantum gate based on the solution to update the quantum state so that the eigenstate of the quantum circuit reaches the ground state.

[0053] Please refer to FIG1 , which shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application. The implementation environment includes: a terminal 110 .

[0054] The terminal 110 is a computer device. The quantum computing method provided in the embodiments of the present application can be implemented by a classical computer (such as a PC), for example, by executing a corresponding computer program on the classical computer to implement the method. It can also be implemented in a hybrid device environment of a classical computer and a quantum computer, for example, by cooperating with a classical computer and a quantum computer to implement the method. For example, a quantum computer is used to implement the solution of the eigenstate in the embodiments of the present application, and a classical computer is used to implement other steps in the embodiments of the present application besides solving the eigenstate problem.

[0055] In the following method embodiments, for ease of description, only a computer device is used as the execution subject of each step. It should be understood that the computer device can be a classical computer or a hybrid execution environment including a classical computer and a quantum computer, and this embodiment of the application is not limited to this.

[0056] Schematically, please refer to FIG2 , which shows a flow chart of a quantum computing method provided by an exemplary embodiment of the present application. The present embodiment of the application takes the method executed by a computer device as an example. As shown in FIG2 , the method includes the following steps:

[0057] Step 210: Obtain the loss function corresponding to the first quantum circuit.

[0058] The first quantum circuit includes a first parameter, which is used to indicate a rotation angle of a quantum gate in the first quantum circuit. The loss function is used to determine an energy prediction loss value of the first quantum circuit based on the first parameter.

[0059] For example, the rotation angle of a quantum gate describes the rotational transformation of a quantum state on the Bloch sphere. Common quantum rotation gates include the RX(θ) gate, the RY(θ) gate, and the RZ(θ) gate. RX(θ) gate, RY(θ) gate, and RZ(θ) gate are three basic single-qubit rotation gates, where θ is the rotation angle. The RX(θ) gate rotates the state vector of a qubit around the X-axis, the RY(θ) gate rotates the state vector of a qubit around the Y-axis, and the RZ(θ) gate rotates the state vector of a qubit around the Z-axis. The RX(θ) and RY(θ) gates are used to change the probability amplitude of a quantum state, while the RZ(θ) gate is used to change the phase of a quantum state.

[0060] In some embodiments, a quantum system is considered to be a collection of multiple qubits that interact with each other. The size of the quantum system indicates the number of qubits in the quantum system. For a quantum system with n qubits, for example, the first parameter is the parameter of an adjustable control quantum gate contained in a first quantum circuit. The first quantum circuit is a parameterized first quantum circuit (PQC). The first PQC is used to transform the input quantum state of the n qubits to obtain an output quantum state of the n qubits, where n is a positive integer. The output quantum state is used to approximate the eigenstate of the quantum system. A second quantum circuit is obtained by adjusting the first parameter in the first quantum circuit, where the first parameter indicates the rotation angle of the quantum gate in the first quantum circuit. Specifically, adjusting the rotation angle of the quantum gate in the first quantum circuit results in the second quantum circuit. The second quantum circuit is used to transform the quantum system to obtain a target quantum system, where the eigenstate of the target quantum system is the ground state.

[0061] A first parameter in a first PQC is iteratively optimized using a variational quantum algorithm (VQA) so that the output state of the first PQC reaches or approaches a ground state, wherein a loss function is constructed and the expectation of the Hamiltonian corresponding to the first quantum circuit is used as an optimization objective. The first parameter is updated based on minimizing the loss function so that the output state of the first PQC based on the first parameter reaches or approaches the ground state. During the optimization process, the first parameter is updated based on the loss function, and the loss function is used to determine an energy prediction loss value of the first quantum circuit based on the first parameter, wherein the energy prediction loss value is used to indicate the difference between a first energy corresponding to the quantum system in the output state of the first quantum circuit based on the current first parameter and a second energy corresponding to the quantum system in the ground state, that is, the loss function is used to determine the difference between the output state of the first quantum circuit based on the current first parameter and the ground state. The first parameter is updated by optimizing the loss function until the iterative update requirement is met, thereby obtaining a second parameter, and a second quantum circuit is obtained based on the second parameter, wherein the output state of the second quantum circuit based on the second parameter reaches or approaches the ground state.

[0062] In some embodiments, a loss function is constructed based on the Hamiltonian of the quantum system, and the energy expectation value of the Hamiltonian of the quantum system in the output quantum state of n quantum bits is used as the optimization target. Schematically, the variational parameter θ is loaded into the parameterized first quantum circuit. Specifically, a quantum gate with adjustable parameters is selected as the target quantum gate according to the algorithm requirements, and the gate parameters are set for the target quantum gate, wherein the rotation angle of the target quantum gate is set to the rotation angle indicated by the parameter θ. Based on the above settings, a first quantum circuit is constructed, and the input data is encoded on the quantum bit to form the input state of the first quantum circuit. The input state is evolved through the first quantum circuit to obtain the output state, so that the output quantum state of the quantum computer is |ψ(θ)>. The loss function is constructed by measuring the expectation sum of certain operators on the quantum state. Specifically, please refer to the following formula 1: C(θ)=∑ i w i <ψ(θ)|P i |ψ(θ)> Formula 1,

[0063] Where C(θ) is the loss function, P is used to indicate the expected value of the quantum state, w is used to indicate the weight value corresponding to P, and i is used to indicate the i-th quantum bit. That is, in the quantum state |ψ(θ)>, for all possible quantum bits i, according to their probability w i The weighted summation gives the expected value C(θ).

[0064] Optionally, the iterative update requirement includes at least one of: a loss function meeting a predicted loss requirement; or a first parameter update coefficient reaching a preset number threshold. The predicted loss requirement includes at least one of: an energy predicted loss value determined by the loss function based on the jth first parameter being less than a preset loss threshold; or a difference between an energy determined by the first quantum circuit based on the jth first parameter and an energy determined by the first quantum circuit based on the j-1th first parameter being less than a preset energy threshold.

[0065] Taking minimizing the loss function as the optimization goal as an example, the first parameter is updated based on the loss function until the calculated result of the loss function is minimized, and the second parameter is obtained.

[0066] Step 220: In the process of iteratively updating the first parameter in the first quantum circuit based on the loss function so that the eigenstate of the first quantum circuit approaches the ground state, based on the metric matrix determined in the previous j-1 rounds of iterative updating of the first parameter, determine the j-th metric matrix applied in the j-th round of iterative updating of the first parameter.

[0067] Wherein, j>1, the metric matrix is ​​used to indicate the gradient descent amplitude of the first parameter, and the first parameter is updated through an iterative update process so that the eigenstate of the first quantum circuit based on the first parameter approaches the ground state.

[0068] Taking the above-mentioned loss function as an example, the optimization goal is to minimize the loss function. The first parameter can be iteratively updated through natural gradient descent to gradually achieve the optimization goal. In the natural gradient descent iterative update process of the first parameter, the gradient descent amplitude is usually determined based on the inverse matrix of the QFI matrix corresponding to the first parameter. However, due to the matrix pathology of the QFI matrix, there are problems such as numerical instability when inverting the QFI matrix. Therefore, a smaller diagonal matrix is ​​usually used to adjust the QFI matrix, and the sum of the diagonal matrix and the QFI matrix is ​​used as the metric matrix to indicate the gradient descent amplitude of the first parameter. However, since the diagonal matrix is ​​a preset fixed matrix and lacks adaptability, the metric matrix used in the embodiment of the present application is a matrix with memory. The metric matrix used in each round of iterative update process is dynamically determined based on the metric matrix used in the historical iterative update process, that is, the j-th metric matrix is ​​determined based on the j-1-th metric matrix, thereby uniformly distributing the degree of influence of the metric matrix used in the historical iterative update process on the current iterative update process. During the iterative update process, the first parameter is updated by gradient descent according to the gradient descent amplitude indicated by the metric matrix in each round of iterative update, and the first parameter is updated to the first quantum circuit. For example, after each round of updating the first parameter, the rotation angle of the quantum gate in the first quantum circuit is adjusted according to the first parameter, so that the output state of the first quantum circuit based on each round of iterative update can gradually approach the ground state, that is, the loss function is gradually minimized.

[0069] In some embodiments, the process of determining the j-th metric matrix includes the following two steps:

[0070] The first step is to determine the memory coefficient, which is used to indicate the degree of influence of the first j-1 measurement matrices on the j-th measurement matrix. The first j-1 measurement matrices are the measurement matrices determined in the first j-1 rounds of iterative updates of the first parameter.

[0071] In the second step, the jth metric matrix is ​​determined based on the memory coefficient and the first j-1 metric matrices.

[0072] That is, when determining the j-th measurement matrix used in the j-th round in combination with the measurement matrix determined in the iterative update process of the first parameter in the previous j-1 rounds, the previous j-1 measurement matrices are fused according to the degree of influence of the previous j-1 measurement matrices on the j-th measurement matrix, thereby improving the data accuracy of the obtained j-th measurement matrix and thus improving the update efficiency of the first parameter.

[0073] In some embodiments, determining the jth metric matrix based on the first j-1 metric matrices is implemented as determining the jth metric matrix based on the j-1 metric matrix. For example, determining the third metric matrix based on the second metric matrix, and the second metric matrix is ​​determined based on the first metric matrix, which is equivalent to determining the third metric matrix based on the first and second metric matrices.

[0074] Optionally, by obtaining the j-th preset matrix, the j-th preset matrix corresponds to the j-th first parameter corresponding to the j-th round of gradient descent iterative update; determining the first metric matrix based on the memory coefficient and the j-th preset matrix, and determining the second metric matrix based on the memory coefficient and the j-1-th metric matrix; adding the first metric matrix to the second metric matrix to obtain the j-th metric matrix.

[0075] Schematically, the preset matrix is ​​a pre-set matrix for evaluating the sensitivity of the quantum state during the first parameter update process, wherein each round of the iterative update process of the first parameter corresponds to a preset matrix. In one example, the preset matrix is ​​the quantum Fisher information QFI matrix, and the determination method of the jth metric matrix is ​​as follows: M j =αQFI j +(1-α)M j-1 Formula 2,

[0076] Among them, M j is the jth measurement matrix, QFI j is the j-th QFI matrix, M j-1 is the j-1th metric matrix, α is the memory coefficient, and the QFI matrix is ​​the expectation of the squared gradient with respect to the first parameter. The first parameter in each iterative update process corresponds to a QFI matrix, that is, the j-th QFI matrix is ​​determined based on the j-th first parameter. Specifically, the j-th metric matrix is ​​obtained by performing a weighted summation of the j-1th QFI matrix and the j-1th metric matrix using the memory coefficients (including α and 1-α).

[0077] In some embodiments, the first parameter is updated based on the inverse matrix of the metric matrix. In the extreme case where α is 1, the parameter update scheme of the embodiment of the present application degenerates into the standard natural gradient descent, and the inverse value is unstable. In the extreme case where α is 0, considering that M1=I (I is the unit matrix), the parameter update scheme of the embodiment of the present application degenerates into gradient descent, and the number of steps of parameter iterative update is large, so the memory coefficient satisfies: 0<α<1.

[0078] In mathematical derivation, the formula 2 corresponding to the determination method of the j-th metric matrix is ​​expanded into the following formula 3: j =α(QFI j +(1-α)QFIj-1 +(1-α) 2 QFI j-2 +…) Formula 3,

[0079] The memory coefficient α indicates the degree of influence of the jth QFI matrix on the jth metric matrix. A larger memory coefficient suppresses the influence of earlier QFIs, thus approaching the limit of standard natural gradient descent. This influence of earlier QFIs on the jth metric matrix is ​​a memory effect. In addition to smoothing the matrix, the contributions from this memory effect, averaging and accumulating, are expected to further suppress the negative impact of quantum noise on variational quantum algorithm problems. Similar to the singularity of smoothing matrices, since the metric matrix at each update step is, to some extent, the sum of the contributions from the QFIs measured at previous steps, the accuracy of the QFI calculations at each step can be relaxed while maintaining the accuracy of the metric matrix estimate. This will significantly reduce the total number of measurements and improve the efficiency of quantum computing.

[0080] Optionally, the memory coefficient may be a fixed preset coefficient or a coefficient that changes with the number of gradient descent update rounds.

[0081] In some embodiments, the j-1 memory coefficients are adjusted according to a preset coefficient adjustment method to obtain the jth memory coefficient, and the jth memory coefficient is used to determine the jth measurement matrix, wherein the preset coefficient adjustment method is used to indicate the adjustment direction and adjustment amplitude of the jth memory coefficient relative to the j-1th memory coefficient. For example, the preset coefficient adjustment method is used to indicate that the memory coefficient is determined incrementally according to the preset adjustment amplitude. Then, the larger j is, the larger the memory coefficient is, and the smaller the influence of the earlier measurement matrix on the current measurement matrix is.

[0082] Step 230 , performing the jth round of gradient descent iterative update on the first parameter based on the loss function and the jth metric matrix until the iterative update requirement is met, obtaining the iteratively updated first parameter as the second parameter, and adjusting the rotation angle of the quantum gate based on the second parameter to obtain a second quantum circuit.

[0083] The second parameter is used to indicate the rotation angle of the quantum gate in the second quantum circuit. The second quantum circuit is obtained by adjusting the rotation angle of the quantum gate in the first quantum circuit based on the second parameter.

[0084] Optionally, the iterative update requirement includes at least one of the following: a loss function meets a predicted loss requirement, or an update coefficient of the first parameter reaches a preset number threshold. The predicted loss requirement includes at least one of the following: an energy predicted loss value determined by the loss function based on the jth first parameter is less than a preset loss threshold, or a difference between an energy determined by the first quantum circuit based on the jth first parameter and an energy determined by the first quantum circuit based on the j-1th first parameter is less than a preset energy threshold.

[0085] Taking minimizing the loss function as the optimization goal as an example, the first parameter is updated based on the loss function until the calculated result of the loss function is minimized, and the second parameter is obtained.

[0086] In some embodiments, step 230 is implemented by performing a gradient descent update on the j-1th first parameter based on the j-th metric matrix to obtain the j-th first parameter; determining the j-th first parameter as the second parameter based on an iterative update requirement; and obtaining a second quantum circuit based on the second parameter. The gradient descent update performed on the j-1th first parameter is implemented using a gradient descent algorithm, which is an iterative optimization algorithm used to find the local minimum of a function.

[0087] The optimizer performs gradient descent update on the j-1th first parameter to obtain the jth first parameter. The optimizer is implemented as the following formula 4: θ j =f(θ j-1 ) Formula 4,

[0088] Among them, θ j is the jth first parameter, θ j-1 is the j-1th first parameter, f is the gradient descent algorithm, that is, obtain the gradient descent algorithm corresponding to the optimizer, substitute the j-1th first parameter into the gradient descent algorithm, and obtain the jth first parameter.

[0089] In some embodiments, a gradient vector is determined based on the first parameter and the loss function, and the gradient vector is used to indicate the degree of influence of the change in the first parameter on the loss function; the inverse matrix of the j-th metric matrix is ​​multiplied by the gradient vector and a preset learning rate parameter to obtain the j-th gradient adjustment parameter, and the preset learning rate parameter is used to indicate the update speed of the first parameter, and the j-th gradient adjustment parameter is used to indicate the parameter adjustment amplitude of the j-1-th first parameter; the j-1-th first parameter is updated according to the j-th gradient adjustment parameter to obtain the j-th first parameter.

[0090] Updating the j-1th first parameter according to the j-th gradient adjustment parameter to obtain the j-th first parameter can be implemented by taking the difference between the j-1th first parameter and the j-th gradient adjustment parameter as the j-th first parameter.

[0091] Schematically, the natural gradient descent iterative update method of the first parameter is implemented as the following formula 5:

[0092] Among them, θ j is the jth first parameter, θ j-1 is the j-1th first parameter, is the jth gradient adjustment parameter, is the inverse matrix of the j-th metric matrix, λ is the preset learning rate parameter, and g is the gradient vector.

[0093] In summary, the method provided in the embodiment of the present application, when iteratively updating the first parameter of the first quantum circuit through the loss function, determines the metric matrix used in the current round based on the metric matrix in the iterative update process of the historical round in the iterative update process of the current round, and then uses the loss function on the determined metric matrix to realize the gradient descent iterative update of the first parameter until the iterative update requirements are met, and the second quantum circuit is updated. Since the metric matrix of the historical round is incorporated into the update of the first parameter in each round, the contribution of the historical steps in the gradient descent iterative update process is averaged, the variance of the calculated quantum Fisher information is reduced, the convergence speed of the loss function is accelerated, the stability of the calculation results is improved, the calculation error is reduced, and the accuracy and efficiency of the quantum calculation are improved.

[0094] Please refer to FIG3 , which is a flow chart of a method for determining a metric matrix provided by an exemplary embodiment of the present application. As shown in FIG3 , the present embodiment of the present application takes the method executed by a computer device as an example for explanation. As shown in FIG3 , the above step 220 includes the following steps:

[0095] Step 221, determine the memory coefficient.

[0096] The memory coefficient is used to indicate the degree of influence of the first j-1 metric matrices on the j-th metric matrix, and the first j-1 metric matrices are metric matrices respectively determined in the iterative update process of the first parameter in the first j-1 rounds.

[0097] Optionally, the memory coefficient may be determined in at least two ways:

[0098] The first method is to obtain a preset coefficient as a memory coefficient.

[0099] In some embodiments, a fixed memory coefficient is used to test the first quantum circuit, and the ground state energy approximation of the quantum system corresponding to the first quantum circuit is tested. The preset coefficient is determined as the memory coefficient in combination with the speed of gradient descent and the stability of the result, thereby reducing the amount of data calculation when iteratively updating the first parameter of the first quantum circuit.

[0100] The second method is to adjust the j-1th memory coefficient according to a preset coefficient adjustment method to obtain the jth memory coefficient.

[0101] Among them, the j-th memory coefficient is used to determine the j-th metric matrix.

[0102] For each round of iterative update, the preset coefficient adjustment method is used to adjust the memory coefficient used in the previous round of iterative update, so that the memory coefficient used in the current iterative update round meets the needs of the current iterative update round, and the memory coefficient used can remember the influence between the measurement matrices of different rounds in the historical iterative update rounds.

[0103] In some embodiments, the preset coefficient adjustment method is used to indicate the adjustment direction and adjustment amplitude of the j-th memory coefficient relative to the j-1-th memory coefficient. For example, the preset coefficient adjustment method is used to indicate that the memory coefficient is determined incrementally according to the preset adjustment amplitude. The larger j is, the larger the memory coefficient is, and the smaller the influence of the earlier measurement matrix on the current measurement matrix is.

[0104] In some embodiments, a memory coefficient is determined by a preset model. Taking the preset model as an example in which the preset model outputs an increasing memory coefficient in each round as the number of iterations increases, the preset model is iteratively updated for the j-th round of gradient descent to determine the condition number of the j-th QFI matrix. In response to the condition number being greater than a preset number threshold, the preset adjustment amplitude of the j-th memory coefficient is reduced, or the preset adjustment amplitude of the j-th memory coefficient is set to 0. In the case of increasing memory coefficients, when the condition number of the j-th QFI matrix is ​​large and prone to computational instability, the increase in the j-th memory coefficient is suppressed and the influence of the first j-1 metric matrices on the j-th metric matrix is ​​increased, thereby avoiding ill-conditioning of the j-th metric matrix due to ill-conditioning of the j-th QFI matrix.

[0105] Step 222: Determine the jth metric matrix based on the memory coefficient and the first j-1 metric matrices.

[0106] In some embodiments, the metric matrix is ​​implemented as follows: j =QFI j +∈I Formula 6,

[0107] Among them, M j The j-th metric matrix, QFI j is the j-th QFI matrix, I is an identity matrix, and ∈ is a preset diagonal matrix. That is, the j-th metric matrix is ​​obtained by adding the matrix product of the identity matrix and the preset diagonal matrix to the j-th QFI matrix.

[0108] When the jth metric matrix is ​​implemented as Formula 6 above, it lacks adaptability and relies on a preset diagonal matrix. When a smaller correction scheme is used, it is still prone to poor numerical stability and cannot compensate for the defects of natural gradient descent. When a larger correction scheme is used, the true value and physical meaning of QFI will be changed, causing errors. Therefore, a memory coefficient is introduced. The jth metric matrix is ​​determined based on the memory coefficient and the previous j-1 metric matrices, and the contribution of historical metric matrices to the current metric matrix is ​​automatically averaged to avoid the problems caused by using a fixed preset matrix to correct QFI.

[0109] In some embodiments, step 320 includes the following three steps:

[0110] The first step is to obtain the j-th preset matrix.

[0111] Among them, there is a corresponding relationship between the j-th preset matrix and the j-th first parameter corresponding to the j-th round of gradient descent iterative update.

[0112] In some embodiments, the preset matrix is ​​a QFI matrix. For a method of obtaining the j-th QFI matrix, refer to the following formula 7:

[0113] Among them, QFI ij is an element in the QFI matrix, i is used to indicate the i-th quantum bit, j is used to indicate the j-th round of gradient descent, ψ(θ) is the quantum state of the quantum system based on the first parameter θ, that is, |ψ(θ)) is a vector representation of the quantum state that depends on the parameter θ, is a column vector, <ψ(θ)| is the conjugate transpose (also called Hermitian conjugate or adjoint) of the corresponding quantum state, is a row vector, It expresses the conjugate transpose of the quantum state ψ(θ) with the parameter θ i The first rate of change, It expresses the conjugate transpose of the quantum state ψ(θ) with the parameter θ j The second change rate of the QFI matrix is ​​a matrix with the product of the first change rate and the second change rate as matrix elements.

[0114] In the second step, a first metric matrix is ​​determined based on the memory coefficient and the j-th preset matrix, and a second metric matrix is ​​determined based on the memory coefficient and the j-1-th metric matrix.

[0115] In some embodiments, the first memory coefficient is multiplied by the jth preset matrix to obtain a first measurement matrix; the second memory coefficient is multiplied by the j-1th measurement matrix to obtain a second measurement matrix; wherein the sum of the first memory coefficient and the second memory coefficient is a preset value.

[0116] The third step is to add the first metric matrix to the second metric matrix to obtain the jth metric matrix.

[0117] For illustration, please refer to the above formula 2: M j =αQFI j +(1-α)M j-1 Formula 2,

[0118] Among them, Mj is the j-th measurement matrix, QFIj is the j-th QFI matrix, Mj-1 is the j-1-th measurement matrix, α is the first memory coefficient, 1-α is the second memory coefficient, and the preset value is 1.

[0119] In summary, the method provided in the embodiment of the present application determines the memory coefficient, determines the j-th metric matrix based on the memory coefficient and the first j-1 metric matrices, and uses the memory coefficient to indicate the degree of influence of the first j-1 metric matrices on the j-th metric matrix, thereby smoothing the singularity of the matrix and improving the stability of quantum computing.

[0120] The method provided in an embodiment of the present application obtains the j-th preset matrix, determines a first metric matrix based on a memory coefficient and the j-th preset matrix, determines a second metric matrix based on the memory coefficient and the j-1-th metric matrix, adds the first metric matrix to the second metric matrix to obtain the j-th metric matrix, and implements adaptive correction of the QFI matrix through the second metric matrix and the memory coefficient to avoid instability caused by an excessively large condition number of the QFI matrix.

[0121] The method provided in the embodiment of the present application uses a first memory coefficient and a second memory coefficient with preset values ​​to respectively indicate the degree of influence of the j-th preset matrix on the j-th metric matrix, and the degree of influence of the j-1-th metric matrix on the j-th metric matrix, forming a relationship of increase and decrease. By adopting different first memory coefficients or second memory coefficients, the degree of influence of historical metric matrices on the current metric matrix can be adjusted, thereby improving the flexibility and adaptability of quantum computing.

[0122] The method provided in the embodiment of the present application obtains a preset coefficient as a memory coefficient, or adjusts the j-1th memory coefficient according to a preset coefficient adjustment method to obtain the jth memory coefficient. It provides two methods for determining the memory coefficient. Either a fixed memory coefficient or a dynamic memory coefficient that changes with the iteration rounds can be used, further improving the flexibility of quantum computing.

[0123] Please refer to FIG4 , which is a flow chart of a parameter updating method provided by an exemplary embodiment of the present application. The present embodiment of the present application takes the method executed by a computer device as an example. As shown in FIG4 , the above step 230 includes the following steps:

[0124] Step 231 : Perform gradient descent update on the j-1th first parameter based on the jth metric matrix to obtain the jth first parameter.

[0125] In some embodiments, step 231 includes the following three steps:

[0126] In the first step, the gradient vector is determined based on the first parameter and the loss function.

[0127] The gradient vector is used to indicate the degree of influence of the change of the first parameter on the loss function.

[0128] Schematically, the method for determining the gradient vector is as follows:

[0129] Among them, C is the loss function, θ is the first parameter, and g is the gradient vector, that is, the gradient vector is the partial derivative of the loss function with respect to the first parameter.

[0130] In the second step, the inverse matrix of the j-th metric matrix, the gradient vector and the preset learning rate parameter are multiplied to obtain the j-th gradient adjustment parameter.

[0131] The preset learning rate parameter is used to indicate the update speed of the first parameter, and the preset learning rate parameter determines the update step size of the first parameter. The j-th gradient adjustment parameter is used to indicate the parameter adjustment amplitude of the j-1-th first parameter. In some embodiments, the preset learning rate parameter is a parameter determined based on the update efficiency requirement of the first quantum circuit after evaluating the update efficiency requirement of the first quantum circuit before the first quantum circuit is updated. For example, the higher the required update efficiency, the larger the update step size of the first parameter indicated by the preset learning rate parameter.

[0132] For example, the gradient adjustment parameter is determined by referring to the following formula 9:

[0133] Where T is the gradient adjustment parameter, is the inverse matrix of the j-th metric matrix, g is the gradient vector, and λ is the preset learning rate parameter.

[0134] The third step is to update the j-1th first parameter according to the jth gradient adjustment parameter to obtain the jth first parameter.

[0135] In some embodiments, the difference between the j-1th first parameter and the jth gradient adjustment parameter is used as the jth first parameter.

[0136] Schematically, the natural gradient descent iterative update method of the first parameter is implemented as the above formula 5:

[0137] Among them, θ j is the jth first parameter, θ j-1 is the j-1th first parameter, is the jth gradient adjustment parameter, is the inverse matrix of the j-th metric matrix, λ is the preset learning rate parameter, and g is the gradient vector.

[0138] That is, during the iterative update process of the first parameter, the update speed of the first parameter is controlled by presetting the learning rate parameter, thereby ensuring the convergence speed during the update process of the quantum circuit. The appropriate preset learning parameter is selected according to specific business needs, thereby improving the dynamic adjustability of the iterative update of the quantum circuit under different businesses.

[0139] Step 232: In response to the jth first parameter meeting the prediction loss requirement, the jth first parameter is determined as the second parameter; or, in response to the number of updates in the jth round of gradient descent iterative update reaching a preset number threshold, the jth first parameter is determined as the second parameter.

[0140] In some embodiments, the second parameter is determined based on the jth first parameter based on an iterative update requirement, where the iterative update requirement is used to indicate that the loss function converges based on the jth first parameter. Optionally, the iterative update requirement includes the first parameter meeting a prediction loss requirement, or the number of updates of the gradient descent iterative update reaching a preset threshold.

[0141] The predicted loss requirement includes at least one of the following: the difference between the energy determined by the first quantum circuit based on the j-th first parameter and the energy determined by the first quantum circuit based on the j-1-th first parameter is less than a preset energy threshold, or the energy predicted loss value determined by the loss function based on the j-th first parameter is less than a preset loss threshold.

[0142] The preset energy threshold is a preset energy threshold of the quantum system corresponding to the first quantum circuit after iterative update. In some embodiments, the preset energy threshold is a threshold obtained by estimating the energy of the quantum system corresponding to the first quantum circuit in the ground state.

[0143] The preset number threshold is a preset threshold of the number of iterations of the first parameter. In some embodiments, the preset number threshold is a preset loss threshold set according to the parameter complexity of the first parameter after evaluating the parameter complexity of the first parameter before the parameters of the first quantum circuit are updated.

[0144] Taking the minimization of the loss function as an example, when the calculated result of the loss function is minimized, the first parameter currently updated is determined as the second parameter, and the gradient descent iterative update is stopped.

[0145] Step 233: Adjust the rotation angle of the quantum gate based on the second parameter to obtain a second quantum circuit.

[0146] The rotation angle of the quantum gate in the second quantum circuit is the rotation angle indicated by the second parameter, and the eigenstate of the quantum system is determined to be the ground state based on the second parameter.

[0147] In summary, the method provided in the embodiment of the present application obtains the j-th first parameter by performing a gradient descent update on the j-1-th first parameter based on the j-th metric matrix, and determines the j-th first parameter as the second parameter based on the iterative update requirement, thereby clarifying the scheme for updating parameters based on the iterative update requirement, wherein the iterative update requirement includes that the first parameter meets the prediction loss requirement, or that the number of updates of the gradient descent iterative update reaches a preset threshold number, thereby clarifying the iterative update requirement and improving the accuracy of quantum computing.

[0148] The method provided in the embodiment of the present application determines a gradient vector based on a first parameter and a loss function, multiplies the inverse matrix of the j-th metric matrix with the gradient vector and a preset learning rate parameter to obtain the j-th gradient adjustment parameter, and updates the j-1-th first parameter according to the j-th gradient adjustment parameter, thereby realizing a natural gradient descent update method with memory. On the basis of natural gradient descent, the gradient adjustment parameter is determined by introducing the j-th metric matrix determined based on the previous j-1 metric matrices, and the contribution of historical steps in the iterative update process of average gradient descent is used to reduce the variance of the calculated quantum Fisher information, accelerate the convergence speed of the loss function, improve the stability of the calculation results, reduce the calculation error, and improve the accuracy and efficiency of quantum computing.

[0149] In some embodiments, by comparing the quantum computing performance of different memory parameters, the value range of the memory parameter is determined. Schematically, taking the Heisenberg model as an example, a one-dimensional open boundary condition spin Hamiltonian is used, please refer to Formula 10: H = ∑ i X i X i+1 +Y i Y i+1 +Z i Z i+1 Formula 10.

[0150] Where H is the Hamiltonian, X i 、Y i , Z i is the Pauli matrix acting on the i-th quantum bit. The Pauli matrix is ​​a set of three matrices used in quantum mechanics to represent the spin operator of spin-1 / 2 particles. The X matrix represents the operator of spin in the x direction, the Y matrix represents the operator of spin in the y direction, and the Z matrix represents the operator of spin in the z direction. Each X in Formula 10 i X i+1 +Y i Y i+1 +Z i Z i+1 Describes the interaction between the i-th qubit and the next qubit.

[0151] The VQE framework is used to calculate the ground state energy approximation of the model. This model has two-dimensional spinor symmetry (Spinorial Unitary Symmetry, SU(2)) on each bit, so the initial state preparation and quantum gate are both selected to maintain the SU(2) symmetry circuit structure as shown in Figure 5, where the first two-bit gate is e iθ(XX+YY) This parameterized two-bit gate uses 5 layers of repeated circuits 510.

[0152] Taking the number of bits n=12 as an example for testing, the natural gradient optimization scheme with memory and the comparison results with gradient descent for different memory parameters α are shown in Figure 6. Different curves may have different end points, which means that under the corresponding parameters, the metric matrix is ​​numerically unstable at the beginning of the inversion step of the corresponding step, which is manifested as "nan" returned when the numerical program is calculated. The result of α=1, that is, the standard natural gradient descent, is not shown because it becomes numerically unstable in the first step of the update. As α increases, the numerical instability becomes earlier and earlier, which also proves this point. On the contrary, when α is small, the optimization speed is very fast and stable, and the final converged value is much smaller than the convergence value of simple gradient descent, and the optimization curve will not or less frequently have abnormal fluctuations. Among them, curve 610 is used to indicate the change of energy with the number of gradient descent rounds when gradient descent is used. Finally, the optimization effect is best when α is 0.1 and 0.3.

[0153] Taking the Heisenberg model with external field as an example, using the one-dimensional periodic boundary condition spin Hamiltonian, please refer to formula 11: H=∑ i X i X i+1 +Y i Y i+1 +Z i Z i+1 +hX i Formula 11.

[0154] The first half of formula 11 is the same as that of formula 10. The second part hX is added to formula 11 compared to formula 10. i describes the effect of the external magnetic field on each quantum bit in the x direction, where h is a constant representing the strength of the external magnetic field.

[0155] Assuming the external field h = 0.5, the corresponding first quantum circuit structure is shown in FIG7 , taking 5 layers of repeated circuits 710, and the gates of each layer are ladder-shaped dual-bit gates. and single-bit gates

[0156] The corresponding numerical experimental results for this model are shown in Figure 8. It can be seen that a larger α can lead to numerical instability in subsequent update steps, thus terminating the optimization. However, a smaller α allows for faster optimization and achieves results far superior to gradient descent. Curve 810 shows how the energy changes with the number of gradient descent rounds when using gradient descent. An optimal α is between 0.1 and 0.5.

[0157] In summary, the quantum computing method provided by the embodiment of the present application achieves a more stable and efficient parameter update than gradient descent and standard natural gradient descent, and plays a decisive role in improving the optimization and end-to-end effect of the variational quantum algorithm. In the context of the variational quantum algorithm, the quantum computing method provided by the embodiment of the present application consumes the same computing hardware resources as the standard natural gradient descent in a single step, and does not generate additional time and resource overhead. The number of optimization steps to the required accuracy is greatly shortened, thereby achieving certain savings in total computing resources. The accuracy and minimum position achieved by the optimization are relatively stable, and the corresponding QFI calculation and update avoid the serious impact of matrix pathology.

[0158] The quantum computing method provided in the embodiments of the present application can accelerate and strengthen the development and design of variational quantum algorithms at this stage. The representative algorithm family that can be run on quantum hardware in the NISQ era is the variational quantum algorithm. Because this algorithm is embedded in the large framework of optimization, it can try to solve a variety of scientific and industrial problems. Its derivative large solutions such as quantum simulation, quantum optimization and quantum machine learning are the main paradigms for quantum computing to empower industrial partners such as biopharmaceuticals, energy materials, and financial information at this stage. Therefore, the improvement plan for the optimization components at the core of the variational quantum algorithm will greatly improve the quality and efficiency of the entire variational quantum algorithm workflow and accelerate the industrialization of quantum computing. This solution is particularly suitable for applications on quantum hardware in the near future, thereby accelerating the verification and commercial application of effective quantum advantages.

[0159] The quantum computing method provided in the embodiments of this application can be applied to quantum hardware research and development in the short to medium term as a standard benchmark task. For the evaluation of QFI and the optimization of small-scale practical problems with natural gradient descent, both can be developed into standard quantum hardware and software test sets, driving the coordinated development of quantum hardware and software. The framework can also be provided and called as a quantum cloud service and can be encapsulated into a very simple application programming interface (API) enhanced by variational quantum algorithms.

[0160] FIG9 is a block diagram of a quantum computing device according to an exemplary embodiment of the present application. As shown in FIG9 , the device includes the following components:

[0161] an acquisition module 910, configured to acquire a loss function corresponding to a first quantum circuit, wherein the first quantum circuit includes a first parameter, the first parameter being used to indicate a rotation angle of a quantum gate in the first quantum circuit, and the loss function being used to determine an energy prediction loss value of the first quantum circuit based on the first parameter;

[0162] a processing module 920 configured to determine, in a process of iteratively updating a first parameter in the first quantum circuit based on the loss function so that an eigenstate of the first quantum circuit approaches a ground state, a j-th metric matrix applied in a j-th round of iterative updating of the first parameter based on a metric matrix determined in a previous j-1 round of iterative updating of the first parameter, where j>1, and the metric matrix is ​​used to indicate a gradient descent amplitude of the first parameter;

[0163] The processing module 920 is further configured to perform a j-th round of gradient descent iterative update on the first parameter based on the loss function and the j-th metric matrix until an iterative update requirement is met, obtain the iteratively updated first parameter as the second parameter, and adjust the rotation angle of the quantum gate based on the second parameter to obtain a second quantum circuit.

[0164] Please refer to FIG10 , which is a block diagram of a quantum computing device module provided by an exemplary embodiment of the present application. As shown in FIG10 , in some embodiments, the processing module 920 includes:

[0165] a coefficient determination unit 921, configured to determine a memory coefficient, where the memory coefficient indicates the degree of influence of the first j-1 metric matrices on the j-th metric matrix, where the first j-1 metric matrices are metric matrices determined during the first j-1 rounds of iterative updating of the first parameter;

[0166] The matrix determination unit 922 is configured to determine the j-th metric matrix based on the memory coefficient and the first j-1 metric matrices.

[0167] In some embodiments, the matrix determination unit 922 is configured to:

[0168] Obtaining a j-th preset matrix, where the j-th preset matrix corresponds to the j-th first parameter corresponding to the j-th round of gradient descent iterative update;

[0169] Determining a first metric matrix based on the memory coefficient and the j-th preset matrix, and determining a second metric matrix based on the memory coefficient and the j-1-th metric matrix;

[0170] The first metric matrix and the second metric matrix are added to obtain the j-th metric matrix.

[0171] In some embodiments, the matrix determination unit 922 is further configured to:

[0172] Multiplying the first memory coefficient by the j-th preset matrix to obtain the first metric matrix;

[0173] Multiplying the second memory coefficient by the j-1th metric matrix to obtain the second metric matrix;

[0174] The sum of the first memory coefficient and the second memory coefficient is a preset value.

[0175] In some embodiments, the preset matrix is ​​a Quantum Fisher Information (QFI) matrix.

[0176] In some embodiments, the coefficient determination unit 921 is configured to:

[0177] Obtaining a preset coefficient as the memory coefficient; or,

[0178] The j-1th memory coefficient is adjusted according to a preset coefficient adjustment method to obtain the jth memory coefficient, and the jth memory coefficient is used to determine the jth metric matrix.

[0179] In some embodiments, the processing module 920 further includes:

[0180] a parameter updating unit 923, configured to perform a gradient descent update on the j-1th first parameter based on the jth metric matrix to obtain the jth first parameter;

[0181] a parameter determining unit 924 configured to determine the jth first parameter as the second parameter in response to the jth first parameter meeting the prediction loss requirement; or, in response to the number of updates in the jth round of gradient descent iterative updates reaching a preset number threshold, determine the jth first parameter as the second parameter;

[0182] The system updating unit 925 is configured to adjust the rotation angle of the quantum gate based on the second parameter to obtain the second quantum circuit.

[0183] In some embodiments, the parameter updating unit 923 is configured to:

[0184] Determine a gradient vector based on the first parameter and the loss function, where the gradient vector is used to indicate the degree of influence of a change in the first parameter on the loss function;

[0185] Multiplying the inverse matrix of the j-th metric matrix by the gradient vector and a preset learning rate parameter to obtain a j-th gradient adjustment parameter, where the preset learning rate parameter is used to indicate an update speed of the first parameter, and the j-th gradient adjustment parameter is used to indicate a parameter adjustment amplitude of the j-1-th first parameter;

[0186] The j-1th first parameter is updated according to the jth gradient adjustment parameter to obtain the jth first parameter.

[0187] In some embodiments, the parameter updating unit 923 is configured to use the difference between the j-1th first parameter and the jth gradient adjustment parameter as the jth first parameter.

[0188] In some embodiments, the predicted loss requirement includes at least one of the following: a difference between the energy determined by the first quantum circuit based on the j-th first parameter and the energy determined by the first quantum circuit based on the j-1-th first parameter is less than a preset energy threshold, or an energy predicted loss value determined by the loss function based on the j-th first parameter is less than a preset loss threshold.

[0189] It should be noted that the quantum computing device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0190] Figure 11 shows a block diagram of a terminal 1100 according to an exemplary embodiment of the present application. Terminal 1100 may be a quantum computer, a smartphone, a tablet computer, an MP3 player, an MP4 player, a laptop computer, or a desktop computer. Terminal 1100 may also be referred to as user equipment, a portable terminal, a laptop terminal, a desktop terminal, or other similar names.

[0191] Typically, the terminal 1100 includes a processor 1101 and a memory 1102 .

[0192] The processor 1101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1101 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 1101 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1101 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1101 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0193] Memory 1102 may include one or more computer-readable storage media, which may be non-transitory. In some embodiments, the non-transitory computer-readable storage medium in memory 1102 is used to store at least one instruction, which is executed by processor 1101 to implement the quantum computing method provided in the method embodiments of this application.

[0194] In some embodiments, the terminal 1100 also includes other components 1103. Those skilled in the art will understand that the structure shown in Figure 11 does not constitute a limitation on the terminal 1100, and it may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.

[0195] An embodiment of the present application further provides a computer device, which can be implemented as a terminal or server as shown in FIG1 . The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set, or instruction set, and the at least one instruction, at least one program, code set, or instruction set is loaded and executed by the processor to implement the quantum computing methods provided in the above-mentioned method embodiments.

[0196] An embodiment of the present application also provides a computer-readable storage medium, which stores at least one instruction, at least one program, code set, or instruction set. The at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the quantum computing methods provided by the above-mentioned method embodiments.

[0197] Embodiments of the present application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the quantum computing methods provided in the above-mentioned method embodiments.

[0198] An embodiment of the present application further provides a quantum chip, which includes a second quantum circuit obtained by executing the above-mentioned quantum computing method.

[0199] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.

[0200] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A quantum computing method, which is executed by a computer device, and the method includes: Obtaining a loss function corresponding to a first quantum circuit, where the first quantum circuit includes a first parameter, the first parameter is used to indicate the rotation angle of a quantum gate in the first quantum circuit, and the loss function is used to determine an energy prediction loss value of the first quantum circuit based on the first parameter; During the process of iteratively updating the first parameter in the first quantum circuit based on the loss function to make the eigenstate of the first quantum circuit approach the ground state, based on the metric matrices determined during the iterative update process of the first parameter in the previous j - 1 rounds, determining the jth metric matrix applied during the iterative update process of the first parameter in the jth round, j > 1, and the metric matrix is used to indicate the gradient descent amplitude of the first parameter; Performing the jth round of gradient descent iterative update on the first parameter based on the loss function according to the jth metric matrix until the iterative update requirement is met, obtaining the iteratively updated first parameter as the second parameter, and adjusting the rotation angle of the quantum gate based on the second parameter to obtain a second quantum circuit.

2. The method according to claim 1, wherein, The determining the jth metric matrix applied during the iterative update process of the first parameter in the jth round based on the metric matrices determined during the iterative update process of the first parameter in the previous j - 1 rounds includes: Determining a memory coefficient, where the memory coefficient is used to indicate the influence degree of the previous j - 1 metric matrices on the jth metric matrix, and the previous j - 1 metric matrices are the metric matrices respectively determined during the iterative update process of the first parameter in the previous j - 1 rounds; Determining the jth metric matrix based on the memory coefficient and the previous j - 1 metric matrices.

3. The method according to claim 1 or 2, wherein The determining the jth metric matrix based on the memory coefficient and the previous j - 1 metric matrices includes: Obtaining the jth preset matrix; Determining a first metric matrix based on the memory coefficient and the jth preset matrix, and determining a second metric matrix based on the memory coefficient and the (j - 1)th metric matrix; Adding the first metric matrix and the second metric matrix to obtain the jth metric matrix.

4. The method according to any one of claims 1 to 3, wherein, The determining a first metric matrix based on the memory coefficient and the jth preset matrix, and determining a second metric matrix based on the memory coefficient and the (j - 1)th metric matrix includes: Multiplying a first memory coefficient by the jth preset matrix to obtain the first metric matrix; Multiplying a second memory coefficient by the (j - 1)th metric matrix to obtain the second metric matrix; Wherein, the sum of the first memory coefficient and the second memory coefficient is a preset value.

5. According to the method as claimed in any one of claims 1 to 4, wherein, The preset matrix is a quantum Fisher information QFI matrix.

6. According to the method of any one of claims 1 to 5, wherein The determining the memory coefficient includes: Obtaining a preset coefficient as the memory coefficient; or, Adjusting the (j - 1)th memory coefficient according to a coefficient adjustment method to obtain the jth memory coefficient, and the jth memory coefficient is used to determine the jth metric matrix.

7. According to the method as claimed in any one of claims 1 to 6, wherein, Performing the j-th round of gradient descent iterative update on the first parameter according to the j-th metric matrix based on the loss function until the iterative update requirement is met, obtaining the iteratively updated first parameter as the second parameter, and adjusting the rotation angle of the quantum gate based on the second parameter to obtain the second quantum circuit, including: Performing gradient descent update on the (j - 1)-th first parameter according to the j-th metric matrix to obtain the j-th first parameter; In response to the j-th first parameter meeting the prediction loss requirement, determining the j-th first parameter as the second parameter; or, in response to the number of update times of the j-th round of gradient descent iterative update reaching a preset number threshold, determining the j -th first parameter as the second parameter; Adjusting the rotation angle of the quantum gate based on the second parameter to obtain the second quantum circuit.

8. The method according to any one of claims 1 to 7, wherein, The performing gradient descent update on the (j - 1)-th first parameter according to the j-th metric matrix to obtain the j-th first parameter includes: Determining a gradient vector based on the first parameter and the loss function, where the gradient vector is used to indicate the influence degree of the change of the first parameter on the loss function; Multiplying the inverse matrix of the j-th metric matrix, the gradient vector, and a preset learning rate parameter to obtain the j-th gradient adjustment parameter, where the preset learning rate parameter is used to indicate the update speed of the first parameter, and the j-th gradient adjustment parameter is used to indicate the parameter adjustment amplitude of the (j - 1)-th first parameter; Updating the (j - 1)-th first parameter according to the j-th gradient adjustment parameter to obtain the j-th first parameter.

9. According to the method of any one of claims 1 to 8, wherein The updating the (j - 1)-th first parameter according to the j-th gradient adjustment parameter to obtain the j-th first parameter includes: Taking the difference between the (j - 1)-th first parameter and the j-th gradient adjustment parameter as the j-th first parameter.

10. According to the method of any one of claims 1 to 9, wherein, The prediction loss requirement includes at least one of the following: the difference between the energy determined by the first quantum circuit based on the j-th first parameter and the energy determined by the first quantum circuit based on the (j - 1)-th first parameter is less than a preset energy threshold, or the energy prediction loss value determined by the loss function based on the j-th first parameter is less than a preset loss threshold.

11. A quantum computing device, the device includes: An acquisition module, configured to acquire a loss function corresponding to a first quantum circuit, where the first quantum circuit includes a first parameter, the first parameter is used to indicate the rotation angle of a quantum gate in the first quantum circuit, and the loss function is used to determine an energy prediction loss value of the first quantum circuit based on the first parameter; A processing module, configured to, in the process of iteratively updating the first parameter in the first quantum circuit based on the loss function to make the eigenstate of the first quantum circuit approach the ground state, determine the j-th metric matrix applied in the j-th round of iterative update of the first parameter based on the metric matrix determined in the previous j - 1 rounds of iterative update process of the first parameter, j > 1, and the metric matrix is used to indicate the gradient descent amplitude of the first parameter; The processing module is further configured to perform the j-th round of gradient descent iterative update on the first parameter according to the j-th metric matrix based on the loss function until the iterative update requirement is met, obtain the iteratively updated first parameter as the second parameter, and adjust the rotation angle of the quantum gate based on the second parameter to obtain a second quantum circuit.

12. A computer device, comprising a processor and a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor to implement the quantum computing method according to any one of claims 1 to 10.

13. A quantum chip, comprising a second quantum circuit generated by the quantum computing method according to any one of claims 1 to 10.

14. A computer-readable storage medium, wherein at least one computer program is stored in the storage medium, and the at least one computer program is loaded and executed by a processor to implement the quantum computing method according to any one of claims 1 to 10.

15. A computer program product, wherein, Comprising a computer program, which implements the quantum computing method according to any one of claims 1 to 10 when executed by a processor.

Citation Information

Patent Citations

  • Method and device for calculating quantum partition function, and program product

    CN112633511A

  • Model training method and device based on quantum computing

    CN113592095A

  • Quantum system simulation method, computing equipment, device and storage medium

    CN114580647A

  • Quantum circuit training method and device, storage medium and electronic device

    CN116579437A

  • System and method of quantum enhanced accelerated neural network training

    US20210342730A1

Cited By

  • A guiding adaptive measurement optimization method and apparatus for quantum states

    CN122572707A

  • Quantum variational network classifier

    US20240070508A1