Experimental Quantum Learning Spectral Decomposition
Experimental Quantum Learning Spectral Decomposition
Quantum simulation and machine learning are among lap with an input state that might itself be the output
the most promising applications of large-scale quantum of another algorithm [38–41]. Although a minimum of
computers. Of these, the discovery of algorithms with 2(2n − 1) real parameters are required to do this exactly
provable exponential speedup has been more challeng- in general, it is widely believed that for many cases of
ing in the machine learning domain, in part because it is interest a polynomial number of parameters will suffice.
harder to port established machine learning techniques to Beyond learning states, it is also useful to variation-
the quantum setting [1]. Notable exceptions include lin- ally learn a unitary channel ρ 7→ U ρU † . This is more
ear system solvers [2–4], kernel methods [5, 6], and Boltz- challenging because now all of the 4n − 1 matrix ele-
mann machines [7, 8]. But quantum simulation demon- ments must match for an exact replica V of an arbitrary
strations [9–13] appear to be ahead of machine learning U , up to a global phase. A hybrid protocol for learning
[14–20] in terms of the maximum problem sizes achieved, a unitary is provided by the quantum-assisted quantum
suggesting that quantum simulation might yield the ear- compiling algorithm [38]. This is a low-depth subroutine
liest applications with quantum advantage. appropriate for both near-term and fault-tolerant quan-
Variational quantum algorithms [21–23] will likely fa- tum computing.
cilitate near-term implementations for these applications. Given a target unitary U and parameterized unitary
Such algorithms employ a problem-specific cost function V (θ), both acting on n-qubits, quantum-assisted quan-
that is evaluated on a quantum computer, while a classi- tum compiling uses a maximally entangled Bell state on
cal optimizer trains a parameterized quantum circuit to 2n qubits to compute the Hilbert-Schmidt inner product,
minimize this cost. |Tr(U V (θ)† )|. Since this inner product is directly related
Some variational quantum algorithms have interest be- to the average fidelity between states acted on by U and
yond their ability to achieve quantum advantage on their V (θ) [42, 43], this allows the action of U on all possible
own, and can serve as subroutines for larger quantum al- input states to be studied using a single entangled input
gorithms. These include quantum autoencoders for data state. Consequently, with this entanglement-enhanced
compression [24, 25] and linear algebra methods [26– learning strategy, only a single training state is needed
28]. A common subroutine is the training of a varia- to fully learn U , in contrast to the ∼2n input-output pairs
tional quantum state to approximate the ground state of that are required in the absence of entanglement [44, 45].
a given n-qubit Hamiltonian, which can be the Hamilto- Although more challenging than state learning, learn-
nian of a simulated model [29] or some other optimiza- ing a unitary can be used for a wide variety of quantum
tion objective [30–32]. Variational quantum algorithms information applications, including circuit depth com-
to learn and diagonalize density matrices have also been pression, noise-tailoring, benchmarking, and the ‘black
developed [33–35], which is a fundamental subroutine box uploading’ of an unknown experimental system uni-
that will have many uses including principal component tary [38]. Quantum-assisted quantum compiling has been
analysis and estimation of quantum information quanti- demonstrated on 1+1 qubits, where a single-qubit vari-
ties [36, 37]. Another subroutine is the learning of one ational circuit V (θ) learned the value of a single-qubit
quantum state by a second state, where the output of unitary U [38].
a variational circuit is optimized to maximize the over- Quantum-assisted quantum compiling can be gener-
2
alized to learn not only a unitary, but also its Schur METHODS
decomposition W (θ)D(γ)W (θ)† , where W (θ) is a pa-
rameterized unitary and D(γ) is a parameterized diag- Learning task. We demonstrate the variational learn-
onal unitary. That is, one can use quantum-assisted ing of the spectral decomposition of a unitary by learning
quantum compiling to variationally diagonalize a uni- a diagonalization of the short-time evolution operator of
tary. This is useful for a variety of quantum information the 2-spin Ising model
science applications, since access to the spectral decom-
position of a unitary U enables arbitrary powers of U
X X
H=J Zi Zi+1 + B Xi . (1)
to be implemented using a fixed depth circuit. Specif- i=1,2 i=1,2
ically, suppose we learn the optimum parameters θopt
and γopt such that U = W (θopt )D(γopt )W (θopt )† . We Here J quantifies the exhange energy, B is the trans-
can then implement U k using the fixed depth circuit verse field strength and Zi and Xi are Pauli operators
W (θopt )D(kγopt )W (θopt )† . We stress that the parameter on the ith qubit. We approximate the short-time evolu-
k here can take any real value and hence this approach tion exp(−iH∆t) of the spin chain using a second order
can be used to implement non-integer and negative pow- Trotter approximation, that is we take
ers of U .
Y Y Y 2
One important application of variational unitary diag- U= Rx (θB )i × Rzz (θJ )i,i+1 × Rx (θB )i (2)
onalization is quantum simulation. Let U be a Trotter- i i i
ized (or other) approximation to a short-time evolution
e−iH∆t by some Hamiltonian H. We assume that H is where θB = B∆t/2 and θJ = 2J∆t/2. The simulated
local [46–49], sparse [50–52], or given by a linear combina- Ising model parameters are listed in Table I. The specific
tion of unitaries [53–55], permitting efficient simulation circuit we used for U is shown in Fig. 1.
with bounded error. Then W Dt/∆t W † is an approximate
fast-forwarded evolution operator with a circuit depth TABLE I. Ising model parameters.
that is independent of t. By contrast, most of the best Parameter Value
known Hamiltonian simulation algorithms [49, 52, 55] N number spins 2
have depths scaling at least linearly in t, inhibiting long ∆t short evolution time 0.2
time simulations on near-term hardware. J exchange energy 1
B transverse field 1
This low-depth algorithm, called variational fast-
forwarding [56], lies at an exciting intersection of machine
learning and quantum simulation and is an promising Ansatz. To learn the spectral decomposition of U we
approach in the burgeoning field of variational quantum variationally compile it to a unitary with a structure of
simulation [57–68]. Variational fast-forwarding has been the form
demonstrated on 1+1 qubits [56]. Refinements of varia-
tional fast-forwarding for simulating a given fixed initial V (θ, γ) = W (θ)D(γ)W (θ)† , (3)
state [67] and for learning the spectral decomposition of a
given Hamiltonian [68] have also been proposed. It is im- where W is an arbitrary unitary, D is a diagonal matrix
portant to note that the unitary being diagonalized need and θ and γ are vectors of parameters. After successful
not already be known. Therefore, variational unitary di- training, D will capture the eigenvalues of U , and W will
agonalization could also be used to perform a ‘black box capture the rotation matrix from the computational basis
diagonalization’ of the dynamics of an unknown experi- to the eigenbasis of U .
mental system. Thus, this approach provides a new al- The parameterized circuits we used as ansätze for
gorithmic tool for probing dynamics in an experimental the diagonal unitary D and basis transformation W are
setting. shown in Fig. 3. A general diagonal unitary D ∈ SU(2n )
on n qubits contains 2n − 1 variational parameters. In
In this work we use ibmq bogota to demonstrate the our experiment we implement a two-qubit version of this
successful learning of a spectral decomposition on 2+2 exact D containing 3 variables. In general an arbitrary
qubits. Specifically, we diagonalize the short time evolu- unitary W can be constructed from any general n-qubit
tion unitary for an Ising spin chain. After only 16 steps parameterized quantum circuit with poly(n) variables.
of training by gradient descent, the spectral decompo- The expressive power of different options has been in-
sition is used to fast-forward the evolution of the Ising vestigated in [69, 70]. The two-qubit circuit we use to
model, resulting in a dramatic reduction of simulation implement the arbitrary unitary W consists of 3 layers
error compared with Trotterized Hamiltonian simulation of X, Y rotations and phase gates on each qubit, sepa-
and a significant (∼ 10×) increase in the effective quan- rated by 2 CNOT gates.
tum volume of the simulation.
3
FIG. 1. Circuit for the short-time evolution of the Ising model. The boxes indicate individual Trotter steps. Here
Rx (θ) = eiθX/2 is a single qubit Pauli X rotation, P (γ) = diag(1, eiγ ) is a single qubit phase gate and Rzz (θ) = eiθZ⊗Z/2 is a
two-qubit diagonal unitary.
FIG. 3. Ansatz circuits. Implemented circuits for the diagonal unitary D and basis transformation W . Here Rzz (γ) =
eiγZ⊗Z/2 is a two-qubit diagonal unitary and P (γ) = diag(1, eiγ ) is a single qubit phase gate. D contains 3 variational
parameters. W has 3 layers and 18 variational parameters.
Error
the raw cost to 0.1099 corresponding to an ideal cost 1
0.4
of 0.013. The raw cost from the quantum computer is
higher than the ideal cost because of gate errors. 0
Cost
0.3 0 4 8 12 16
The inset of Fig. 4 confirms that the errors in D Iteration
and W DW † are both iteratively reduced as the cost 0.2
is trained. Here the Frobenius distance between U
and V is plotted, minimized over the arbitrary global 0.1
Raw
phase eiϕ . The ideal and learnt diagonals are also Ideal
compared, accounting for the global phase eiϕ and for 0.0
a possible reordering, specified by a permutation ma- 0 4 8 12 16
Iteration
trix χ. Specifically, we plot the Frobenius distance
minϕ,χ ||Dexact − eiϕ χDχ† || where Dexact is a diagonal
matrix with {λexact }, the ordered exact spectrum of U , FIG. 4. Training curves. In the main plot we show the
i
cost as a function of the iteration step during training. The
along the diagonal. P This is equivalent to the sum of the
blue curve is the measured cost function C and the green
eigenvalue errors i |λexact
i −λ i e iϕopt 2
| , where {λi } is the curve is its noise-free ‘ideal’ value. In the inset, the yellow
ordered learnt spectrum and ϕopt accounts for the global curve indicates the total error in the learnt unitary defined
phase shift. as Frobenius distances between U and V minimized over a
It is also interesting to monitor the training by using global phase eiϕ , i.e., the quantity minϕ,χ ||U −eiϕ V ||. The red
the measured gradient g meas at each step to calculate curve indicates the eigenvalue error, defined as the Frobenius
distance between the learnt and exact diagonal also minimized
the angle between g meas and the exact gradient simu-
over a permutation χ, i.e., minϕ,χ ||Dexact − eiϕ χDχ† ||.
lated classically. This is plotted in the Supplementary
Information. The data confirms that the optimization is
correctly moving downhill in the cost function landscape. |+i⊗2 , but with D0 s parameters (γ1 , γ2 , γ3 ) changed to
Having learned the spectral decomposition, we use the t
result to fast-forward the Hamiltonian simulation of the (γ1 , γ2 , γ3 ) × . (8)
∆t
Ising model (1) for 2 spins on ibmq bogota. In this ex-
periment we prepare an initial state |+i⊗2 and propagate The state fidelity with perfect evolution e−iHt |+i⊗2 is
it forward in time by both Trotterization and variational also measured in this case. The results for this exper-
fast-forwarding (with backend circuit optimization dis- imental fast-forwarding and experimental Trotter sim-
abled in both cases). The Trotterized evolution at times ulation are indicated by the green and blue solid lines
t = K∆t, is obtained by applying K = 0, 8, 16, · · · , 96 respectively in Fig. 5.
consecutive Trotter steps from Fig. 1. After each step We compare the experimental fast forwarding to the
we experimentally measure the fidelity of the Trotter- ideal classical fast-forwarding by also measuring the
ized evolution with the perfect evolution e−iHt |+i⊗2 , noise-free fidelities obtained by classical simulation. In
which contains no Trotter error. The variational fast- this ideal simulation, the initial state |+i⊗2 is prepared
forwarding evolution at time t is obtained by applying perfectly and the Trotterized evolution includes Trotter
the optimized variational circuits for W † , D∗ , and W to errors but no gate errors. The measurement is also as-
5
Trent Huang, William J. Huggins, Lev Ioffe, Sergei V. Clean, Kosuke Mitarai, Xiao Yuan, Lukasz Cincio, and
Isakov, Evan Jeffrey, Zhang Jiang, Cody Jones, Dvir Patrick J. Coles, “Variational quantum algorithms,”
Kafri, Kostyantyn Kechedzhi, Julian Kelly, Seon Kim, arXiv preprint arXiv:2012.09265 (2020).
Paul V. Klimov, Alexander Korotkov, Fedor Kostritsa, [22] Suguru Endo, Zhenyu Cai, Simon C Benjamin, and Xiao
David Landhuis, Pavel Laptev, Mike Lindmark, Erik Yuan, “Hybrid quantum-classical algorithms and quan-
Lucero, Orion Martin, John M. Martinis, Jarrod R. tum error mitigation,” Journal of the Physical Society of
McClean, Matt McEwen, Anthony Megrant, Xiao Mi, Japan 90, 032001 (2021).
Masoud Mohseni, Wojciech Mruczkiewicz, Josh Mutus, [23] Kishor Bharti, Alba Cervera-Lierta, Thi Ha Kyaw,
Ofer Naaman, Matthew Neeley, Charles Neill, Hartmut Tobias Haug, Sumner Alperin-Lea, Abhinav Anand,
Neven, Murphy Yuezhen Niu, Thomas E. O’Brien, Eric Matthias Degroote, Hermanni Heimonen, Jakob S.
Ostby, Andre Petukhov, Harald Putterman, Chris Quin- Kottmann, Tim Menke, Wai-Keong Mok, Sukin Sim,
tana, Pedram Roushan, Nicholas C. Rubin, Daniel Sank, Leong-Chuan Kwek, and Alán Aspuru-Guzik, “Noisy
Kevin J. Satzinger, Vadim Smelyanskiy, Doug Strain, intermediate-scale quantum (nisq) algorithms,” arXiv
Kevin J. Sung, Marco Szalay, Tyler Y. Takeshita, Amit preprint arXiv:2101.08448 (2021).
Vainsencher, Theodore White, Nathan Wiebe, Z. Jamie [24] Jonathan Romero, Jonathan P Olson, and Alan Aspuru-
Yao, Ping Yeh, and Adam Zalcman, “Hartree-fock on a Guzik, “Quantum autoencoders for efficient compression
superconducting qubit quantum computer,” 369, 1084– of quantum data,” Quantum Science and Technology 2,
1089 (2020). 045001 (2017).
[12] Frank Arute, Kunal Arya, Ryan Babbush, Dave Ba- [25] Dmytro Bondarenko and Polina Feldmann, “Quantum
con, Joseph C Bardin, Rami Barends, Andreas Bengts- autoencoders to denoise quantum data,” Physical Review
son, Sergio Boixo, Michael Broughton, Bob B Buckley, Letters 124, 130502 (2020).
et al., “Observation of separated dynamics of charge [26] Carlos Bravo-Prieto, Ryan LaRose, Marco Cerezo, Yigit
and spin in the fermi-hubbard model,” arXiv preprint Subasi, Lukasz Cincio, and Patrick J Coles, “Variational
arXiv:2010.07965 (2020). quantum linear solver,” arXiv preprint arXiv:1909.05820
[13] Igor Aleiner, Frank Arute, Kunal Arya, Juan Atalaya, (2019).
Ryan Babbush, Joseph C Bardin, Rami Barends, An- [27] Xiaosi Xu, Jinzhao Sun, Suguru Endo, Ying Li, Simon C
dreas Bengtsson, Sergio Boixo, Alexandre Bourassa, Benjamin, and Xiao Yuan, “Variational algorithms for
et al., “Accurately computing electronic properties linear algebra,” arXiv preprint arXiv:1909.03898 (2019).
of materials using eigenenergies,” arXiv preprint [28] Hsin-Yuan Huang, Kishor Bharti, and Patrick Reben-
arXiv:2012.00921 (2020). trost, “Near-term quantum algorithms for linear systems
[14] Diego Riste, Marcus P da Silva, Colm A Ryan, An- of equations,” arXiv preprint arXiv:1909.07344 (2019).
drew W Cross, Antonio D Córcoles, John A Smolin, [29] Alberto Peruzzo, Jarrod McClean, Peter Shadbolt, Man-
Jay M Gambetta, Jerry M Chow, and Blake R John- Hong Yung, Xiao-Qi Zhou, Peter J Love, Alán Aspuru-
son, “Demonstration of quantum advantage in machine Guzik, and Jeremy L O’brien, “A variational eigenvalue
learning,” npj Quantum Information 3, 1–5 (2017). solver on a photonic quantum processor,” Nature com-
[15] Maria Schuld, Mark Fingerhuth, and Francesco Petruc- munications 5, 4213 (2014).
cione, “Implementing a distance-based classifier with a [30] Edward Farhi, Jeffrey Goldstone, and Sam Gutmann, “A
quantum interference circuit,” EPL (Europhysics Let- quantum approximate optimization algorithm,” arXiv
ters) 119, 60002 (2017). preprint arXiv:1411.4028 (2014).
[16] Xi-Wei Yao, Hengyan Wang, Zeyang Liao, Ming-Cheng [31] Stuart Hadfield, Zhihui Wang, Bryan O’Gorman,
Chen, Jian Pan, Jun Li, Kechao Zhang, Xingcheng Lin, Eleanor G Rieffel, Davide Venturelli, and Rupak Biswas,
Zhehui Wang, Zhihuang Luo, et al., “Quantum image “From the quantum approximate optimization algorithm
processing and its application to edge detection: theory to a quantum alternating operator ansatz,” Algorithms
and experiment,” Physical Review X 7, 031041 (2017). 12, 34 (2019).
[17] He-Liang Huang, Xi-Lin Wang, Peter P Rohde, Yi-Han [32] Kosuke Mitarai, Makoto Negoro, Masahiro Kitagawa,
Luo, You-Wei Zhao, Chang Liu, Li Li, Nai-Le Liu, Chao- and Keisuke Fujii, “Quantum circuit learning,” Physical
Yang Lu, and Jian-Wei Pan, “Demonstration of topo- Review A 98, 032309 (2018).
logical data analysis on a quantum processor,” Optica 5, [33] Ryan LaRose, Arkin Tikku, Étude O’Neel-Judy, Lukasz
193–198 (2018). Cincio, and Patrick J Coles, “Variational quantum
[18] D. Zhu, N. M. Linke, M. Benedetti, K. A. Landsman, state diagonalization,” npj Quantum Information 5, 1–10
N. H. Nguyen, C. H. Alderete, A. Perdomo-Ortiz, N. Ko- (2019).
rda, A. Garfoot, C. Brecque, L. Egan, O. Perdomo, and [34] M Cerezo, Kunal Sharma, Andrew Arrasmith, and
C. Monroe, “Training of quantum circuits on a hybrid Patrick J Coles, “Variational quantum state eigensolver,”
quantum computer,” 5 (2019), 10.1126/sciadv.aaw9918. arXiv preprint arXiv:2004.01372 (2020).
[19] Kunal Kathuria, Aakrosh Ratan, Michael McConnell, [35] Carlos Bravo-Prieto, Diego Garcı́a-Martı́n, and José I
and Stefan Bekiranov, “Implementation of a hamming Latorre, “Quantum singular value decomposer,” Physical
distance–like genomic quantum classifier using inner Review A 101, 062310 (2020).
products on ibmqx2 and ibmq 16 melbourne,” Quantum [36] Marco Cerezo, Alexander Poremba, Lukasz Cincio, and
machine intelligence 2, 1–26 (2020). Patrick J Coles, “Variational quantum fidelity estima-
[20] Teague Tomesh, Pranav Gokhale, Eric R Anschuetz, and tion,” Quantum 4, 248 (2020).
Frederic T Chong, “Coreset clustering on small quantum [37] Jacob L Beckey, M Cerezo, Akira Sone, and Patrick J
computers,” arXiv preprint arXiv:2004.14970 (2020). Coles, “Variational quantum algorithm for estimat-
[21] M. Cerezo, Andrew Arrasmith, Ryan Babbush, Simon C ing the quantum fisher information,” arXiv preprint
Benjamin, Suguru Endo, Keisuke Fujii, Jarrod R Mc-
7
1.2
0.4
0.0
π/2
b)
−π/2
0 4 8 12 16
Iteration
η0
FIG. S2. (a) Learning rate versus optimization step during training by gradient descent. This rate obeys η(j) = [1+(j/δ)] κ
where j ∈ {0, 1, 2, · · · , 16} is the optimization step number and the hyperparameters η0 = 1.1, κ = 0.5, and δ = 12 were optimized
by classical simulation. (b) Error in the measured gradient direction during training. Here we plot the angle between gradient
measured on ibmq bogota during training, and true gradient calculating classically for the same set of parameters, for each
optimization step.