Quantum calculation method and device, equipment, storage medium and program product

By using the memory-with natural gradient descent method in the variable component quantum algorithm, the jth metric matrix is ​​determined based on the first j-1 metric matrix, which solves the local optimal solution, high noise sensitivity and gradient vanishing problems of the gradient descent solution, and the numerical instability of the inverse of the pathological matrix in natural gradient descent, achieving more efficient and stable quantum computing.

CN120218259APending Publication Date: 2025-06-27TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311812386.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-25
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

In variable component quantum algorithms, the gradient descent scheme has problems such as local optimal solutions, high noise sensitivity and gradient disappearance, and the natural gradient descent method needs to consider the pathological quantum Fisher information matrix inverse, resulting in unstable numerical calculations.

Method used

By determining the jth metric matrix based on the first j-1 metric matrix, combining the loss function to iteratively update the parameters in the quantum circuit until the iterative update requirements are met, the parameters after iterative update are obtained, and the natural gradient descent with memory is achieved.

Benefits of technology

This method reduces the variance of computing quantum Fisher information, speeds up the convergence speed of the loss function, improves the stability of the calculation results, reduces calculation errors, and improves the accuracy and calculation efficiency of quantum computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120218259A_ABST
    Figure CN120218259A_ABST
Patent Text Reader

Abstract

The invention discloses a quantum computing method and device, equipment, a storage medium and a program product, and relates to the technical field of quantum. The method comprises the steps that a loss function corresponding to a quantum circuit is acquired, the quantum circuit comprises a first parameter, the first parameter is used for indicating a rotation angle of a quantum gate in the quantum circuit, and the loss function is used for determining an energy prediction loss value of the quantum circuit based on the first parameter; based on the metric matrix determined in the iterative updating process of the first parameter in the previous (j-1) rounds, determining the jth metric matrix applied in the iterative updating process of the first parameter in the jth round, j > 1, and the metric matrix being used for indicating the gradient descent amplitude of the first parameter; and performing a jth round of gradient descent iterative update on the first parameter according to the jth metric matrix based on the loss function until an iterative update requirement is met, obtaining the iteratively updated first parameter as a second parameter, and obtaining a target quantum circuit based on the second parameter, thereby improving calculation stability and calculation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of quantum technologies, and particularly to a quantum computing method, apparatus, device, storage medium, and program product. Background Art

[0002] In the Variational Quantum Algorithm (VQA), the gradient descent scheme is a commonly used optimization method for adjusting the parameters in a parameterized quantum circuit to minimize the objective function. Although this method is widely used in variational quantum algorithms, there are still problems such as local optimal solutions, high noise sensitivity, and vanishing gradients.

[0003] In related technologies, by adopting the natural gradient descent method, multiplying the gradient by the matrix inverse of the Quantum Fisher Information (QFI) realizes the optimization of the gradient descent algorithm, and better takes into account the local similarity and curvature of the quantum state space to improve the optimization efficiency.

[0004] However, in the above method, since it is necessary to consider the QFI matrix and invert the QFI matrix, and the QFI matrix is almost always ill-conditioned in practical problems and experiments, the stability of numerical calculation is poor and the error is large during the process of inverting the matrix. Summary of the Invention

[0005] Embodiments of this application provide a quantum computing method, apparatus, device, storage medium, and program product, which can improve the stability of quantum computing. The technical solution is as follows.

[0006] On the one hand, a quantum computing method is provided. The method includes:

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

[0008] During the process of iteratively updating the first parameter in the quantum circuit based on the loss function to control the eigenstate of the quantum circuit to 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 during the previous j - 1 rounds of iterative update of the first parameter, where j > 1, and the metric matrix is used to indicate the gradient descent amplitude of the first parameter;

[0009] 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 the target quantum circuit.

[0010] On the other hand, a quantum computing device is provided, and the device includes:

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

[0012] A processing module, configured to, in the process of iteratively updating the first parameter in the quantum circuit based on the loss function and controlling the eigenstate of the quantum circuit to 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 of the first parameter, where j > 1, and the metric matrix is used to indicate the gradient descent amplitude of the first parameter;

[0013] 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 the target quantum circuit.

[0014] On the other hand, a computer device is provided, where the computer device includes a processor and a memory, and at least one instruction, at least one program, a code set, or an instruction set is stored in the memory, 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 one of the embodiments of the present application above.

[0015] On the other hand, a computer-readable storage medium is provided, and at least one instruction, at least one program, a code set, or an instruction set is stored in the storage medium, 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 one of the embodiments of the present application above.

[0016] On the other hand, a computer program product or a computer program is provided. The computer program product or the computer program 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 the processor executes the computer instructions, so that the computer device executes the quantum computing method described in any one of the above embodiments.

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

[0018] By determining the j-th metric matrix based on the first j - 1 metric matrices, 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 to obtain the second parameter, averaging the contributions of historical steps during the gradient descent iterative update process, reducing the variance of calculating the quantum Fisher information, accelerating the convergence speed of the loss function, improving the stability of the calculation result, reducing the calculation error, and improving the accuracy and calculation efficiency of quantum computing. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0020] Figure 1 is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;

[0021] Figure 2 is a flowchart of a quantum computing method provided by an exemplary embodiment of the present application;

[0022] Figure 3 is a flowchart of a method for determining a metric matrix provided by an exemplary embodiment of the present application;

[0023] Figure 4 is a flowchart of a parameter update method provided by an exemplary embodiment of the present application;

[0024] Figure 5 is a schematic diagram of a quantum circuit structure provided by an exemplary embodiment of the present application;

[0025] Figure 6 is a schematic diagram of performance comparison provided by an exemplary embodiment of the present application;

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

[0027] Figure 8 It is a schematic diagram of performance comparison provided by an exemplary embodiment of the present application;

[0028] Figure 9 It is a structural block diagram of a quantum computing device provided by an exemplary embodiment of the present application;

[0029] Figure 10 It is a structural block diagram of a quantum computing device module provided by an exemplary embodiment of the present application;

[0030] Figure 11 It is a structural block diagram of a terminal provided by an exemplary embodiment of the present application. Detailed implementation manners

[0031] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0032] It should be understood that although terms such as first and second may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the present disclosure, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0033] Before introducing and explaining the embodiments of the present application, some terms involved in the present application will be first explained.

[0034] 1. Quantum computing: A computing method based on quantum logic, and the basic unit for storing data is a quantum bit (qubit).

[0035] 2. Quantum bit: The basic unit of quantum computing. Traditional computers use 0 and 1 as the basic units of binary. Different from this, quantum computing can process 0 and 1 simultaneously, and the system can be in a linear superposition state of 0 and 1: |ψ> = α|0> + β|1>, where α and β represent the complex probability amplitudes of the system on 0 and 1. The square of their moduli |α| 2 , |β| 2 respectively represent the probabilities of being in 0 and 1.

[0036] 3. Hamiltonian: A Hermitian conjugate matrix that describes the total energy of a quantum system. Hamiltonian is a physical 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. Eigenstate: In quantum mechanics, the possible values that a mechanical quantity can take are all the eigenvalues of its operator. The state described by an eigenfunction is called the eigenstate of this operator. In its own eigenstate, this mechanical quantity takes a definite value, that is, the eigenvalue to which this eigenstate belongs. For a Hamiltonian matrix H, the solution that satisfies the equation: H|ψ> = E|ψ> is called the eigenstate |ψ> of H, with an eigenenergy E. The ground state corresponds to the eigenstate with the lowest energy of the quantum system.

[0039] 6. Quantum circuit: Also known as a quantum circuit, it is a representation of a quantum universal computer, representing the hardware implementation of the corresponding quantum algorithm / program under the quantum gate model. If the quantum circuit contains adjustable parameters of the control quantum gate, it is called a parameterized quantum circuit (Parameterized Quantum Circuit, PQC) or a variational quantum circuit (Variational Quantum Circuit, VQC), and the two are the same concept.

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

[0041] 8. Noisy Intermediate-Scale Quantum (NISQ): It is the current stage of the development of quantum computing and the key research direction. At this stage, due to the limitations of scale and noise, quantum computing cannot be used as a general computing engine for the time being, but for some problems, results that exceed the most powerful classical computers have been achieved, which is usually called quantum advantage.

[0042] 9. Variational Quantum Algorithm (VQA): Usually uses an adjustable parameterized quantum circuit (Parametrized Quantum Circuit), and the parameters therein can be optimized through classical computing. By iteratively adjusting these parameters, the algorithm can gradually approach the optimal solution of the problem. This iterative optimization process can use classical optimization algorithms such as the gradient descent method. Variational quantum algorithms have extensive applications in solving optimization problems, such as in chemical calculations for simulating molecular structures and reaction kinetics, or in machine learning for training quantum neural networks, etc. Although the practical applications of variational quantum algorithms still face many challenges, such as noise and error correction problems, they represent a promising method to utilize the potential of quantum computers to solve complex optimization problems.

[0043] 10. Variational Quantum Eigensolver (VQE): Estimating the ground state energy of a specific quantum system through a variational circuit (i.e., PQC / VQC), which is a typical quantum-classical hybrid computing paradigm and has extensive applications in the field of quantum chemistry.

[0044] 11. Variational optimization: For a function with multiple variables as input and a scalar (referred to as the loss function or objective function) as output, the process of minimizing the output scalar by adjusting the input variables is called variational optimization. In this process, the way of adjusting the input variables is called the optimizer or optimization scheme.

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

[0046] 13. Quantum Fisher Information (QFI): An important concept in quantum mechanics used to measure the sensitivity and information content of quantum states. It provides information about the parameters of a quantum state, including its precision and distinguishability. In quantum mechanics, we can use a parameterized quantum state to describe a system, where the parameters can be any physical quantities. The quantum Fisher information measures the impact of the change in a quantum state on the measurement results given a parameter. It can be used to evaluate the sensitivity of a quantum state, that is, how sensitive the quantum state is to parameter changes. Mathematically, considering a parameterized quantum state |ψ(θ)>, there is a corresponding QFI matrix. The quantum Fisher information has extensive applications in fields such as 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 the quantum Fisher information, the quantum measurement scheme can be optimized to improve the efficiency and accuracy of quantum information processing.

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

[0048] 15. Matrix ill - conditioned: A matrix being ill - conditioned means that its condition number is large, that is, the ratio of the largest singular value to the smallest singular value of the matrix is large. The condition number is an index to measure the stability and numerical sensitivity of the matrix when solving linear equations or performing matrix inversion, etc. When the condition number of the matrix is large, it means that there is a large difference between the singular values of the matrix, and the smallest singular value is close to zero. This will lead to the instability of the numerical calculation of matrix inversion.

[0049] In VQA, the gradient - descent scheme is a commonly used optimization method for adjusting the parameters in a parameterized quantum circuit to minimize the 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 according to 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 (such as reaching the maximum number of iterations or the magnitude of the gradient is small enough).

[0050] Although the gradient - descent scheme is widely used in variational quantum algorithms, it also has some disadvantages: Local optima: The gradient - descent scheme may get stuck in local optima and fail to find the global optimum. This is because the gradient - descent can only guarantee finding the optimum at the current position and cannot guarantee the global optimum. High noise sensitivity: There are noises and errors in quantum computing, which will affect the calculation and update process of the gradient. The gradient - descent scheme is very sensitive to noises and errors, which may lead to the instability and inefficiency of parameter updates. Vanishing gradients: In some cases, the gradient - descent scheme may encounter the problem of vanishing gradients. Vanishing gradients means that the value of the gradient becomes very small, resulting in slow or stagnant parameter updates. In summary, the gradient - descent scheme is a commonly used optimization method in variational quantum algorithms, but it also has disadvantages such as local optima, noise sensitivity, vanishing gradients, and high computational cost. Especially in quantum simulation and quantum machine - learning problems, the gradient - descent has low optimization efficiency and is prone to getting stuck in local minima because it does not take into account the state - space curvature brought by wave - function parameterization. These problems can be greatly alleviated in the natural gradient - descent scheme in theory.

[0051] For the natural gradient descent scheme, the QFI needs to be considered and the matrix inversion is required. However, in practical problems and experiments, the QFI matrix is almost always ill-conditioned. This will lead to numerical instability or even infeasibility in inverting the matrix, greatly affecting the application of natural gradient descent. A relatively direct mitigation scheme is to add a very small positive diagonal matrix to the QFI matrix before each inversion. However, this scheme lacks adaptability. A relatively small correction strength may still cause numerical stability problems, while a relatively large correction strength will change the true value and physical meaning of the QFI, resulting in deviation of the optimization.

[0052] The quantum computing method provided in the embodiments of the present application proposes a natural gradient descent algorithm with memory. By determining the j-th metric matrix based on the previous j - 1 metric matrices, a natural gradient descent scheme that combines adaptive and memory-based QFI update is realized, thus 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 simply relying on the magnitude and direction of the gradient. It uses the metric matrix (QFI) to adjust the direction and magnitude of the gradient to better adapt to the geometric characteristics of the parameter space. This can improve the efficiency and stability of parameter update. (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 consider the correlation between parameters. This can reduce the redundancy and conflict of parameter update and improve the optimization effect. (3) Mitigating 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, reducing the numerical instability 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 a 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 the quantized parameter to be solved as an example, for the optimization goal of the quantum circuit to make the eigenstate of the quantum circuit approach the ground state, the parameter is updated through the 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 this solution to update the quantum state, so that the eigenstate of the quantum circuit reaches the ground state.

[0053] Please refer to Figure 1 , which shows a schematic diagram of the 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 by 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 executed in a hybrid device environment of a classical computer and a quantum computer, for example, implemented by the cooperation of a classical computer and a quantum computer. Exemplarily, the quantum computer is used to implement the solution of the eigenstate in the embodiments of the present application, and the classical computer is used to implement other steps in the embodiments of the present application except for the eigenstate solution problem.

[0055] In the following method embodiments, for the convenience of description, only the execution subject of each step is introduced as a computer device. It should be understood that the computer device can be a classical computer or can also include a hybrid execution environment of a classical computer and a quantum computer, and the embodiments of the present application do not limit this.

[0056] Schematically, please refer to Figure 2 , which shows a flowchart of the quantum computing method provided by an exemplary embodiment of the present application. The embodiments of the present application are described by taking the method as being executed by a computer device as an example. As Figure 2 shown, the method includes the following steps:

[0057] Step 210, obtain the loss function corresponding to the quantum circuit.

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

[0059] In some embodiments, the quantum system is regarded as a set containing multiple qubits, and there is an interaction between these qubits. The size of the quantum system is used to indicate the number of qubits included in the quantum system. Taking a quantum system of n qubits as an example, the first parameter is the parameter of the adjustable control quantum gate included in the quantum circuit. The quantum circuit is a parameterized quantum circuit (PQC), and the PQC is used to perform transformation processing on the input quantum state of n qubits to obtain the output quantum state of the n qubits. n is a positive integer, and the above output quantum state is used to approximately represent the eigenstate of the quantum system. By adjusting the first parameter in the quantum circuit, a target quantum circuit is obtained. Among them, the first parameter is used to indicate the rotation angle of the quantum gate in the quantum circuit, that is, the target quantum circuit is obtained by adjusting the rotation angle of the quantum gate in the quantum circuit. The target quantum circuit is used to perform transformation processing on the quantum system to obtain a target quantum system, and the eigenstate of the target quantum system is the ground state.

[0060] Iteratively optimize the first parameter in the PQC through the variational quantum algorithm (VQA) so that the output state of the PQC reaches or approaches the ground state. Among them, by constructing a loss function, the expectation value of the Hamiltonian corresponding to the quantum circuit is used as the optimization target, and the first parameter is updated based on minimizing this loss function, so that the output state of the PQC based on the first parameter reaches or approaches the ground state. During the optimization process, the first parameter is updated based on this loss function, and this loss function is used to determine the energy prediction loss value of the quantum circuit based on the first parameter, that is, the loss function is used to determine the difference between the output state of the 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 requirements are met, obtaining the second parameter, and a target quantum circuit is obtained based on the second parameter. The output state of the target quantum circuit based on the second parameter reaches or approximately reaches the ground state.

[0061] 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 qubits is used as the optimization target. Schematically, the variational parameter θ is loaded into the parameterized quantum circuit. Specifically, a quantum gate with adjustable parameters is selected as the target quantum gate according to the algorithm requirements, and gate parameters are set for the target quantum gate. Among them, the rotation angle of the target quantum gate is set to the rotation angle indicated by the parameter θ. Based on the above settings, a quantum circuit is constructed, and the input data is encoded onto the qubits to form the input state of the quantum circuit. The input state is evolved through the quantum circuit to obtain the output state, so that the output quantum state of the quantum computer is |ψ(θ)>. By measuring the expectation sum of certain operators on this quantum state, a loss function is constructed. Specifically, please refer to Formula 1 below:

[0062] C(θ)=∑ i w i <ψ(θ)|P i |ψ(θ)> Formula 1,

[0063] Among them, C(θ) is the loss function, P is used to indicate the quantum state expectation value, w is used to indicate the weight value corresponding to P, and i is used to indicate the i-th qubit.

[0064] Optionally, the iterative update requirements include at least one of the loss function meeting the prediction loss requirements, or the update coefficient of the first parameter reaching a preset number threshold, etc. Among them, the prediction loss requirements include at least one of the energy prediction loss value determined by the loss function based on the j-th first parameter being less than a preset loss threshold, or the difference between the energy determined by the quantum circuit based on the j-th first parameter and the energy determined by the quantum circuit based on the j-1-th first parameter being less than a preset energy threshold.

[0065] Taking the minimization of the loss function as an example of the optimization objective, the first parameter is updated based on the loss function until the calculation 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 quantum circuit based on the loss function and controlling the eigenstate of the quantum circuit to approach the ground state, based on the metric matrix determined in the iterative update process of the first parameter in the previous j - 1 rounds, determine the jth metric matrix applied in the iterative update process of the first parameter in the jth round.

[0067] Where j > 1, the metric matrix is used to indicate the gradient descent amplitude of the first parameter, and the first parameter is updated through the iterative update process to make the eigenstate of the quantum circuit based on the first parameter approach the ground state.

[0068] Taking the above loss function as an example, the optimization objective is to minimize the loss function. The first parameter can be iteratively updated by natural gradient descent to gradually achieve this optimization objective. In the process of natural gradient descent iterative update 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 ill - condition of the QFI matrix, there are problems such as numerical instability when inverting the QFI matrix. Therefore, a small 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 this diagonal matrix is a preset fixed matrix and lacks adaptability, the metric matrix adopted in the embodiments of this application is a matrix with memory. The metric matrix adopted in each round of iterative update process is dynamically determined based on the metric matrix adopted in the historical iterative update process, that is, the jth metric matrix is determined based on the (j - 1)th metric matrix, so as to evenly the influence degree of the metric matrix adopted in the historical iterative update process on the current iterative update process. In the iterative update process, in each round of iterative update process, the first parameter is updated by gradient descent according to the gradient descent amplitude indicated by the metric matrix and the first parameter is updated into the quantum circuit. For example, after updating the first parameter in each round, the rotation angle of the quantum gates in the quantum circuit is adjusted according to the first parameter, so that the output state of the 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 determination process of the jth metric matrix includes the following two steps:

[0070] The first step is to determine the memory coefficient. The memory coefficient is used to indicate the influence degree of the previous j - 1 metric matrices on the jth metric matrix. The previous j - 1 metric matrices are the metric matrices respectively determined in the iterative update process of the first parameter in the previous j - 1 rounds;

[0071] Step 2: Determine the j-th metric matrix based on the memory coefficient and the previous j - 1 metric matrices.

[0072] In some embodiments, determining the j-th metric matrix based on the previous j - 1 metric matrices is implemented as determining the j-th metric matrix based on the (j - 1)-th metric matrix. For example, determining the 3rd metric matrix based on the 2nd metric matrix, and the 2nd metric matrix is determined based on the 1st metric matrix. Equivalently, the 3rd metric matrix is determined based on the 1st and 2nd metric matrices.

[0073] Optionally, by obtaining the j-th preset matrix, 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 iteration update. Determine the first metric matrix based on the memory coefficient and the j-th preset matrix, and determine the second metric matrix based on the memory coefficient and the (j - 1)-th metric matrix; add the first metric matrix and the second metric matrix to obtain the j-th metric matrix.

[0074] Schematically, the preset matrix is the quantum Fisher information QFI matrix. The determination method of the j-th metric matrix can refer to Equation 2 below:

[0075] M j =αQFI j +(1 - α)M j-1 Equation 2,

[0076] where, M j is the j-th metric matrix, QFI j is the j-th QFI matrix, M j-1 is the (j - 1)-th metric matrix, α is the memory coefficient. Among them, the QFI matrix is the expectation of the square of the gradient of the first parameter. Each first parameter in each round of iteration update corresponds to a QFI matrix, that is, the j-th QFI matrix is determined based on the j-th first parameter.

[0077] In some embodiments, the first parameter is updated based on the inverse matrix of the metric matrix. In the limit case where α is 1, the parameter update scheme of this application embodiment degenerates into the standard natural gradient descent, and the inverse calculation is numerically unstable. In the limit case where α is 0, considering M1 = I (I is the identity matrix), the parameter update scheme of this application embodiment degenerates into gradient descent, and the number of steps of parameter iterative update is relatively large. Therefore, the memory coefficient satisfies: 0 < α < 1.

[0078] In mathematical derivation, expand Equation 2 corresponding to the determination method of the above j-th metric matrix as Equation 3 below:

[0079] M j =α(QFI j +(1 - α)QFI j-1 +(1 - α)2 QFI j-2 +…), Formula 3,

[0080] The memory coefficient α indicates the influence degree of the j-th QFI matrix on the j-th metric matrix. The larger the memory coefficient, the more it suppresses the influence degree of earlier QFIs, thus approaching the limit of the standard natural gradient descent. The influence of this earlier QFI on the j-th metric matrix is a kind of memory effect. In addition to the smoothing matrix, the contributions caused by this memory effect are averaged and accumulated, which is expected to better suppress the negative impact of quantum noise on the variational quantum algorithm problem. Similar to the singularity of the smoothing matrix, since the metric matrix at each update step is to some extent the superposition of the contributions of the measured QFIs in previous steps, this allows for a certain relaxation in the calculation accuracy of QFIs at each step while ensuring the accuracy of the metric matrix estimation. This will greatly reduce the total number of measurements and improve the running efficiency of quantum computing.

[0081] Optionally, the memory coefficient can be a fixed preset coefficient or a coefficient that varies with the number of gradient descent update rounds.

[0082] In some embodiments, the j - 1 memory coefficients are adjusted according to a preset coefficient adjustment method to obtain the j-th memory coefficient, and the j-th memory coefficient is used to determine the j-th metric matrix, where 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, if the preset coefficient adjustment method is used to indicate that the memory coefficient is incrementally determined according to a preset adjustment amplitude, the larger j is, the larger the memory coefficient, and the smaller the influence degree of earlier metric matrices on the current metric matrix.

[0083] Step 230, based on the loss function, perform the j-th round of gradient descent iterative update on the first parameter according to the j-th metric matrix 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 the target quantum circuit.

[0084] Among them, the second parameter is used to indicate the rotation angle of the quantum gate in the target quantum circuit, and the target quantum circuit is obtained by adjusting the rotation angle of the quantum gate of the above quantum circuit based on the second parameter.

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

[0086] Taking the minimization of the loss function as an example of the optimization objective, the first parameter is updated based on the loss function until the calculation result of the loss function is minimized, and the second parameter is obtained.

[0087] In some embodiments, step 230 is implemented as performing gradient descent update on the (j - 1)-th 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 the iterative update requirement; and obtaining the target quantum circuit based on the second parameter.

[0088] The (j - 1)-th first parameter is updated by a gradient descent using an optimizer to obtain the j-th first parameter, and the optimizer is implemented as formula 4 below:

[0089] θ j = f(θ j-1 ) Formula 4,

[0090] where θ j is the j-th first parameter, θ j-1 is the (j - 1)-th first parameter, and f is the gradient descent algorithm.

[0091] 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; and the (j - 1)-th first parameter is updated according to the j-th gradient adjustment parameter to obtain the j-th first parameter.

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

[0093] Illustratively, the natural gradient descent iterative update method of the first parameter is implemented as formula 5 below:

[0094]

[0095] where θ j is the j-th first parameter, θ j-1 is the (j - 1)-th first parameter, is the j-th 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.

[0096] In summary, the method provided by the embodiments of the present application determines the j-th metric matrix based on the first j-1 metric matrices, and performs the j-th round of gradient descent iteration update on the first parameter according to the j-th metric matrix based on the loss function until the iteration update requirement is met, obtaining the second parameter, averaging the contributions of historical steps in the gradient descent iteration update process, reducing the variance of the computational quantum Fisher information, accelerating the convergence rate of the loss function, improving the stability of the calculation result, reducing the calculation error, and improving the accuracy and calculation efficiency of quantum computing.

[0097] Please refer to Figure 3 , which is a flowchart of a method for determining a metric matrix provided by an exemplary embodiment of the present application. As Figure 3 shown, the embodiments of the present application take the execution of this method by a computer device as an example for illustration. As Figure 3 shown, the above step 220 includes the following steps:

[0098] Step 221, determine the memory coefficient.

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

[0100] Optionally, the determination method of the memory coefficient includes at least the following two types:

[0101] The first type is to obtain a preset coefficient as the memory coefficient.

[0102] In some embodiments, by using a fixed memory coefficient to test the quantum circuit, approximating the ground state energy of the quantum system corresponding to the tested quantum circuit, and combining the speed of gradient descent and the stability of the result, the preset coefficient is determined as the memory coefficient.

[0103] The second type is to adjust the (j-1)-th memory coefficient according to a preset coefficient adjustment method to obtain the j-th memory coefficient.

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

[0105] 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, if the preset coefficient adjustment method is used to indicate that the memory coefficient is determined incrementally according to a preset adjustment amplitude, then the larger j is, the larger the memory coefficient is, and the smaller the influence degree of earlier metric matrices on the current metric matrix is.

[0106] In some embodiments, a memory coefficient is determined by a preset model. Taking the example that the preset model outputs an increasing memory coefficient round by round as the number of iteration rounds increases, for the j-th round of gradient descent iterative update, the preset model determines the condition number of the j-th QFI matrix. In response to the condition number being greater than a preset quantity threshold, the preset adjustment amplitude for the j-th memory coefficient is reduced, or the preset adjustment amplitude for the j-th memory coefficient is set to 0. When the memory coefficient is increasing and the condition number of the j-th QFI matrix is large and prone to computational instability problems, by suppressing the increase amplitude of the j-th memory coefficient, the influence degree of the first j - 1 metric matrices on the j-th metric matrix is increased, avoiding the ill-conditioned of the j-th metric matrix due to the ill-conditioned of the j-th QFI matrix.

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

[0108] In some embodiments, the metric matrix is implemented as the following formula 6:

[0109] M j = QFI j + ∈I Formula 6,

[0110] where M j is the j-th metric matrix, QFI j is the j-th QFI matrix, I is an identity matrix, and ∈ is a preset diagonal matrix.

[0111] When the j-th metric matrix is implemented as the above formula 6, it lacks self-adaptability and depends on the preset diagonal matrix. When a relatively small correction scheme is adopted, it is still prone to problems of poor numerical stability and cannot make up for the defects of natural gradient descent. When a relatively large correction scheme is adopted, it will change the true value and physical meaning of QFI, causing errors. Therefore, a memory coefficient is introduced, and the j-th metric matrix is determined based on the memory coefficient and the first j - 1 metric matrices, automatically averaging the contribution of historical metric matrices to the current metric matrix and avoiding the problems brought by using a fixed preset matrix to correct QFI.

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

[0113] The first step: Obtain the j-th preset matrix.

[0114] 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.

[0115] In some embodiments, the preset matrix is a QFI matrix. The method for obtaining the j-th QFI matrix can refer to the following formula 7:

[0116]

[0117] Among them, i is used to indicate the i-th qubit, j is used to indicate the j-th round of gradient descent, and ψ(θ) is the quantum state of the quantum system based on the first parameter θ.

[0118] In the second step, determine the first metric matrix based on the memory coefficient and the j-th preset matrix, and determine the second metric matrix based on the memory coefficient and the (j - 1)-th metric matrix.

[0119] In some embodiments, multiply the first memory coefficient by the j-th preset matrix to obtain the first metric matrix; multiply the second memory coefficient by the (j - 1)-th metric matrix to obtain the second metric matrix; where the sum of the first memory coefficient and the second memory coefficient is a preset value.

[0120] In the third step, add the first metric matrix and the second metric matrix to obtain the j-th metric matrix.

[0121] Schematically, please refer to Formula 2 above:

[0122] M j = αQFI j +(1 - α)M j-1 Formula 2,

[0123] Among them, M j is the j-th metric matrix, QFI j is the j-th QFI matrix, M j-1 is the (j - 1)-th metric matrix, α is the first memory coefficient, 1 - α is the second memory coefficient, and the preset value is 1.

[0124] In summary, the method provided by the embodiments of the present application determines the memory coefficient, determines the j-th metric matrix based on the memory coefficient and the previous (j - 1) metric matrices, uses the memory coefficient to indicate the influence degree of the previous (j - 1) metric matrices on the j-th metric matrix, smooths the singularity of the matrix, and improves the stability of quantum computing.

[0125] The method provided by the embodiments of the present application obtains the j-th preset matrix, determines the first metric matrix based on the memory coefficient and the j-th preset matrix, determines the second metric matrix based on the memory coefficient and the (j - 1)-th metric matrix, adds the first metric matrix and the second metric matrix to obtain the j-th metric matrix, and realizes the adaptive correction of the QFI matrix through the second metric matrix and the memory coefficient, avoiding the instability caused by the too large condition number of the QFI matrix.

[0126] The method provided by the embodiment of the present application uses a first memory coefficient and a second memory coefficient both being preset values to respectively indicate the influence degree of the j-th preset matrix on the j-th metric matrix and the influence degree of the (j - 1)-th metric matrix on the j-th metric matrix, forming a relationship of one increasing while the other decreasing. By adopting different first memory coefficients or second memory coefficients, the influence degree of the historical metric matrix on the current metric matrix can be adjusted, improving the flexibility and adaptability of quantum computing.

[0127] The method provided by the embodiment of the present application obtains a preset coefficient as the memory coefficient, or adjusts the (j - 1)-th memory coefficient according to a preset coefficient adjustment method to obtain the j-th memory coefficient, providing two ways to determine the memory coefficient. It can either adopt a fixed memory coefficient or a dynamic memory coefficient that changes with the iteration rounds, further improving the flexibility of quantum computing.

[0128] Please refer to Figure 4 , which is a flowchart of the parameter update method provided by an exemplary embodiment of the present application. The embodiment of the present application takes the example that this method is executed by a computer device. As Figure 4 shown, step 230 above includes the following steps:

[0129] Step 231, perform gradient descent update on the (j - 1)-th first parameter based on the j-th metric matrix to obtain the j-th first parameter.

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

[0131] The first step is to determine the gradient vector based on the first parameter and the loss function.

[0132] Among them, the gradient vector is used to indicate the influence degree of the change of the first parameter on the loss function.

[0133] Schematically, the method for determining the gradient vector please refer to the following formula 8:

[0134]

[0135] Among them, C is the loss function, θ is the first parameter, and g is the gradient vector.

[0136] The second step is to multiply the inverse matrix of the j-th metric matrix by the gradient vector and a preset learning rate parameter to obtain the j-th gradient adjustment parameter.

[0137] Among them, 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.

[0138] Schematically, the method for determining the gradient adjustment parameter please refer to the following formula 9:

[0139]

[0140] Among them, 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.

[0141] Step 3, update the (j - 1)-th first parameter according to the j-th gradient adjustment parameter to obtain the j-th first parameter.

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

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

[0144]

[0145] where θ j is the j-th first parameter, θ j-1 is the (j - 1)-th first parameter, is the j-th 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.

[0146] Step 232, in response to the j-th first parameter meeting the prediction loss requirement, determine 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 the preset number threshold, determine the j-th first parameter as the second parameter.

[0147] In some embodiments, the j-th first parameter is determined as the second parameter based on the iterative update requirement, and the iterative update requirement is used to indicate that the loss function converges based on the j-th first parameter. Optionally, the iterative update requirement includes that the first parameter meets the prediction loss requirement, or the number of update times of the gradient descent iterative update reaches the preset number threshold. Among them, the prediction loss requirement includes at least one of that the difference between the energy determined by the quantum circuit based on the j-th first parameter and the energy determined by the quantum circuit based on the (j - 1)-th first parameter is less than the preset energy threshold, or the energy prediction loss value determined by the loss function based on the j-th first parameter is less than the preset loss threshold.

[0148] Taking minimizing the loss function as an example, when the calculation result of the loss function is the smallest, the currently updated first parameter is determined as the second parameter, and the gradient descent iterative update is stopped.

[0149] Step 233, adjust the rotation angle of the quantum gate based on the second parameter to obtain the target quantum circuit.

[0150] The rotation angle of the quantum gates in the target 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.

[0151] In summary, the method provided by the embodiments of the present application obtains the j-th first parameter by performing 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, clarifying the parameter update scheme based on the iterative update requirement. Among them, the iterative update requirement includes that the first parameter meets the prediction loss requirement, or the number of gradient descent iterative updates reaches a preset number threshold, clarifying the iterative update requirement and improving the accuracy of quantum computing.

[0152] The method provided by the embodiments of the present application determines the gradient vector based on the first parameter and the loss function, multiplies the inverse matrix of the j-th metric matrix by the gradient vector and the 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, realizing the natural gradient descent update method with memory. On the basis of natural gradient descent, the j-th metric matrix determined based on the previous (j - 1) metric matrices is introduced to determine the gradient adjustment parameter, averaging the contributions of historical steps in the gradient descent iterative update process, reducing the variance of calculating the quantum Fisher information, accelerating the convergence speed of the loss function, improving the stability of the calculation result, reducing the calculation error, and improving the accuracy and calculation efficiency of quantum computing.

[0153] 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 adopted. Please refer to Equation 10:

[0154] H = ∑ i X i X i+1 + Y i Y i+1 + Z i Z i+1 Equation 10.

[0155] The VQE framework is used to calculate the approximate ground state energy of the model. This model has two-dimensional spin symmetry (Spinorial Unitary Symmetry, SU(2)) on each qubit. Therefore, the initial state preparation and quantum gates are both selected as the circuit structure shown in Figure 5 which can maintain the SU(2) symmetry. The first two-qubit gate refers to the iθ(XX+YY) parameterized two-qubit gate, and a 5-layer repeated circuit 510 is adopted.

[0156] Taking the case where the number of bits is n = 12 as an example for testing, the memory - based natural gradient optimization scheme with different memory parameters α and its comparison results with gradient descent are as follows Figure 6 shown. Different curves may have different termination points, which represents that under the corresponding parameters, the metric matrix starts to be numerically unstable when taking the inverse at the corresponding step, manifested as returning "nan" during the numerical program calculation. The result of the standard natural gradient descent with α = 1 is not shown because it becomes numerically unstable at the first update step. As α increases, the numerical instability occurs earlier and earlier, which also proves this point. On the contrary, when α is small, the optimization speed is very fast and stable, and the finally converged value is much smaller than the converged value of simple gradient descent, and the optimization curve does not show abnormal fluctuations or shows fewer abnormal fluctuations. Among them, curve 610 is used to indicate the change of energy with the number of gradient descent rounds when using gradient descent. Finally, the optimization effect is the best when α is between 0.1 and 0.3.

[0157] Taking the Heisenberg model with an external field as an example, using the one - dimensional periodic - boundary - condition spin Hamiltonian, please refer to formula 11:

[0158] H = ∑ i X i X i+1 +Y i Y i+1 +Z i Z i+1 +hX i Formula 11.

[0159] Taking the external field h = 0.5, the corresponding quantum circuit structure is as follows Figure 7 shown. Taking 5 - layer repeated circuit 710, the gates of each layer are two - qubit gates arranged in a ladder - type layout and single - qubit gates

[0160] The corresponding numerical experimental results of this model are as follows Figure 8 shown. It can be seen that a larger α will cause numerical instability in subsequent update steps, thus terminating the optimization. While a smaller α can complete the optimization faster, and the result is far better than gradient descent. Among them, curve 810 is used to indicate the change of energy with the number of gradient descent rounds when using gradient descent. At this time, the better choice of α is between 0.1 and 0.5.

[0161] In summary, the quantum computing method provided by the embodiments of the present application achieves more stable and efficient parameter updates than gradient descent and standard natural gradient descent, and plays a decisive role in improving the optimization and end-to-end effects of variational quantum algorithms. In the context of variational quantum algorithms, the quantum computing method provided by the embodiments of the present application consumes the same computing hardware resources per step as standard natural gradient descent, without generating additional time and resource overhead. The number of optimization steps to reach the required accuracy is significantly reduced, thus achieving a certain savings in total computing resources. The accuracy and minimum value position reached by the optimization are relatively stable, and the corresponding QFI calculation and update avoid the serious influence of matrix ill-conditioning.

[0162] The quantum computing method provided by the embodiments of the present application can accelerate and strengthen the development and design of current variational quantum algorithms. The representative algorithm family that can be run on quantum hardware in the NISQ era is the variational quantum algorithm. Since this algorithm is embedded in an optimized large framework, it can be used to attempt to solve diverse scientific and industrial problems. Its derived large-scale solutions such as quantum simulation, quantum optimization, and quantum machine learning are the main paradigms for current quantum computing to empower industrial partners such as biopharmaceuticals, energy materials, and financial information. Therefore, the improvement scheme for the core optimization components of variational quantum algorithms will greatly improve the quality and efficiency of the entire variational quantum algorithm workflow and accelerate the industrial implementation of quantum computing. This scheme is particularly suitable for applications on near-term quantum hardware, thus accelerating the verification of effective quantum advantage and commercial applications.

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

[0164] Figure 9 is a structural block diagram of a quantum computing device provided by an exemplary embodiment of the present application, as Figure 9 shown, the device includes the following parts:

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

[0166] A processing module 920, configured to, during the process of iteratively updating a first parameter in the quantum circuit based on the loss function and controlling the eigenstate of the quantum circuit to approach the ground state, determine a j-th metric matrix applied during the j-th round of iterative update of the first parameter based on the metric matrices determined during the previous j - 1 rounds of iterative update of the first parameter, where j > 1, and the metric matrix is used to indicate the gradient descent amplitude of the first parameter;

[0167] The processing module 920 is further configured to perform a 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 a second parameter, and adjust the rotation angle of the quantum gate based on the second parameter to obtain a target quantum circuit.

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

[0169] A coefficient determination unit 921, configured to determine a memory coefficient, where the memory coefficient is used to indicate the influence degree of the previous j - 1 metric matrices on the j-th metric matrix, and the previous j - 1 metric matrices are the metric matrices respectively determined during the previous j - 1 rounds of iterative update of the first parameter;

[0170] A matrix determination unit 922, configured to determine the j-th metric matrix based on the memory coefficient and the previous j - 1 metric matrices.

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

[0172] Obtain a j-th preset matrix, where the j-th preset matrix has a corresponding relationship with the j-th first parameter corresponding to the j-th round of gradient descent iterative update;

[0173] Determine a first metric matrix based on the memory coefficient and the j-th preset matrix, and determine a second metric matrix based on the memory coefficient and the (j - 1)-th metric matrix;

[0174] Add the first metric matrix and the second metric matrix to obtain the j-th metric matrix.

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

[0176] Multiply a first memory coefficient by the j-th preset matrix to obtain the first metric matrix;

[0177] Multiply the second memory coefficient by the (j-1)-th metric matrix to obtain the second metric matrix;

[0178] wherein, the sum of the first memory coefficient and the second memory coefficient is a preset value.

[0179] In some embodiments, the preset matrix is a quantum Fisher information QFI matrix.

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

[0181] Obtain a preset coefficient as the memory coefficient; or,

[0182] Adjust the (j-1)-th memory coefficient according to a preset coefficient adjustment method to obtain the j-th memory coefficient, and the j-th memory coefficient is used to determine the j-th metric matrix.

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

[0184] A parameter update unit 923, configured to perform gradient descent update on the (j-1)-th first parameter based on the j-th metric matrix to obtain the j-th first parameter;

[0185] A parameter determination unit 924, configured to determine the j-th first parameter as the second parameter in response to the j-th first parameter meeting the prediction loss requirement; or, in response to the number of update times of the j-th round of gradient descent iterative update reaching a preset number threshold, determine the j-th first parameter as the second parameter;

[0186] A system update unit 925, configured to adjust the rotation angle of the quantum gate based on the second parameter to obtain the target quantum circuit.

[0187] In some embodiments, the parameter update unit 923 is configured to:

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

[0189] Multiply 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 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;

[0190] Perform parameter update on the (j-1)-th first parameter according to the j-th gradient adjustment parameter to obtain the j-th first parameter.

[0191] In some embodiments, the parameter update unit 923 is configured to use the difference between the (j - 1)-th first parameter and the j-th gradient adjustment parameter as the j-th first parameter.

[0192] In some embodiments, the predicted loss requirement includes at least one of: the difference between the energy determined by the quantum circuit based on the j-th first parameter and the energy determined by the 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.

[0193] In summary, the device provided in the embodiments of the present application determines the j-th metric matrix based on the first j - 1 metric matrices, performs 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 to obtain the second parameter, averages the contributions of historical steps in the gradient descent iterative update process, reduces the variance of calculating the quantum Fisher information, speeds up the convergence rate of the loss function, improves the stability of the calculation result, reduces the calculation error, and improves the accuracy and calculation efficiency of quantum computing.

[0194] It should be noted that: for the quantum computing device provided in the above embodiments, only the division of the above functional modules is used for illustration. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0195] Figure 11 FIG. shows a structural block diagram of a terminal 1100 provided by an exemplary embodiment of the present application. The terminal 1100 may be: a quantum computer, a smart phone, a tablet computer, an MP3 player, an MP4 player, a laptop computer or a desktop computer. The terminal 1100 may also be referred to by other names such as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, etc.

[0196] Generally, the terminal 1100 includes: a processor 1101 and a memory 1102.

[0197] The processor 1101 may include one or more processing cores, such as a quad-core processor, an octa-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), or 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 wake state, also known as the 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), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1101 may further include an artificial intelligence (AI) processor, and the AI processor is used to process computational operations related to machine learning.

[0198] The memory 1102 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 1102 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1102 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 1101 to implement the quantum computing method provided in the method embodiments of the present application.

[0199] In some embodiments, the terminal 1100 further includes other components. Those skilled in the art can understand that Figure 11 the structure shown 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 different component arrangements.

[0200] Embodiments of the present application further provide a computer device, which may be implemented as Figure 1 the terminal or server shown in the figure. The computer device includes a processor and a memory, and at least one instruction, at least one program, a code set, or an instruction set is stored in the memory. The at least one instruction, at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the quantum computing methods provided in the above method embodiments.

[0201] Embodiments of the present application also provide a computer-readable storage medium, on which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, at least one program, the code set or the instruction set is loaded and executed by a processor to implement the quantum computing methods provided in the above method embodiments.

[0202] Embodiments of the present application also provide a computer program product or a computer program, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the quantum computing methods provided in the above method embodiments.

[0203] Optionally, the computer-readable storage medium may include: Read Only Memory (ROM), Random Access Memory (RAM), Solid State Drives (SSD), or optical discs, etc. Among them, the random access memory may include Resistance Random Access Memory (ReRAM) and Dynamic Random Access Memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.

[0204] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk, or an optical disc, etc.

[0205] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A quantum computing method, characterized in that, The method includes: Obtaining a loss function corresponding to a quantum circuit, where the quantum circuit includes a first parameter for indicating the rotation angle of a quantum gate in the quantum circuit, and the loss function is used to determine an energy prediction loss value of the quantum circuit based on the first parameter; During the process of iteratively updating the first parameter in the quantum circuit based on the loss function to control the eigenstate of the quantum circuit to 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, determine the jth metric matrix applied during the iterative update process of the first parameter in the jth round, where j > 1, and the metric matrix is used to indicate the gradient descent amplitude of the first parameter; Based on the loss function, perform the jth round of gradient descent iterative update on the first parameter according to the jth metric matrix 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 the target 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; Determine the jth metric matrix based on the memory coefficient and the previous j - 1 metric matrices.

3. The method according to claim 2, characterized in that, The determining the jth metric matrix based on the memory coefficient and the previous j - 1 metric matrices includes: Obtaining the jth preset matrix, where the jth preset matrix has a corresponding relationship with the jth first parameter corresponding to the jth round of gradient descent iterative update; Determine a first metric matrix based on the memory coefficient and the jth preset matrix, and determine a second metric matrix based on the memory coefficient and the (j - 1)th metric matrix; Add the first metric matrix and the second metric matrix to obtain the jth metric matrix.

4. The method according to claim 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: Multiply a first memory coefficient by the jth preset matrix to obtain the first metric matrix; Multiply 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. The method according to claim 3, wherein The preset matrix is a quantum Fisher information QFI matrix.

6. The method according to claim 2, wherein The determining the memory coefficient includes: Obtaining a preset coefficient as the memory coefficient; or, Adjust the (j - 1)th memory coefficient 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.

7. The method according to any one of claims 1 to 6, characterized in that, Updating the first parameter in the j-th round of gradient descent iteration according to the loss function and the j-th metric matrix until the iteration 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 target 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 iteration 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 target quantum circuit.

8. The method according to claim 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 by 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. The method according to claim 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. The method according to claim 7, wherein The prediction loss requirement includes at least one of the following: the difference between the energy determined by the quantum circuit based on the j-th first parameter and the energy determined by the 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, characterized in that, The apparatus includes: An acquisition module, configured to acquire a loss function corresponding to a quantum circuit, where the quantum circuit includes a first parameter, the first parameter is used to indicate the rotation angle of a quantum gate in the quantum circuit, and the loss function is used to determine an energy prediction loss value of the quantum circuit based on the first parameter; A processing module, configured to 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 of the first parameter during the process of iteratively updating the first parameter in the quantum circuit based on the loss function to control the eigenstate of the quantum circuit to approach the ground state, where 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 iterative update of gradient descent 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 the target quantum circuit.

12. A computer device, characterized in that, The computer device includes a processor and a memory, and at least one segment of computer program is stored in the memory, and the at least one segment of 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 computer-readable storage medium, characterized in that, At least one segment of computer program is stored in the storage medium, and the at least one segment of computer program is loaded and executed by a processor to implement the quantum computing method according to any one of claims 1 to 10.

14. A computer program product, characterized in that, It includes a computer program, and when the computer program is executed by a processor, it implements the quantum computing method according to any one of claims 1 to 10.