Hamiltonian engineering for robust quantum state transfer and qubit readout in cavity QED

Quantum state transfer into a memory, state shuttling over long distances via a quantum bus, and high-fidelity readout are important tasks for quantum technology. Realizing these tasks is challenging in the presence of realistic couplings to an environment. Here, we introduce and assess protocols that can be used in cavity QED to perform high-fidelity quantum state transfer and fast quantum nondemolition qubit readout through Hamiltonian engineering. We show that high-fidelity state transfer between a cavity and a single qubit can be performed, even in the limit of strong dephasing due to inhomogeneous broadening. We generalize this result to state transfer between a cavity and a logical qubit encoded in a collective mode of a large ensemble of $N$ physical qubits. Under a decoupling sequence, we show that inhomogeneity in the ensemble couples two collective bright states to only two other collective modes, leaving the remaining $N-3$ single-excitation states dark. Moreover, we show that large signal-to-noise and high single-shot fidelity can be achieved in a cavity-based qubit readout, even in the weak-coupling limit. These ideas may be important for novel systems coupling single spins to a microwave cavity.


Introduction
Spin qubits encoded in collective modes of ensembles [1,2,3] and single spins in quantum dots [4,5,6] can be coupled to microwave cavities for cavity quantum electrodynamics (QED) experiments [7]. Spin qubits show promise for use as longlived quantum memories, but often suffer from weak qubit-cavity coupling relative to the inhomogeneously broadened linewidth [8]. Inhomogeneous broadening typically originates from nuclear-spin or electrical (charge) noise [9,10,11,12]. While nuclearspin noise [13] can often be controlled through isotopic purification, strong coupling of a single spin to the electric field of a cavity mode typically requires a strong correlation of spin and charge degrees of freedom [14,15,16,17,18]. This correlation makes the spin qubit susceptible to low-frequency charge noise [19,20]. An alternative strategy is to enhance the weak magnetic coupling of a spin qubit (which may be otherwise insensitive to charge noise) by coupling to the collective mode of a large spin ensemble [21,22]. However, spatial inhomogeneities in such ensembles can result in an inhomogeneous linewidth that is comparable to the qubit-cavity coupling [3,23].
It is well known that the effects of inhomogeneous broadening can be eliminated through a suitable dynamical decoupling sequence. To determine the quality of a cavity-QED scheme, the coupling is therefore often compared with the inverse qubit coherence time under a train of decoupling π-pulses [14,15,16], rather than the inhomogeneous linewidth. However, for a qubit coupled to a cavity, a sequence of π-pulses typically generates unwanted cavity excitations on the same timescale as coherent qubit-cavity (vacuum Rabi) oscillations, severely reducing the fidelity of, e.g., quantum state transfer between a qubit and a cavity.
In this paper, we show that these limitations can be overcome by engineering appropriate time-averaged Hamiltonians [24,25,26,27] through a combination of qubit dynamical decoupling and control of the qubit-cavity coupling. In particular, we introduce and quantitatively characterize protocols for a high-fidelity quantum state transfer between a qubit and cavity, and for a fast quantum nondemolition qubit readout. Our readout protocol yields a large signal-to-noise ratio even in the weakcoupling regime, in which the qubit-cavity coupling is small compared to the cavity damping rate. Moreover, we show that control of the qubit-cavity coupling makes high-fidelity quantum state transfer possible even in the strong-dephasing limit, in which the inhomogeneous linewidth dominates the qubit-cavity coupling. This result applies even to logical qubits encoded in the collective mode of an ensemble of physical qubits (relevant to, e.g., spin or atomic ensembles that are routinely used for quantum memories [3,28,29]). Inhomogeneous broadening across an uncontrolled ensemble of N physical qubits would typically lead to coupling of the logical qubit to ∼ N collective modes [23,30,31]. However, remarkably, for our pulse sequence we find that the leading corrections in average Hamiltonian theory couple only four distinct collective modes in the large-N limit. This may allow for very high-fidelity storageand-retrieval or even coherent manipulation of quantum information in the ensemble through revivals. This paper is organized as follows. In Section 2, we introduce the Hamiltonian engineering protocol studied throughout this work. In Section 3, we evaluate the fidelity of a quantum state transfer between a cavity and a single physical qubit under the Hamiltonian-engineering protocol presented here, and show that errors can be strongly suppressed, even in the strong-dephasing limit (in which the inhomogeneous broadening is larger than the qubit-cavity coupling). In Section 4, we generalize this τ /2 3τ /2 5τ /2 7τ /2 g(t) t π π π π Figure 1. SQUADD (SQUare wave And Dynamical Decoupling): the Carr-Purcell sequence is applied to a qubit coupled to a cavity while turning off the coupling g(t) [Eq. (4)] after each odd-numbered π-pulse to prevent unwanted cavity excitations.
result to state transfer between a cavity and a collective mode of a large ensemble of physical qubits. In Section 5, we analyze realistic control limitations. We focus on finite off/on ratio of the tunable qubit-cavity coupling, deterministic over (under)rotations of the qubit during imperfect π-pulses, finite bandwidth of the qubit-cavity coupling pulses, and finite duration of the qubit π-pulses. Finally, in Section 6, we assess a readout protocol based on the Carr-Purcell sequence that yields high signalto-noise and single-shot fidelity in the weak-coupling regime.

Hamiltonian engineering
We first consider a single qubit coupled to a cavity. With the cavity and the qubit on resonance and working in a rotating frame within the rotating-wave approximation, the system is described by a Jaynes-Cummings Hamiltonian: where we have allowed for a tunable qubit-cavity coupling g(t) (setting = 1). In addition, the qubit is controlled via H c (t), giving the total Hamiltonian In H JC (t), we take ξ to be a Gaussian random variable with zero mean and variance (∆ξ) 2 that describes inhomogeneous broadening in the qubit-cavity detuning. Most decoupling schemes rely entirely on qubit control. However, electrical control of g(t) is now possible in several architectures [5,6,16,32,33,34]. By modulating H c (t) and g(t) sufficiently quickly, we can eliminate unwanted terms and generate useful time-averaged Hamiltonians.
To average away unwanted terms, we move to the toggling frame [35], which incorporates H c (t) into the transformed system Hamiltonian, where . To reduce dephasing due to the random detuning ξ, a natural choice for U c (t) is the Carr-Purcell sequence: a train of sharp π-pulses applied at times (m + 1 2 )τ , with m ∈ N (Fig. 1). When U c (t) generates fast π-rotations about the x-axis, with n(t) the number of π-pulses applied before time t. For n(t) even, the qubitcavity interaction is described by a co-rotating term, preserving the total number of excitations, N ex ≡ a † a + σ + σ − . However, for n(t) odd, the interaction is rather given by a counter-rotating term, which does not conserve N ex . For fixed g(t) = g, the counter-rotating term leads to simultaneous excitation of the qubit and cavity. This flow of excitations can be blocked simply by taking g(t) = 0 for n(t) odd. With this choice, N ex is a constant of motion, allowing for coherent state transfer (vacuum Rabi oscillations) between the qubit and the Hilbert space spanned by the vacuum and first excited state of the cavity.
In the rest of this paper, we will use the acronym SQUADD (SQUare wave And Dynamical Decoupling) to describe the simultaneous square-wave modulation of g(t) and sequence of π-pulses shown in Fig. 1. In an ideal implementation of SQUADD, qubit π-pulses are infinitely narrow and coupling modulations perfectly square: g(t) = g for n(t) even and g(t) = 0 for n(t) odd. We focus on this idealized limit in Sections 3 and 4. Control imperfections will be considered in detail in Section 5. In Section 6, we will show that the Carr-Purcell sequence with fixed g(t) = g can be used for fast readout of the qubit via the cavity.

Qubit-cavity state transfer
In this section, we assess the quality of a quantum state transfer realized using SQUADD. In particular, we show that SQUADD allows for a high-fidelity quantum state transfer, even in the limit of strong inhomogeneous broadening, ∆ξ > g.
To characterize the performance of SQUADD, we evaluate the average fidelity The integral in Eq. (5) represents an average with respect to the Haar measure dψ (a uniform average over the Bloch sphere) for the ensemble of states of the form |ψ ≡ |ψ q |0 c , where |ψ q is a pure qubit state and |0 c is the cavity vacuum. We have also introduced the unitary operator U 0 describing an ideal state transfer: U 0 |ψ q |0 c = |g q |ψ c , with |g q the qubit ground state. In addition, M is the completely positive trace-preserving map that describes the actual state transfer, accounting for an average over the random detuning ξ and a finite cavity damping rate κ. We first consider the case κ = 0, then generalize to finite κ, below.

Exact solution (κ = 0)
An exact solution is possible for SQUADD under the ideal conditions described above: sharp π-pulses, g(t) = g for n(t) even, and g(t) = 0 for n(t) odd. The time-evolution operator then breaks into segments associated with the intervals of duration τ between π-pulses. In the single-excitation subspace, N ex = a † a + σ + σ − = 1, the evolution operator for a single period of the decoupling sequence is with Ω = g 2 + ξ 2 /4, In Eq. (6), we have introduced the operator Rn(θ) ≡ e −iθn·τ /2 , which applies an SU(2) rotation by angle θ around the axis set by the unit vectorn in the space spanned by the vector of pseudospins τ = (τ x , τ y , τ z ). These pseudospins are defined by In Eqs. (9) to (11), g (e) labels the ground (excited) state of the qubit, while 0 or 1 is the number of photons in the cavity. The product of the three rotation matrices in Eq. (6) is itself a rotation matrix U 1 = Rv(ϑ), where The evolution at the end of the full sequence of n p pulses (and thus n p /2 periods) is given by Equation (16) gives a closed-form analytical expression for the evolution operator under SQUADD. Taking M(|ψ ψ|) = U (t f )|ψ ψ|U † (t f ) in Eq. (5), with U (t f ) given by Eq. (16), we obtain the average state-transfer fidelity where E[·] is an ensemble average over the detuning ξ. Equation (17) is plotted as a function of n p in Fig. 2 (purple solid line).
A small error can be reached when n p 1, even for strong dephasing, gT * 2 = √ 2g/∆ξ < 1, where T * 2 is the qubit free-induction decay time (dephasing time) due to inhomogeneous broadening ∆ξ. This result is apparent in Fig. 2, which gives the exact solution described above (solid purple line), along with the large-n p expansion of Eq. (18) (dashed black line). Here, we have chosen gT * 2 = 1/10. Even for this choice of parameters, placing the system in the strong-dephasing regime, errors smaller than 1% are reached with n p ∼ 40 pulses, at the onset of the validity criterion for Eq. (18): n p > π∆ξ/g ∼ 40. Consequently, the usual weak-dephasing criterion (1/T * 2 g) has been traded for a fast-control requirement (τ T * 2 ) ‡. Fast π-pulses in this limit have already been demonstrated with isolated spin qubits (not coupled to cavities) [13,19,37], and could in principle be made even faster for single spins by taking advantage of exchange coupling and the magnetic field gradient generated by a micromagnet [38,39]. Since g(t) can be controlled electrically when these systems are coupled to cavities [5,6], fast pulsing of g(t) may be possible in the very near future (we give an analysis of finite-bandwidth control for g(t) and the influence of counter-rotating terms in Section 5.3).

Finite cavity damping (κ = 0)
When n p → ∞, inhomogeneous broadening becomes irrelevant and the fidelity will ultimately be limited by cavity damping at rate κ (we neglect intrinsic qubit decay ‡ Here, we consider static noise ξ, corresponding to an infinite correlation time, τc → ∞. For a fluctuating detuning with a finite correlation time, the pulse interval τ must also satisfy τ < τc for significant error suppression [36]. due to a homogeneous linewidth when κT 2 > 1). Accounting for finite cavity damping κ = 0 in the map M in Eq. (5), and expanding for κ/g 1, we find that the error saturates at when n p → ∞. To establish the influence of cavity damping more generally as a function of κ/g and n p , we numerically solve the Lindblad master equation generated by a Liouvillian superoperator L accounting for both Hamiltonian evolution under Eq. (4) and cavity damping. As shown in Fig. 2, cavity damping does indeed lead to a saturation of the error as a function of n p at 1 − F ∼ κ/g (blue dots: κ/g = 1, red triangles: κ/g = 1/100). As a concrete example, a coupling g/2π 1 MHz has been predicted for spin qubits in GaAs double quantum dots [15], leading to gT * 2 0.05 due to hyperfine coupling to nuclear spins [13]. Even in this case, SQUADD could enable coherent coupling between a single spin and a cavity. In addition, SQUADD could improve state transfer between a single spin confined in a carbon nanotube and a coplanar-waveguide resonator. In a recent experiment on this system, g/2π = 1.3 MHz, κ/2π = 0.6 MHz, and T * 2 60 ns have been reported [5]. With these parameters, a large state-transfer error 1 − F 0.42 results from Eq. (5) without π-pulses. Using SQUADD, n p = 10 (τ = π gnp 40 ns) suffices to reduce the error from pure dephasing to 0.004. The total error is then 1 − F 0.18, limited by the large κ/g ratio in this experiment.

Average Hamiltonian theory
For κ = 0, some insight into the dependence of the state-transfer error on n p can be gained using average Hamiltonian theory, a standard tool in the analysis of open-loop Hamiltonian engineering protocols [24]. In average Hamiltonian theory, the evolution operator is recast in terms of a Magnus expansion [40,41]: Substituting H T (t) [Eq. (4)] into the expressions for H (k) [40,41] gives the first few terms in the Magnus expansion for SQUADD The leading term, H (0) , generates coherent vacuum Rabi oscillations between the qubit and the cavity. In Eq. (22), H (1) vanishes because the toggling-frame Hamiltonian given by Eq. (4) has the following property: H T (t) = H T (2τ − t), corresponding to a symmetric cycle with period T = 2τ [35]. For such symmetric cycles, all odd orders vanish in the Magnus expansion, leading to H (1) = 0 [42]. The leading source of error is then H (2) . In the subspace containing a single qubit or cavity excitation (N ex = 1), the first and second terms in H (2) [Eq. (23)] lead to unwanted rotations by an angle ∝ τ 2 around the axes defined by τ x [Eq. (9)] and τ z [Eq. (11)], respectively. For small rotation angles, this gives a correction ∝ (τ 2 ) 2 to the fidelity (which involves an overlap between two state vectors at an angle ∝ τ 2 ), thus explaining the error ∝ τ 4 ∝ 1/n 4 p obtained in Eq. (18). A sufficient criterion for convergence of the Magnus expansion [Eq. (20)] for a periodic Hamiltonian H T (t) with period 2τ is [41] 2τ where O is the 2-norm of O, with O an arbitrary operator. Here, we have taken the detuning ξ to be Gaussian distributed over an infinite interval and the cavity mode is described by unbounded operators a, a † . Thus, H T (t) is formally unbounded. However, realistically, we expect that the Gaussian distribution for ξ can be truncated at a few ∆ξ, and the cavity occupation can be truncated to include only a few quanta in Fock space, resulting in ||a|| ∼ ||a † || ∼ 1, which gives 2τ 0 dt H T (t) max(g, ∆ξ)2τ up to factors of order unity. Thus, for a fixed transfer time t f = n p τ = π/g, we expect convergence of the Magnus expansion for n p 2 max(1, ∆ξ/g).
Absolute convergence of the Magnus expansion does not guarantee that the first few terms of average Hamiltonian theory lead to an accurate description of the evolution operator. Since the terms of average Hamiltonian theory appear within the argument of an exponential in Eq. (20), correction terms that are small over a single period 2τ may add up to produce large deviations over the entire evolution time t f = n p τ τ . However, for SQUADD, the duration of the sequence is set to t f = π/g through the condition for complete state transfer. This sets a bound on the magnitude of deviations of a truncated Magnus expansion from the exact solution. Indeed, for k ≥ 2, we have H (k) t f max(g∆ξ k , g k ∆ξ)τ k (π/g) ∼ max[(∆ξ/g) k , ∆ξ/g]/n k p , where we have used τ = π/gn p . Keeping only the first correction term in the Magnus expansion will then lead to an accurate description of the evolution operator (with In this limit, Eq. (24) already ensures that the expansion of average Hamiltonian theory is convergent. In this same limit, we find that the expansion given in Eqs. (21) to (23) leads to the error given in Eq. (18), thus coinciding with the exact solution.

Collective modes in qubit ensembles
In this section, we consider the application of SQUADD to quantum state transfer between a cavity and a collective mode of an ensemble of N physical qubits. We account for leading corrections in the Magnus expansion and show that, up to corrections ∼ O(1/ √ N ), this system evolves in a closed 4-dimensional subspace. Using this approach, we find an expression similar to Eq. (18) for the state-transfer fidelity, but applicable to a collective mode. For single spins coupled to microwave cavities, the κ/g ratio can be large [5,43], limiting the fidelity achievable through SQUADD. However, the effective coupling can be significantly enhanced by encoding a logical qubit into a large number of physical qubits. Indeed, an ensemble of N qubits coupled to a common cavity mode hosts an excitation out of the ground state |g q = |g 1 ⊗ |g 2 · · · |g N that is annihilated by the collective lowering operator where g i is the coupling for qubit i. For N 1, the logical qubit encoded in the subspace of |g q and |e q = b † |g q couples to the resonator with an ensemble coupling g ens ≡ √ N g av [21]. However, an inhomogeneity in qubit-cavity detunings across the ensemble may lead to leakage from the collective mode b to many dark states [23,30,31]. When ∆ξ g ens , leakage due to dephasing will typically result in an error of order one.
Errors due to inhomogeneous broadening in an ensemble can be suppressed through SQUADD. The toggling-frame Hamiltonian for a qubit ensemble is We thus consider an ensemble of qubits with couplings g i (t) and detunings ξ i from the cavity. As in the single-qubit case, we assume that g i (t) = g i ∀ i for n(t) even and g i (t) = 0 ∀ i for n(t) odd. The time-dependent Hamiltonian in Eq. (27) describes rapid periodic modulation for small pulse interval τ . Under the conditions described in Section 3.3, above, we then expect convergence of the Magnus expansion for max(g ens , ∆ξ)2τ π. Because we have assumed g(t) = 0 for n(t) odd, the total number of excitations N ex = a † a + i σ + i σ − i is a constant of motion. We thus project each H (k) into the subspace H 01 associated with N ex = 0 or 1. Explicitly, H 01 is spanned by the states |g q ⊗ |0 c , |g q ⊗ |1 c , and |g 1 ⊗ |g 2 · · · |e j · · · |g N ⊗ |0 c , where |0 c and |1 c label cavity Fock states, and where |g j and |e j label the ground state and excited state of qubit j, respectively. We then have In Eqs. (28) and (29), we have introduced two new collective qubit lowering operators Equation (29) describes the coupling of modes a and b with the new modes c and d with strengths In addition, Eq. (29) contains a resonator frequency shift By construction, after projecting into H 01 , the collective qubit operators obey the commutation relations Therefore, in the large-N limit, the Hamiltonian H (0) + H (2) can be expanded in the basis of single-excitation states However, this basis is typically non-orthogonal. To see this, we consider the case where the coupling strengths g i are uncorrelated with the detunings ξ i , implying that, e.g., (gξ) av → g av ξ av for N → ∞. We also take the distribution of qubit-resonator detunings to be Gaussian with mean E[ξ i ] = 0. Projecting into H 01 , this gives To avoid the complications associated with the non-orthogonal basis {|a , |b , |c , |d }, we introduce a new set of single-excitation states {|ã , |b , |c , |d }, where The states given in Eq. (38) and (39) form an orthonormal basis if we neglect overlaps . Writing a matrix representation of H (0) + H (2) in this basis, we find In Eq. (40), we have introduced couplings between the orthonormal modesã,b,c, and d, given by For N 1, we neglect corrections ∼ O(1/ √ N ). The Hamiltonian in Eq. (40) can then be represented graphically, as shown in Fig. 3(b). For ∆ξτ = 0, Eq. (41) yields ω ± = 0. The Hamiltonian then has the structure of a Λ system, with a basis state |ã coupled to the two basis states |b and |d . These couplings are represented by the thick red arrows in Fig. 3(b). In this limit, the Hamiltonian in Eq. (40) has two bright eigenstates with energies ±g ens /2. This is clearly seen in Fig. 3(a), which shows the eigenenergies of the Hamiltonian in Eq. (40) as a function of ∆ξτ , where ∆ξ is the standard deviation of the Gaussian distribution of qubit-resonator detunings. For ∆ξτ = 0, all other N − 1 eigenstates are zero-energy dark states which do not couple to the resonator mode. In contrast, when ∆ξτ > 0, the Hamiltonian has the structure of a tight-binding problem on a ring; the basis states |b and |d become weakly coupled through an additional mode |c . These additional hopping terms are represented by the thin blue arrows in Fig. 3(b). Because respectively, where The eigenenergies given in Eq. (42) are shown in Fig. 3(a) (solid red lines). Introducing couplings to the mode |c by turning on ∆ξτ shifts the energies of the two initial bright states, and lifts the degeneracy between two of the initial dark states by coupling them to the resonator mode. These two effects will generate errors in the state transfer of the resonator quantum state into the ensemble of qubits. We characterize errors in SQUADD due to inhomogeneous broadening with the average fidelity F , as defined in Eq. (5). We consider the initial state |ψ ≡ |g q ⊗|ψ c , where |ψ c is an arbitrary superposition of the cavity states |0 c and |1 c . We choose the evolution operator for an ideal state transfer to be U 0 = −ib † a, where the −i phase factor appears because the state transfer described here is equivalent to an SU(2) rotation. We take the linear map M representing imperfect state transfer to correspond to the evolution operator under the effective time-independent Hamiltonian in Eq. (40). We perform a Taylor expansion of the resulting fidelity to leading (fourth) order in τ , assuming max(g ens , ∆ξ)τ 1. Using the condition for complete state transfer, τ = π/g ens n p , this assumption becomes n p max(π, ∆ξ/g ens ), resulting in We recall that we have dropped corrections of O(1/ √ N ) arising from overlaps between basis states. Ignoring numerical prefactors of order 1, Eq. (45) exactly corresponds to  Eq. (18) for a single qubit, after the replacement g → g ens . In Eq. (45), the numerical prefactors (obtained for N 1) differ from those obtained in Eq. (18) for N = 1 because the mode structure is not the same. Indeed, taking N = 1 in Eqs. (26), (30), and (31) leads to b = c = d = σ − . The overlap between excitations of any pair of modes ∈ {b, c, d} is then 0|σ − σ + |0 = 1, in contrast with the overlaps obtained from Eqs. (35) to (37) when neglecting terms ∼ O(1/ √ N ) for N 1. The above discussion shows that SQUADD is robust to inhomogeneous broadening, even when coupling a cavity to a collective mode. By modulating the detuning rather than the coupling, it may be possible to use a variation of SQUADD on ensembles of nitrogen vacancy (NV)-center spin qubits in diamond coupled to superconducting coplanar waveguides, for which ∆ξ ∼ g ens has been reported [23].
This treatment of collective modes in qubit ensembles also demonstrates a clear advantage of our analytical approach over brute-force numerical methods for optimal control. Indeed, the time required for numerical exponentiation of the full system Hamiltonian grows exponentially with ensemble size, making the problem numerically challenging for N 1. In contrast, the analytical approach reveals a closed 4dimensional subspace in the same large-N limit.

Control limitations
In this section we evaluate the robustness of SQUADD to control imperfections. We first discuss errors due to a finite off/on ratio in the qubit-cavity coupling g(t) and pulse errors due to deterministic over-rotation or under-rotation of the qubit. We then describe the effects of a finite bandwidth and of counter-rotating terms in the qubit-cavity coupling Hamiltonian. We finally discuss error due to finite qubit π-pulse duration, and show that this source of error can be efficiently mitigated by properly alternating the qubit π-pulse rotation direction.

Finite off/on ratio
The ideal SQUADD sequence analyzed in Section 3 assumes that the coupling can be tuned to vanish identically in the "off" state. As a consequence, all terms in average Hamiltonian theory [Eqs. (21) to (23)] commute with the total number of excitations N ex . If there were some residual coupling g(t) = 0 for n(t) odd, terms that do not commute with N ex would appear in average Hamiltonian theory. Indeed, H (0) would then contain a term ∝ g(aσ − + a † σ + ). In addition, for a sequence that is not a symmetric cycle [H T (t) = H T (2τ − t)], H (1) would contain, e.g., a cavity-squeezing term ∝ ig 2 τ (a 2 − a †2 )σ z . This squeezing term may be useful, e.g., to enhance the fidelity of a qubit readout [44].
Given a finite off/on ratio g off /g [where g(t) = g off for n(t) odd], the term ∝ g(aσ − + a † σ + ) in H (0) generates a correction to the error given in Eq. (18) of order ∼ (g off /g) 2 . This correction would ultimately limit the saturation fidelity at large n p whenever g off = 0.

Pulse errors
In general, over-rotation or under-rotation of the qubit due to imperfect control can lead to an accumulation of errors as the number of pulses n p is increased. A simple way to avoid accumulation of these pulse errors is to use a phase-alternated sequence [35], in which the qubit rotation direction alternates from one π-pulse to the next. Consequently, the (fixed, deterministic) error ε on the rotation angle of successive pulses cancels for n(t) even, but introduces a small over-rotation for n(t) odd. We evaluate the resulting correction δF to the state-transfer fidelity of Eq. (18) by expanding U (t) = T exp[−i t 0 dt H T (t )] to leading order in ε and in τ . When max(g, ∆ξ)τ 1, δF is then well-approximated by this leading correction: Thus, neglecting order-unity prefactors, pulse errors can be made negligible compared to the error given in Eq. (18) when ε max (∆ξ/g) 2 , 1 /n 2 p .

Finite bandwidth and counter-rotating terms
In this section, we evaluate the state-transfer fidelity using numerical simulations that take into account both the finite bandwidth of the coupling modulation g(t) and the counter-rotating terms in the Rabi Hamiltonian. In these simulations, we find the evolution of the system under the toggling-frame Hamiltonian where H even with ω q the qubit frequency (assumed to be tuned to equal the resonator frequency). In contrast with Eq. (4), Eqs. (48) take into account the counter-rotating terms appearing in the Rabi Hamiltonian. These terms give rise to leakage outside the subspace of zero or one excitation when g(ω) ≡ ∞ −∞ dt exp[iωt]g(t) has significant weight at ω = 2ω q . To take into account the finite bandwidth of the coupling modulations, we convolve the ideal square-wave train of pulses with a Gaussian filter. In particular, we take the coupling to be given by where In Eqs. (49) and (50), F (−1) is the (inverse) Fourier transform, g id (t) is an ideal train of square-wave pulses having width τ , period 2τ , and amplitude g. The function f (ω) is a Gaussian filter with standard deviation σ f which eliminates high-frequency components of g id (t). Evaluating Eq. (49) gives where g sq (t) describes a single filtered square pulse centered around t = 0, In Eq. (52), τ may differ from the pulse interval τ [ Fig. 4(a)]. Neglecting corrections that are suppressed exponentially with σ f τ , the time required for the coupling to rise from 10 % to 90 % of its final value is, using Eq. (52), When σ f < ω q , the spectral weight of g(ω) is suppressed at ω = 2ω q and the influence of the counter-rotating terms becomes negligible. When σ f > 1/τ ∼ 1/τ , the pulse train g(t) closely approximates a sequence of square-wave pulses. Crucially, there is always the possibility for a separation between ω q , σ f , and 1/τ , allowing both conditions to be satisfied simultaneously: To verify the analysis given above, we numerically evaluate the fidelity of a state transfer using Eq. (5), considering evolution under the toggling-frame Hamiltonian given in Eq. (47), which fully accounts for counter-rotating terms. For a finite pulse rise time, t r = 0, g(t) will be non-zero even for n(t) odd. To suppress the resulting unwanted excitations of the qubit and cavity, we then take τ = τ − t r [τ and t r are illustrated in Fig. 4(a)]. Consequently, the time-averaged coupling g = 2τ 0 dt g(t)/2τ also decreases; the pulse interval that results in a complete state transfer is then obtained by numerically solving gn p τ = π/2 for a given value of g and n p . The resulting state-transfer error is shown in Fig. 4(b) (blue dots) as a function of σ f /g for n p = 100, gT * 2 = 1/10, and κ = 0. As σ f /g increases, the error decreases, approaching the value given by Eq. (18) for perfectly square modulation of g(t) (dashed black line). Additional error due to a finite pulse rise time becomes negligible compared to the error already present for an ideal pulse (for this choice of parameters) for σ f 500g. Even when the bandwidth is too narrow for saturation to have occurred, σ f < 500g, Fig. 4(b) shows that the error due to inhomogeneous broadening can be suppressed substantially (without SQUADD, error would be of order 1 for gT * 2 = 1/10). In the simulations, we have taken ω q = 2000g. This choice allows us to filter out the effect of the counter-rotating terms over the entire parameter range of the simulation, guaranteeing that σ f < ω q is satisfied.

Finite π-pulse duration
In typical experimental settings, the finite duration of π-pulses poses an important practical limitation to the achievable fidelity of quantum operations [13,45,46,47,48,49]. Therefore, in this section, we numerically evaluate the state-transfer fidelity under SQUADD as a function of the π-pulse duration.
With the cavity and the qubit on resonance, and working in the rotating frame, we describe qubit π-pulses with finite duration using the Hamiltonian valid under the rotating-wave approximation for the qubit drive. In Eq. (55), we have introduced the drive amplitude, w(t). Within the rotating-wave approximation for the qubit-cavity coupling (which is justified for σ f < ω q , as explained above), substituting

) leads to the toggling-frame Hamiltonian
where we have introduced the qubit rotation angle Gaussian filter Eq. (18) We take w(t) to describe a train of identical pulses. For numerical evaluation, we consider perfect rectangular pulses of amplitude w 0 and duration t p centered around (m + 1 2 )τ , m ∈ N [ Fig. 4(a)]. For w 0 t p = π, evolution under H T (t) leads to π-pulses. We retrieve the toggling-frame Hamiltonian for instantaneous π-pulses [Eq. (4)] when taking the limit t p → 0 in H T (t) given by Eq. (56) while requiring w 0 t p = π. In plots and numerical evaluations, we take g(t) to be given by Eq. (51), above. The strategies proposed here for error suppression with a finite pulse duration are, however, independent of the specific shape of w(t) and g(t). Importantly, the counter-rotating [∝ a † σ + + aσ − ] and cavity-displacement [∝ (a † − a)σ z ] terms in Eq. (56) both vanish for times t satisfying θ(t) = 2jπ (with j ∈ N), at which the state-transfer is complete. These unwanted terms are, however, finite for θ(t) = 2jπ [i.e., during π-pulses and for n(t) odd]. The error that results can be suppressed by approximately turning off the coupling during the qubit π-pulses [by choosing, e.g., τ = τ − t r − t p as shown in Fig. 4(a)], in addition to turning the coupling off for n(t) odd. Any error arising from a finite pulse duration is then predominantly due to the term ∝ ξ sin θ(t)σ y in Eq. (56).
As in Section 5.3, we numerically evaluate the fidelity F [Eq. (5)] of a quantum state transfer generated by the toggling-frame Hamiltonian given in Eq. (56). Figure 4(c) displays the resulting error 1 − F as a function of t p (blue dots) for n p = 100, gT * 2 = 1/10, σ f /g = 1000, τ = τ − t r − t p , and κ = 0. To suppress the error below 1%, gt p /2π < 10 −4 is required for these parameters. For, e.g., g/2π = 1 MHz, this level of error suppression would require t p < 0.1 ns. Realizing such short pulses may be challenging experimentally.
To explain this poor suppression of error in the limit of small t p , we note that, for the pulse sequence described below Eq. (57) [top-left inset in Fig. 4(c)], H T (t) does not result in a symmetric cycle (in the sense described in Section 3.3). Indeed, for this sequence with period T = 2τ , θ(T − t) = 2π − θ(t), leading to sin θ(T − t) = − sin θ(t) and thus to H T (T − t) = H T (t) [see Eq. (56)]. We thus expect the error to be finite at first order in average Hamiltonian theory [35], H (1) = 0 [see the discussion following Eq. (23)]. This sequence only becomes a symmetric cycle [i.e., H T (T − t) = H T (t), leading to H (1) = 0] in the limit t p → 0.
A symmetric cycle (leading to H (1) = 0) may be obtained using the phasealternated sequence described in Section 5.2, in which the qubit rotation direction [i.e. the sign of w(t)] alternates from one π-pulse to the next. However, for this sequence, T 0 dt 1 sin θ(t 1 ) = 0, leading to finite error at zeroth order (H (0) ) for any pulse with finite t p due to the term ∝ sin θ(t)σ y in Eq. (56). A sequence that is a symmetric cycle (leading to H (1) = 0) and for which T 0 dt 1 sin θ(t 1 ) = 0 (leading to vanishing error at zeroth order) is obtained when: (i) w(t) is periodic and odd, w(t) = −w(−t); (ii) w(t) describes identical π-pulses that come in pairs with common phase, corresponding to successive rotations about +x, +x, −x, −x, ..., with no specific assumption about the pulse shape except that w(t) > 0 ∀ t ∈ [0, τ ].
Error due to finite pulse duration then arises entirely from terms of order H (2) or higher. A sequence that fulfills the above criteria is shown in the bottom-right inset in Fig. 4(c), in which we consider the specific example of square pulses. As expected from the above discussion, the phase-alternated sequence shown in the bottom-right inset in Fig. 4(c) leads to an error [red triangles in Fig. 4(c)] that is significantly reduced compared with the original fixed-phase sequence [blue dots in Fig 4(c)]. The error is also significantly more strongly suppressed in the limit of small t p for the phase-alternated sequence, relative to the fixed-phase sequence. For the same parameters as above, an error < 1% is obtained for gt p /2π = 10 −3 , corresponding to t p = 1 ns for g/2π = 1 MHz. For gt p /2π < 10 −3 , the error quickly decreases and plateaus near the value given by Eq. (18). Finally, as explained in Section 5.2, phasealternated sequences have the additional advantage of suppressing an accumulation of deterministic pulse errors.

Qubit readout
Recently, a longitudinal qubit-cavity interaction [∝ g(a † + a)σ z ] has been considered theoretically and shown to produce a quantum nondemolition readout that is faster than the usual dispersive readout [44]. Here, we show how this type of interaction can be engineered simply by applying the Carr-Purcell sequence on a qubit with a fixed coupling to the cavity, g(t) = g ∀ t, leading to qubit readout. To simplify the discussion, throughout this section we neglect contributions from inhomogeneous broadening [i.e., we take ξ = 0 in Eq. (4)].
If the Carr-Purcell sequence shown in Fig. 1 is applied with a fixed coupling, g(t) = g ∀ t, the counter-rotating term in Eq. (4) contributes. Although this is harmful to state transfer, this term can also generate otherwise useful quantum operations. Indeed, the evolution operator from leading-order average Hamiltonian theory is then where D(α) is the displacement operator producing the coherent state |α c ≡ D(α)|0 c [50]. The interaction appearing in Eq. (58) is longitudinal with respect to σ x eigenstates, |± q . Applying U R (t f ) on |± q |0 c then gives with α ≡ −igt f /2. Thus, in combination with a qubit rotation conditioned on the cavity state [51], U R (t f ) can be used to map a qubit state to a superposition of cavity coherent states; a Schrödinger's cat state [52,53]. Alternatively, the states | ± α c can be resolved by homodyne detection of the signal leaking from the cavity, enabling quantum nondemolition readout of the qubit in the basis {|± q }.
In the rest of this section, we investigate the limitations of the qubit readout resulting from this combination of Hamiltonian engineering and homodyne detection. For averaged measurements, the appropriate figure of merit is the signal-to-noise ratio of an associated estimator for the qubit expectation value. For single-shot measurements, the appropriate figure of merit is the single-shot measurement fidelity. We will find that these two measures can indicate a high-quality readout for this protocol even in the weak-coupling regime (g < κ).

Signal-to-noise ratio
When a qubit is successively prepared and measured m 1 times to estimate an expectation value, the measurement statistics describing the mean of many independent repeated measurements (a so-called 'soft average' [54,55]) become Gaussian due to the central limit theorem. The performance of the readout is then well-characterized by the signal-to-noise ratio (SNR). For a qubit being measured through a cavity, as considered here, the SNR compares the first two moments of the measurement operator which gives the integrated homodyne-detection signal for a measurement time t f , with a out (t) the output field leaking from the cavity with damping rate κ. These first two moments of M are quantified by the measurement signal X and noise Ξ, where The signal-to-noise ratio is then simply SNR = X/Ξ.
In this section, we evaluate X and Ξ for the readout scheme described below Eq. (59), accounting for the first two nonvanishing orders in the Magnus expansion for the timeperiodic Liouvillian L [defined explicitly in Eq. (68), below]: L = L (0) + L (2) . We will show that while L (0) generates the required conditional coherent-state displacement, L (2) results in qubit switching at a rate Γ g 2 τ 2 κ/24 in the basis {|± q }. This qubit switching acts as a source of telegraph noise in the Langevin equation for the cavity field a(t) [56]. We will evaluate the SNR including noise fom qubit switching and show that for a sufficiently short pulse interval, κτ < 1, the readout considered here can result in a large SNR (SNR > 1) even in the weak-coupling regime (g < κ).
To evaluate the SNR for a given measurement scheme, it is useful to relate M to the input field a in (t) and to the field a(t) inside the cavity. This relation is given by the input-output formula [56] a out (t) = a in (t) + √ κ a(t).
Assuming that the input is vacuum, substitution of Eq. (65) into Eq. (60) gives Eqs. (66) and (67) relate M ± and M 2 ± -and thus the SNR-to simple expectation values and autocorrelation functions of the cavity field a(t). Employing standard formulas [56], these expectation values and autocorrelation functions are easily calculated knowing the time-evolution superoperator V (t, t 0 ), generating evolution for the qubit-cavity density matrix. We find V (t, t 0 ) by solving the (time-inhomogeneous) master equationV (t, t 0 ) = L(t)V (t, t 0 ).
In Eq. (68), we have introduced the Liouvillian L(t) describing cavity damping at rate κ and unitary evolution under the qubit-cavity toggling-frame Hamiltonian, H T (t), where the centerdot ("·") represents an arbitrary operator upon which the relevant superoperator is applied. In Eq. (69), H T (t) is given by Eq. (4), taking ξ = 0 and g(t) = g ∀ t.
To evaluate V (t, t 0 ) analytically, we assume that t − t 0 = 2n p τ . We then use the Magnus expansion As in average Hamiltonian theory, the terms L (k) are time-independent because L(t) is periodic, L(t + 2τ ) = L(t) ∀ t. The first few terms of the expansion in L (k) are obtained by replacing H (k) → iL (k) and H T (t) → iL(t) in Eqs. (21) to (23) [41].
To gain insight into the problem, we evaluate the SNR to leading order in the Magnus expansion, Eq. (71). In this first approach, we neglect any qubit decay that may arise from higher-order terms in the expansion. We then find According to Eqs. (72) and (73), the qubit forever remains in its initial state |± ±| q . For κt f 1, the cavity correspondingly settles in the coherent state |α α| c = | ∓ ig/κ ∓ig/κ| c . Since the cavity field leaks from the output port at a rate κ/2, this steady state leads to X ∝ κt f × g/κ ∝ gt f . In addition, noise in the output field then entirely comes from shot noise: ∆M 2 ± = κt f , giving [44] X Therefore, in this ideal scenario, signal always accumulates faster than noise, making it possible to achieve arbitrarily large SNR simply by increasing t f . In practice, qubit relaxation leads to a saturation of the signal and to an enhancement of the noise, thus limiting the achievable SNR. Qubit relaxation can be intrinsic, coming from coupling of the qubit to a decay channel independent of the cavity. Higher-order corrections to the leading-order Magnus expansion taken here also lead to qubit decay via the cavity. This can be seen by means of a short-time expansion of σ x (t) ± . Indeed, the term of order O(t) in this short-time expansion gives decay at a rate analogous to that of Purcell decay: The term of order O(t) in the above expansion of σ x (t) ± dominates over the correction term of order O(t 2 ) when κt < 256/[3(κτ ) 2 ].  Equation (84) shows that Ξ 2 contains two terms: one from photon shot noise, ∝ κt f , and an additional contribution from qubit switching, ∝ g 2 Γt 3 f . Therefore, including qubit switching, the noise grows faster than the signal (∝ t f ) for sufficiently large t f . This is visible in Fig. 5(a), in which we plot X(t f ) and Ξ(t f ) resulting from an exact numerical solution of the master equation given by Eq. (68). In Fig. 5(a), X(t f ) and Ξ(t f ) are represented by the solid black line and the dotted red line, respectively. Using the dashed blue line, we also plot Ξ(t f ) = 2κt f , expected for pure photon shot noise, Eq. (75). Clearly, excess noise due to qubit decay determines the optimal measurement time t opt. that maximizes the SNR [shown by the double arrow in Fig. 5(a)]. We evaluate t opt. analytically by maximizing SNR = X/Ξ, with X and Ξ given by Eq. (84). We find Equation (86) provides a simple relationship between the maximal SNR and the cooperativity C ≡ g 2 /κΓ, SNR (6C) 1/4 . Equation (86) gives the maximal SNR when the qubit undergoes switching in the eigenbasis of σ x . As seen above, this can be due to the subleading term L (2) in the Magnus expansion, Eq. (71), which leads the qubit to decay at the rate given in Eq. (76). When this mechanism is the dominant source of decay in the eigenbasis of σ x , we substitute Eq. (76) into Eq. (86) to find the corresponding optimal SNR, valid for Γt f 1 κt f 256/[3(κτ ) 2 ]. The last inequality arises from the short-time expansion performed in Eq. (76). Equation (87) implies that SNR > 1 is achievable even in the weak-coupling regime, g < κ. This result is shown in Fig. 5(b), in which we plot the maximal SNR obtained from an exact numerical solution of Eq. (68) as the black dots for g/κ = 1/10. This numerical result is in good agreement with the optimal SNR given in Eq. (87), displayed as the dashed blue line.
We now discuss conditions under which the Magnus expansion used here [Eq. (71)] converges. The Magnus expansion converges when 2τ 0 dt L(t) < π [41]. For g < κ, the steady-state cavity population is small: a † a(t) = (g/κ) 2 < 1 for κt f 1. In this situation, we can represent the operators a and a † by truncated matrices of small dimension, making a ( †) ∼ 1. This implies that L(t) ∼ κ, and we conclude that the Magnus expansion converges for κτ π/2 under the assumption that g < κ. This statement is consistent with Fig. 5(b), which shows excellent agreement between the exact numerical solution (black dots) and Eq. (87) (dashed blue line) for κτ < π/2.

Single-shot fidelity
In contrast to the case of many repeated measurements (described above), for a singleshot readout, the measurement statistics are typically non-Gaussian. Indeed, while the conditional probability distribution describing the integrated signal M ± would simply describe a displaced Gaussian in the absence of switching, random switching events (e.g. qubit decay due to the mechanism described above) lead to significant bimodality [57]. To characterize readout, the full probability distribution of the measurement outcomes is then needed; the first and second moments [characterized by Eqs. (61) and (62)] are typically not sufficent. A good measure of quality that accounts for the full probability distribution is the single-shot fidelity. To evaluate the fidelity, we use a readout model that takes into account qubit switching at symmetric rates Γ/2, where Γ is given by Eq. (76) [57,58]. In the same regime as above (g κ and κτ 1), this leads to a single-shot fidelity that converges asymptotically to as κτ → 0. For κτ = 0.1, this yields a single-shot fidelity of 99.95 %, showing that the error due to the first correction term in the Magnus expansion is rapidly suppressed in the limit of short pulse intervals. Equation (88) also shows that the readout proposed here can have a high singleshot fidelity even in the weak-coupling regime (g < κ). This readout may then be useful in several novel experimental settings where it is challenging to achieve strong coupling. For example, a spin qubit in a carbon nanotube has recently been successfully coupled to a microwave resonator, but the coupling achieved is marginal, g/κ ∼ 1 [5]. Alternative setups for semiconductor spin qubits in quantum dots or at single donor impurities coupled to microwave cavities have predicted couplings g/2π 1 MHz [15,43,18], typically smaller than the damping rate κ/2π = 2-10 MHz [59,60].

Conclusion
In summary, we have introduced and assessed protocols for two quantum operations relevant to cavity QED: (i) quantum state transfer between a qubit and a cavity, and (ii) qubit readout through the cavity output field.
For quantum state transfer, the protocol presented here (SQUADD) can lead to a high fidelity even in the limit of strong dephasing due to inhomogeneous broadening. This result holds also when storing the logical qubit in a collective mode of a large ensemble of N physical qubits. To evaluate the state-transfer fidelity for ensembles of physical qubits, we have shown that the dynamics of the state transfer under SQUADD is well approximated in a closed subspace formed by only four collective modes in the limit N 1. For quantum state transfer between a cavity and a single physical qubit, we have considered error arising from a finite off/on ratio in the tunable qubitcavity coupling, deterministic π-pulse errors, finite bandwidth of the coupling pulses, and finite duration of the qubit π-pulses. We have also considered phase-alternated versions of SQUADD with reduced error from finite pulse duration and deterministic over (under)-rotations.
We have shown that applying the Carr-Purcell sequence on a qubit with constant coupling to a cavity leads to a longitudinal interaction that can be used to produce a fast qubit readout (compared with the dispersive readout that is commonly used in cavity QED). This readout can have a large signal-to-noise and a high single-shot fidelity even in the weak-coupling regime. The above results for quantum state transfer and qubit readout are especially relevant to spin qubits [5,13,15,23], for which coupling to the cavity is typically weak compared with inhomogeneous broadening and/or cavity damping.
Since SQUADD builds on the well-known Carr-Purcell sequence, it may be easily incorporated into near-term experiments. In the future, applying more complex dynamical decoupling sequences (e.g., Uhrig [61] or concatenated [62] dynamical decoupling) to a qubit coupled to a cavity may be a promising avenue for both quantum state transfer and qubit readout. Indeed, these alternative protocols may allow for a better suppression of error due to qubit dephasing and cavity-mediated qubit switching.
Moving forward, the ideas presented here could lead to applications well beyond state transfer and readout. For example, going to second order in average Hamiltonian theory yields terms ∝ ig 2 τ [a 2 −(a † ) 2 ], which could be used to generate cavity squeezing (see Section 5.1). Such squeezing may be useful, e.g., to further improve qubit readout [44], or to realize a high-fidelity two-qubit gate [63,64]. In addition, by monitoring the coherence of a state that is periodically swapped between a qubit and a bosonic mode, it may be possible to characterize noise processes affecting a harmonic system (e.g., a cavity or a magnon mode [65]). This may allow for the application of noise spectroscopy methods [66] to harmonic systems in situations where dynamical decoupling through parity kicks [67] may be challenging.