Parameterized Hamiltonian Learning With Quantum Circuit

Hamiltonian learning, as an important quantum machine learning technique, provides a significant approach for determining an accurate quantum system. This paper establishes parameterized Hamiltonian learning (PHL) and explores its application and implementation on quantum computers. A parameterized quantum circuit for Hamiltonian learning is first created by decomposing unitary operators to excite the system evolution. Then, a PHL algorithm is developed to prepare a specific Hamiltonian system by iteratively updating the gradient of the loss function about circuit parameters. Finally, the experiments are conducted on Origin Pilot, and it demonstrates that the PHL algorithm can deal with the image segmentation problem and provide a segmentation solution accurately. Compared with the classical Grabcut algorithm, the PHL algorithm eliminates the requirement of early manual intervention. It provides a new possibility for solving practical application problems with quantum devices, which also assists in solving increasingly complicated problems and supports a much wider range of application possibilities in the future.


INTRODUCTION
Q UANTUM computation has attracted considerable scientific attention due to its potential to address some fundamental problems, such as factoring integers or finding an unordered set of data. Since Deutsch published the quantum computer construction theory in 1985, quantum computers have advanced at a breakneck pace. The first optical quantum computer in the world was created in 2017. A 127qubit quantum computer has been developed by IBM until 2021, which marks a new milestone in the development of quantum computing. Recently, there has been a rise of interest in quantum machine learning and its application [1]. For example, Xiao et al. proposed a generalized negation method for quantum basic belief assignment [2]. Li et al. designed a method based on the quantum dots to improve the the accuracy of electronic nose [3]. Mach.et al. introduced quantum biomimetics, which aims at establishing analogies between biological and quantum systems, to look for previously inadvertent connections that may enable useful applications [4]. Hamiltonian learning (HL) as an important quantum machine learning technique was proposed in 2014 to perceive an unknown physical system by learning its Hamiltonian that is a necessary parameter that expresses the energy of a physical system [5]. It provides an important idea to solve the essential issue for preparing and measuring a physical system, where the physical state of a system forms the basis for a large number of potential applications [3]. Subsequently, it has received much interest in the application of quantum state preparation that Hamiltonian learning algorithm (HLA) [5] is designed to learn a quantum system with the Ising model by updating evolution time. In 2020, Sahinoglu et al. completed the Hamiltonian simulation in the low energy subspace by reducing the complexities of product formulas [6]. HLA has been improved in the calculation accuracy and elimination of noise effects in recent years. Youle et al. presented a hybrid quantum-classical Hamiltonian learning method to avoid the challenge of estimating von Neumann entropy in free energy minimization [7]. Zubida et al. designed efficient measurement methodologies based on short-time dynamics to limit the effect of noise on the accuracy of Hamiltonian measurements [8]. A series of improvement approaches for HLA extensively promotes the research process of exploring the state of quantum systems. However, the capability of HLA in computing and application has not been fully explored in terms of executing it on quantum computers. In general, the above HLA [5] only describe a theoretical model for creating quantum circuits for HL without presenting the approach for quantum gate construction in the design of actual circuits. As a result, the absence of suitable circuits for HLA may limit its implemention on quantum computers and impede its progress. Thus constructing an appropriate quantum circuit to characterize the system evolution process of HLA becomes a significant task.
Fortunately, we discover that parameterized quantum circuit (PQC) [9], which can be used to train and optimize quantum circuits by lowering a loss function on the parameter in the circuits until convergence, has potential to complete the task. PQC can introduce parameters into the decomposition of unitary operators, accelerating the construction of quantum circuits for HLA. Lots of quantum approaches based on PQC have been utilized to complete several application tasks on quantum computers, such as training Boson sampling [10], improving principal component analysis [11] and implementing chemical measurement [12]. PQC has the ability to characterize quantum algorithms [9], and it may realize exciting applications with the improvement of quantum computers. The purpose of this paper is to figure out how to build a parameterized quantum circuit for HL that allows quantum computers to execute HLA.
A method for efficiently constructing parameterized quantum circuits to realize HLA on quantum computers is proposed, abbreviated as parameterized Hamiltonian learning (PHL), in which the created quantum circuit for parameterized Hamiltonian learning algorithm (PHLA) excites the process of system evolution and the training is carried out iteratively by updating the gradient of the loss function associated with the circuit parameters with gradient-based optimization. Moreover, inspired by an accurate edge detector using richer convolutional features designed by Liu et al. [13], we prove PHLA can be applied to solve the image segmentation problem with experiments on Origin Pilot [14] and a successful segmentation result is derived effectively. It also indicates the proposed PHL has a broad range of applications in material production and condensed matter potentially.
The main contributions of this work are summarized as follows.
PHL and its parameterized quantum circuit are proposed for executing HLA on the quantum computers, which can precisely represent the system evolution. The PHL is impressive in quantum state tomography and state preparation as a quantum machine learning model. PHLA is introduced for training the parameters of quantum circuits to produce the final quantum system with a specified Hamiltonian. The PHLA can be impletemented on quantum devices to solve the image segmentation problem and has potential to be applied in other applications. The remainder of this paper is organized as follows. Related studies and fundamental principles are summarized in Section 2. PHL and PHLA are proposed in Section 3. The experiment and discussion are discussed in Section 4. Finally, the conclusion is drawn in Section 5.

RELATED WORK
In this section, we first introduce the preliminary of quantum mechanics, then review the Hamiltonian learning algorithm and parameterized quantum circuit. The notations are summarized in Table 1.

Preliminary
The physical quantities of PHL method based on quantum mechanics are explained as follows.
Hamiltonian. In quantum mechanics, the Hamiltonian H represents the energy of the system, which is an essential parameter in determining the state of a quantum system [5]. It comes from the stationary Schr€ odinger equation in Eq. (1), which is the core of quantum mechanics where r is the gradient operator, cðrÞ is the quantum state, h is the Planck constant, m is a constant in quantum mechanics and vðrÞ is the wave function. ½À h 2 2m r 2 þ V ðrÞ is the Hamiltonian that usually represented byĤ. The energy eigenequation of the quantum system can be expressed aŝ Hcðr; tÞ ¼ Ecðr; tÞ; ( where E and c are the eigenvalue and eigenfunction of the operatorĤ respectively, t is the time andr is the space vector. During the system evolution, the energy in the wave function consistently follows Eqs. (1) and (2). System Evolution. System evolution refers to the process that a quantum system changes constantly, in which lots of intermediate states jc t i are produced , where n is the number of particles, t is the time, jci is the quantum state , is the direct product symbol. In quantum mechanics, the state of a particle is uncertainty, which continually changes and fluctuates [15]. When a quantum system is adiabatically excited, the Hamiltonian of intermediate state H t satisfies the Eq. (3), according to the adiabatic theorem where H b is the Hamiltonian of initial quantum system and H p is the Hamiltonian of final quantum system , t represents the time of evolution and T is the temperature for the system [3]. In quantum computation, the parameters of the quantum circuit and the quantum system both change over time in a similar ways, making the two synchronized and compatible.
Unitary Operator. The Unitary Operator is a bounded linear operator U defined in the Hilbert space [16], which satisfies where U Ã is the Hermitian transpose of U and I is the identity operator. A unitary transformation is an isomorphism between two Hilbert spaces, i.e., U : H 1 ! H 2 , where H 1 and H 2 are Hilbert spaces.

Hamiltonian Learning Algorithm
The Hamiltonian learning algorithm (HLA) proposed by Nathan et al. in 2014 is able to derive physical system with specific Hamiltonian by updating the time t of evolution and the update rule [5] can be expressed as where the parameters x x x x x x x À , x x x x x x x 0 are the prior knowledge in Bayesian inference, Hðx x x x x x x À Þ and Hðx x x x x x x 0 Þ are the Hamiltonian in intermediate states jc t i. As shown in Fig. 1, the circuits of HLA consist of two major components: trusted simulator and untrusted simulator, which are constructed according to the Bayes rule. Under the control of the SWAP gate, the system evolution is excited by continuous reversal of the two simulators to derive the specific final system and D is the posterior distribution in Bayes.
The framework of the Hamiltonian learning algorithm can be summarized in Fig. 2 [5], which consists of four parts: initializing the quantum system, system evolution, Bayesian optimization and obtaining the final generated quantum system. It determines the Hamiltonian H p based on the Ising model [17] in Eq. (6) as the Hamiltonian in final state, i.e., x n s z n s z n ; where "" is the direct product symbol in quantum computing, s x n , s z n are the Pauli operators, n ¼ 1; 2; . . . ; N and N is number of particles and x is the constant coefficient.
First, HLA selects initial quantum system with Hamiltonian H b based on the current level of uncertainty in the Hamiltonian of quantum system. After that, the system evolution is carried out that the trusted quantum simulator in Fig. 1 is used to effectively compute the likelihood of the measurement outcome occurring if each of the hypothetical models is true. Then Bayesian optimization is applied to update the parameter of time t, resulting in an updated probability distribution derived as the posterior distribution D. Finally, the quantum system can be derived the with Hamiltonian H p [5].

PARAMETERIZED HAMILTONIAN LEARNING
This section provides a parameterized Hamiltonian learning model (PHL) and a parameterized Hamiltonian learning algorithm (PHLA). We first present the PHL and the construction of its parameterized quantum circuit and then introduce PHLA.

PHL Model
Fig. 3 depicts the framework of the PHL, where the initial system evolves into the final state under adiabatic conditions. The system evoluntion in PHL fulfills the adiabatic theorem [15] that there is no mutual energy transmission or exchange between the quantum system and the outside world. It is quite different from the HLA that we construct a parameterized quantum circuit which can excite the system evolution effectively, where the parameters are variable and can be updated iteratively. In PHL, the initial quantum system state jc in i corresponds to a simple Hamiltonian H b , i.e., where H b is the sum of the Pauli Y operators, n ¼ where I is the Identity matrix, s z is the Pauli Z operator, n ¼ 1; 2; 3; . . . ; N and N is the number of particles that determines the number of qubits to be used. The Hamiltonian H p satisfies the Ising model in Eq. (6). PHL derives the specific quantum system by performing the following steps: Before the system evolves, the Hamiltonian H b and H p should be determined and parameters a, b are random. Initial system state with H b completes a system evolution process by PQC that consists of Hadamard gate, Pauli X gate, R y ðaÞ gate and CNOT-R z ðbÞ gate, resulting in the intermediate state jc t i with Hamiltonian H t . The system evolution is spontaneous and continuous. By comparing the  gaps between H t and H p , PHL determines whether the intermediate state is the one we wish to derive. If the gap is smaller than (denote as a minimal algebra), the intermediate state is the final state. If the gap is larger than , the intermediate state is reintroduced into the circuit for evolution, while the PQC parameters are updated.

Quamtum Circuit of PHL
Quantum gates can be represented mathematically as unitary operators U. The quantum circuit of PHL is based on the accumulation of the unitary transformations with parameters a and b as the generator in Uða; bÞ where r ¼ 1; 2; 3; . . . ; M and M is the step of evolution, a and b are parameters that need to be updated, a r and b r represent the parameters of quantum circuits about the r-th step of the evolution. The quantum circuit corresponding to each step is the product of the unitary transformation about UðH b ; a r Þ and UðH p ; b r Þ. The formula of them are presented in Eqs. (10) and (11) respectively where i is the imaginary number, H b and H p are Hamiltonian in Eqs. (7) and (8) respectively. We can prove that the unitary transformation about UðH b ; a r Þ of r-th step can be deduced as a series of R y ðaÞ gates by bringing Hamiltonian H b from Eq. (7) into UðH b ; a r Þ as shown in Eq. (12) For example, if the step of evolution M ¼ 1 and we use five qubits N ¼ 5, the quantum circuit constructed by PHL is shown in Fig. 4, where Hadamard gate and Pauli X gate are used to generate entangled states and stabilize the circuits, which are introduced in the Appendix, available in the online supplemental material. If the step of evolution M 6 ¼ 1, we need to repeat the circuits. In summary, the initial state jc 0 i can evolve to the intermediate state jc t i after exciting by the parameterized quantum circuits constructed by the unitary transformation about Uða; bÞ in Eq. (9). When the number of step M is increased, it becomes more accurate in the result of system evolution. Fig. 3. The parameterized Hamiltonian learning model. We construct an initial quantum system jc in i with Hamiltonian of H b and hope that the system will evolve through the parameterized quantum circuits based on the R y ðaÞ gate and the CNOT -R z ðbÞ gate to generate the final quantum system jc out i with the Hamiltonian H p .

Parameterized Hamiltonian Learning Algorithm
We propose a parameterized Hamiltonian learning algorithm (PHLA) based on PHL by introducing a gradient descent optimizer to update the parameters in quantum circuits, depicted in Fig. 5. In PHLA, the output result is characterized by calculating the Hamiltonian expectation of the system. The initial quantum system jc in i is developed to the intermediate state. After calculating the expectation of the Hamiltonian H t in intermediate state and the loss function of the PQC, we update the parameters in quantum circuit. In the end, the final state is with the highest expectation.
The Algorithm 1 illustrates the pseudocode of the PHLA, where we take H b ; H p ; ; g as input where is the number of iteration step, H b and H p are Hamiltonian in Eqs. (7) and (8) separately, g is the adaptive learning rate in optimizer, N is the number of qubits to be used, M is the step of evoluntion. The output are the final quantum state jci and the expectation E of Hamiltonian. The parameters a and b are radom in the beginning. H b and H p statisfy Eqs. (7) and (8) [14]. The expectation E is calculated in Eq. (15): where C is the measurement operator, jci is the quantum state. QOP is composed of two components: qop and qop pmeasure [14]. Step 1: Prepare the initial quantum system with the Hamiltonian H b .
Step 2: Use H b ; H p ; a; b for the decomposition of unitary operators to establish parameterized quantum circuits.
Step 3: The initial quantum system evolves through quantum circuits of PHL to the intermediate quantum system.
Step 4: Use QOP function [14] to calculate the expectation E of Hamiltonian in the intermediate state and compare it with the expectation E of H p then generate the loss function Lða; bÞ.
Step 5: Use the gradient-descent optimization method to update a; b. For j < : @Lða j ;bÞ @a j ¼ Lða j þD j ;bÞÀLða j ÀD j ;bÞ 2D j ; a j a j À g @Lða j ;bÞ The function of qop is to output the expectation E of the Hamiltonian, while the function of qop pmeasure is to compute the loss function. We calculate the gradient for parameters a and b in Lða; bÞ using the batch gradient descent method [18]. In the case of a j , the gradient is shown in Eq. (16). @Lða j ; bÞ @a j ¼ Lða j þ D j ; bÞ À Lða j À D j ; bÞ 2D j ; where D j is a small parameter in the j-th direction, j ¼ 1; 2; 3; . . . ; and is the number of iteration step. a j is updated with Eq. (17) [10]. a j a j À g @Lða j ; bÞ @a j ; where the g is the adaptive learning rate.

EXPERIMENT AND DISCUSSION
The development of quantum technology faces a challenge in combining quantum computer advantages with practical applications. PHLA has the potential to execute on quantum computers and will soon have a wider range of applications in the future. We attempted to adapt PHLA to applications other than the preparation of physical systems. After many explorations, we find PHLA can be applied to solve image segmentation problems [13]. This section provides the experiment based on PHL and discussion. We first present the experiment in image segmentation field which shown that PHL has the potential to give accurate image segmentation results and then introduce the discussion.

Experiment Setting
Fig . 6 shows the experimental setup. In order to establish the correspondence between the original image and the quantum system, we deal with the gray-scale images, which is abstracted into an undirected weighted network graph G in Fig. 6d. We can use the position of qubits in PHLA to present the information in original image, as shown in Fig. 6c. The first pixel in the upper left corner of the image is defined as the first qubit and the serial number is 0. The definition of the remaining pixels follows the principle of ordering from top to bottom and from left to right. The vertices v i v j in Fig. 6d represent the pixels of the original image. The edges in Fig. 6d have weights w ij that correspond to the association between neighboring pixels in the original image: If adjacent pixels are the same grayscale, the weight w ij is defined as w ij ¼ 0. Otherwise, the weight w ij is set to a value between 0 and 1 based on the difference of grayscale [13], [20]. Vertexes and edge weights in Fig. 6d contain different information, so the initial quantum system jc in i with Hamiltonian H b and the final quantum system jc out i with the Hamiltonian H p are different for each image.
Through an undirected weighted graph, we determine how quantum states and pictures are related. By sending the created quantum system with initial quantum state with H b via PHL, an image segmentation result that is relatively precise may be achieved.
There are three kinds of experiments to prove the possibility of PHLA used in image segmentation: 1) Experiment (01) : Four-pixels experiment with three different grayscales. 2) Experiment (02) : Six-pixels experiment with two different grayscales. 3) Experiment (03) : Six-pixels experiment with three different grayscales. Experiment (01) and Experiment (03) are comparisons to prove that PHLA can be used for different numbers of pixels. Experiment (02) and Experiment (03) are the control groups to prove that PHLA can be used for pixels with different amount of grayscales. The experimental results show that PHLA can give a good segmentation scheme. Table 2 summarizes the results of qubits and the expectation of Hamiltonian in Experiment (01) on the Origin Pilot Lab [14]. Fig. 7 shows the results in Experiment (01). Fig. 7c represents the position information of qubits in PHLA corresponding to each pixel. The qubit positions about the white pixels with the grayscale of 255 are ranked as 0 and 3, the black pixels with the grayscale of 0 are ranked as 1, the pixel with the grayscale of 94 is ranked as 2. The qubit sequence numbers from small to large correspond to low-order to high-order. The bar chart describes the evolution of the quantum system calculated by PHLA and the corresponding Hamiltonian expectation, where the qubit with the highest expectation represents the segmentation result. In Table 2, the order of the highest corresponding qubits is j0110i. According to the expression of the qubit, the loworder qubit is ordered on the far right. Therefore, the result shows the pixels whose grayscale is not 255 are segmented from the white pixels, which is shown in Fig. 7. Table 3 summarizes the results of qubits and the expectation of Hamiltonian in Experiment (02). Fig. 8 shows the results in Experiment (02). Fig. 8c represents the position information of the qubit in PHLA, where except for the qubit of 1 and 4, which describes black pixels with a grayscale of 0, other qubits represent white pixels with grayscales of 255. In Table 3, the highest Hamiltonian expectation corresponding  qubits is j010010i, which shows that the black pixels are segmented from the white pixels after the original image is calculated by the PHLA, as shown in Fig. 8. Table 4 summarizes the results of qubits and the expectation of Hamiltonian in Experiment (03). Fig. 9 shows the results in Experiment (03). Fig. 9c represents the position information of the qubit in the PHLA, where the position of qubits on 1, 3 and 5 represent the white pixels with the grayscale of 255, the position of qubits on 0 and 2 are pixels with grayscale of 94, the position of qubits on 4 is the black pixel with grayscale of 0. In Table 4, the highest Hamiltonian expectation corresponding qubits is j010101i, which shows that the pixels whose grayscale is not 255 are segmented from the white pixels, as shown in Fig. 9.

Experimental Results and Discussion
The loss function for Experiment (01), Experiment (02), and Experiment (03) are shown in Fig. 10, where the training step of the loss function is 200. As shown in Fig. 10, the loss functions of the three experiments have rapid downward trend and the final results are stabilized. By comparing the different trends, we observe that due to the complexity of the original image in Experiment (01) and Experiment (03), the loss function has a slower downward trend than the Experiment (02), and the final result is stable at roughly À1:8. In summary, we conclude that the decline trend of the loss function for PHLA has a great relationship with the number and distribution of pixels in the original image [28]. But the results produced by the loss function in PHLA are quick convergence and tend to be stable, and the final results are stable [29].
It can be seen from the above experiments that the PHLA can be applied to the field of image segmentation. This is the first time that PHLA has been used in this field, providing new ideas for the application of HLA. The experimental results also confirmed that the PHL we presented is effective, which complete the task of expressing Hamiltonian learning with parameterized quantum circuits. Compared with classical Grabcut algorithm [20], the PHL algorithm eliminates the requirement of early manual intervention. Finally, according to ref. [30], we may construct an image segmentation model based on graph theory and quantum computing features with the goal of lowering computational complexity and assuring the correctness of the calculation results.
In Table 5, we compare the PHL model with some Hamiltonian learning models [21], [22], [23], [24]. The standards we chose are those used in quantum mechanics to evaluate physical quantities and system evolution. The stable adiabatic process is used to determine the energy change and system evolution is characterized by continuity and spontaneity. It can be seen from the comparison that PHL fits the  requirements for general character and has the advantage of using parameterized quantum circuits to excite system evolution.
In Table 6, we compare PHLA and other Hamiltonian learning algorithms [5], [25], [26], [27]. The standards we chose are about quantum mechanics, algorithm structure and its application. Quantum system produced by PHLA follows standards of system evolution characteristics, including initial state preparation, continuous system evolution and Hamiltonian changing over time. As for algorithm structure, the most notable aspect for PHLA is the parameterized quantum circuits and the parameters are trained. In the application, PHLA may be used to not only prepare quantum states but also to solve the problem of image segmentation.
Comparing with the classical Grabcut [20] technique based on graph theory, PHLA can use the parallelism of quantum computing to process the pixels in an image concurrently, reducing the need for manual intervention during the initial stages of the image processing. Based on the correspondence between pixels and qubits, PHLA has the potential to apply on object detection [31] in the future.

CONCLUSION
We establish parameterized Hamiltonian learning (PHL) and explores its application and implementation on quantum computers in this paper. The proposed PHL demonstrates how to use parameterized quantum   circuits to characterize the evolution of the system, which provides a solid theoretical groundwork for the future research on application of Hamiltonian learning. We also develop a quantum Hamiltonian learning algorithm (PHLA) based on PHL to perform quantum state preparation and image segmentation. Our experimental results demonstrate that PHLA can provide an accurate image segmentation solution, by improving the loss function to update the circuit parameters using the gradient descent method. We believe that, with the development of quantum hardware, in addition to the advantages of preparing a quantum system with a specific Hamiltonian, HLA has the potential to be executed on quantum computers in combination with PQC and has wide practical applications. Xiaoping Lou (Member, IEEE) is a professor with the College of Information Science and Engineering, Hunan Normal University, Changsha, China. She has long been engaged in research on cyberspace security, information security technology, and cryptographic protocol design and analysis.
Shichao Zhang (Senior Member, IEEE) received the PhD degree in computer science from the Deakin University, Australia. He is currently a China national-level-title professor with the School of Computer Science and Technology, Central South University, China. His research interests include information quality and pattern discovery. He has published about 90 international journal papers and more than 100 international conference papers. He has won 16 national-class grants, and eight China provincial/ ministerial awards. He served/is serving as an associate editor of the ACM Transactions on Knowledge Discovery from Data, IEEE Transactions on Knowledge and Data Engineering, Knowledge and Information Systems, and the IEEE Intelligent Informatics Bulletin, as conference chair, PC chair and vice PC chair for 10 more international conferences. He is a senior member of the IEEE Computer Society and a member of the ACM.
Xuelong Li (Fellow, IEEE) is a full professor with the School of Artificial Intelligence, Optics and Electronics, Northwestern Polytechnical University, Xi'an, China.