Hamiltonian Switching Control of Noisy Bipartite Qubit Systems

We develop a Hamiltonian switching ansatz for bipartite control that is inspired by the Quantum Approximate Optimization Algorithm (QAOA), to mitigate environmental noise on qubits. We illustrate the approach with application to the protection of quantum gates performed on i) a central spin qubit coupling to bath spins through isotropic Heisenberg interactions, ii) superconducting transmon qubits coupling to environmental two-level-systems (TLS) through dipole-dipole interactions, and iii) qubits coupled to both TLS and a Lindblad bath. The control field is classical and acts only on the system qubits. We use reinforcement learning with policy gradient (PG) to optimize the Hamiltonian switching control protocols, using a fidelity objective defined with respect to specific target quantum gates. We use this approach to demonstrate effective suppression of both coherent and dissipative noise, with numerical studies achieving target gate implementations with fidelities over 0.9999 (four nines) in the majority of our test cases and showing improvement beyond this to values of 0.999999999 (nine nines) upon a subsequent optimization by Gradient Ascent Pulse Engineering (GRAPE). We analyze how the control depth, total evolution time, number of environmental TLS, and choice of optimization method affect the fidelity achieved by the optimal protocols and reveal some critical behaviors of bipartite control of quantum gates.


I. INTRODUCTION
Quantum computation has a number of promising potential applications.However, currently available noisy intermediate scale quantum (NISQ) devices suffer from various sources of noise, which limit their performance [1,2].Error mitigation methods are needed to improve the fidelity of quantum circuits in order to obtain meaningful results from the computations.To generate unitary controls that mitigate against qubit noise due to unwanted interactions with external qubit or spin systems, we introduce here a Hamiltonian switching technique inspired by the Quantum Approximate Optimization Algorithm (QAOA).First studied in the context of the combinatorial optimization problems [3], QAOA employs a set of piece-wise constant Hamiltonians to parameterize quantum circuits with a relatively small set of parameters.The QAOA methodology has also received interest as an ansatz for quantum control and error mitigation.Several recent works have investigated robust control under classical noise using QAOA with reinforcement learning [4,5], sequential convex programming (SCP) [6,7] and policy gradient (PG) [8][9][10].These methods were shown to outperform prevalent gradient-based control algorithms for the majority of test-cases on both a single qubit and a coupled spin chain having classical Hamiltonian uncertainties, suggesting an intrinsic robustness of QAOA-based controls.
A typical control Hamiltonian H c (t) is dependent on a set of control variables {v j (t), j = 1 . . ., m}, where often H c (t) is linear in these variables: H c (t) = m j=1 v j (t)H j .In our Hamiltonian switching ansatz, the operational time of the gate is divided into m variable length intervals that we refer to as "hold times" and H c (t) is held constant during each hold time at one of the m Hamiltonians in a predefined set, {H j , j = 1 . . ., m}.During each hold time only one control is active and is set to its maximum value; the remaining controls are set to zero.
In this work we apply the Hamiltonian switching ansatz to control of the central spin (CS) model.Sometimes referred to as the spin star model, the CS model is relevant to various types of solid-state quantum devices [11][12][13].Extensive work has been done on different aspects of CS models for quantum information processing, such as reduced spin dynamics [12,[14][15][16], coherence times [17][18][19] and bipartite control [13,[20][21][22][23].In the CS model, the central spin, which can be used as a qubit for quantum computation, is coupled to a collection of bath spins through isotropic [24] or dipole-dipole [25] Heisenberg spin-spin interactions.The CS model is also relevant to coherent noise in superconducting transmon qubits.In these devices, multiple two-level-systems (TLS) couple coherently to the qubit through dipole-dipole Heisenberg couplings due to the defects introduced by device fabrication [26].The Hamiltonian then takes the same form as a CS model with dipole-dipole couplings.The transmon qubit has been one of the most promising candidates for near-term applications and has been notably used for Google's quantum supremacy experiment [27].The energy splittings, coupling strengths, and mechanism of TLS coupling have been experimentally characterized in several works [28][29][30].Bipartite control of a single transmon qudit coupled to both a TLS bath and a Lindblad bath, which provides a more realistic model for real physical devices, has also been studied [31].
Despite this activity, relatively little work has been done on controlling central spin systems to implement target gates with sufficiently high fidelity for fault-tolerant quantum computation.Specifically, it is highly desirable to implement elementary quantum gates with fidelity higher than the thresholds of practically relevant quantum error correction codes.Since the error thresholds for non-local concatenation codes and practical surface codes are of order 10 −4 [32][33][34], a gate fidelity higher than 1 − 10 −4 = 0.9999 (we refer to this as "four nines") is a reasonable target for successful control of quantum computers.In this work, we will test the performance of bipartite Hamiltonian switching control on CS systems under the effect of coupling to both a spin bath (TLS bath) and a Lindblad bath, for the implementation of high-quality quantum logic gates with fidelity higher than 1 − 10 −4 .The PG algorithms will be used for the classical optimization of the control ansatz.
Our results show that the bipartite Hamiltonian switching control can readily implement single qubit gates on a qubit isotropically coupled to bath spins with fidelity over six nines, and single and two qubit gates on qubits coupled to TLS through dipole-dipole couplings with fidelity over four nines.The fidelity of single qubit gates with dipole-dipole coupled TLS can be further improved to nine nines by adding a secondary optimization using GRadient Ascent Pulse Engineering (GRAPE [35]).For systems with a secondary Lindblad bath, the fidelity achieved lies generally between two to four nines.We also reveal the trends of fidelity dependence on total time, control depth and the number of bath spins/TLS.The fidelity of different gates on the same system have similar fidelity level and control properties.
The remainder of the paper is structured as follows.We will first introduce our physical models in Sec.II, followed by presentation of the bipartite Hamiltonian switching control ansatz and secondary optimization by GRAPE in Sec.III.We then present the fidelity measure and the classical algorithms used for optimization in Sec.IV.Numerical results and analysis are presented in Sec.V and the features of the results discussed in Sec.VI.We then discuss the fidelity differences for different test cases and present possible improvements in Sec.VI.Sec.VII concludes with a summary and outlook.

II. PHYSICAL MODELS
We set = 1 throughout this work.σ i q , i ∈ {z, y, z, +, −} are Pauli operators.The number of bath spins/TLS is n.We study two types of central spin (CS) models with different types of practically relevant couplings to the bath spins.We also consider additional Lindblad decoherence due to a secondary bath acting on both the qubits and the primary bath of spins.A general Hamiltonian for the controlled dynamics is where H S and H env describes the intrinsic dynamics of the system (qubits) and primary bath (bath spins/ TLS) respectively, and H I describes the coupling between system and primary spin bath.These terms are all timeindependent.H c (t) describes the time-dependent control applied to the system qubits, which will be discussed in detail in the next section.
We study the control problem on single and two-qubit systems.The system Hamiltonian H S for the one-qubit system is just its energy splitting For the 2-qubit system, H S contains an extra coupling term between the two qubits to enable implementation of 2-qubit gates: Note that neither H 1qubit S nor H 2qubit S allow implementation of arbitrary 1-qubit or 2-qubit quantum gates, respectively.This capability will be added by the control Hamiltonians H c (t).Note that the enumeration of qubits is different in the 1-qubit and 2-qubit systems.For the 1-qubit system, the system qubit is indexed as 0 and the bath spins start from index 1.For the 2-qubit system, the system qubits are indexed as 0 and 1 and the bath spin index starts at 2.

A. Isotropic Couplings
In the model with an isotropic Heisenberg interaction, all of the environmental spins couple to the central spin through a σ x σ x + σ y σ y + σ z σ z type of interaction.The coupling Hamiltonian is then Using the parameters of [13], we set the energy splitting of the system qubit to be E = 1.The coupling strengths are set to be A q = 1 when they are all equal, and to be uniformly distributed between 1 and 2 (A q ∼ U[1, 2]) when they are not equal.The energy unit is chosen to be arbitrary for simplicity and generality.Note that the coupling strength chosen for this model is very strong compared to that used in the more physically-relevant model in the next subsection.

B. Dipole-dipole Couplings
In this model, environmental TLS are coupled to the system through a σ + σ − + σ − σ + ≡ 1/2(σ x σ x + σ y σ y ) type dipole-dipole Heisenberg interaction.This model is relevant to decoherence in superconducting transmon qubits, one important component of which is caused by the qubit coupling to TLS that are associated with device defects [26].Among several possible mechanisms for qubit-TLS coupling, we focus on one that is induced by charge fluctuations, resulting in a dipole-dipole coupling.The interaction Hamiltonian takes the form and the TLS energy splittings are For calculations with this model we use a set of experimentally relevant parameters.The TLS energy splittings ∆ q have a similar magnitude as the qubit energy splitting E (i.e., ∆ q ≈ E), and the coupling strength A q is normally 2 to 3 orders of magnitude smaller [28][29][30].The coupling constants in real devices are usually not equal, so we focus here on the variable coupling case.We use E = 8 GHz, ∆ q = 8 + 0.8q GHz, and A q having a variable value uniformly distributed in the range 4 − 40 MHz [28][29][30].The system energy splitting E is equivalent to an angular frequency ω = 8 × 2π • 10 9 rad • s −1 .To compare with the unit-less convention used in the isotropic model in the previous subsection, this angular frequency is normalized to be 1 and consequently the unit time in our simulation is 1 16π ns.In the two-qubit system with dipolar coupling to TLS, the bath and interaction Hamiltonians take the form Here the index i enumerates the system qubits and n i is the number of TLS coupling to the system qubit i.We set E 0 = 8.0 GHz and E 1 = 8.4 GHz.All other parameter strengths are the same as for the single qubit.
Since the classical simulation cost scales exponentially with system size, the largest system simulated here is of six bath spins/TLS.However, as shown in Sec.II C, within the time-frame of our simulations and in the absence of control, several bath TLS can effectively represent a larger and even infinite spin bath.Fig. 1b shows that the dynamics of a single qubit coupled to a different finite number of TLS or an infinite TLS bath have very good agreement up to 2 ns, which is beyond the maximal time of most simulations in this work.

C. Reduced Dynamics of Different Bath Sizes
The dynamics of central spin systems with specific system Hamiltonians have been solved analytically in [12] for dipoledipole couplings and in [14] for isotropic couplings.These solutions cannot be directly applied to our simulations as they require conservation of the z-component of total angular momentum, which is not the case in our control ansatz.However, we can utilize these solutions in the absence of control to compare the dynamics of our simulated smaller systems with larger systems and even an infinite spin bath.
The dynamics of central spin systems of different sizes with no control fields are plotted in Fig. 1.The initial state of the qubit is |0 , and the initial state of the bath is an infinite temperature mixed state for both plots.Panel (a) shows that the dynamics of systems with less than 10 bath spins agree well only within t = 0.02.However, as will be presented in the next section, the typical timescale of a working control protocol for the isotropic coupling is well above 1, which means that the simulated central spin systems cannot represent a larger bath.
Panel (b) shows that, for a superconducting qubit coupled to TLS through dipole-dipole couplings, the dynamics agree well up to 2 ns for different number of TLS, even for a infinite number of TLS.In comparison, the protocols in this work typically take less than 0.2 ns, which is well below this timescale.Therefore, the optimized protocols for smaller dipolar TLS coupled systems should be applicable to a larger or even infinite TLS bath.

D. Secondary Bath
We refer to the finite number of environmental spins as the primary bath.To better simulate real physical systems, in some calculations we further also consider a secondary bath, described by Lindblad dynamics, that acts on both the system qubits and the environmental spins (TLS).For this we choose a model modified from that in [31], which is a superconducting device coupled to TLS with dipole-dipole coupling under the effect of spontaneous emission (T 1 decay).This model is an extension to our model in Sec.II B. The overall dynamics for this model can be described by Here the Lindblad operators for spontaneous emission are L 0 = 1/ T S 1 σ − 0 for the system and L q = 1/ T dipole 1 σ − q for each of the TLS, where T S 1 and T dipole 1 are the T 1 time of the qubit and TLS respectively.

III. BIPARTITE CONTROL WITH HAMILTONIAN SWITCHING
The idea of QAOA is to switch between two time-constant Hamiltonians according to an ansatz designed for a specific computational task [3].The QAOA approach is naturally related to bang-bang control when used as a method for control pulse parameterization.In the current implementation of the Hamiltonian switching method, we also employ two control Hamiltonians H A and H B .The parameters are then the time duration over which each piece-wise constant Hamiltonian is applied.In the i-th round out of p total rounds, we denote the time applying H A to be α i and the time applying H B to be β i .p is called the control depth,i.e. the number of switching times is 2p and it is the total number of parameters.The control sequence θ ≡ {α i , β i } p i=1 is then optimized classically.The unitary evolution of the full system can then be written as with the total duration of the controls given by T = p i=1 (α i + β i ).We define a fidelity measure F (θ) in the next section that serves as the performance merit of the control.We then use classical optimization methods to find the optimal control sequence θ * , defined as The classical optimizer employed in this work is reinforcement learning with policy gradient (PG), which will be introduced in Sec.IV B 1.

A. Control Ansatz
The goal of the Hamiltonian switching control in this work is to implement arbitrary quantum logic gates on the system qubits, which requires that the control ansatz be universal on the logical subspace.Thus, the alternating terms of the Hamiltonian switching ansatz should be able to generate arbitrary unitary transformations on the system Hilbert space in the absence of coupling to the environment.

Single-qubit
For single-qubit control, the ansatz we choose is derived from an experimentally relevant form of the Landau-Zener Hamiltonian [36,37].We apply a piece-wise constant control pulse with constant strength and alternating direction in the form of σ x on the system qubit, with an always-on system σ z term representing the system energy splitting [4].
The ansatz is then expanded by turning on coupling to environmental degrees of freedom as described in the previous section.The control is only on the system part, which makes the control problem bipartite.
For isotropic coupling, we then evolve the system under the following two piece-wise constant Hamiltonians: For the system with dipolar coupling to TLS, the corresponding piece-wise constant Hamiltonians are To further improve the fidelity for this model, we considered application of a 4-Hamiltonian switching scheme by adding a σ y control term, as detailed in Appendix C. The combination of alternating signs of σ y and σ y control terms then gives 4 switching Hamiltonians.We also further tested a secondary optimization with GRadient Ascent Pulse Engineering (GRAPE) [35] on the optimization results of the 2-Hamiltonian switching control.With this additional secondary optimization, the unitary evolution operator becomes where and H c = 2Eσ x 0 , the time-duration protocol θ ≡ {α i , β i } p i=1 is the optimized result for Hamiltonian switching, and the piecewise-constant pulse-strength protocol c ≡ {c ai , c bi } p i=1 is optimized using GRAPE.The strengths c are initialized as alternating ±1, which are the strengths in the Hamiltonian switching protocol.
We also tested a model that is a single-qubit analog of the 4-level qudit model in [31] by changing the control term to ±Eσ z 0 in Eq. 12, resulting in the following switching Hamiltonians Without the TLS bath this Hamiltonian can only generate Z-rotations and is thus not universal in SU(2).However, as noted in [31], the dipole-dipole coupling between the 4-level qudit and TLS introduces transversal terms to the Hamiltonian and thereby changes the algebraic structure of this ansatz, enabling it to generate transformations in a larger subspace of the corresponding unitary group.It is expected that the same argument might also hold for the model of Eq. 14, since the Lie algebra generated by the σ z terms in Eq. 14 and the dipolar coupling terms has higher rank than the trivial Lie algebra generated by the drift and control term in Eq. 14 alone.Therefore, the effect of Hamiltonian switching with this non-universal ansatz Eq. 14 will also be tested.

Two-qubits
For a universal ansatz on the SU(4) group for two-qubit gates, the control ansatz we use is based on that proposed in [38].The idea is to alternate 2-local σ z σ z terms and single-qubit σ x terms.For a control ansatz, we treat the σ z terms as the drift part and alternate the sign of σ x terms, which will not change the generated Lie algebra.This results in the following QAOA Hamiltonians with H dipole-2qubit env and H dipole-2qubit I defined in Eq. 7. We focus on the dipole-dipole coupled TLS for two qubit controls.We have set E 0 = E 1 here since this is required for the ansatz to be universal according to [39].The σ z terms resemble the Hamiltonian of a CPHASE gate, practically relevant to superconducting devices.[40] We note that for three or more qubits, this ansatz is only universal for an odd number of qubits [39], due to the symmetry of the coupling constants when the number of qubits is even.However, this is not true when there are only two qubits, since there is only one qubit-qubit coupling parameter, and the two-qubit ansatz is actually universal in this special case.A detailed proof is given in Appendix A. This is also validated by our numerical experiments, where we find that a fidelity of seven nines can be achieved by this control ansatz for 2 qubits alone, i.e., in the absence of coupling to TLS.

Unitary Fidelity
An intuitive fidelity measure is the overlap between the final state, as the result of control, and the target state.However, the states of the bath spins or TLS are not of interest, so a fidelity measure assuming an optimal bath condition has been proposed in [22,23,41].
Ref. [22] first defines a distance between the unitary evolution in Eq. 9 and the tensor product between the target gate on the qubits W and an arbitrary unitary Φ on the bath spins by taking the Frobenius norm of the difference matrix.Assuming that the optimal unitary factorizes, this yields The optimal control will minimize this distance.However, the choice of the bath unitary Φ will still affect the distance D(θ).To eliminate this bath dependence, another fidelity measure F (θ) w.r.t optimal Φ is defined [22], which for a single qubit or two qubits interacting with the bath spins is min Here N B = 2 n is the total number of degrees of freedom of the bath, and N = 2 n+1 or N = 2 n+2 is the total number of degrees of freedom of the system and bath.This optimization can be done analytically [22] to obtain an optimal bath unitary Φ that is characterized by fidelity where In this work we classically optimize the fidelity measure in Eq. 18 to obtain high-fidelity gate implementations.
Th fidelity of Eq. 18 is state-independent, with the target being a system unitary.Eq. 19 presents the target unitary gate matrices W which we use here for benchmarking the bipartite control method with different physical systems.Together these generate the Clifford + T universal set of gates [42].

Average State Fidelity
While the fidelity measure from Eq. 18 is state-independent, it is often practically relevant to check how the controlled final state and the target state overlap for a given gate implementation.For this purpose, we checked the optimal protocols obtained from optimization using a state fidelity defined as the average over M initial states sampled randomly and uniformly, i.e.
The time-evolved reduced density matrix at time T is defined as where |ψ im = |m S ⊗ |m B , with |m S and |m B being Haar-random states of the system and the bath respectively, and |ψ T = W |m S is the target state.The Haar-random states are generated using the Python software qutip [43].
3. Fidelity with respect to a set of reference states In the case of Lindblad evolution, the unitary fidelity of Eq. 18 is not applicable, as the Lindblad evolution provides a quantum channel instead of a unitary over the qubits and coupled spins that constitute the primary bath.Instead, we use the fidelity measure proposed in [44] for optimizations with Lindblad dynamics.This fidelity is the average of the Hilbert-Schmidt product between the target state and the evolved density matrix with respect to a set of reference states [2,44], Here d + 1 is the number of reference states in the set, ρ i is the i-th reference state, w i is a weight for each reference state with i w i = 1 and is the quantum channel governing the evolution.L[•] is the Lindblad evolution of Eq. 8 for the qubits and primary TLS bath.
Following [44], for efficiency and accuracy we choose d = 2 for a single qubit and d = 4 for two qubits, corresponding to the dimension of the system Hilbert space in each case.The reference states are

Optimization Algorithms
Optimization of the bipartite control problem is a numerically challenging task and requires careful design of the optimization algorithm [13,23].In this work, we employ reinforcement learning with policy gradient (PG), which have been shown to be effective for optimizing QAOA protocols on systems with classical noise.[8][9][10].We also applied the sequential convex programming (SCP) method of [6,7] which showed outcomes similar to those obtained with PG.To keep the focus on the Hamiltonian switching protocol rather than on the algorithmic implementations, we present only the PG results here.
The PG method used in this work was developed in [8][9][10].The key idea is to treat the values each parameter as a probability distribution and to then optimize over the mean and standard deviation of the distribution, instead of over the parameter themselves.This has the advantage of not requiring any information about the derivatives of the fidelity function.The final result is expected to converge to a delta distribution with the mean value being the optimal value of the parameter [8].The original PG method developed in [8] has the disadvantages of unbounded protocol durations and possibility of negative time intervals, which limits its application to Hamiltonian switching control.These issues were fixed in subsequent work [9,10] and we use here the improved versions of the PG methods from Refs.[9,10].
Although we can set constraints on the time duration of the protocols and avoid the occurrence of negative entries (i.e., non-physical negative time intervals), small negative values are nevertheless still observed in optimizations.This issue is resolved by taking the absolute value of the negative entries in the protocol when evaluating the fidelity.The number of PG iterations is set to 2000 to ensure convergence (see Sec. IV B 3).All simulations are carried out with several optimizations running in parallel.To achieve the best result within a reasonable simulation time, each simulation is run 3 to 5 times with different initial interval sets.In all cases we show the best results from all of the parallel simulations.
When the accuracy reached with PG optimization of Hamiltonian switching is not sufficient, we conduct a secondary optimization using the GRAPE method [35] on the outcomes of Hamiltonian switching control.Instead of optimizing the hold times as in the Hamiltonian switching control, we now optimize the amplitude of each control pulse in GRAPE with their time durations fixed at the values obtained from the Hamiltonian switching optimization.The numerical optimization in GRAPE is carried out using gradient-based methods.

Numerical Details
The unitary dynamics are implemented using NumPy [45].The unitary evolution operator Eq. 9 is generated by directly multiplying −iH A and −iH B in computational basis with time durations α i , β i , exponentiating the resultant matrix, then multiplying all 2p matrices together.Simulation of Lindblad dynamics is carried out with the superoperator approach implemented using NumPy [45] for three or less total number of spins and TLS (system plus primary bath), and by numerical integration of the ordinary differential equation implemented with qutip [43] for larger models.All of the Pauli operators in the computational basis are generated using Python package quspin [46].
The GRAPE optimizations are done using qutip [43] with modifications.The gradient of fidelity measure Eq. 18 used in GRAPE optimization is given in [47].The optimization method is the BFGS algorithm implemented by scipy [48].The control amplitudes are constrained to lie within the range [−1.2, 1.2], while the control amplitudes in Hamiltonian switching control are held at ±1.In all of the plots shown in this work, the fidelity is presented as minus log infidelity (MLI), i.e., the vertical axis of the displayed plots This allows the fidelity differences between different simulations to be better assessed, since most of the fidelities are close to 1.The integer part of the MLI gives the number of nines in the actual fidelity.
In numerical experiments for a certain physical model, we focus on characterizing the change of the fidelity with the control depth p and the total evolution time T .The control depth p corresponds to the number of parameters for the circuit parameterization: larger p gives added flexibility to the protocol, which is expected to give more powerful protocols and thus higher fidelity.However, larger control depth adds to the effort of optimization and is experimentally harder to implement.It is also desirable for the total evolution time T to be short for fast gate implementation.However, for an ansatz with fixed control strength there is a theoretical lower bound for the required gate time [4,37].Since any protocol with shorter gate time would give lower fidelity, we therefore simultaneously probe the effect of both p and T on the fidelity of the Hamiltonian switching control, and look for low-depth and short-time protocols that give fidelity values larger than 0.9999, corresponding to infidelities, i.e., gate errors, below the threshold of most contemporary quantum error correction codes.[32][33][34]

Trial Simulations
To find the number of iterations required to achieve optimal fidelity with reasonable resources in a PG optimization, a series of test optimizations were first carried out.Fig. 2a shows the MLI dependence on the number of PG iterations for a Z gate on a single qubit isotropically coupled (see Eq. 4) to n environmental spins.We find that 2000 iterations are enough for the optimizer to converge.The vertical axis here is the best fidelity reached in any single run.The uncertainties are due to averaging over several (3 or 5) simulations with different initial protocols.It is evident that the fidelity is not significantly improving after 1000 iterations, so 2000 is enough to exploit the power of the optimizer.The fidelity change over the number of iterations for other simulations are also checked and show a similar trend, confirming that 2000 iterations is a valid choice.
We also compare with the fidelity for evolution without any control.Fig. 2b) shows the MLI as a function of the control protocol time T for a Z gate on a single qubit isotropically coupled to n = 2 bath spins under evolution with (green curve)or without (orange curve) Hamiltonian switching.This comparison is made with a state evolved with the same number of bath spins under the Hamiltonian that directly produces the unitary within the total duration of the protocol T .For example, for the target gate Z, the system part of the Hamiltonian is H s = − π 2T σ z , which gives exp(−iH s T ) = σ z up to phase.Then the unitary under decoherence due to the primary bath is given by U n = exp(−i(H s + H I )T ), and the fidelity under this evolution is given by the fidelity measure in Eq. 18.In the absence of coupling to the bath (H I = 0), both of these evolutions would give unit fidelity.However, it is evident from Fig. 2b) that the fidelity is significantly lower in the presence of coupling to the bath.Implementing the Hamiltonian switching bipartite control leads to a considerable improvement in fidelity, showing the effectiveness of the Hamiltonian switching bipartite control.the optimization method used is PG.The fidelities of the orange points without Hamiltonian switching are calculated with the same total duration of the corresponding control protocol and would be 1 if there were no decoherence due to coupling to the primary bath of spins.
V. RESULTS

Isotropic coupling
We first study control of the isotropically coupled central spin system with all the coupling constants set equal to A = 1.We start with the target gate Z.The optimization results for n = 2, 3 bath spins are displayed in Fig. 3.In all of the test-cases, the highest fidelity reached is above 1 − 10 −6 , given sufficient control depth p and evolution time T .A notable feature is that when the protocol depth p is below a certain threshold value, the fidelity does not change significantly with T .For instance, in Fig. 3a, the fidelity has no significant change with T when p < 20, but for p ≥ 20, it increases drastically when T changes from 10 to 20, displaying the phase-transition behavior observed in [4].We refer to the minimal depth required for significant fidelity improvement with time as the critical depth p * .Beyond the critical depth p * , the fidelity generally first increases with total evolution time T and then reaches a plateau.We refer to the transition time between the increasing and plateau regions for given number of spins n as the critical time T * .Panel (a) for n = 2 shows that in the plateau region, the fidelity may not improve much, as the depth p further increases.To better reveal the fidelity dependence on protocol depth p, Fig. 3c shows the fidelity plotted as a function of p, for fixed time T .For n = 2 we see a significant improvement in fidelity as p increases to 20, and we can infer that p * = 20.For n = 3 the corresponding jump is not so drastic, but we can still see the appearance of a critical depth at p * = 32.In general, the fidelity changes with time and with control depth display similar behaviors, with both increasing to a plateau value.The critical points represent the onset of plateau for each parameter.We note that only when one parameter is located beyond its critical value, can the other parameter show this pattern of increase to a plateau value.In all other situations the fidelity is restricted to low values.
In these calculations the optimization was carried out with the unitary fidelity of Eq. 18.The corresponding state fidelities of Eq. 20 are also plotted in Fig. 3 The fidelity dependence on time T for the Hadamard gate and T gate targets are plotted in Fig. 4a and 4b .These show similar trends to the results with the Z gate in Fig. 3.The fidelities reached for each of these target gates are of similar magnitude at sufficiently large T and p, with more than six nines in most cases.The critical depths and critical times are about p * = 20 and T * = 20, which are the same as the Z gate.Thus, we can conclude that the control properties for different 1-qubit target unitaries are similar.
The results for the isotropic coupling model with equal coupling constants, i.e., all A q = 1, are summarized in Table I.Note that the results for n = 1, 4 are not plotted but the patterns are similar to those found in Figs. 3 and 4.
While not exact, the critical value assignments in Table I already show rich features of the control.A general trend with increasing bath spin count n is that the critical time T * and critical depth p * increase, while the highest fidelity drops.This trend is reasonable, since an increased bath size increases the noise strength and adds to the difficulty of the control task.This result is consistent with the reduced dynamics shown in Fig. 1a in the absence of the control Hamiltonian, in which the dynamics of systems with different bath spin count behave very differently within the timescale of the protocols.As shown in [13], the controllability is rather different when the coupling constants between the system and bath spins A q vary with q.Specifically, when the coupling constants are different, the bath spins of the central spin model with isotropic couplings become controllable through bipartite control.However, the additional controllable degree of freedom adds difficulty to the control problem, and was found in [13] to result in lower fidelity than the equal coupling case.Fig. 4c shows the result of applying Hamiltonian switching on a system with the same range of coupling strengths as that in [13], which is uniformly distributed between 1 and 2. We can see from the plots that the difficulty of control is significantly greater when the couplings are different.The critical depth for 2 qubits increases to 40 or 50.In the case of n = 2, p = 50, we see the typical behavior of an initial increase in the MLI, and hence the fidelity, which is followed by a plateau above a critical depth p * .Note that the critical time is still around 20, which is the same as the case of n = 2 for equal couplings in Fig. 3a.Changing to the variable coupling strengths A q increases the critical depth but appears to keep the critical time T * the same.Notably, the fidelity above critical time and depth can still reach six nines.

Dipole-dipole Coupling -TLS bath
Here we apply bipartite Hamiltonian switching control to a single qubit coupled to TLS through dipole-dipole couplings as described in Eq. 5.In this model we focus on the variable coupling case (A q sampled uniformly on [4,40] MHz) for practical relevance, since in superconducting qubits the coupling strengths between the qubit and individual TLS are generally variable [28][29][30].The results of fidelity dependence on time with PG optimization are shown in Fig. 5a, 5b for n = 2, 3 bath spins.Notice that the horizontal axis is now in units of nanoseconds.One time unit in these simulations, corresponding to the time unit in the isotropic model of Sec.V A 1 above, is now 1 16π ≈ 0.02 ns.The fidelity dependence on T for n = 1, 4, 5 is also simulated and shows very similar behavior.Trial simulations with all coupling constants equal to 40MHz yield results very similar those shown in Fig. 5.
The fidelity dependence on T and p for all simulations are rather similar.The critical time for all the Z gate simulations is T * = 4 16π ns ≈ 0.08 ns (4 time units), which is significantly shorter than the corresponding value for the isotropically coupled model in the previous section.The critical depth is also much lower than for the central spin model with isotropic couplings, with all simulations for n = 2 − 5 displaying the pattern of an increase to a plateau value for p = 20 that does not change significantly for larger p.Additional simulations suggest that the critical depth for all n = 2 − 5 test cases with target gate Z have critical depth p * = 5.The significant decrease of critical time and critical depth seen relative to the values for the isotropically coupled model is likely the result of a much weaker coupling strength compared to that used for the calculations with the central spin model and isotropic couplings in Sec.V A. This is confirmed by trial simulations carried out with dipole-dipole coupled qubits having the same coupling strengths as those employed in the isotropic model (i.e., of the same order of magnitude as the system energy splitting).These simulations now give similar T * and p * values to those found for the isotropically coupled model.
The results for Hadamard and T gates are shown in Fig. 5d.The critical time of the Hadamard gate is T * = 2 16π ns ≈ 0.04 ns (2 time units) and of the T gate is T * = 3 16π ns ≈ 0.06 ns (3 time units), which are both shorter than the Z gate.The critical depths are also lower.The highest fidelity achieved is also around four nines.In general, the control properties of different target gates are quite similar, but the Hadamard and T gates are expected to be easier to implement because the critical depths are lower and the critical times are shorter compared to the Z gate.
In general, all of the curves for the TLS coupling model show a rather similar pattern, with a short critical time T * and a low critical depth p * , and with final gate fidelity limited at around four nines.The results are summarized in  feature of the reduced dynamics of the control-free system shown in Fig. 1b, namely, that the dynamics of a single qubit coupled to different number of TLS appear almost identical within the timescale of the simulations.
We note that the state fidelity of the protocols for the TLS model is somewhat higher than the gate fidelity.The standard deviation of the state fidelity is also larger than that for the isotropic coupling model, but are still generally small, indicating weak fidelity dependence on initial states.
It is apparent that for qubits with dipolar coupling to the primary bath spins, Hamiltonian switching alone does not always reliably increase the fidelity significantly above the desired fidelity.To further improve the fidelity, we applied GRAPE to undertake a secondary optimization of the piecewise constant control amplitudes with the duration of each piece fixed to the optimal protocol derived from the optimal Hamiltonian switching control.This was carried out on the results for n = 2 bath spins with T = 20, 30, 40, 50, 60 time units (approximately 0.4, 0.6, 0.8, 1.0 and 1.2 ns) and p = 20 that are presented in Fig. 5a.The MLI after PG optimization are 2.83, 3.56, 4.24, 5.08 and 5.14.
After GRAPE optimization, the MLI are improved to 7.65, 8.16, 8.44, 9.48 and 8.45 respectively.These values are now well above our target of four nines.

Dipolar CS bath and Lindblad bath
We also studied the effect of T 1 decay on both the qubit and TLS, as described in Eq. 8.The decay rates of the qubit and all TLS are set to be equal.Results are shown in Fig. 6 for a target T gate on a single qubit, with zero TLS (panel (a)) and with n = 3 TLS (panel (b)).Simulation costs restricted the PG iterations to 250 in the latter case, but the fidelities were well converged at this point.Calculations for other gates show similar performance.The fidelity measure used here is given by Eq. 22.Note that this fidelity measure is defined on a set of reference states that effectively represents an average over all states in the qubit Hilbert space [44], so we do not additionally present an average state fidelity over Haar-random states.Each point is the best result of 3 or 5 parallel simulations with different protocol parameter initialization.The fidelity, Eq. 22, is plotted as MLI, Eq. 24.
Fig. 6a shows that spontaneous emission severely reduces the gate fidelity of an isolated qubit (n = 0), lowering this from a value above ten nines in the absence of both TLS and spontaneous emission, to a value of only three to four nines.The critical behavior with respect to time is still apparent but there is now no real plateau and instead the fidelity (MLI) shows a slow decay over duration of the protocol which is consistent with the dissipative nature of spontaneous emission.Fig. 6b shows that after adding the additional coupling to the TLS, the fidelity further drops, as expected because of the increased overall noise strength with coupling to both the TLS and Lindblad bath, but the critical time is not changed.

Non-universal Control
All results in the preceding sections are derived with the universal ansatz H S (t) = E • − 1 2 σ z ± 2σ x (Eq.12).As mentioned in Sec.III A, we have also tested the non-universal ansatz H Sz (t) = E • − 1 2 σ z ± 2σ z (Eq.14) with Hamiltonian switching.
We first analyzed the performance of this ansatz on implementation of a T gate.Since the gate itself is a Z-rotation, the ansatz is able to generate the gate with high fidelity, as shown in Fig. 7.In Fig. 7a, the results are shown for a T gate implemented by both the universal ansatz (Eq.12) and the non-universal ansatz (Eq.14) on an isolated qubit.The universal ansatz shows the increase to a plateau value seen in the previous sections, whereas the non-universal ansatz gives very a high fidelity (over ten nines) even below the critical time T * , and does not show a plateau behavior.The behavior of the universal ansatz is consistent with the theoretical time lower bound of [37] for this Hamiltonian.However, this bound does not apply to the non-universal control ansatz.Instead, the minimal time required for the non-universal ansatz to implement a Z-rotation gate can be readily calculated from the Hamiltonian strength and is lower than the time limit for the universal ansatz.Therefore, in Fig. 7a, the fidelity of the universal ansatz is very low when T is less than the critical time T * but the fidelity of the non-universal ansatz is still high, even at times shorter than T * .
After turning on the coupling to n > 0 TLS, the fidelity is still above six nines and is weakly dependent on TLS count, as shown in Fig. 7b.Compared to the similar case for the universal ansatz in Fig. 5, which is also plotted in Fig. 7b, with highest fidelity around four nines, the fidelity of non-universal control ansatz is still higher.After tuning on Lindblad T 1 decay (purple points in Fig. 7b), the fidelity drops to around two nines, which is now similar to the performance of universal ansatz in Fig. 6.Lindblad results for n = 0, 1 (not shown) are virtually identical to the result shown here for n = 2, indicating that the fidelity dependence on the number of TLS n is even weaker in the presence of T 1 decay.Each point is the best result of 3 parallel simulations with different initialization.The fidelity, Eq. 22, is plotted as MLI, Eq. 24.
In the case of the Hadamard gate target (not shown), the straight fidelity without T 1 decay is about 0.5 for any number n of TLS.After turning on the T 1 decay, the straight fidelity drops with the protocol duration T but generally stays above 0.4.The straight fidelity for the same protocol duration with different numbers of TLS is almost the same and is well below 0.9 (i.e. a MLI less than 1).
In general, the non-universal control shows better performance when applied to Z-rotation gates like the T gate.For these gates, the fidelity obtained with the non-universal control is higher than can be obtained with the universal control ansatz and the critical times are also shorter.However, when applied to other gates such as the Hadamard gate, the non-universal control ansatz is not effective and gives fidelities well below 0.9.We note that the fidelity achieved for the T gate here is higher than that obtained for quantum gates on a 4-level qudit similarly experiencing spontaneous decay while also undergoing dipolar interaction with n TLS spins [31].

B. Two Qubits
So far we have shown the results of bipartite Hamiltonian switching control on a single qubit.In this section we present the results of applying the method to two system qubits to implement the entangling CNOT gate.The two qubit model studied here is two superconducting qubits coupled to a primary bath of TLS, as described by Eq. 7, with or without a secondary Lindblad bath.The control ansatz is given in Eq. 15.
(a) 2 qubit, p = 30 (b) 2 qubit, T = 30 16π ns≈ 0.6 ns FIG.8: CNOT gate fidelity dependence on (a) total evolution time and (b) control depth for 2-qubit system coupled to n TLS and optimized with PG.The coupling constants are unequal and evenly distributed in the relevant strength of superconducting devices.Each point is the best result of 5 parallel simulations with different initialization.For each pair of points with the same color and T value, the solid line is the actual optimization result and the pale line with error bar is the average state fidelity over M = 100 Haar-random states.The fidelity, Eq. 18, is plotted as MLI, Eq. 24.
The results of 2-qubit control with only the primary TLS bath are plotted in Fig. 8. Results for the case with no TLS are also plotted for comparison.The 2-qubit gate fidelity in the absence of TLS can reach seven nines, which shows that the ansatz is effective.After turning on the couplings, the fidelity drops but the dependence on total time and protocol depth has the same pattern as that with no couplings.The fidelity generally increases to about four nines after the critical time and critical depth, and is lower for smaller values of T and p.The state fidelity of each protocol is also plotted in Fig. 8 (points with error bars, connected by pale dashed lines), showing good agreement with the optimization results.FIG.9: CNOT gate fidelity dependence on total evolution time for 2-qubit system coupled to n TLS under the effect of both TLS couplings and Lindblad decoherence optimized with PG.Each point is the best result of 3 parallel simulations with different initialization.The control depth is p = 30.The fidelity, Eq. 22, is plotted as MLI, Eq. 24.
The results of 2-qubit control with both a primary TLS bath and a secondary Lindblad bath are plotted in Fig. 9.As expected, the fidelity is lowered compared to that without Lindblad decoherence in Fig. 9.In general, the effect of the Lindblad bath in decreasing the gate fidelity is seen to be more significant than the effect of the TLS bath.In addition, given a fixed level of Lindblad noise, the fidelity with different numbers of TLS is very similar.The lowest MLI under the strongest Lindblad noise (T sys 1 = 500ns, T T LS 1 = 200ns) and one TLS is about 1.36.The critical time is not significantly affected by either the Lindblad noise strength or the coupling strength to the TLS.
Comparing Fig. 5 and Fig. 8, we can see that the two-qubit gate fidelities are similar to one-qubit when the qubits are coupled only to the primary TLS bath.But when the qubits are also coupled to the secondary Lindblad bath, the fidelity of two-qubit control is lower than the one-qubit case.It is apparent that the Hamiltonian switching control of a two-qubit system is less robust to Lindblad noise.In both cases (i.e. with or without T 1 decay), the critical time T * and depth p * of two-qubit control are both larger than one-qubit control.

VI. DISCUSSION
Table III summarizes all the simulations carried out in this work using Hamiltonian switching.We focus our discussion of the results primarily on the single-qubit dipole-dipole coupling case studied in Sec.V A 2 since this is the most relevant model for real devices.
The fidelity at the plateau region for all numbers of TLS n = 1 − 5 is around four nines, lower than the six nines achieved for most of the test cases of the isotropic model, for which the coupling strength between the system qubits and bath spins is about three degrees of magnitudes stronger.Beyond the critical depth p * , further increasing the protocol depth p does not appear to improve the fidelity.Adjusting other protocol parameters is also found to be ineffective in increasing the fidelity level.To find the factors affecting the highest achievable fidelity level, we have performed additional simulations shown in Appendix B. These results show that performing the control for the system in a rotating frame with strong system-bath couplings achieve the highest fidelity level, which is then usually six to eight nines.Changing to either the lab frame or the weak coupling regime is found to lower the fidelity to around four nines.Systems for which control is carried out in both the lab frame and the weak coupling regime also have a fidelity around four nines.This was observed for both types of couplings to the primary bath of spins, i.e., isotropic and dipolar.

TABLE III: Summary of simulations carried out in this work
To analyze these observations, we first computed the gradient and Hessian of several simulations, as described in Appendix.B. The largest components of the gradients for all four selected simulations were found to be approximately 10 −3 , which are relatively small, indicating proximity to critical points of the control landscape.The majority of the eigenvalues of the Hessian matrices were negative, indicative of saddle points that are nearly local maxima.Furthermore, in the weak coupling scenario, most of the eigenvalues had small magnitudes, suggesting a possible robustness of the control [49].
We also conducted a controllability analysis in Appendices D and E for the case of 2 bath spins, to understand whether the differences in precision achieved with Hamiltonian switching for the two types of bath coupling could be assigned to different extent of controllability.The results are summarized in Table IV.
It is evident that the controllablity analysis is not able to explain the fidelity differences between rotating and lab frames, nor of course, differences due to the change of coupling strength.The controllability of the qubit and bath  spins does not necessarily depend on whether they are described in the rotating or the lab frame: it depends only on whether the coupling strengths are all equal or not, rather than on the strength of the couplings relative to the system energy.Instead, the controllability affects only the critical depth p * , as shown in Sec.V A 1.
We explored several options to improve the fidelity for the dipolar coupling case.One is to add an additional σ y control term, which ensures controllability of the system qubit regardless of the type and relative strength of the couplings to the bath spins.These calculations require extension of the two-Hamiltonian switching protocol to a four-Hamiltonian protocol and are summarized in Appendix.C. The resulting simulation results show that the fidelity in the lab frame and strong coupling regime is now improved above six nines, but the fidelity in the other test cases is not significantly improved.
A more successful strategy derives from noting that for the specific choice of Hamiltonians H A and H B used in the switching Hamiltonian protocol in this work, Eq. ( 12), the effective control Hamiltonian reduces to alternating between −2Eσ x and +2Eσ x , i.e., to a bang-bang form of control.This suggests that we may further refine the strength of the effective control pulses obtained from the Hamiltonian switching method to allow variable strength of the σ x term during each variable time interval determined by optimization of the Hamiltonian switching protocol.We carried this out by applying the GRAPE method as described in Sec.IV.B.The results for the dipole-dipole coupled systems in the lab frame and in the weak coupling regime were presented in Sec.V A 2, where we saw that the fidelity is now very significantly improved by this secondary optimization of the pulse strength.Note that this secondary optimization may also be understood as a generalization of the Hamiltonian switching protocol to allow variation of an additional parameter in each instance of H A and H B , beyond just the duration of each instance.
In general, our results indicate that the fidelities that can be achieved by the basic form of Hamiltonian switching given in Eq. ( 12) are primarily affected by the presence of bath Z terms and by the relative strength of the qubit system-bath spin couplings and the system energies.The fact that the fidelities are lower in the weak coupling regime indicates that it is hard for the symmetric ('bang-bang') type of switching to cancel the effect of weak qubit-spin couplings, allowing the fidelities to reach only four or five nines.However, the additional flexibility offered by a secondary optimization of the effective control strength from pulse to pulse using the GRAPE method allows this to be further improved to nine nines.

VII. SUMMARY AND CONCLUSIONS
In this work, we have developed a bipartite Hamiltonian switching control protocol for qubits coupled to a primary bath of two level systems and a Lindblad bath describing an extended environment.We applied this approach to systems of one and two qubits coupled to a primary bath of spins/TLS via either an isotropic interaction or a dipoledipole interaction, and analysed the control of the system in this setting, as well as with a secondary Lindblad bath.The simulations for systems coupled only to the primary bath (spin or TLS bath) are optimized using a unitary gate fidelity measure, while the simulations for systems coupled to both a primary bath and a secondary Lindblad bath are optimized using a reference state fidelity measure.The Hamiltonian control optimizes the time duration for application of each Hamiltonian, with constant amplitude in all time intervals.In cases where the fidelity obtained with this basic Hamiltonian switching control was too low, we boosted the fidelity using a secondary optimization with GRAPE that also allows the amplitude of the Hamiltonian controls to be adjusted for each time interval.
Our numerical results demonstrated the effectiveness of bipartite Hamiltonian switching control.In the presence of coupling to the primary bath, the fidelity of direct implementation of gates would drop below 0.9.However, with Hamiltonian switching, the fidelity in most of the test cases were improved to between 1 − 10 −4 and 1 − 10 −8 .Further refinement with a secondary GRAPE optimization brought the fidelity in all cases to 1 − 10 −8 or higher, which is well within the thresholds of most contemporary quantum error correction codes.Applying the resulting protocols to specific states gives state fidelities of similar magnitude to the corresponding gate fidelities.
Analysis of the change of fidelity over the protocol evolution time reveals a general pattern that the fidelity first increases with time, then reaches a plateau region that is approximately constant as the protocol time increases further.A similar trend holds for the fidelity change as the control depth p, i.e., the number of Hamiltonian switching intervals, is increased.However, only with sufficient control depth p can the behavior of an increase to a plateau value over total evolution time be observed, and the plateau value does not change significantly when the control depth is further increased.We refer to the turning points between the region of increasing fidelity and the subsequent plateau region as the critical time T * and critical depth p * , for the dependence on protocol time T and depth p respectively.
For qubit systems strongly coupled to the primary bath of spins with an isotropic interaction and a Z gate target, the critical depth and critical time both increase with the number of bath spins.This is consistent with the simulated reduced dynamics in the absence of control, where different numbers of bath spins are known to give rather different system dynamics.However, for fixed system parameters, different target gates give similar fidelity values and almost identical patterns of change with control depth and evolution time.The most efficient protocol for the implementation of a gate is obtained using the critical time T * and critical depth p * .Changing the coupling strengths between the system qubits and bath spins from all equal to variable strength was found to have a significant impact on the fidelity, with the critical depth p * being much larger for the variable coupling strength case.In most of the simulations with variable coupling strength, despite increased control depth, the highest fidelity reached in the isotropic model is significantly lower than that found in the equal-coupling case.This validates the claim in [13] that the variable coupling case is harder to control.
In the case of qubits coupled to TLS through dipole-dipole interactions, with parameters emulating typical superconducting qubit systems, the coupling strengths are 2 to 3 magnitudes weaker than those we employed for the isotropic central spin model with variable values.With a Z gate target, simulations with different TLS count n, control depth p and optimization method were found to yield almost identical highest fidelity values, as well as identical dependence on the total protocol evolution time T .The critical time and depth are lowered to T * = 4 16π ns ≈ 0.08 ns (4 time units) and p * = 5, suggesting significantly easier implementation in experimental systems.In contrast to the isotropic central spin model, these values are independent of the number of TLS.This is consistent with the weaker coupling and also with the simulated reduced dynamics, since the reduced dynamics of a qubit with no control fields but coupled by dipolar interactions to different numbers of TLS are almost the same up to 2 ns, a considerably longer time than all protocols in this work.The critical time and critical depth are similar for Hadamard and T gate targets.The highest fidelity reached by Hamiltonian switching alone for qubits that are dipolar coupled to a bath of TLS is around 1 − 10 −4 , but was shown to be improved to 1 − 10 −9 by a secondary optimization by GRAPE that modulates the amplitudes of the switching Hamiltonians in addition to their duration.Introducing additional couplings to a secondary Lindblad bath causing T 1 decay of the system qubits lowers the fidelity, as expected.Nevertheless, a fidelity of approximately 1 − 10 −3 on a single qubit can still be reached when the T 1 time of the qubit is 500 ns.
The non-universal ansatz is not capable of implementing arbitrary single-qubit gates.While it can reach higher fidelities when implementing Z-rotations including the T gate, also with lower critical time than the universal ansatz, the fidelity is however very low when implementing other gates.Our analysis shows that while coupling to TLS changes the Lie algebraic structure of the coupled system-primary bath, it does not increase the fidelity per se when implementing either Z-rotation or Hadamard gates.In general, this non-universal ansatz is better suited for implementing Z-rotation gates like the T gate, but is not as capable for other gates like the Hadamard gate.This work demonstrated that bipartite Hamiltonian switching control for high fidelity quantum gates can very effectively mitigate environmental noise, particularly when the optimization of the switching Hamiltonian pulse durations is supplemented by secondary optimization of the switching Hamiltonian amplitudes.Our analysis revealed several interesting features of this method.One notable feature is that with a universal ansatz, the control properties depend only weakly on the target gate, suggesting a generic robustness of the optimal bipartite control.It will be interesting in the future to further explore the robustness of this bipartite control scheme in a more systematic manner, e.g., examining its performance under diverse uncertainties using the recently developed classical averaging method [49].For example, one can ask whether there are classes of imperfections for which control of switching time intervals and the fine-tuning their amplitudes is naturally more robust than standard pulse shaping.Many robustness issues are related to the topology of the quantum control landscape, i.e., the fidelity as a function of the control variables.In particular, at the top of the landscape where the fidelity is near one and the gradient is near zero, there is a large null space which allows for considerable design freedom, e.g., for a significant robustness in the choice of control parame-ters.An interesting question here is to compare the null space for Hamiltonian switching with that for standard pulse control.For example, if the key variable is the area under the pulse, for the standard case this is simply amplitude times a fixed time interval, whereas for Hamiltonian switching it is a fixed amplitude times a varying time-interval.The robustness properties will also depend on the accuracy of setting the pulse intervals and/or the pulse amplitudes.In some cases larger pulse amplitudes induce other phenomena, e.g., if too much energy is pumped into the system.In such situations, Hamiltonian switching by intrinsically fixing the pulse amplitudes may avoid disruptions or unwanted side effects.In general, we conclude that Hamiltonian switching bipartite control is a promising practical candidate for the implementation of high-fidelity quantum gates on NISQ devices.Hessian Eigenvalues TABLE V: l-infinity norm (i.e. largest absolute value of the components) of the gradients and plots of the eigenvalues of Hessian matrices for selected simulations.
Appendix C: Four-Hamiltonian Switching To improve the fidelity in the lab frame and weak coupling regime, we tested an ansatz containing an additional σ y term, which results in switching between the following four Hamiltonians: A q 2 (σ + 0 σ − q + σ − 0 σ + q ). (C1) It can be readily shown that this ansatz is universal on the qubit.The fidelity dependence on evolution time T is plotted in Fig. 11.(i.e., the Hamiltonian includes bath σ Z terms), "rotating" means rotating frame (i.e., no bath σ z terms), "strong" means strong coupling strength (i.e., of the same order of magnitude as the system energy splitting), and "weak", means weak coupling strength (i.e. about 10 −3 relative to the system energy splitting).Each point is the best result of 5 parallel simulations with different initialization.The fidelity, Eq. 18, is plotted as MLI, Eq. 24.
1. Rotating Frame According to the controllability analysis for isotropically coupled systems in [13], when the coupling strengths are equal, the qubit is controllable and the CS bath is controllable in each subspace conserving total angular momentum, while when the coupling strengths are variable, the qubit and the full CS bath are both controllable, using a control ansatz with identical Lie algebra to that in this work.

FIG. 1 :
FIG. 1: The |0 state population of a qubit coupled to different numbers of bath spins through (a) isotropic coupling with strength 1 (arbitrary unit) and (b) dipole-dipole coupling of strength 40 MHz , assuming the qubit energy splitting to be 1 (arbitrary unit) and 8 GHz respectively.The aforementioned coupling strengths are of the same scale as our simulated systems.The initial state of the qubit is |0 and the initial state of the bath is an infinite temperature mixed state.

FIG. 2 :
FIG.2:(a) Dependence of MLI of fidelity (Eqs.18 and 24)  on the number of iterations with PG, for a Z gate on a single qubit that is isotropically coupled (Eq.4) to n environmental spins.Run parameters are displayed in the legend.(b) Comparison of the unitary fidelity (Eq.18) for a Z gate on a single qubit isotropically coupled to n = 2 bath spins under evolution with (green curve)or without (orange curve) Hamiltonian switching.The horizontal T axis is the total duration of evolution for the bipartite protocol.The control depth for the green curve is p = 20 and the optimization method used is PG.The fidelities of the orange points without Hamiltonian switching are calculated with the same total duration of the corresponding control protocol and would be 1 if there were no decoherence due to coupling to the primary bath of spins.

FIG. 3 :
FIG.3: Z gate fidelity dependence on total evolution time T ( panels (a),(b)) and control depth p (panel (c)) for isotropically coupled systems optimized with PG.All coupling constants are equal to A q = 1.0.Each point is the best result of 3 or 5 parallel simulations with different protocol parameter initialization.For each pair of points with the same color and T value, the solid line is the actual optimization result and the dashed pale line with error bar is the average state fidelity over M = 100 Haar-random states.The fidelity, Eq. 18, is plotted as MLI, Eq. 24.

FIG. 4 :
FIG. 4: Single qubit gate fidelity dependence on total evolution time for isotropically coupled central spin systems with n = 2 bath spins optimized with PG.The target gates are (a) Hadamard gate, (b) T gate and (c) Z gate.In panels (a), (b), the coupling constants are all equal to A q = 1.0.In panel (c), the coupling strengths are unequal and evenly distributed in the range [1, 2].Each point in (a) and (b) is the best result of 3 or 5 parallel simulations with different initialization.For each pair of points with the same color and T value, the solid line is the actual optimization result and the pale dashed line with error bar is the average state fidelity over M = 100 Haar-random states.All fidelities are plotted as MLI, Eq. 24.

FIG. 5 :
FIG. 5: Single qubit gate fidelity dependence on (a),(b) and (d): total evolution time and (c) control depth for dipole-dipole coupled systems optimized with PG.The target gate is Z for panels (a)-(c) and Hadamard and T for panel (d).The coupling constants are unequal and evenly distributed over 4-40 MHz, which is in the relevant strength range for superconducting devices.Each point is the best result of 3 or 5 parallel simulations with different initialization.For each pair of lines with the same color and T value, the solid one is the actual optimization result and the pale dashed one with error bar is the average state fidelity over M = 100 Haar-random states.All fidelities are plotted as MLI, Eq. 24.
FIG.6: T gate fidelity dependence on total evolution time for a single qubit coupled to n TLS and optimized with PG.In addition to coupling to the TLS, both the system and TLS are under T 1 decay.The coupling constants are unequal and evenly distributed over 4-40 MHz, which is in the relevant strength range for superconducting devices.Each point is the best result of 3 or 5 parallel simulations with different protocol parameter initialization.The fidelity, Eq. 22, is plotted as MLI, Eq. 24.

1 = 1 =
FIG.7: T gate fidelity dependence on total evolution time for (a) 1 isolated qubit (b) 1 qubit dipole coupled to n TLS.Optimizations were performed with PG, using a control depth p = 20 for calculations without Lindblad decoherence and p = 30 for calculations with Lindblad decoherence.The control ansatze are Eq.12 (universal) and Eq. 14 (non-universal).In panel (b), the purple line shows results for a system where both the qubit and TLS are subject to T 1 decay, with T sys 1 = 500 ns and T T LS 1 = 200 ns.All other lines show results with no Lindblad decoherence.The dipolar coupling constants are unequal and evenly distributed over 4 − 40 MHz.
(a) n1 = n2 = 0 (No TLS) (b) n1 = 1, n2 = 0 FIG. 10: Fidelity dependence on evolution time for (a) and (b) isotropically and (c) dipole-dipole coupled systems optimized with PG.The target gate is Z.The coupling constants are (a) and (c) equal and (b) unequal.The number of bath spins for all the plots is n = 2.For each line, lab means lab frame (i.e.The Hamiltonian includesbath σ Z terms) and rotating means rotating frame (i.e.no bath σ z terms), and strong means strong coupling strength (i.e. in the same order of magnitude as the system energy splitting) and weak means weak coupling strength (i.e. about 10 −3 relative to the system energy splitting).Each point is the best result of 3 or 5 parallel simulations with different initialization.The fidelity, Eq. 18, is plotted as MLI, Eq. 24.

FIG. 11 :
FIG. 11: Fidelity dependence on evolution time T for (a) isotropically and (b) dipole-dipole coupled systems optimized with PG using 4-Hamiltonian switching.The target gate is Z.The coupling constants are equal.The number of bath spins for all the plots is n = 2 and the control depth is p = 20.For each line, "lab" means lab frame(i.e., the Hamiltonian includes bath σ Z terms), "rotating" means rotating frame (i.e., no bath σ z terms), "strong" means strong coupling strength (i.e., of the same order of magnitude as the system energy splitting), and "weak", means weak coupling strength (i.e. about 10 −3 relative to the system energy splitting).Each point is the best result of 5 parallel simulations with different initialization.The fidelity, Eq. 18, is plotted as MLI, Eq. 24.
d − 1, with |ϕ i ϕ i | being computational basis states and (ρ d ) ij = 1 d .All weights are set equal to w i = 1 d+1 .The TLS initial state is the zero temperature state.

TABLE I :
The estimated critical depth p * and critical time T * values, together with the highest log fidelity reached in the simulations of the central spin model with isotropic couplings and equal coupling strengths.
Table.II.The similarity of critical time and depth among different numbers of TLS agree with the characteristic Target gate # of bath spins (n) Critical depth (p * , T = T * ) Highest MLI a Highest MLI obtained with secondary GRAPE optimization.

TABLE II :
The estimated critical depth p * and highest log fidelity reached in the simulations of dipole-dipole couplings.

TABLE IV :
Summary of controllability of systems with 1 qubit and 2 bath spins.See Appendices D and E for full details.