A quantum neural network computes its own relative phase Elizabeth C. Behrman James E. Steck Department of Mathematics, Statistics, and Physics Department of Aerospace Engineering Wichita State University Wichita State University Wichita, Kansas 67260–0033 Wichita, Kansas 67260–0044 email: [email protected] email: [email protected] 3 1 0 2 Abstract—Completecharacterizationofthestateofaquantum 2−qubit Pure State QNN − Real Coefficients 1 n systemmadeupofsubsystemsrequiresdeterminationofrelative 0.9 a phase, because of interference effects between the subsystems. 0.8 J For a system of qubits used as a quantum computer this is 3 especially vital, because the entanglement, which is the basis 0.7 1 forthequantumadvantageincomputing,dependsintricatelyon 0.6 phase.Wepresenthereafirststeptowardsthatdetermination,in QNN0.5 ] whichwe usea two-qubitquantumsystem as a quantumneural 0.4 h network,whichistrainedtocomputeandoutputitsownrelative 0.3 p phase. 0.2 - t 0.1 n I. INTRODUCTION 0 0 0.2 0.4 0.6 0.8 1 a Entanglement of Formation u Entanglement is the root of the power of quantum q computers[1]; thus, the production and measurement of en- Fig. 1. QNN entanglement for 50,000 randomly generated pure states of [ tanglement are essential if we are ever to be successful in the form a00|00 > +a01|01> +a10|10 > +a11|11>, where a00, a01, a10,and a11 are all real, as a function of the entanglement of formation. 1 making full use of the potential of quantum computing. This Pointslyingalongthedashedyellowlinearestatesforwhichtheentanglement v turns out to be a very hard problem. predictedbytheQNNwitnessexactlymatchestheentanglementofformation. 8 In previous work, we have proposed a method to find 0 an entanglement witness for a general, unknown, quantum 2−qubit complex pure states QNN 8 1 2 input state, using dynamic learning to find parameters for the 0.9 . quantum system that make it calculate its own entanglement. 1 0.8 Wecalledthisaquantumneuralnetwork(QNN)[2].Thebasic 0 0.7 3 idea is that contained in the system itself is the information 0.6 1 about its entanglement: If we find, through learning, an ap- NN0.5 Q v: propriate set of parameters for the system, then it can extract 0.4 i the entanglement of its initial state as an output measure of 0.3 X the state at some final time. We imagine that our quantum 0.2 r systemevolvesundersomeHamiltoniancontainingadjustable 0.1 a 0 parameters; we find that set of parameters such that our des- 0 0.2 0.4 0.6 0.8 1 Entanglement of Formation ignated output function (the qubit-qubit correlation function) is mapped onto the correctvalues forthe entanglementof the Fig.2. AsinFigure1,butwithcomplexcoefficients. initial state. Our entanglement witness gave good results for large classes of input states, including both pure and mixed states. Unlike the case with any other witness (see, e.g., [3]), 2-qubit system. These are pure states with real coefficients theinputstatedidnotneedtobe“close”toanyparticularstate. on the usual (“charge”) basis. The agreement is excellent. We have also [4], [5] extended our work to the 3-, 4-, and 5- Unfortunately these results do not carry over to the more qubitcases,andfoundthatasthesizeofthesystemgrows,the general case of complex coefficients. See Figure 2, which amount of additional training necessary diminishes; thus, our shows a similar set but with complex coefficients. Indeed, as method may be very practical for use on large computational we showed [2], it is impossible to find any single measurable systems. which will notexhibitanomalousoscillation; all witnesses do Figure 1 shows some representative results, in which we so. But is there a way to get around this difficulty? compare our entanglement witness to the entanglement of There are, of course, ways to determine more information formation [6] for 50,000 randomly generated states for the about the state; if we know the entire density matrix we can, at least for the 2-qubit system, simply calculate the to beexperimentallyadjustableasfunctionsoftime (see, e.g., entanglement of formation (as we ourselves did to generate [8], for the case of SQuID charge qubits.) By adjusting the the comparisondata forFigure1.) Forthe 2-qubitsystem this parametersusing a neurallearning algorithm we can train the may not be unreasonable.But for the eventualgoal of a large system to evolve in time to a set of chosen target outputs computational system, this can become quite daunting, since at the final time t , in response to a corresponding (one- f the number of parameters necessary goes like 22N, where N to-one) set of given inputs. Because the time evolution is is the number of qubits. Perhaps dynamic learning can allow quantum mechanical (and, we assume, coherent), a quantum ustofindashortcut.Thispaperisafirststepinthatdirection. mechanicalfunction,likeanentanglementwitnessoftheinitial Ifwekneworcoulddeterminetherelativephases θ ofthe state, can be mapped to an observable of the system’s final { } basis states, we could apply the (unitary) phase shift operator state, a measurement made at the final time t . The time f of e iθ to each relevant part of our input state. Since the evolution of the quantum system is calculated by integrating − { } coefficients would then be real, we could then perform our the Schro¨dingerequation numerically in MATLAB Simulink, entanglement witness measurement and achieve results like using ODE4 (Runge-Kutta), with a fixed integration step size those in Figure 1. of 0.05 ns [9]. The system was initialized in each input state In 2005, Yang and Han [7] found an algorithm for de- in the training set, in turn, then allowed to evolve for 190 termining the relative phase between parts of the n-qubit ns. A measurement is then made at the final time; this is the Bell (or GHZ) state, √p0...0 > +eiφ√1 p1...1 >. They “output” of the network. An error, target output, is calcu- | − | − showed that performing a Hadmard transform on each qubit lated, and the parameters are adjusted slightly to reduce the puts the system in a state in which the probability of finding error. This is repeated for each (input,target) pair multiple an even number of qubits in the state 1 > is given by times until the calculation convergeson parameters that work | p = 1+ p(1 p)cosφ.Givenalargenumberofcopies well for the entire training set. Complete details, including a even 2 p − ofthestate,itisthenpossibletodeterminebothpandφ.Here derivation of the quantum dynamic learning paradigm using weshowthat,withourQNN,wecanextendthisresult,forthe backpropagation[10] in time [11], are given in [2]. 2-qubit system, in two ways. First, we show that we can also We choose the usual “chargebasis ”, in which each qubit’s findthephaseoffsetinanEPRstate,a 01>+eiθa 10>. state is given as 0 or 1. 01 10 | | Second, we show that we can also find the phase offset for All of the parameters K,ε,ζ were taken to be functions { } any of the partially entangled states consisting of an EPR or of time; in contrast to our earlier work [2], [4], [5], in which a Bell state with some contaminant: theparametersweretakentobepiecewiseconstantintime,we have, here, allowed the parametersto be continuousfunctions a 00>+a 01>+eiφa 11> (1) 00| 01| 11| of time. For the backpropagation learning, the output error a00 00>+a10 101>+eiφa11 11> needs to be back-propagated backward through time [11], so | | | a00 00>+a01 01>+eiθa10 10> theintegrationhastobecarriedoutfromthefinaltimetf to0. | | | a 01>+eiθa 10>+a 11> ToimplementthisinMATLABSimulink,achangeofvariable 01 10 11 | | | is made by letting t = t t, and running this simulation eiξa 01>+a 10>+a 11> ′ f − 01| 10| 11| forward in t′ in Simulink. a 00>+eiξa 01>+a 10> 00 01 10 | | | III. TRAINING OFTHE PHASEINDICATOR II. DYNAMICLEARNING:QUANTUM NEURALNETWORK Inthechargebasis,we canwritea generalpurestate ofthe (QNN) system at time t=0 as We consider 2-qubit system whose Hamiltonian is: Ψ(0)>=a 00>+a eiξ 01>+a eiθ 10> (4) 00 01 10 H =K σ +K σ +ε σ +ε σ +ζσ σ (2) | | | | A xA B xB A zA B zB zA zB +a eiφ 11> 11 | where σ arethePaulioperatorscorrespondingtoeachofthe { } where normalization requires that twoqubits,AandB,K andK arethetunnelingamplitudes, A B ε andε are the biases, and ζ the qubit-qubitcoupling.The tiAme evolButionof the system is then givenby the Schro¨dinger qa200+a201+a210+a211 =1 (5) equation: Since anoverallphaseis physicallymeaninglesswe maytake dρ 1 outanyoverallphasefactor;thatis, withoutlossofgenerality = [H,ρ] (3) dt i¯h wemaytakethecoefficientofthe 00>basisstate tobereal. | where ρ is the density matrix and H is the Hamiltonian. The We then write each of the other coefficients as its magnitude parameters K,ε,ζ control the time evolution of the system times a phase factor; thus, each a will be a real number, nm { } in the sense that, if one or more of them is changed, the way and the phase factor, if any, will be written in explicitly. As a given state will evolve in time will also change. This is discussed above, the state of the system evolves under the the basis for using our quantum system as a neural network. Hamiltonian, Equation 2, to another state, Ψ(t ) >, at the f | The role of the “weights” of the network is played by the final time t . At that final time we make a measurement. In f parametersoftheHamiltonian, K,ε,ζ ,allofwhichwetake the terminology of neural network learning: (1) the input to { } the neural network is the initial state Ψ(0) > at time t = 0 | 0.2 of the quantum system; (2) the output of the neural network is a quantummeasuremade on the finalstate atthe final time t = t of the quantum system; and (3) the trainable weights f 0.15 of the neural network are the time histories of the adjustable parameters of the quantum system. The network is trained or on a set of training pairs, each of which consists of (input, Err correctoutput).Eachtrainingpairispresentedtothenetwork, S 0.1 M the output is calculated, the error computed, and the weights R changedso asto decreasetheerror[2].Eachpassthroughthe 0.05 entire training set is called an epoch. As with all good science, we began with what was already known [7]: namely, that it is possible to extract relative 0 phase information from the Bell state, Bell >= a 00 > 0 2 4 6 8 10 | 00| Epoch +a eiφ 11 >. Because we are using a learning process, 11 | it is important to see how much information we can get Fig.3. RMSerrorpertrainingpairvs.epoch(passthroughthetrainingset) with as little input as possible. Thus, our original training fortheφphaseoffsetindicator. Thetrainingsetof11(input,output) pairsis set consisted of only 11 training pairs, using only equal giveninthetext. amplitude Bell states Bell>=a 00>+a eiφ 11> with 00 11 | | | a =a = 1 , where the phase angle φ varies from π/2 00 11 √2 − 1 to π/2 as φ = π + (n−1)π, for n = 1 : 11. The network −2 10 output is the absolute magnitude squared of the projection of 0.8 thefinalstateofthequantumsystemontothestate 11>,i.e., | the probabilityof the system’s beingfoundin the state 11>. | 0.6 The correct, or target, output for these equal-amplitude EPR ut p states is takento be justcos2(φ/2). Thatis, the (input,output) ut O pairs are 0.4 1 input= Ψ(0)>= (00>+eiφ 11>) (6) 0.2 | √2 | | output= <11Ψ(t )> 2 target=cos2(φ/2) f | | | → 0 0 0.2 0.4 0.6 0.8 1 The network was trained for 10 epochs, on a total of 11 Target training pairs. The average RMS error of all 11 training pairs aftertrainingis0.0127.AplotofRMSerrorvsepochisshown Fig.4. Resultsforthetrainingsetfortheθ phaseoffsetindicator, showing deviation of the output, | < 11|Ψ(tf) > |2, from the target function in Figure 3. A plot of output vs target for the 11 training cos2(φ/2). Average RMS error perpair is 0.0127. Theline shows the goal pairs is shown in Figure 4. A plot of the trained parameters (perfect agreement.) as functions of time is shown in Figure 5. Each is a simple oscillatoryfunction.Note thatthe trained tunnelingamplitude x 10−3 3 functions K and K lie right on top of each other, as do A B ǫ and ǫ , which is unsurprising given the symmetry of the A B 2.5 training set. To see if the network has generalized (i.e., learned as Hz 2 Ka opposedtohavingsimplycurvefitted),wethentested(withno − G KEbpsilon a additional training) on a set of Bell states of random relative eter 1.5 EZeptsailon b magnitude, that is, on states of the type Bell >= a 00 > m 00 +a11eiφ 11 > with now randomly gen|erated number|s for ara 1 | P a and a (such that the state remained normalized, i.e., 00 11 a2 +a2 =1.)From [7] we knew thatit was unlikely that 0.5 p 00 11 we would be able to train to the same simple target function cos2(φ/2) , and so it transpired; however, we found that a 0 0 50 100 150 simple analogue, 2(1 a2 )2a2 + 2a a cos2(φ/2), did time − nanoseconds 2 − 00 11 00 11 work quite well. Again, the measurable is the probability of the system’s being found in the 11 > state at the final time, Fig. 5. The functions KA, KB, ǫA, ǫB, and ζ, as functions of time, as it.oe.t,h|e<ta1rg1e|Ψtf(utnfc)ti>on|u2.seNdoftoertthraait|ntihnigs,wtahrgeentafu00nc=tioan11re=du√c1e2s, KtǫrAaAinae=nddfKǫoBrBt.h=Eeap2chh.a5swe×aos1ff0sst−eatr3tθeG.dHKouAzt,a(npadnred-KtǫrBaAinl=iinegǫriBgvahl=tuoenζs)t=oaps1oc0fo−ne4satcGahnHtotfzhu.enrc,taiosndso: and maintainsthe necessary symmetry.These data are plotted 1 inFigure6(bluetriangles.)Ascaneasilybeseeninthefigure, agreement is excellent. 0.9 The ability of the system to map onto the target function 0.8 dependsonitsbeinganentangledstate[7];however,aslongas 0.7 we adjust the target function appropriately, full entanglement 0.6 is, clearly, not necessary. Thus it ought also to be possible ut to find the phase offset for a partially entangled input state, utp0.5 O e.g., of the form a 00 > +a 01 > +eiφa 11 >. How 0.4 00 01 11 | | | do we do this? We consider a probability-weighted target 0.3 function, equal to our earlier targets for the special case of 0.2 the pure Bell state, but adjusting the relative function for the 0.1 diminished entanglement. We are guided here by symmetry and by earlier analytic results [7], in which it was found that, 00 0.2 0.4 0.6 0.8 1 while the relative phase was extractable, it was not easily Target separable from the amplitude information, and, in fact, had Fig.6. Resultsforthetestingsetforthephaseoffsetφ,consistingofthree to be separatelymeasuredfor(hence,the necessity for“many typesofstates:unequalamplitudesBellstatesa00|00>+eiφa11|11>(blue copies”oftheoriginalstate.)Experimentationeventuallygave triangles),andtwokindsofpartiallyentangled states,a00|00>+a01|01> us the following (relatively) simple functions. For the Bell +eiφa11|11>(greensquares),anda00|00>+a10|101>+eiφa11|11> state, a 00 > +a eiφ 11 >, the target function for the (red circles). As in Figure 4, we show the deviation of the output from the 00| 11 | target functions (given in the text.) Average RMS error per pair is 0.0270. output <11Ψ(tf)> 2 is: Thelineshowsthegoal(perfect agreement.) | | | 1 target =2( a2 )2a2 +2a a cos2(φ/2) (7) Bell 2 − 00 11 00 11 were also able to recover this information! In other words, For the BP >= a 00 > +a 01 > +a eiφ 11 > state, 1 00 01 11 the neural net, trained to map φ informationto the projection | | | | the target function for the output <11Ψ(t )> 2 is: f onto the basis state 11>, also maps the θ information to the | | | | 1 1 projection onto the 01 > basis state. For equal amplitudes, target =2 a2 a2 a2 +3 a2 a2 a2 (8) | BP1 |3 − 01| 00 11 |3 − 00| 01 11 a01 = a10 = √12, we again use the simple cosine function, +2a a cos2(φ/2) cos2(θ/2); we use the analogous measure on the final state, 00 11 < 10Ψ(t ) > 2. That is, the (input,output) pairs for equal For the |BP2 >= a00|00 > +a10|10 > +eiφa11|11 > state, a|mplitu|de EfPR s|tates are the target function for the output <11Ψ(t )> 2 is: f | | | 1 targetBP2 =2|31 −a210|a200a211+3|31 −a200|a210a211 (9) input=|Ψ(0)>= √2(|01>+eiθ|10> (10) +2a00a11cos2(φ/2) output=|<10|Ψ(tf)>|2 →target=cos2(θ/2) Note that these target functions agree with the functions For non-equalamplitude EPR states, and for the analogous used for training: that is, the training states 1 [00 > partially entangled EPR states, we employ exactly analogous √2 | +eiφ 11>], for φ: π/2 to π/2, had a target function given target functions as with the Bell states. For the EPR state, by co|s2(φ/2); this −is exactly what the training function in a01 01 > +a101eiθ 10 >, we take the target function for the | | Equation 7 reduces to, in the case a00 =a11 = √12. Similarly output |<10|Ψ(tf)>|2 to be: the target functions for the BP > states both reduce to the functiontested on forthe pu|reBell states in the case of equal targetEPR =2(21 −a201)2a210+2a01a10cos2(θ/2) (11) amplitudesof 1 . Testing results for550randomlygenerated √3 states of all three types, for all values of the angle φ, are For the EP >= a 00 > +a 01 > +a eiθ 10 > state, 1 00 01 10 | | | | showninFigure6.Agreementisquitegood,evenremarkable, the target function for the output <10Ψ(t )> 2 is: f | | | considering that the system was trained only on 11 phase 1 1 angles for an equal-amplitude Bell state. The average RMS target =2 a2 a2 a2 +3 a2 a2 a2 (12) EP1 |3 − 00| 01 10 |3 − 01| 00 10 errorperpairoverall550testingpairsaftertrainingis0.0270. +2a a cos2(θ/2) Withsomeconfidenceinourmethod,wenowextendtothe 01 10 correspondingstatesofthetwoqubitsystemthatalsocanhave For the EP >= a 01 > +a eiθ 10 > +a 11 > state, 2 01 10 11 maximal entanglement, the EPR states, Ψ(0) >= a 01 > | | | | +a eiθ 10 >. By symmetry, these state|s are “the sa0m1|e” as the target function for the output |<10|Ψ(tf)>|2 is: 10 | the Bell states; thus, we would expect that similar training 1 1 target =2 a2 a2 a2 +3 a2 a2 a2 (13) oughtto be able to map the phase shift to the projection onto EP2 |3 − 11| 01 10 |3 − 01| 11 10 the 01 > basis state. However, with no further training, we +2a a cos2(θ/2) 01 10 | 1 1 0.9 0.9 0.8 0.8 0.7 0.7 0.6 0.6 ut ut utp0.5 utp0.5 O O 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0 0 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 Target Target Fig. 7. Results for the testing set on the phase offset θ, consisting of Fig. 8. Results for the testing set on the phase offset ξ, consisting of input states of three types: (1) a01|01 > +a10eiφ|10 > (blue triangles); input states of three types: (1) eiξa01|01 > +a10|10 > (blue triangles); (2) |EP1(θ) >= [a00|00 > +a01|01 > +eiθa10|10 > (green squares), |EP3(ξ)>=a01eiξ|01>+a10|10>+a11|11>(greensquares),and(3) and (3) |EP2(θ) >= a01|01 > +eiθa10|10 > +a11|11 > (red circles.) (2)|EP4(ξ)>=a00|00>+eiξa01|01>+a10|10>(redcircles.)Again, Again, we show the deviation of the output from the target function (given weshowthedeviation oftheoutputfromthetarget function. Average RMS inthetext.) Average RMS errorperpairis 0.0489.Theline showsthe goal errorperpairis0.0699.Thelineshowsthegoal(perfectagreement.) (perfect agreement.) the set was trained for only 10 epochs. Agreement is not Results for testing on 550 randomly generated states of all perfect, and, doubtless, a more complicatedfunctioncould be three types are shown in Figure 7. devisedsuchthatbetteragreementwouldbereached.Butifwe If we can recover phase offset information on both 11 > are considering inverting these functions, in order to perform | and 10> projections,we oughtto be ableto doso on 01>. the rotations that would enable our use of the entanglement | | And so we can. Again we test only (no additional training), estimator discussed in the Introduction, simplicity is also using, this time, the projection onto the 01 > state, and important. Because our method relies on the phase offset’s | lookingforinformationaboutthephaseoffsettermmultiplied being on a basis state which carries entanglement, it is not bythatbasisstate.Ourtargetfunctionsaretheexactanalogues completely general; however, since our goal is to be able to to the EPR> and EP1,2 > targets. For the EPR state with estimate the entanglement of a general input state, it does | | the ξ offset, a01eiξ 01 > +a10 10 >, the target function for not really matter, since no phase correction is necessary to | | the output <01Ψ(tf)> 2 is: an unentangled state, and would make no difference to the | | | 1 calculation if made. target =2( a2 )2a2 +2a a cos2(ξ/2) (14) EPRx 2 − 10 01 10 01 Our previous work [4], [5], which extended our work on entanglement in 2-qubit systems to n-qubit systems, seems For the EP >= a eiξ 01 > +a 10 > +a 11 > state, | 3 01 | 10| 11| to indicate that extension of our present results to multiple the target function for the output <01Ψ(t )> 2 is: | | f | qubit systems should be possible without too much difficulty. 1 1 The ease with which we are able to extract multiple angle target =2 a2 a2 a2 +3 a2 a2 a2 (15) EP3 |3 − 11| 10 01 |3 − 10| 11 01 information is encouraging. It should be not too difficult to +2a a cos2(ξ/2) performthe inverserotations, and, thereby,to be able to form 10 01 a good and reliable estimate for the entanglementwith only a For the EP >= a 00 > +a eiξ 01 > +a 10 > state, | 4 00| 01 | 10| veryfew measurements,evenformany-qubitsystems. We are the target function for the output <01Ψ(t )> 2 is: | | f | currently working on these calculations, and on the extension 1 1 of our results to mixed systems. target =2 a2 a2 a2 +3 a2 a2 a2 (16) EP4 |3 − 00| 10 01 |3 − 10| 00 01 +2a a cos2(ξ/2) REFERENCES 10 01 [1] M.NielsenandI.Chuang,Quantumcomputationandquantuminforma- Results are shown in Figure 8 for 550 randomly generated tion.Cambridge: CambridgeUniversity Press(2000). states. [2] E.C.Behrman,J.E.Steck,P.Kumar,andK.A.Walsh,Quantumalgorithm design using dynamic learning, Quantum Information and Computation IV. CONCLUSION 8,pp.12-29(2008). [3] G.TothandO.Guhne,Detectinggenuinemultipartiteentanglementwith We have shown that a two-qubit quantum system, con- twolocalmeasurements,Phys.Rev.Lett.94,060501(2005). sidered as a trainable quantum neural net, can compute its [4] E.C.Behrman and J.E.Steck, Dynamic learning of pairwise and three- wayentanglement,inProceedingsoftheThirdWorldCongressonNature own phase offsets. The training is not difficult: the training and Biologically Inspired Computing (NaBIC 2011) (Salamanca, Spain, set consisted of only 11 training pairs, of a single type, and October19-21,2011.(Institute ofElectrical andElectronics Engineers). [5] E.C.BehrmanandJ.E.Steck,Multiqubitentanglementofageneralinput state,Quantum InformationandComputation 13,36-53(2013). [6] W.K. Wootters, Entanglement of formation of an arbitrary state of two qubits,Phys.Rev.Lett.80,pp.2245-2248(1998). [7] C-P Yang and S. Han, Extracting an arbitrary relative phase from a multiqubit two-component entangled state, Phys. Rev. A 72, 014306 (2005). [8] T. Yamamoto, Yu.A. Pashkin, O. Astafiev, Y. Nakamura, and J.S. Tsai,Demonstrationofconditionalgateoperationusingsuperconducting chargequbits,Nature 425,pp.941-944(2003). [9] MATLAB Simulink documentation notes [Online]. Available at http://www.mathworks.com/access/helpdesk/help/toolbox/simulink [10] Yann le Cun, A theoretical framework for back-propagation in Proc. 1998ConnectionistModelsSummerSchool,D.Touretzky,G.Hinton,and T.Sejnowski, eds.,MorganKaufmann, (SanMateo),pp.21-28(1988). [11] Paul Werbos, in Handbook of Intelligent Control, Van Nostrand Rein- hold,p.79(1992).