Learning Unitary Transformation by Quantum Machine Learning Model

2021-12-14 09:59YiMingHuangXiaoYuLiYiXuanZhuHangLeiQingShengZhuandShanYang
Computers Materials&Continua 2021年7期

Yi-Ming Huang,Xiao-Yu Li,*,Yi-Xuan Zhu,Hang Lei,Qing-Sheng Zhu and Shan Yang

1School of Information and Software Engineering,University of Electronic Science and Technology of China,Chengdu,610054,China

2School of Physics,University of Electronic Science and Technology of China,Chengdu,610054,China

3Department of Chemistry,Physics and Atmospheric Sciences,Jackson State University,Jackson,MS,39217,USA

Abstract:Quantum machine learning(QML)is a rapidly rising research feld that incorporates ideas from quantum computing and machine learning to develop emerging tools for scientifc research and improving data processing.How to effciently control or manipulate the quantum system is a fundamental and vexing problem in quantum computing.It can be described as learning or approximating a unitary operator.Since the success of the hybrid-based quantum machine learning model proposed in recent years,we investigate to apply the techniques from QML to tackle this problem.Based on the Choi–Jamiołkowski isomorphism in quantum computing, we transfer the original problem of learning a unitary operator to a min–max optimization problem which can also be viewed as a quantum generative adversarial network.Besides,we select the spectral norm between the target and generated unitary operators as the regularization term in the loss function.Inspired by the hybrid quantum-classical framework widely used in quantum machine learning, we employ the variational quantum circuit and gradient descent based optimizers to solve the min-max optimization problem.In our numerical experiments,the results imply that our proposed method can successfully approximate the desired unitary operator and dramatically reduce the number of quantum gates of the traditional approach.The average fdelity between the states that are produced by applying target and generated unitary on random input states is around 0.997.

Keywords: Machine learning; quantum computing; unitary transformation

1 Introduction

With the enormous variety of applications, machine learning has already impacted modern life [1,2].It not only provides powerful tools for mining the potential information from massive data but also helps us explore the laws of nature from a new perspective.In recent years,machine learning has caught the attention of researchers from various felds such as physics and chemistry [3,4].They intend to develop new tools based on machine learning techniques for scientifc research.Quantum machine learning is one such rising and promising branch that combines the approaches of data processing from machine learning with the outperformance of quantum computing.As well known, there is computational diffculty in simulating a quantum system by classical methods.As the size of a quantum system increases, the resources required for simulating will increase exponentially.

Based on this fact, quite a lot of quantum machine learning models that harness the quantum advantages have been proposed in recent years.Quantum support vector machine (QSVM) and its physical implementation that runs on a small-scale quantum device result in an exponential speed-up over the corresponding classical one [5].Quantum principal component analysis (QPCA)is more than a quantum extension of the classical algorithm.It also provides a technique to construct unitary transformation effciently [6].Quantum generative adversarial networks (QGAN)inherit the framework of classical models, consisting of a generator and a discriminator.However, the components of QGAN can be constructed by variational quantum circuits such that generating quantum data is more effcient like quantum state preparation [7–10].These quantum machine learning models are classifed into two categories.One category is full quantum that the models only rely on full quantum algorithms including quantum Fourier transformation,quantum phase estimation and HHL algorithm etc.[11,12].The representative works are QSVM,QPCA, and so on.Another category is hybrid that the models consist of the classical part and quantum part.That is the reason why it is called the hybrid quantum-classical model.These models are formalizing the problem of interest as a variational optimization problem and fnding an approximate solution by parametrized quantum circuit and classical optimizer [13].Compared to the full quantum-based model, the hybrid quantum-classical model requires fewer resources to build, particularly the size of the quantum system, the number of quantum gates, etc.Meanwhile,the well-developed optimization techniques can be naturally employed, which means that we are able to make use of well-maintained open-source optimization libraries such as Tensorfow and Pytorch as the optimizing backend [14,15].

In this work, relying on the advantages of the hybrid-based quantum machine learning model,we intend to exploit it for a unitary learning problem that is an essential task in quantum computing.One reason why learning unitary matrices matters a lot is that the dynamics of a quantum system can be described by a unitary transformation, exploring the effcient way to implement the unitary transformation is fundamental.Since we are still in the early stages of quantum computing with the limitation of quantum resources for computation, it is necessary to investigate how to control or manipulate the quantum system effciently.Besides, various tasks will beneft from the results of the study on learning unitary transformation.For instance,unitary matrix compiling, that is the task of ‘compiling’ a known unitary transformation into a quantum circuit constructed by a sequence of gates chosen from the specifc quantum gate set.A large amount of existing works has been focused on how to implement unitary transformations effciently.Such works provide theoretic analysis of approximate error and gate or time complexity for implementing target unitary transformation [16,17].Recently, some work investigated the ideas from machine learning for simulating a desired unitary transformation [18,19].Similar to these related literatures, we formulate the learning of a given target unitary operator as an optimization problem, and employ the hybrid-based quantum machine learning model to approximate the solution.From our numerical experiments, the results show that the proposed method provides a reasonable approximation while the number of required quantum gates is much less than those of traditional approach.

We organized this paper as follows.In Section 2, we formalize the learning problem of unitary transformation.In Section 3, we give a brief introduction of the techniques in hybrid quantum-classical framework and quantum generative adversarial networks (QGAN).In Section 4,we propose a method by which a quantum machine learning model can be used for solving the formulized unitary learning problem.In Section 5, we provide the numerical experiments which demonstrate the advantages of the proposed model.We also introduce the background of quantum computing in the appendix.

2 Learning Problem of Unitary Transformation

In quantum mechanics, we have two pictures for the dynamics of a quantum system.One is the Hamiltonian picture; another is the unitary operator picture.In the Hamiltonian picture, given the Hamiltonian, a Hermitian operator, that is the total energy function of the closed system, we can describe the evolution of the system by Schrödinger equation as follow,

It can be verifed that the solution of Eq.(1) can be,

Because the HamiltonianHis a Hermitian operator, the operatorUis unitary.Thus, in the unitary operator picture, we use this unitary transformation to formulate the quantum dynamics.

In the following, our discussion is mainly under the unitary operator picture.As shown in Eq.(2), the manipulation of a quantum system is equivalent to manipulating corresponding unitary matrices.Once there is an effcient way to implement the desired unitary operator, we can effectively imitate the behavior, that is the dynamics, of a quantum mechanical system, which is an intractable task for classical methods [20].This learning unitary problem introduced above is related to Hamiltonian simulation, which suppose given a HamiltonianH, timetand precisionε>0, the task is to fnd a quantum algorithm (quantum circuit) to produce operatorUwhich is approximate to the target unitary operatorUT=e−i·H·t, that is,

Plenty of methods were proposed in past years.Lloyd [20] frst invented the quantum algorithm by using Lie-Trotter product formula for simulating Hamiltonian which only includes the local interactions.Berry et al.[21] based on Trotter–Suzuki algorithm gave a method for simulating sparse Hamiltonian.As the unitary operator can be rewritten by the Taylor series expansion, Berry et al.[22] gave an algorithm for approximating the unitary operator with the truncated Taylor series in the same year.Low et al.[23] proposed a quantum signal processing for simulating.Being different from these approaches by quantum algorithm, some works intended to build a unitary operator by neural network or parametrized quantum gate sequence to approximate the target [19,24].They formulize the approximation of the target evolution operator as an optimization problem.The loss function is the square of Frobenius norm between desired unitary operator and parametrized alternating operator sequences [19].

3 Quantum Machine Learning

In this section, we will introduce the hybrid-based quantum machine learning model.The hybrid quantum-classical framework is derived from the quantum approximate optimization algorithm (QAOA) [25].The QAOA was proposed for solving the MAX-CUT problem, which can be viewed as minimizing the expectation value of a specifc observableAthat encodes the subjective function in the parametrized quantum state generated by applying alternating operatorse−iβi·Bande−iγi·Aon a uniform quantum state as follow,

where we are able to program the |β,γ〉 by following way

By calculating the derivative, in terms of parametersβandγ, of the loss function Eq.(5),the gradient-based optimizer can iteratively update these parameters and eventually approximate a solution.The fundamental of QAOA is the hybrid quantum-classical framework which consists of classical optimizer and variational quantum circuit (VQC).

The framework of hybrid-based model is shown in Fig.1, where VQC is responsible for calculating the gradient of the loss functionLrespect to parametersθ, then classical optimizer updates the parameters according to the gradient information and feed back to VQC.Similar to this idea discussed above, plenty of hybrid-based quantum machine learning models are successively developed for tackling different problems such as quantum generative model [26], quantum generative adversarial network [8,9], and so on.

Figure 1:The framework of hybrid-based model

The works listed above form the problem as a non-convex optimization problem, such as minimizing or maximizing a composite functiong°f (θ), wheref (θ)is the expectation value.The choice of functiongcan refer to the loss function in classical learning like mean square error(MSE), cross entropy loss etc.

where the observableOis the Hermitian operator of interest.In general, the density matrixρθcan be described as an ensemble of pure states,

By virtue of the success of QAOA, the non-convex optimization of the loss functiong°f (θ)can also be optimized by gradient descent or heuristic algorithms.

Variational quantum circuit (VQC), known as the parametrized quantum circuit, plays the core role in the hybrid quantum-classical framework.It can be viewed as the quantum blackbox model that is capable of approximating any given unitary operator with a small error like neural networks in classical machine learning [13].Unlike neural networks using weight matrices(parameters) between layers that are adjusted by back-propagation methods, VQC achieves a similar work in the quantum setting by utilizing a sequence of fxed and parametrized quantum gates to construct a circuit model with a specifc structure, that is

whereUθjcan be regarded as a quantum gate acting on specifc qubits.They are selected from a gate set that consists of parameter-free quantum gates including Pauli matrices (σX,σY,σZ),controlled NOT gate (CNOT) and parametrized gates such as rotation gates (RX(θ),RY(θ),RZ(θ)).Besides,Uθjcan also represent a quantum circuit block, a similar role of the layer in neural network, that is built by quantum gates with the specifc structure.The widely used ways to construct variational quantum circuits byUθjare shown in Fig.2.

Figure 2:The structure of quantum circuit block Uθj.(a) Universal two-qubits gate, (b) one qubit gates+entanglement gates

In subgraph (a) of Fig.2, each square represents the universal two-qubits gate which can be implemented by 15 rotation gates and 3 CNOT gates [27].All these universal two-qubits gates are applied on nearest-neighbor qubits.If the size of the quantum system isnqubits and number of the layer isl, this type of structure requires 15(n−1)lquantum gates to create.In subgraph (b)of Fig.2, the gates ofUθjis divided into two parts, the layer of one qubit gates and the layer of entangling gates.The squares represent the one rotation gates with angle and the rectangles stand for the entangling gates such as CNOT gates or Ising (XX, YY, ZZ) coupling gates.The details of these quantum gates are listed in Appendix A.

4 Learning Unitary by QML

Different from the methods introduced to solve the problem of learning a unitary transformation in Section 2, we reformulate the problem from another perspective.According to Choi–Jamiołkowski isomorphism in quantum information theory [11], there is the correspondence between a quantum mappingEand quantum statesρEsuch that,

whereρEis known as Choi matrix which is identical to the quantum mapEandρΦis the maximally entangled state,

Since the unitary transformationUTcan be regarded as a mappingEfrom one density matrix to another one.Thus the learning unitary problem can be formed as the follow optimization problem, that is minimizing the distance between quantum stateρUTandρUθ.

where the quantum stateρUθis

The learning problem of Eq.(13) stands for fnding the unitary operator which minimizes the average output fdelity when feed the maximally mixed state as the input toUθandUT.Thus,it is necessary to add a regularization term to the problem Eq.(13), which also guarantees the distance betweenUθandUTare still small enough.Therefore, the learning unitary problem is shown as follow,

There are many choices forL(·,·)and ‖·‖pin problem Eq.(15).Since the bad selection ofL(·,·)and ‖·‖pwill affect the performance of the model, the appropriate choice ofL(·,·)and ‖·‖pis required.We will introduce the measure of distance between quantum states and between operators.

Given two quantum stateρAandρB, the commonly used measure of distance for how ‘close’between the quantum states are shown as follows,

• Trace distance:

It can be viewed as a generalization of the total variation distance on probability distribution that satisfes the symmetry and triangle inequality.It is also related to the maximum probability of distinguish different quantum state.The variational form of trace distance is shown in the second line of Eq.(16) [28].

• Fidelity:

Although the fdelity is not a metric, it has many good properties, such as it is invariant unitary transformation, the value of fdelity lies within 0 and 1.It also can be interpreted as the angle between states on a unit sphere.IfρA,ρBare pure state, the fdelity can reduced to the overlap (inner product) between states.

• Quantum Optimal Transport Distance:

It is the quantum extension of classical optimal transport distance [10].However, it is semimetric which does not satisfy the triangle inequality of metric on quantum states.It inherits the nice property of classical optimal transport distance including smoothness and continues.

Because the quantum optimal transport distance can naturally be implemented by hybrid quantum-classical framework on quantum device, we select quantum optimal transport distance asL(·,·).

Given a unitary operatorU, the norm of operatorUcan be represented in a general form,namely Schattenp-norm,

• Trace norm (p=1):

• The Frobenius norm (p=2):

• The Spectral norm (p=∞):

where ‖·‖ is the Euclidean norm.

There are many nice properties of Schattenp-norm, such as the inequality between the different norms.For any operatorX, if 1 ≤p≤q≤∞, then ‖X‖q≤‖X‖p[28].Therefore, we have the following inequality between trace norm, Frobenius norm and spectral norm of operatorX,

The related work employed the square of Frobenius norm as the loss function for learning unitary transformation [19].In this work, we utilize the typically stronger norm, spectral norm,to estimate the error between approximate and desired unitary operator.Consequently, we can rewrite Eq.(15), the loss function of learning a unitary operator, in the following concrete way,

Since the min-max problem of Eq.(23) can be considered as quantum GAN with regularization term.As directly solving the problem of Eq.(23) is intractable, we intend to tackle the dual form of this problem by the Lagrange multiplier technique.

s.t.I ⊗φ−φ⊗I

As the spectral norm of matrixAis to fnd the unit vector x which maximize the Euclidean norm ofAx, we use a full-connected neural network with soft-max layer to construct unit vector x, i.e., x=fsoftmax(W·x0+b).Moreover, we regard the variational quantum circuitUθas the generator and the parametrized observablesφ,φas the discriminator.On account of the variational quantum circuit can naturally be used for modeling the unitary transformationUθ,we investigate the feasibility of applying the hybrid quantum classical framework to solve the optimization problem shown as Eq.(24).By applying the gradient based optimization algorithm,we iteratively adjust the parameters of quantum circuit to approximate the target unitary operator.Inspired by the training process of classical generative adversarial network, we also apply the strategy of alternately updating the parameters of generator and discriminator.The training algorithm is shown in Algorithm 1.

?

5 Experimental Results

In this section, we provide the experiments of applying the quantum machine learning model for learning the unitary transformation.We apply the quantum machine learning model discussed above to the task of learning the unitary transformation of one dimensional Heisenberg spin model which is also considered in reference [29].The target unitary operatorUTonN-qubit system is given by,

In which the HamiltonianHis described as,

wherestands for a vector of Pauli matricesσx,σy,σzonjth qubit, and the external magnetic feldhjin the z direction is randomly chosen from −htoh.We investigate the following cases that the system sizeN=2,3 and the evolution timet=N, andh=1.

In Figs.3 and 4, we provide the changes of trace norm, Frobenius norm and spectral norm between target and generated unitary operator during the training process.The solid black line represents the average norm for 10 runs with random initialization of parametrized quantum circuit, and the shaded area refers to the range of variation of the norm.In all case, the norm will approximate to zero which means the generated unitary operator is close to the target.In addition, the small system will lead to faster convergence, which is same as we expected.

We select fdelity between the generated and target quantum states to evaluate the performance of our model.In Fig.5, we show the fdelity between the quantum states which are generated by applyingUθandUTon the same random input quantum states.As shown in Fig.5, the fdelity is eventually around 0.997 which indicates that the generated quantum circuit provides a practicable approximation.

Figure 3:The trace norm, Frobenius norm and spectral norm vs. iterations (N=2).(a) Trace norm (N=2), (b) Frobenius norm (N=2), (c) spectral norm (N=2)

6 Discussion

Learning unitary transformation is an important and vexing task in quantum computing,which is related to controlling a quantum system or implementing a quantum algorithm with fewer resources.In this work, we investigate the use of promising techniques from quantum machine learning for learning a unitary transformation of a quantum system.Instead of the related works which formulate the learning problem as minimizing the norms between target and generated unitary operator, we express the problem as a quantum generative adversarial network with regularization term from the other perspective based on Choi–Jamiołkowski isomorphism.Comparing the trace norm and Frobenius norm used in related works, we add an intuitively stronger norm, spectral norm, as the regularization term to the loss function.Our numerical experiments demonstrate that the operator generated by our proposed model can successfully approximate the desired target unitary operator.The average spectral norm error of 10-replication runs is 0.1, and the average fdelity between the states produced by applying target and generated operators on the random input is around 0.997.Meanwhile, compared to the traditional method using product formulas for Hamiltonian simulation, our proposed model can signifcantly reduce the number of quantum gates for implementation.There are some potential applications of our proposed model such as providing help for assisting us in implementing quantum algorithms or compiling quantum circuits.

Figure 4:The trace norm, Frobenius norm and spectral norm vs. iterations (N=2).(a) Trace norm (N=2), (b) Frobenius norm (N=2), (c) spectral norm (N=2)

Figure 5:The fdelity of the states generated by applying U θ on random input (N=2, 3)

Acknowledgement:Thanks for constructive suggestion and helpful discussions from professor Xiaodi Wu.

Funding Statement:This work has received support from the National Key Research and Development Plan of China under Grant No.2018YFA0306703.

Conficts of Interest:The authors declare that they have no conficts of interest to report regarding the present study.

Appendix A.Preliminary of Quantum Computing

A.1 Quantum State

Instead of storing a certain state in one classical bit, a qubit, the counterpart of classical bit, is in a superposition of two basic state |0〉 and |1〉.Let |φ〉 represents an arbitrary one-qubit state, which can be described by the |φ〉=α|0〉+β|1〉 or |φ〉=whereαandβare both complex number such that |α|2+|β|2=1.They are known as probability amplitude which means if we perform a measurement on state |φ〉, then |φ〉 will collapse into state |0〉 or state |1〉 with the probability |α|2or |β|2, respectively.Besides, the quantum state |0〉 and |1〉 are also orthonormal bases, which are also called the computational bases in quantum computing.For a multi-qubit system, the state of this composite system can be described by the tensor product of the state of subsystem such as |φ〉=|φ1〉⊗···⊗|φm〉.All the quantum states we discussed above are pure states.Besides, a mixed state is an ensemble of some pure states {|φi〉} with coeffcientpi, which is generally described by a density matrix in the form ofρ=∑

i pi|φi〉〈φi|, and ∑

i pi=1.

A.2 Quantum Gates and Quantum Circuit Model

The widely used model for quantum computation is the quantum circuit model that is constructed by a sequence of reversible quantum logic gates.In quantum mechanics, the time evolution of a quantum system can be described by a unitary transformation.Thus, the quantum logic gates are equivalent to the unitary transformations in the quantum circuit model.The followings are commonly used one-qubit and multiple-qubits quantum gates,

• Puali Gates,

• Rotation Gates,

• Entangling Gates,

Ising XX Coupling Gates,

An example of quantum circuit is shown in Fig.A.1, each solid line through quantum gates represents one qubit, which is corresponding to the passage of time.The square box denotes the quantum gates, i.e., the revolution of the quantum system.The quantum states are passed through the quantum gates from left to right.

Figure A.1:An example of quantum circuit

A.3 Qubit Measurement

The classical data stored i n quantum states cannot be directly read out.To extract the data,we have to perform the quantum measurement on the state.Due to the measurement involve the distraction from the exterior environment, the system will collapse after the measurement which is an irreversible action.The operation of measurement can be described by a group of measurement operator {Mi}, where ∑=I.The projective measurement is simple and widely used measurement.It is described by an observableMwhich has the spectral decomposition,m·Pm, wherePm= |φm〉〈φm| is the projector to the corresponding eigenspace with eigenvaluem.When we perform the projective measurement on state |φ〉, we can get the state |φm〉with probability 〈φm|Pm|φm〉 and the expectation valueE(M)of observableM,E(M)=tr(Mρ),whereρis the density matrix of state |φ〉.