Variational quantum process tomography

Quantum process tomography is an experimental technique to fully characterize an unknown quantum process. Standard quantum process tomography suffers from exponentially scaling of the number of measurements with the increasing system size. In this work, we put forward a quantum machine learning algorithm which approximately encodes the unknown unitary quantum process into a relatively shallow depth parametric quantum circuit. We demonstrate our method by reconstructing the unitary quantum processes resulting from the quantum Hamiltonian evolution and random quantum circuits up to $8$ qubits. Results show that those quantum processes could be reconstructed with high fidelity, while the number of input states required are at least $2$ orders of magnitude less than required by the standard quantum process tomography.


I. INTRODUCTION
Quantum process tomography is an indispensable technique in quantum information processing to fully characterize an unknown quantum process [1]. It is increasingly pivotal in identifying and verifying the performance of a quantum device and its dynamics when the system goes larger. Standard quantum process tomography (SQPT) works by preparing an informationally complete set of input states and then performing the standard quantum state tomography on the corresponding output quantum states [2,3]. As a result, the total number of quantum measurements scales as 4 2n for an n-qubit quantum process. The exponential growth severely limits the problem size on which SQPT can be feasibly applied. Currently, SQPT has only been experimentally implemented up to 3 qubits [4][5][6][7][8][9]. In the meantime, with the rapid development of quantum computing hardwares [10][11][12], scalable quantum process tomography schemes are in great demand.
Various schemes have been proposed to alleviate the exponential scaling problem of SQPT. For example, ancillaassisted process tomography could reduce the exponential number of input states to a single entangled state [13][14][15], and direct characterization of quantum dynamics (DCQD) could reduce the total number of configurations from 4 2n to 4 n [16,17]. In general, the exponential scaling is unavoidable to reconstruct a generic quantum process. However, by assuming certain structures of the unknown quantum process, the number of configurations can be significantly reduced. Such examples include compressed sensing quantum process tomography that assumes the measurement outcomes are sparse [18], and tensor network states based quantum process tomography which assumes a low entanglement structure of the underlying quantum process [19,20]. Recently, it is shown that one could efficiently encode the information * guochu604b@gmail.com † junjiewu@nudt.edu.cn of certain quantum states into a parametric quantum circuit (PQC) using a gradient-based quantum machine learning algorithm, after which the unknown quantum state can be reconstructed classically with high fidelity using the optimal parameters of the PQC [21].
In this work, we propose a unsupervised quantum machine learning algorithm for quantum process tomography, which is also a continuation of Ref. [21]. As shown in Fig. 1, we use a PQC of certain depth d to approximate the unknown quantum process denoted by U, where θ is a list of parameters to be optimized in this PQC. To learn the information of U, we randomly prepare a set of N random quantum states |ψ j , each of which is separately fed into the unknown quantum process and the PQC. Then as long as each pair of output quantum states, U|ψ j and C( θ)|ψ j are equal to each other, and that N is large enough, the unitary operation represented by C( θ) should be approximate to U. As a result, all the information of U are stored in the parameters θ, and we can systematically reconstruct U from those parameters using a classical computer. Interestingly, during the training process, we use an additional set of random input states as the validation set, similar to that used in classical machine learning algorithms, which tests the generalization ability of the training outcomes for a particular PQC and set of input states. Here we also point out that our approach is initially designed only for the unitary quantum process, however, it is possible to generalize it to a generic quantum process by using auxiliary qubits as in Ref. [21].
Compared to its alternatives, our approach has several advantages. First, near-term quantum computers or simulators may only be able to faithfully run a quantum process with limited depths, therefore it is reasonable that the same process could be reproduced by a parametric quantum circuit with a relatively low depth. However, the amount of entanglement produced by such quantum computers could be huge [11,12], in which case the tensor network states based methods would be invalid. Second, our approach only requires to measure a single qubit for each configuration, taking into consideration that for current quantum computers the errors of quantum gate arXiv:2108.02351v1 [quant-ph] 5 Aug 2021 operations are almost one order of magnitude less than that of quantum measurements [11,12], our approach could be less prone to errors. Last, with a small number of input states, our approach may already be able to reconstruct U with very high fidelity. We demonstrate our approach on the reconstruction of two unitary processes produced by quantum Hamiltonian evolution and random quantum circuits, respectively. In both examples our numerical results show that we could reconstruct a quantum process up to 8 qubits with a similarity value (defined in Eq.(6)) higher than 97%, and the number of required input quantum states is smaller than that required by SQPT by at least 2 orders of magnitude.
This paper is organized as follows. In Sec. II, we introduce the scheme of our quantum machine learning algorithm for quantum process tomography. In Sec. III, we demonstrate our method with numerical simulations of quantum process tomography for the time evolution of a quantum XXZ spin chain and the randomly generated quantum circuit. We conclude in Sec. IV.

II. APPROXIMATING UNITARY QUANTUM PROCESSES WITH PARAMETRIC QUANTUM CIRCUIT
Our quantum machine algorithm is composed of three parts: design of the PQC, training, and validation, which are shown in Fig. 1(b, c). Fig. 1(a) shows the procedures of standard quantum process tomography as a comparison. In the following, we present the details of each component.

A. The parametric quantum circuit
The design of our PQC is shown in Fig. 1(c), where interlaced layers of single-qubit gates and two-qubits gates are used. It is designed to quickly generate entanglement between qubits, thus make it possible to approximate complicated quantum processes. In practice, the design of the PQC should also take the underlying quantum hardware into consideration, especially the choice as well as the pattern of the two-qubit gates. Each two-qubit layer is counted as a depth. Each single-qubit layer contains three rotational gates (R z , R y , and R z ) on each qubit, where R y and R z are defined as (1) (2) The sequence R z , R y , and R z makes sure that arbitrary single qubit rotations can be produced with appropriate parameters. Our PQC ends with a single-qubit layer. As a result, for such a circuit with n qubits and d depth, the total number of parameters is 3n(d + 1). gives a general framework of our method. We build a loss function f to evaluate the distance between U and C( θ). By training the PQC with the quantum states in the training set and validation set, and optimizing the parameters in C( θ) based on a gradient-descending approach, the PQC gradually approximates the physical quantum process U. (c) shows the structure of the parametric quantum circuit which begins and ends with a single-qubit layer. Each two-qubit layer is counted as a depth and the circuit contains d depths of operations and ends with a single-qubit layer.

B. The training process
We build a loss function which reflects the distance between the unitary represented by C( θ) and the target unitary U. Concretely, we first randomly generate a set of N quantum states, denoted as Ψ = {|ψ 1 , |ψ 2 , ..., |ψ N }. Here, a random quantum state is generated by applying an R y gate with random parameters onto each qubit and CZ gates with random control and target qubits. Each state |ψ j is fed into the unknown quantum process U and the PQC C( θ), with the output quantum states denoted as |ψ ideal j = U |ψ j and |ψ j = C( θ) |ψ j . Then we compute the Euclidean distance between |ψ ideal j and |ψ j , which is The inner product on the right-hand side of Eq. (3) can be efficiently computed with a quantum computer using a generalized SWAP-test algorithm, which is detailed in Appendix. A.
The loss function f is defined as the summation of the distance obtained over all input states, which is namely, f is the mean square error between the two set of output quantum states.
The loss function f is a hybrid quantum-classical function, where it contains functions to be evaluated with a quantum computer (SWAP-test) and functions to be evaluated on a classical computer. The gradient of the quantum part can be computed by where O in our case means the SWAP-test with parametric quantum gates, θ j denotes the j-th parameter in the parameter list θ, and θ ± j = θ j ± π 2 . The gradient of the loss function f can be computed following Ref. [22], which proposes a method to embed Eq.(5) into the classical automatic differentiation framework, such that the gradient of a hybrid quantumclassical loss function can be automatically computed using a hybrid quantum-classical computer. The gradient can then be fed into a gradient-based optimizer to minimize the loss function f .
After the training, we evaluate the accuracy between U and C( θ) using the similarity defined as Here X denotes the 2-norm of the vectorized matrix X. similarity(U, C( θ)) = 1 means C( θ) − U = 0, in which case U can be perfected reconstructed from C( θ).

C. Usage of a validation set
As a prior, we do not know whether our PQC is expressive enough or not to represent U, and whether the number of input states is enough or not to ensure convergence to U. Moreover, in practice we may also have the problem of overfitting such that the optimal C( θ) is very distinct from U but the loss function f has already converged to 0. To overcome these problems, we borrow the idea of the validation set from classical machine learning, which is part of the training data and primarily used to test the generalization ability of the training outcomes without resorting to the testing data.
Concretely, we generate another set of input states denoted as Φ = {|φ 1 , |φ 2 , ..., |φ N }, i,e, the validation set, which is independent of the training set. After the training process, we feed each |φ j into the unknown quantum process and the resulting optimal PQC, obtaining two outputs |φ ideal j = U |φ j and |φ j = C( θ) |φ j . Then we compute the quantum fidelity between |φ ideal j and |φ j efficiently through the SWAP-test [23] on a quantum computer, and summarize over all the instances of the validation set, which is defined as the accuracy We can see that 0 ≤ accuracy(U, C( θ)) ≤ 1. If accuracy is close to 1, it means the PQC we obtained can be well generalized to the new input state. Therefore, it is possible to determine if the training is successful based on accuracy, without resorting to the truth value of U as required in Eq. (6). In our numerical simulation we show that accuracy and similarity are indeed strongly correlated, therefore we can identify the simulation with accuracy close to one as the most faithful reconstruction of U.

III. NUMERICAL RESULTS AND DISCUSSIONS
We demonstrate our quantum machine learning algorithm using numerical simulations based on a classical PQC simulator. Specifically, we concentrate on two cases: 1) the unknown unitary process is produced by a quantum Hamiltonian evolution and 2) by random quantum circuits, respectively.

A. XXZ spin chain time evolution
We take the Hamiltonian of the Heisenberg XXZ spin chain [24] in a magnetic field as our example, which can be written as,

(8)
Here n is the number of spins (qubits), J is the tunneling strength, ∆ is the interaction strength, and h is the magnetization strength. The evolutionary operator with time dt is denoted as In the simulations, we fix h = 0.1, J = 1, and set dt = 0.01. As shown in Sec. II, we will encode U XXZ into the circuit parameters θ. We prepare a set of randomly generated states |ψ i as inputs, i.e., the training set Ψ, and feed each |ψ i into both the quantum process and the PQC. The same training procedure is repeated for 100 times, with each of them initialized independently. After training, another randomly generated validation set is utilized to test the generalizability and pick out the most faithful instance of parametric circuit. Based on Eq.(6) and (7), we can evaluate the performance of the parametric quantum circuits on the training set and validation set.
Here, we denote (n, d, N ) as an n-qubit, d-depth, and Ninput PQC configuration in numerical simulation. Fig. 2(a) illustrates a typical 5-qubit training process on different sizes of input states- (5,6,8), (5,6,9) and (5, 6, 10) cases. The parametric quantum circuit is initialized by randomly generated parameters and evaluated by loss function in Eq.(4) at each epoch. Fig. 2(a) shows that the loss function goes down with the training process while the similarity gradually reaches 1 under different N . Moreover, among 100 independent trials with random initialization on the (5, 6, 10) PQC configuration, we utilize the validation set to distinguish the more faithful PQC. It is plotted in Fig. 2(b) that the accuracy on the validation set shows a strong correspondence with the final similarity value. Therefore, it is feasible to utilize the accuracy value as a criterion to determine the optimal circuit parameters to reconstruct U with higher similarity.
In Fig. 2(c), we conduct simulations on Heisenberg XXZ spin chains of different lengths to evaluate the scalability of our method. For an n-qubit Heisenberg XXZ spin chain time evolution process (n ranges from 2 to 8), we utilize different depths of PQC d, choose different sizes of training sets N , repeat such independently identical simulations for 100 times, and calculate the maximum similarity achieved. Compared with standard quantum process tomography, which needs 4 n pairs of input states and output states, the number of required input quantum states in our method is at least 2 orders of magnitude less (concretely N = 56 and N = 120 for 7-qubit and 8-qubit quantum processes, while the corresponding numbers in SQPT are 16384 and 65536, respectively). Meanwhile we utilize a relatively shallow depth circuit (d ≤ 8) and achieve a faithful similarity (higher than 97%) over all cases. More data and configuration details can be seen in Appendix. B. Besides, our method only involves single qubit measurements for each configuration, instead of measuring in the complete set of computational basis.
We further study the influence of the evolution time dt of the Hamiltonian on the results of our method in Fig. 2(d). We take a (6, 6, 30) PQC configuration as an example, and set various evolution times dt, ranging from 0.01 to 0.15. Under each case, we repeat the numerical simulations and get the maximum similarity value. In Fig. 2(d), we plot the maximum similarity against the evolution times dt. It can be seen that our method still achieves an acceptable similarity when the evolution time goes longer.

B. Randomly generated quantum circuit
In this section, we consider the quantum process of randomly generated circuits. For an n-qubit D-depth randomly generated quantum circuit, we firstly apply Hadamard gates to initialize the state to a symmetric superposition. Then, the circuit is organized by depth, including controlled-phase (CZ) gates alternating between odd and even configurations to entangle neighbouring qubits and randomly chosen single-qubit gate (T , Finally, Hadamard gates are applied to each qubit. A specific 6-qubit randomly generated circuit is organized as shown in Fig. 3(a). It is noted that such randomly generated quantum circuits are hard for efficient simulation on a classical computer [25,26]. Here, we take the 4-qubit 8-depth, 5-qubit 7-depth and 6qubit 6-depth randomly generated quantum circuits as examples. We utilize (4,5,8), (5,7,20), and (6, 8, 39) PQC configurations to learn the corresponding quantum process respectively. Data details can be seen in Appendix. B. In Fig.  3(b), we plot the similarity value against the PQC depth d. It is noted that for such a specific random quantum circuit, our method can give an approximate circuit C( θ) with high similarity among repetitive independent trails, and the results depends on the depth of the parametric circuits d. Taking the 4-qubit (green line) randomly generated quantum circuit as an example, the most appropriate depth d is among 5 to 10. Shal-low circuits may not be expressive enough to rebuild U, while deeper depth with more parameters may result in overfitting. Hence the maximum similarity is tougher to reach one when the depth d > 12.

IV. CONCLUSION
In this work, we propose a quantum machine learning algorithm for quantum process tomography, which encodes the unknown unitary quantum process into a parametric quantum circuit of certain depth d. A set of randomly generated product quantum states are used as the training data to minimize the loss function. The training process is repeated with a validation set in the end of filter out the instance with highest similarity, namely the closest to the unknown quantum process. We demonstrated our method by two numerical examples, including the Hamiltonian evolution with the Heisenberg XXZ spin chain from 2-qubit to 8-qubit and random quantum circuits. The results indicate that a faithful reconstruction of U (similarity higher than 97%) can be reached with a relatively low-depth PQC (d ≤ 8), and a relatively small number of training states (at least 2 orders of magnitude compared to SQPT). Moreover, only single qubit measurement is required in each configuration, instead of measuring in the complete set of computational basis. Our work presents a promising application of using quantum machine learning algorithm to accelerate quantum process tomography.

V. ACKNOWLEDGMENTS
We appreciate the helpful discussion with other members of the QUANTA group. We thank He-Liang Huang for fruitful discussion. J.W. acknowledges the support from the National Natural The key to calculating the loss function and accuracy is the inner product between the target state |ψ ideal j = U |ψ j and the circuit output state |ψ j = C( θ) |ψ j . For real state vectors, the standard SWAP-test circuit (shown in Fig. 4 grey shaded box) is enough to evaluate the overlap since it is a real number. However, |ψ ideal j and |ψ j are complex vectors, so we introduce a generalized SWAP-test to evaluate the overlap value.
Given two complex quantum states |ψ and |φ , it is already known that the fidelity between the two states can be evaluated using SWAP-test circuit, namely a = | ψ|φ | 2 can be efficiently calculated on a quantum device. Thus as long as we can prepare another superposition state ξ = 1 √ 2 (|ψ + |φ ), In Fig. 2(c), we conduct the scalability tests on n-qubit Heisenberg XXZ spin chain time evolution. Here, we give detailed numerical results listed in Table I where d, N P QC , and N SQP T denote PQC depth, number of input quantum states in our method and number of input quantum states in SQPT respectively. In Fig. 2(d), we conduct extension tests on longer time evolution process with (6, 6, 30) configuration. Here, we give detailed numerical results listed in Table II, where maximum and average similarity are calculated under 100 trials. In Fig. 3(b), we utilize (4,5,8), (5,7,20), and (6, 8, 39) PQC configurations to learn the corresponding 4-qubit 8depth, 5-qubit 7-depth and 6-qubit 6-depth randomly generated quantum circuits respectively. Here, we give detailed numerical results listed in Table III, where std corresponds to the standard deviation of 100 trials.