Quantum gate learning in engineered qubit networks: Toffoli gate with always-on interactions

We put forward a strategy to encode a quantum operation into the unmodulated dynamics of a quantum network without the need of external control pulses, measurements or active feedback. Our optimization scheme, inspired by supervised machine learning, consists in engineering the pairwise couplings between the network qubits so that the target quantum operation is encoded in the natural reduced dynamics of a network section. The efficacy of the proposed scheme is demonstrated by the finding of uncontrolled four-qubit networks that implement either the Toffoli gate, the Fredkin gate, or remote logic operations. The proposed Toffoli gate is stable against imperfections, has a high-fidelity for fault tolerant quantum computation, and is fast, being based on the non-equilibrium dynamics.


INTRODUCTION
Computational devices based on the laws of quantum mechanics hold promise to speed up many algorithms known to be hard for classical computers [1].The implementation of a full scale computation with existing technology requires an outstanding ability to maintain quantum coherence (i.e.isolation from the environment) without compromising the ability to control the interactions among the qubits in a scalable way.Among the most successful paradigms of quantum computation, there is the "circuit model", where the algorithm is decomposed into an universal set of single-and two-qubit gates [2], and, to some extent, the so-called adiabatic quantum computation (AQC) [3] where the output of the algorithm is encoded in the ground state of an interacting many-qubit Hamiltonian.A different approach [4] is based on the use of always-on interactions, naturally occurring between physical qubits, to accomplish the computation.Compared to the circuit model, this scheme has the advantage of requiring minimal external control and avoiding the continuous switch off and on of the interactions between all but two qubits; while compared to AQC it has the advantage of being faster, being based on the non-equilibrium evolution of the system.Quantum computation with always-on interactions is accomplished by combining the natural couplings with a moderate external control, e.g. with a smooth shifting of Zeeman energies [5], via feedforward techniques [6], using measurement based computation [7] or quantum control [8,9].Most of these approaches are based on the assumption that the natural couplings are fixed by nature and not tunable, while local interactions can be modulated with external fields.However, the amount of external control required can be minimized if the couplings between the qubits can be statically tuned [10], e.g. during the creation of the quantum device.
The recent advances in the fabrication of superconducting quantum devices has opened up to the realization of interacting quantum networks.In a superconducting device, the qubits are built with a Josephson tunnel element, an inductance and a capacitor [11], while local operations and measurements are performed by coupling the qubit to a resonator [12].The interactions can be designed using lithographic techniques by jointly coupling two qubits via a capacitor [13] or an inductance [14], and can be modeled via an effective two-body Hamiltonian α J α σ α ⊗σ α [15,16], where σ α are the Pauli matrices.Because of the flexibility in wiring the pairwise interactions among the qubits, it is possible to arrange them in a planar graph structure, namely a collection of vertices and links, where the vertices correspond to the qubits and the links correspond to the 2-body interactions between them.Moreover, thanks to the development of threedimensional superconducting circuits [17], it may be possible in the near future to wire also non-planar configurations, namely a general qubit network.
Motivated by the above arguments, we consider the question whether it is possible to encode a quantum algorithm into the unmodulated dynamics of a suitably large quantum network of pairwise interacting qubits.This would be extremely interesting, as it would enable quantum computation by simply "waiting", without the need of continuously applying external control pulses or measurements.Even when sequential operations cannot be avoided, our scheme can enable the in-hardware implementation of recurring multi-qubit operations of a quantum algorithm (see e.g.Fig. 1), such as quantum arithmetic operations [18], and possibly also the quantum Fourier transform or error correcting codes [1].We focus on two-body interactions, since they are the most common in physical setups, and we consider an enlarged network where auxiliary qubits enrich the quantum dynamics.The important question analyzed in this paper is the following: given a target unitary operation U Q on a given set of qubits Q, we consider an extended network Q∪A where A is a set of auxiliary qubits (ancillae), and we ask whether it is possible to engineer the pairwise interactions in Q∪A, modeled by the time-independent Hamiltonian H QA , such that e itH QA =U Q ⊗V A after some time t (V A may be an extra unitary operation on the auxiliary space).More generally the target operation can depend also on the ancillae initial state: if FIG. 1. Schematic transposition of a quantum circuit to a trained quantum network.(a) An example 7-qubit circuit where the gates G1 and G2 are sequentially applied.Many important circuits can be cast into the scheme (a), such as those for quantum arithmetics [18].(b) Quantum network implementation of (a): each qubit network in the green boxes implements either G1 or G2 on the input/output qubits (the three qubits in the bottom row).The quantum bus sequentially transfers the state of three qubits from the register, upon which the gate G1 or G2 has to be applied, to the input/output qubits of the gate network.After the gate network has implemented its transformations, the state is transferred back to the original three-qubits of the register.
or Fredkin gates [1,19,20] where U Q =e itH Q for any 2-local H Q , and for remote logic, namely for applying a gate to qubits which are not directly connected but are rather interacting via intermediate systems.Our approach is completely different from the simulation of k-local Hamiltonians with pairwise interactions discussed in the AQC literature [21,22], being based on the unmodulated dynamics.Moreover, being based on unmodulated (time-independent) interactions and ancillary qubits, it is significantly different from quantum optimal control [23].
Our quantum network design procedure is inspired by supervised learning in feedforward networks [24], where the training procedure involves the optimization of the network couplings (i.e. the weights between different nodes) such that the output corresponding to some input data has a desired functional form (e.g. for data classification).Although there are many recent developments about using a quantum device to speed-up machine learning algorithms [25][26][27][28][29] or storing data [30], our optimization procedure is entirely classical, but specifically developed for quantum hardware design.Our scheme is completely different from other recent proposals [31][32][33] because it avoids measurements or active feedbacks and requires minimal external control.

Supervised quantum network design
Supervised learning is all about function approximation: given a training set {(I 1 , O 1 ), (I 2 , O 2 ), . . .}, namely a collection of inputs I k and the corresponding known outputs O k , the goal is to find a function f with two desired properties: i) O k f (I k ) for any training pair; ii) f should be able to infer the unknown output of an input not contained in the training set.In classical feedforward networks, the function f is approximated with a directed graph organized in layers, where the first layer is the input register and the last one encodes the output.The value s ( ) k of the k-th node in layer is updated via the equation s , where A is an appropriate (typically non-linear) activation function and λ is the weight between node k in layer and node j in −1.The training procedure consists in finding the optimal weights λ by minimizing a suitable cost function such as A quantum network consists on the other hand of an undirected graph (V, E) of vertices V and links E described by a 2-local Hamiltonian where σ α n , α=x, y, z, are the Pauli matrices acting on qubit n and, to simplify the notation, we call λ={J αβ nm , h α n } the set of parameters.
The vertices are composed of two disjoints sets V =Q∪A where Q consists of register qubits and A of auxiliary qubits.
Given a separable initial state |ψ Q ⊗ |ψ A , the time evolution according to Hamiltonian (1) generates a quantum channel on subsystem Q -since we are interested in a fixed operational time t for simplicity we set t=1, reabsorbing t into the definition of the definition of H. Depending on the flexibility of the experimental apparatus in reliably initializing the auxiliary qubits, one can add |ψ A to the set λ. Network design consists in the following procedure: given a target unitary operation U Q that we want to implement, the goal is to find the parameters λ, if they exist, such that To simplify the notation we assume that the gate output is encoded in Q but it is straightforward to generalize the formalism when the output sites differ from the input ones.
Motivated by the similarity with classical supervised learning, where the weights λ are tuned to maximize the ability of the network to reproduce a known output given the corresponding input, we create a training set T with a random set of initial input states.For each input |ψ ∈T the expected known output is U Q |ψ , while the output of the network evolution is E λ [|ψ ψ|].The "learning" procedure involves the minimization of the difference between the output of the network and the expected output, and corresponds to the maximization of the fidelity If the average is performed over all possible states, then Eq.( 2) can be substituted by the average gate fidelity F= F ψ dψ where the formal integration can be explicitly evaluated [10,34,35] yielding where and {|q j } form the computational basis of the D-dimensional Hilbert space of qubits Q.The typical value of the fidelity for a random non-optimal evolution of the qubit network is F=D −1 , obtained using Haar integration techniques [36].This value is independent on the details of the ancillae, since it depends only on the dimension of the target Hilbert space, and provides an estimate for the initial fidelity of an untrained network.
The gate learning procedure corresponds to a global maximization of the fidelity (3).However, because of the many parameters in the Hamiltonian (1), F can have many local maxima making the global optimization extremely complicated.Since most global optimization algorithms introduce stochastic strategies, rather than introducing unphysical random jumps, we take advantage of the explicit stochastic nature of the problem ( F is a uniform average over random states) and we propose the following learning algorithm to design the interactions of the quantum network.update L times the coupling strengths as decrease (see Methods); 6: until convergence (or maximum number of operations).
Specifically, we combine the above algorithm with the maximization of the average fidelity (see below) and we observe a drastic speedup of the optimization process.The parameter L tunes the number of deterministic steps in the learning procedure, and can be set to the minimum value L=1, so that after each interaction the state is changed, or to a higher value.In our simulations we use L=1, for simplicity.Our algorithm is an application of the stochastic gradient descent (SGD) method [37] to the maximization of the function (2).In classical feedforward networks, SGD is the de facto standard algorithm for network training [24,37] and is specifically used for large training datasets, when the evaluation of the cost function and its gradient are computationally intensive.On the other hand, the average in Eq.( 2) can be evaluated explicitly over a uniform distribution of an infinite number of initial states, giving Eq.(3).Although F ψ is easier than F to compute, the major advantage of SGD for quantum network design comes from its ability to escape local maxima.The crucial observation to show the latter point is that the statistical variance over random states VarF=F 2 − F2 vanishes when F=1 (see e.g.[34,35]) -indeed, intuitively, since both F and F ψ are bounded in [0, 1], F can achieve its maximum only if F ψ =1 for all the states, apart from a set of measure zero.On the other hand, if 0< F<1, then VarF>0 and the fluctuations can be so high that a local maximum of F may not correspond to a maximum of F ψ for some state ψ.This is indeed shown in Fig. 2 with a real example for the implementation of the Toffoli gate (see the application section below).In Fig. 2 the average fidelity F has three local maxima at λ loc.k (k = 1, 2, 3) and a single global maximum at λ gl., namely the optimal parameters, while the fidelities F ψ for different random states ψ have a more complicated behavior.In view of the argument discussed above, all the state fidelities F ψ have a global maximum at λ gl.while, remarkably, at least one fidelity F ψ has no local maximum at λ loc.
k .Our stochastic learning algorithm uses a gradient descent technique for locally maximising the function F ψ (λ).Therefore, if we are around the slopes of a local maximum of F ψ (λ) (say λ loc.k from the previous example) and the state |ψ is randomly changed to |φ , that local maximum may disappear from F φ (λ) allowing the algorithm to escape from this non-optimal region when the parameters are updated via Eq.( 4).On the other hand, when the algorithm is probing the neighborhood of a true optimal point for which F(λ)=1, (e.g.λ gl. in the previous example), then the maximum of F ψ (λ) does not disappear when the state ψ is changed, allowing the "climbing" procedure to continue.
The above stochastic algorithm may be combined with a deterministic maximization of Eq.( 3).In our simulations we use stochastic learning for the initial global span of the parameter manifold and, if it reaches a suitably high fidelity (e.g.F>95%), then it is reasonable to suppose that the algorithm has found a global maximum.Starting from this point we perform a local maximization of Eq.( 3) and, if F 1 is reached, the learning has been successful.Otherwise we repeat the procedure.
It is worth emphasizing that given a target gate U , it is an open question to understand a priori whether a solution may exist for a graph with a certain set of interactions (e.g.Heisemberg, Ising, etc.).Unlike in quantum control, where given a time dependent Hamiltonian H(t) = H 0 + β(t)V one can check in advance whether U = T [exp(−i 1 0 H(t)dt)] for some control profile β(t): such profile can exist only if U is contained in the group associated to the algebra generated by the repeated commutators of H 0 and V.Although no complete algebraic characterization is known for our case (see however the Methods for a necessary condition) and we have to study each problem numerically, in the next sections we find some structures which enable the implementation of important quantum gates.All numerical simulations have been obtained in a laptop computer using QuTiP [38].

Application: Toffoli gate
The Toffoli gate is a key component for many important quantum algorithms, notably the Shor algorithm [39], quantum error correction [20], fault-tolerant computation [40], quantum arithmetic operations [18] and, together with the Hadamard gate, is universal for quantum computation [41].Experimental implementations of this gate has been obtained with trapped ions [42], superconducting circuits [19,43], or photonic architectures [44].Toffoli gate is a controlledcontrolled-not (CCNOT) operation acting on three qubits.It can be implemented in a circuit using five two-qubit gates [1], or can be obtained in coupled systems via quantum control techniques [45,46].Efficient schemes require higher dimensional system (i.e.qudits) [44].On the other hand, the direct implementation using natural interactions is complicated, since the Hamiltonian H CCNOT corresponding to the gate, i.e.CCNOT=e iHCCNOT , has three-body interactions which unlikely appear in nature.
By applying our quantum hardware design procedure, we show that the Toffoli gate can be implemented in a four qubit network using only pairwise interactions and constant control fields.Our findings enable the construction of a device which implements the Toffoli gate with a fidelity F=99.98% by simply "waiting" for the natural dynamics to occur, without the need of external control pulses.We consider a four qubit network as displayed in Fig. 3, where the control qubits are labeled by the indices 1,2, the target is qubit 3 and the ancilla is qubit 4. We start our analysis by considering a fullyconnected graph where each qubit interacts with the others using XX-and ZZ-type pairwise interactions, as this kind of interaction can be obtained in superconducting circuits [15].Because of the symmetries of the Toffoli gate (see Methods), we consider the two control qubits to be equally coupled to the target and the ancilla: J αβ 1m =J αβ 2m , for m=3, 4 and similarly we set h α 1 =h α 2 .Moreover, since the Toffoli gate is real, we only consider local fields in the X and Z directions and set |ψ A = cos η |↑ +e iξ sin η |↓ .By combining SGD with the maximization of Eq.( 3) we find the following optimal parameters, where the other XX-and ZZ-type interactions not displayed in ( 5) are found to be zero by the learning algorithm, so the optimal configuration is the one summarized in Fig. 3 where the XX coupling is only between qubits 3 and 4. In more physical terms, if the maximal allowed coupling is fixed to J/2π≈40MHz, then we find a gate time of 60ns and With the optimal parameters of Eqs.( 5),( 6) we obtain an average gate fidelity of 99.98%, above the threshold for topological fault tolerance for single-and two-qubit gates, while by avoiding the extra phase fixing ξ=0 we still obtain F=99.92%.Moreover, our gate fidelity is above the Toffoli gate accuracy threshold (755/756 99.87%) for fault-tolerant computation in the limit in which Clifford gate errors are negligible [47].
The optimal parameters (5),( 6) are stable against an imperfect tuning of the interactions.Indeed, we considered a perturbation λ k →λ k + r k , r k ∈[0, 1] being a random number and being the strength of the static perturbation, and found that F>99.9% if <0.04 ( <0.7 MHz) and F>99% if <0.18 ( <3 MHz).

Application: Fredkin gate
Fredkin gate is a controlled-swap (CSWAP) operation acting on three qubits which is universal for reversible computation [1].We found that this gate can be obtained with perfect fidelity (up to the numerical precision) in a four qubit network with Hamiltonian ( 1 so the gate is independent on the initial state of the ancilla.As for the Toffoli gate, this optimal configuration has been obtained by starting the training procedure with a fully connected graph with all the interactions, so the fact that some interactions are zero is a result of the optimization process.

Application: remote logic
We study a qubit network which implements a maximally entangling gate between two sites which are not directly coupled.Remote logic has been studied extensively in spin chains for achieving entangling operations between the boundary sites [4,10,48,49], and it is a building block for a proposed architecture for solid-state quantum computation at room temperature [50].For simplicity we consider a SU(2) invariant four qubit network, interacting with a Heisenberg Hamiltonian H= universal for quantum computation when paired with single qubit operations [1], can be achieved between qubits 1 and 4 with unit fidelity with different choices of J 12 =J 24 , J 13 =J 34 , and J 23 when the initial state of ancillae is (|↑↓ − |↓↑ )/ √ 2. Given this simplification one can then find a solution analytically: where n is an integer.We find analytically that irrespective of α the above choice gives perfect fidelity.Our strategy has not found any three-qubit configurations which implement a remote √ SWAP gate, so the four qubit network is the minimal non-trivial example.Remarkably, some of our 4-qubit configuration are more stable to noise than the direct implementation of the gate in a two-qubit system (namely when J 14 =π/2 and the other couplings are zero).For instance, if J ij = J optimal ij + , J optimal ij being the optimal value for implementing the gate, we found that when is randomly distributed in [0, 1/2], then the 4-qubit system with n = 1 still has, on average, F 99.1%, while the direct two-qubit case has F 98.8%.

Towards a scalable architecture for quantum computation
Current architectures for quantum computation, e.g. with superconducting qubits [51] or ion traps [52], are based on an arrays of interacting qubits which are continuously controlled via external pulses to implement the desired operation.This approach may suffer from scalability issues because, even assuming the ability to maintain quantum coherence for a long time, extremely large (classical) control units will be necessary to generate the sophisticated pulse sequences required to implement a full-scale quantum algorithm.On the other hand, the approach that we have in mind shares more similarities with integrated circuits in nowadays electronics, where a set of special-purpose logic units (modules) are wired together to achieve computation (or other tasks).In our vision, different modules can be fabricated with qubit networks designed to produce a specific logic task, namely a quantum gate, automatically without the need of external control.As in Fig. 1 the different logic and memory units can be reciprocally connected using a quantum bus, whose purpose is to transfer the qubit states between the quantum registers/memory and the input/output qubits of the modules.In Fig. 1 for simplicity the input/output ports of the modules are designed in the same physical qubits, although this can be easily extended to more general cases.The quantum bus can be realized with different technologies, e.g. with microwave resonators [53], or can also be implemented via quantum state transfer in a qubit network [54].The modules shown in Fig. 1 can be designed to produce either simple basic operations, like the CNOT or the Toffoli gate, or, in principle, they can directly implement larger components of a quantum algorithm like the Quantum Fourier Transform or error correcting codes [1].In this respect, to treat systems with many parameters one can easily combine our optimization strategy, based on fidelity statistics, with metaheuristic strategies [55] which simultaneously deals with many candidate solutions and are known to be fast in global optimization with high-dimensional parameter spaces.
Moreover, highly optimized deep learning algorithms are already used to train neural networks with 60 millions of parameters [56].However, given the difficulty in numerically simulating large quantum systems, this approach may be reasonable for networks up to, say, 20-30 qubits.

DISCUSSION
Inspired by classical supervised learning, we have proposed an optimization scheme to encode a quantum operation into the unmodulated dynamics of a qubit register, which is part of a bigger network of pairwise interacting qubits.Our strategy is based on the static engineering of the pairwise couplings, and enables the creation of a quantum device which implements the desired operation by simply waiting for the natural dynamics to occur, without the need of external control pulses.Our findings show that machine learning inspired techniques can be combined with quantum mechanics not only for data classification speed-up [25,26] or quantum black-box certification [57,58], but also for quantum hardware design.
This paper opens up the topic of encoding quantum gates and operations into the unmodulated dynamics of qubit networks.Although we have focused on small systems, larger networks can be considered using more efficient training schemes.These would enable the simulation of larger components of a quantum algorithm, since different multi-qubit gates can be combined into a unique quantum operation which can be simulated in a large quantum network.Moreover, when combined with a quantum bus as in Fig. 1, our strategy can provide an alternative approach to universal quantum computation which avoids the decomposition of the algorithm into one-and two-qubit gates.Note that most quantum algorithms take classical inputs so the extra control required for initialization demands the further ability to fully polarise globally the spins.The latter step is however typically much easier than the implementation of entangling gates, which has been considered in this paper.Moreover, in view of the recent experimental measures of the average gate fidelity [59], it is tempting to predict an all-quantum version of our learning procedure where F is not classically simulated, but rather directly measured.This would require a further highly controlled system to infer the optimal parameters of an uncontrolled quantum network, which can be used to industrialize the production of unmodulated quantum devices implementing the desired algorithm.
Our results demonstrate the efficacy of the proposed scheme in designing four qubit networks which implement the Toffoli and Fredkin gates or remote logic operations.The proposed Toffoli gate is fast, has high-fidelity for fault-tolerant computation, and only uses static XX-and ZZ-type interactions which can be achieved in superconducting systems [15].The key advantage of our method is in exploiting all the permanent interactions in the qubit network without trying to suppress some of them sequentially to implement pairwise gates.Moreover, being based on non-equilibrium dynamics, our gate is fast: if J/2π≈40MHz then the total operation time is around 60ns which matches the current gate times for single and two qubit operations [51].

Learning rate
The choice of the learning rate is crucial.If the initial learning rate is too small, it might not escape from the different "local maximum" points, while if it is too large it will continue to randomly jump without even seeing the local maxima.To maximize the speed and precision of SDG the learning rate has to decrease as a function of the steps, a common choice being ∝m −1/2 where m is the step counter [37].However, when the gradient in Eq.( 4) cannot be performed analytically, one can use more sophisticated techniques [60] where both the learning rate and the finite difference approximation of the gradient change as a function of m.

Symmetries
In the design of the quantum network and its couplings the number of parameters can be drastically reduced if the target unitary operation U Q has some symmetries, namely if there exists some unitary ma- Q for each state ρ, e.g.[H, S Q ⊗1 1 A ]=0. Conversely, if the interaction type is fixed by nature (for instance, only Ising or Heisenberg interactions are allowed), then one has to check whether the Lie algebra spanned by the operators in H contains the generators of U Q .

Bottom-up construction: Lie algebraic characterization
All the numerical results presented in the main text are obtained using a top-down approach: after selecting the interaction types (e.g.XX, ZZ, Heisenberg etc.), the algorithm starts with a zero-bias fully connected configuration where all the qubit pairs of the network interacts with all possible interactions, each weighted with a different parameter, and different local fields.As a result of the training procedure, we found numerically that most of these parameters are indeed zero.However, for larger networks it is better to use a bottom-up approach where one starts with a minimal set of parameters, and then adds other parameters until a solution is found.
To construct a minimal set of parameters one can use a Lie algebraic characterization inspired by quantum control.We write the Hamiltonian as H= j λ j O j , where λ j are the independent parameters and O j the operators.If the parameters are time dependent, then there exist suitable pulses λ j (t) such that the dynamics implements the target gate G only if log(G) is contained in the algebra generated by the repeated commutators [O j , [O k , . . .]].Since our scheme is based on the particular choice where λ j (t) is constant, the above characterization still provides a necessary condition.As an example, we consider the Toffoli gate and the solution Eq.( 5 It is simple to check that log G (up to an irrelevant constant factor) is contained in the algebra generated by the operators O j , while this is not the case if the operator O 8 is removed from the Hamiltonian.Therefore, no solution is possible if λ 8 ≡0.Inspired by the above example the bottom-up approach consists in the following steps: i) based on the symmetries of the target gate and on the physically allowed interactions one defines an initial set of operators; ii) other operators are added to the set until the dynamical algebra contains log(G); iii) one starts the numerical parameter training to check for convergence (different runs may be required).Until the solution is found one then either adds new operators, or change the previous ones.

FIG. 3 .
FIG.3.Network implementing the Toffoli gate.The gate acts on the three external qubits (the top ones being the control qubits, and the bottom one being the target), and has an additional auxiliary qubit in the center.
where {|A n } form a basis of the ancillae Hilbert space and, e.g., U Q =U Q , then the target operation is implemented when A is initialized in |A 1 .Our method is particularly useful for implementing quantum gates which requires k-body interactions (k>2), such as the Toffoli arXiv:1509.04298v2[quant-ph] 20 Jul 2016 FIG.2.Average fidelity F and fidelity F ψ for some random states ψ for implementing the Toffoli gate in a 4 qubit network (see discussion in the text).All the parameters are set to the optimal ones, except J xx 35 in the abscissa.The region around the only global peak is filled in green.