<<

ARTICLE

DOI: 10.1038/s41467-017-02510-3 OPEN Achieving the Heisenberg limit in quantum metrology using

Sisi Zhou1,2, Mengzhen Zhang1,2, John Preskill3 & Liang Jiang 1,2

Quantum metrology has many important applications in science and technology, ranging from frequency spectroscopy to detection. imposes a fundamental limit on measurement precision, called the Heisenberg limit, which can be

1234567890 achieved for noiseless quantum systems, but is not achievable in general for systems subject to noise. Here we study how measurement precision can be enhanced through quantum error correction, a general method for protecting a quantum system from the damaging effects of noise. We find a necessary and sufficient condition for achieving the Heisenberg limit using quantum probes subject to Markovian noise, assuming that noiseless ancilla systems are available, and that fast, accurate quantum processing can be performed. When the sufficient condition is satisfied, a quantum error-correcting code can be constructed that suppresses the noise without obscuring the signal; the optimal code, achieving the best possible preci- sion, can be found by solving a semidefinite program.

1 Departments of Applied Physics and Physics, Yale University, New Haven, CT 06511, USA. 2 Yale Quantum Institute, Yale University, New Haven, CT 06520, USA. 3 Institute for and Matter, California Institute of Technology, Pasadena, CA 91125, USA. Correspondence and requests for materials should be addressed to S.Z. (email: [email protected]) or to L.J. (email: [email protected])

NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications 1 ARTICLE NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3

25–28 σ uantum metrology concerns the task of estimating a errors , but not for dephasing ( z) noise acting on the probe, Qparameter, or several parameters, characterizing the even if arbitrary quantum controls and feedback are allowed16. σ Hamiltonian of a quantum system. This task is per- (Here x,y,z denote the Pauli matrices.) For this example, we say σ “ ” σ σ formed by preparing a suitable initial state of the system, allowing that x noise is perpendicular to the z signal, while z noise is it to evolve for a specified time, performing a suitable measure- “parallel” to the signal. In some previous work on improving ment, and inferring the value of the parameter(s) from the metrology using QEC, perpendicular noise has been measurement outcome. Quantum metrology is of great impor- assumed25,26, but this assumption is not necessary—for a qubit tance in science and technology, with wide applications including probe, HL scaling is achievable for any noise channel with just frequency spectroscopy, magnetometry, accelerometry, gravi- one Hermitian jump operator L, except in the case where the metry, gravitational wave detection, and other high-precision signal Hamiltonian H commutes with L37. – measurements1 9. In this paper, we extend these results to any finite-dimensional Quantum mechanics places a fundamental limit on measure- probe, finding the necessary and sufficient condition on the noise ment precision, called the Heisenberg limit (HL), which con- for achievability of HL scaling. This condition is formulated as an strains how the precision of parameter estimation improves as the algebraic relation between the signal Hamiltonian whose coeffi- total probing time t increases. According to HL, the scaling of cient is to be estimated and the Lindblad operators {Lk} that precision with t can be no better than 1/t; equivalently, precision appear in the master equation describing the evolution of the scales no better than 1/N with the total number of probes N used probe. We prove that (1) if the signal Hamiltonian can be in an experiment. For a noiseless system, HL scaling is attainable expressed as a linear combination of the identity operator I, the “ ” y in principle by, for example, preparing an entangled cat state of Lindblad operators Lk, their Hermitian conjugates Lk and the 10–12 y N probes . In practice, though, in most cases environmental products LkLj for all k, j, then SQL scaling cannot be surpassed. decoherence imposes a more severep limitationffiffiffiffi on precision; (2) Otherwise HL scaling is achievable by using a QEC code such instead of HL, precision scales like 1= N, called the standard that the effective “logical” evolution of the probe is noiseless and quantum limit (SQL), which can be achieved by using N inde- unitary. Notably, under the assumptions considered here, either – pendent probes13 18. The quest for measurement schemes sur- SQL scaling cannot be surpassed or HL scaling is achievable via passing the SQL has inspired a variety of clever strategies, such as quantum coding; in contrast, intermediate scaling is possible in squeezing the vacuum1, optimizing the probing time19, mon- some other metrology scenarios19. For the case where our suffi- itoring the environment20,21, and exploiting non-Markovian cient condition is satisfied, we explicitly construct a QEC code – effects22 24. that achieves HL scaling. Furthermore, we show that searching Quantum error correction (QEC) is a particularly powerful tool for the QEC code that achieves optimal precision can be for- – for enhancing the precision of quantum metrology25 30. Quan- mulated as a semidefinite program (SDP) that can be efficiently tum error correction is a method for reducing noise in quantum solved numerically, and can be solved analytically in some special – channels and quantum processors31 33. In principle, it enables a cases. Our sufficient condition cannot be satisfied if the noise noisy quantum computer to simulate faithfully an ideal is full rank, and is therefore not applicable for generic computer, with reasonable overhead cost, if the noise is not too noise. However, for noise which is ϵ-close to meeting our cri- strong or too strongly correlated. But the potential value of QEC terion, using the QEC code ensures that HL scaling can be in quantum metrology has not yet been fully fleshed out, even as a maintained approximately for a time Oð1=ϵÞ, before crossing over matter of principle. A serious obstacle for applications of QEC to to asymptotic SQL scaling. sensing is that it may in some cases be exceedingly hard to dis- tinguish the signal arising from the Hamiltonian evolution of the probe system from the effects of the noise acting on the probe. Results Nevertheless, it has been shown that QEC can be invoked to Sequential scheme for quantum metrology. We assume that the – achieve HL scaling under suitable conditions25 28, and experi- probes used for parameter estimation are subject to noise ments demonstrating the efficacy of QEC in a room-temperature described by a Markovian master equation. In addition to the hybrid register have recently been conducted34. probe system, the experimentalist also has noiseless ancilla qubits As is the case for , we should expect at her disposal. She can apply fast, noiseless quantum gates that positive (or negative) statements about improving metrology via act jointly on the ancilla and probe; she can also perform perfect QEC to be premised on suitable assumptions about the properties ancilla measurements, and reset the ancillas after measurement. of the noise and the capabilities of our quantum hardware. But We endow the experimentalist with these powerful tools what assumptions are appropriate, and what can be inferred from because we wish to address, as a matter of principle, how these assumptions? In this paper, we assume that the probes used effectively QEC can overcome the deficiencies of the noisy probe for parameter estimation are subject to noise described by a system. Our scenario may be of practical interest as well, in Markovian master equation35,36, where the strength and structure hybrid quantum systems where ancillas are available, which have of this noise is beyond the experimentalist’s control. However, a much longer time than the probe. For example, aside from the probe system, the experimentalist also has noise- sensing of a magnetic field with a probe electron spin can be less ancilla qubits at her disposal, and the ability to apply noiseless enhanced by using a quantum code, which takes advantage of the quantum gates that act jointly on the ancilla and probe; she can long coherence time of a nearby (ancilla) nuclear spin in also perform perfect ancilla measurements, and reset the ancillas diamond34. In cases where noise acting on the ancilla is weak but after measurement. Furthermore, we assume that a quantum gate not completely negligible, we may be able to use QEC to enhance or measurement can be executed in an arbitrarily short time the coherence time of the ancilla, thus providing better (though the Markovian description of the probe’s noise is justification for our idealized setting in which the ancilla is assumed to be applicable no matter how fast the processing). effectively noiseless. Our assumption that quantum processing is Previous studies have shown that whether HL scaling can be much faster than characteristic decoherence rates is necessary for achieved by using QEC to protect a noisy probe depends on the QEC to succeed in quantum computing as well as in quantum algebraic structure of the noise. For example, if the probe is a metrology, and recent experimental progress indicates that this qubit (two-dimensional quantum system), then HL scaling is assumption is applicable in at least some realistic settings. For σ fl σ possible when detecting a z signal in the presence of bit- ip ( x) example, in superconducting devices, QEC has reached the break-

2 NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3 ARTICLE

a

   dt dt dt Control Control Control Preparation Measuremet Ancillae + probe

Sensing time t

c b Signal m   dt dt

N Code m⊥   dt dt

Noise n Control Control Preparation Measuremet Ancillae + probes

Sensing time t /N

Fig. 1 Metrology schemes and qubit probe. a The sequential scheme. One probe sequentially senses the parameter for time t, with quantum controls applied every dt. b The parallel scheme. N probes sense the parameter for time t/N in parallel. The parallel scheme can be simulated by the sequential scheme. c The relation between the signal Hamiltonian, the noise, and the QEC code on the Bloch sphere for a qubit probe even point where the lifetime of an encoded qubit exceeds actually apply more generally. If H(ω) is not a linear function of the natural lifetime of the constituents of the system;38 one- and ω, the coding scheme we describe below can be repeated many two-qubit logical operations have also been demonstrated39,40. times if necessary, using our latest estimate of ω after each round Moreover, if sensing could be performed using a probe encoded to adjust the scheme used in the next round. By including in the within a noiseless subspace or subsystem41, then active error protocol an inverse Hamiltonian evolution step expðÞiHðÞω^ dt correction would not be needed to protect the probe, making the applied to the probe, where ω^ is the estimated value of ω, we can QEC scheme more feasible using near-term technology. justify the linear approximation when ω^ is sufficiently accurate. In accord with our assumptions, we adopt the sequential The asymptotic scaling of precision with the total probing time is scheme for quantum metrology37,42,43 (Fig. 1a). In this scheme, a not affected by the preliminary adaptive rounds44. single noisy probe senses the unknown parameter for many We denote by HA the d-dimensional Hilbert space of a rounds, where each round lasts for a short time interval dt, and noiseless ancilla system, whose evolution is determined solely by the total number of rounds is t/dt, where t is the total sensing our fast and accurate quantum controls. Over the small time time. In between rounds, an arbitrary (noiseless) quantum interval dt, during which no controls are applied, the ancilla operation can be applied instantaneously, which acts jointly on evolves trivially, and the joint state ρ of probe and ancilla evolves the probe and the noiseless ancillas. The rapid operations between according to the quantum channel: rounds empower us to perform QEC, suppressing the damaging E ðρÞ¼ ρ iω½G; ρ dt effects of the noise on the probe. Note that this sequential scheme dt no Pr can simulate a parallel scheme (Fig. 1b), in which N probes ρ y 1 y ; ρ 2 ; ð2Þ 37,42 þ Lk Lk 2 LkLk dt þ OdtðÞ simultaneously sense the parameter for time t/N . k¼1

Necessary and sufficient condition for HL. We denote the d- where G, Lk are shorthand for G I, Lk I, respectively. We fi dimensional Hilbert space of our probe by HP, and we assume the assume that this time interval dt is suf ciently small that ρ state p of the probe evolves according to a time-homogeneous corrections higher order in dt can be neglected. In between Lindblad master equation of the form (with ħ = 1)31,35,36, rounds of sensing, each lasting for time dt, control operations hi no acting on ρ are applied instantaneously. dρ Xr p ; ρ ρ y 1 y ; ρ ; Our conclusions about HL and SQL scaling of parameter ¼iH p þ Lk pLk LkLk p ð1Þ dt k¼1 2 estimation make use of an algebraic condition on the master equation that we will refer to often, and it will therefore be ’ where H is the probe s Hamiltonian, {Lk} are the Lindblad jump convenient to have a name for this condition. We will call it the operators, and r is the “rank” of the noise channel acting on the Hamiltonian-not-in-Lindblad span (HNLS) condition, or simply probe (the smallest number of Lindblad operators needed to HNLS, an acronym for “Hamiltonian-not-in-Lindblad span.” We y y describe the channel). The Hamiltonian H depends on a para- denote by S the linear span of the operators I, Lk, Lk, LkLj (for all meter ω, and our goal is to estimate ω. For simplicity, we will k and j ranging from 1 to r), and say that the Hamiltonian H assume that H = ωG is a linear function of ω, but our arguments obeys the HNLS condition if H is not contained in S. Now we can

NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications 3 ARTICLE NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3 state our main conclusion about parameter estimation using fast When the noise is not perpendicular to the signal, then not just and accurate quantum controls as Theorem 1. the jumps but also the Hamiltonian evolution can rotate the joint Theorem 1: Consider a finite-dimensional probe with Hamil- state of probe and ancilla away from the code space. However, tonian H = ωG, subject to Markovian noise described by a after evolution for the short time interval dt, the overlap with the Lindblad master equation with jump operators {Lk}. Then ω can code space remains large, so that the projection onto the code be estimated with HL (Heisenberg-limited) precision if and only space succeeds with probability 1 − O(dt2). Neglecting O(dt2) if G and {Lk} obey the HNLS (Hamiltonian-not-in-Lindblad- corrections, then, the joint probe-ancilla state rotates noiselessly span) condition. in the code space, at a rate determined by the component of the Theorem 1 applies if the ancilla is noiseless, and also for an Hamiltonian evolution along the code space. As long as this ancilla subject to Markovian noise obeying suitable conditions, as component is nonzero, HL scaling can be achieved. we discuss in the Methods. We will see that this reasoning can be extended to any finite- dimensional probe satisfying HNLS, including quantum many- Qubit probe. To illustrate how Theorem 1 works, let’s look body systems and (appropriately truncated) bosonic channels. at the case where the probe is a qubit, which has been Here we briefly mention a few other cases where HNLS applies, discussed in detail in ref. 37. Suppose one of the Lindblad and therefore HL scaling is achievable. (1) For a many-qubit operators is L ∝ n · σ, where n = n + in is a normalized complex system, suppose that each Lindblad jump operator Lk is 1 r i y 3-vector and nr, ni are its real and imaginary parts, so that supported on no more than t qubits (hence each LkLj is y σ σ ´ σ L1L1 / ðÞn ðÞn ¼ I þ 2ðÞni nr .Ifnr and ni are not supported on no more than 2t qubits), and the Hamiltonian parallel vectors, then nr, ni, and ni × nr are linearly independent, contains at least one term acting on at least 2t + 1 qubits. Then y y which means that I, L1, L1, and L1L1 span the four-dimensional HNLS holds. (2) Consider a d-dimensional system (a qudit), and space of linear operators acting on the qubit. Hence HNLS cannot define generalized Pauli operators be satisfied by any qubit Hamiltonian, and therefore parameter Xd1 Xd1 estimation with HL scaling is not possible according to Theorem π = X ¼ jik þ 1 hjk ; Z ¼ e2 ik djik hjk ; ð6Þ 1. We conclude that for HL scaling to be achievable, nr and ni k¼0 k¼0 must be parallel, which means that (after multiplying L1 by a 37 phase factor if necessary) we can choose L1 to be Hermitian . Moreover, if L1 and L2 are two linearly independent Hermitian (where addition is modulo d). Suppose that the Hamiltonian H traceless Lindblad operators, then {I, L1, L2, L1L2} span the space (Z) is a non-constant function of Z and that there is a single of qubit linear operators and HL scaling cannot be achieved. In Lindblad jump operator L(X) which is a function of X. Then fact, for a qubit probe, HNLS can be satisfied only if there is a HNLS holds. HNLS may also apply for a multi-qubit sensor with single Hermitian (not necessarily traceless) Lindblad operator L, qubits at distinct spatial positions, where the signal and noise are and the Hamiltonian does not commute with L. parallel for each individual qubit, but the signal and noise depend We will describe below how to achieve HL scaling for any on position in different ways45. master equation that satisfies HNLS, by constructing a two- We must explain how, when HNLS holds, a quantum code can dimensional QEC code that protects the probe from the be constructed that achieves HL scaling. But first we will discuss Markovian noise. To see how the code works for a qubit probe, why HL is impossible when HNLS fails. 1 σ ∝ · σ suppose G ¼ 2 m and L n , where m and n are unit vectors in R3 (Fig. 1c). Then the basis vectors for the QEC code may be Non-achievability of HL when HNLS fails. The necessary con- chosen to be: dition for HL scaling can be derived from the quantum – Cramér–Rao bound46 48 jiC ¼ jim ; þ ji0 ; jiC ¼ jim ; ji1 ; ð3Þ 0 ? P A 1 ? P A pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi δω^ = ρ ; ; ± 1 R FðÞωðtÞ ð7Þ hereji 0 A,1jiA are basis states for the ancilla qubit, and jim? P are the eigenstates with eigenvalues ±1ofm⊥ · σ where m⊥ is the (normalized) component of m perpendicular to n. In particular, if here ω^ denotes any unbiased estimator for the parameter ω, and ⊥ ; δω^ ’ ρ m n (perpendicular noise), then jiC0 ¼ jim þ Pji0 A and is that estimator s standard deviation. FðÞωðtÞ is the quan- ; ρ ji¼C1 jim Pji1 A, the coding scheme previously discussed tum Fisher information (QFI) of the state ω(t); this state is 25–28 ρ in refs. . obtained by preparing an initial state in of the probe, and then In the case of perpendicular noise, we estimate ω by tracking evolving this state for total time t, where the evolution is governed the evolution in the code space of a state initially preparedpffiffiffi as (in a by the ω-dependent probe Hamiltonian H(ω), the Markovian streamlined notation) ψðÞ0 ¼þðÞjiþ; 0 ji; 1 = 2; neglecting noise acting on the probe, and our fast quantum controls. For a the noise, this state evolves in time t to scheme in which the measurement protocol is repeated many times in succession, R denotes the number of such repetitions. ψ 1ffiffiffi iωt=2 ; iωt=2 ; : jiðÞt ¼ p e jiþ 0 þ e ji 1 ð4Þ Here we show that FðÞρωðtÞ is at most asymptotically linear in t 2 when the Hamiltonian H(ω) is contained in the linear span y y If a jump then occurs at time t, the state is transformed to (denoted S)ofI, Lk, Lk, and LkLj, which means that SQL scaling cannot be surpassed in this case. 1 ω = ω = jiψ′ðÞt ¼ pffiffiffi ei t 2ji; 0 þ ei t 2jiþ; 1 : ð5Þ Though it is challenging to compute the maximum attainable 2 QFI for arbitrary quantum channels, useful upper bounds on QFI Jumps are detected by performing a two-outcome measure- can be derived, which provide lower bounds on the precision of 15–18,37,42,49 ment that projects onto either the span of {|+, 0〉, |−,1〉} (the code quantum metrology . The quantum channel describ- space) or the span of {|−,0〉, |+, 1〉} (orthogonal to the code space), ing the joint evolution of probe and ancilla has a Kraus operator and when detected they are immediately corrected by flipping the representation probe. Because errors are immediately corrected, the error- X ρ ρ y; corrected evolution matches perfectly the ideal evolution (without EdtðÞ¼ Kk Kk ð8Þ noise), for which HL scaling is possible. k

4 NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3 ARTICLE

fi Π and in terms of these Kraus operators we de ne C denote the projection onto the code space. Jumps are cor- X fi 31–33 α _ y _ _ y _ ; rectable if the code satis es the error correction conditions , dt ¼ Kk Kk ¼ K K ð9Þ namely: k Π Π λ Π ; ; X ½1 CLk C ¼ k C 8k ð17Þ β _ y _ y ; dt ¼ i Kk Kk ¼ iK K ð10Þ k Π y Π μ Π ; ; ; ½2 CLkLj C ¼ kj C 8k j ð18Þ where we express the Kraus operators in vector notation T λ μ K :¼ ðÞK0; K1; ¼ , and the over-dot means the derivative with for some complex numbers k and kj. The error-corrected joint ω ρ respect to .If in is the initial joint state of probe and ancilla at state of probe and ancilla evolves according to the unitary channel time 0, and ρ(t) is the corresponding state at time t, then the (asymptotically) upper bound on the QFI  dρ ÀÁ pffiffiffiffiffiffiffiffiffiffiffi ¼iH½; ρ ð19Þ ρ t α t 2 β β α eff FðÞðtÞ 4dtkkdt þ 4 dt kkdt ðþkkdt 2 kkdt ð11Þ dt = Π Π = ω (kk denotes the operator norm) derived by the “channel where Heff CH C Geff. There is a code state for which the evolution depends nontrivially on ω provided that extension method” holds for any choice of ρin even when fast and accurate quantum controls are applied during the evolu- ½3 ΠCGΠC ≠ constant ΠC: ð20Þ tion37. This upper bound on the QFI provides a lower bound on ω the precision δω^ via Eq. (7). For this noiseless evolution with effective Hamiltonian Geff, Kraus representations are not unique—for any matrix u the QFI of the encoded state at time t is † satisfying u u = I, K′ = uK represents the same channel as K. ÂÃÀÁ ρ 2 ρ 2 ρ 2 ; Hence, we can tighten the upper bound on the QFI by FðÞðtÞ ¼ 4t tr inGeff ðÞtrðÞinGeff ð21Þ minimizing the RHS of Eq. (11) over all such valid Kraus ρ = representations. We see that where in is the initial state at time t 0. The QFI is maximized by ÀÁ ÀÁ y choosing the initial pure state K_ ′ ¼ u K_ ihK ; K_ ′y ¼ K_ ihK uy ð12Þ 1 jiψ ¼ pffiffiffi ðÞjiλ þ jiλ ; ð22Þ y _ fi α β in min max where h ¼ iu u. Therefore, to nd dt and dt providing 2 the tightest upper bound on the QFI, it suffices to replace K_ by _ K ihK and to optimize over the Hermitian matrix h. where jiλmin , jiλmax are the eigenstates of Geff with the minimal To evaluate the boundpffiffiffiffiffi for asymptotically large t, we expand and maximal eigenvalues; with this choice the QFI is α , β , h in powers of dt: dt dt  ρ 2 λ λ 2: pffiffiffiffiffi FðÞ¼ðtÞ t ðÞmax min ð23Þ ð0Þ ð1Þ ð2Þ 3=2 αdt ¼ α þ α dt þ α dt þ Odt ; ð13Þ By measuring in the appropriate basis at time t, we can ω – pffiffiffiffiffi ÀÁ estimate with a precision that saturates the Cramér Rao bound β βð0Þ βð1Þ βð2Þ βð3Þ 3=2 2 ; dt ¼ þ dt þ dt þ dt þ Odt ð14Þ in the asymptotic limit of a large number of measurements, hence realizing HL scaling. pffiffiffiffiffi ÀÁ To prove the sufficient condition in Theorem 1, we will now ð0Þ ð1Þ ð2Þ ð3Þ 3=2 2 : h ¼ h þ h dt þ h dt þ h dt þ Odt ð15Þ show that a code with properties (1)–(3) can be constructed fi α whenever HNLS is satisfied. (For further justification of these We show in the Methods that the rst two terms in dt and the fi β conditions see the Methods.) In this code construction we make rst four terms in dt can all be set to 0 by choosing a suitable h, α = use of a noiseless ancilla system, but as we discuss in the Methods, assuming that HNLS is violated. We therefore have dt O(dt) β = 2 the construction can be extended to the case where the ancilla and dt O(dt ), so that the second term in the RHS of Eq. (11) vanishes as dt → 0: system is subject to Markovian noise obeying suitable conditions. To see how the code is constructed, note that the d- ð2Þ FðÞρðtÞ 4 α t; ð16Þ dimensional Hermitian matrices form a real Hilbert space where the inner product of two matrices A and B is defined to be tr(AB). proving that SQL scaling cannot be surpassed when HNLS is Let S denote the subspace of Hermitian matrices spanned by I, violated (the necessary condition in Theorem 1). We require the y y y y y y Lk þ Lk, iLk Lk , LkLj þ Lj Lk, and iLkLj Lj Lk for all k, j. probe to be finite dimensional in the statement of Theorem 1 Then G has a unique decomposition into G ¼ G þ G , where α β fi k ? because otherwise the norm of dt or dt could be in nite. The G 2Sand G ?S. fi k ? theorem can be applied to the case of a probe with an in nite- If HNLS holds, then G? is nonzero. It must also be traceless, in dimensional Hilbert space if the state of the probe is confined to a order to be orthogonal to I, which is contained in S. Therefore, finite-dimensional subspace even for asymptotically large t. using the spectral decomposition, we can write 1 ρ ρ ρ ρ G? ¼ 2 ðÞðtrjjG? 0 1Þ, where 0 and 1 are trace-onepffiffiffiffiffiffiffi positive 2 QEC code for HL scaling when HNLS holds. To prove the matrices with orthogonal support and jjG? :¼ G . Our QEC fi ? suf cient condition for HL scaling, we show that a QEC code code is chosen to be the two-dimensional subspace of HP HA ω | 〉 | 〉 fi ρ achieving HL scaling can be explicitly constructed if H( ) is not spanned by C0 and C1 , which are normalized puri cations of 0 ρ in the linear span S. Our discussion of the qubit probe indicates and 1 respectively, with orthogonal support in HA. (If the probe how a QEC code can be used to achieve HL scaling for estimating is d-dimensional, a d-dimensional ancilla can purify its state.) ω the parameter . The code allows us to correct quantum jumps Because the code basis states have orthogonal support on HA,it whenever they occur, and in addition the noiseless error- follows that, for any O acting on HP, corrected evolution in the code space depends nontrivially on ; ω. Similar considerations apply to higher-dimensional probes. Let hjC0 O ICji¼1 0 ¼ hjC1 O ICji0 ð24Þ

NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications 5 ARTICLE NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3

ab G ⊥ G ∉ S G ⊥ ~ ~ G = G ⊥ – G||

~ G|| S S

~ ~ G = G ⊥ – G|| = 0 G ⊥ = 0

G ∉ S S No code exists S

G G Fig. 2 Schematic illustrationpffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi of HNLS and code optimization. a ? is the projection of onto S in the Hilbert space of Hermitian matrices equipped with the ~} Hilbert-Schmidt norm trðO OÞ. G?≠0 if and only if G2S= , which is the HNLS condition. b G is the projection of G onto S in the linear space of Hermitian O ψ O ψ G~} G~} matrices equipped with the operator norm kk¼ maxjiψ hjji. In general, the optimal QEC code can be contructed from and is not necessarily equal to G? and furthermore have seen how to construct a code for which ÀÁ tr G2 trðÞðÞjiC0 hjC0 jiC1 hjC1 ðÞO I λ λ ? : ð30Þ ð25Þ max min ¼ 2 ¼ tr ðÞ¼ðÞρ ρ O 2trðÞG?O : trjjG? 0 1 trjjG? It is possible, though, that a larger value of this difference of In particular, for any O in the span S we have trðÞ¼G?O 0, eigenvalues could be achieved using a different code, improving and therefore the precision by a constant factor (independent of the time t). | 〉 | 〉 fi To search for a better code, with basis states { C0 , C1 }, de ne hjC ðÞO I ji¼C hjC ðÞO I jiC : ð26Þ 0 0 1 1 ρ~ ; ρ~ ; 0 ¼ trAðÞjiC0 hjC0 1 ¼ trAðÞjiC1 hjC1 ð31Þ Code properties (1)–(3) now follow from Eqs. (24) and (26). For this two-dimensional code, the projector onto the code space and consider is ~ ρ~ ρ~ : G ¼ 0 1 ð32Þ Π ; C ¼ jiC0 hjC0 þ jiC1 hjC1 ð27Þ Conditions (1)–(2) on the code imply ÀÁ ~ ; ; ð33Þ and therefore tr GO ¼ 0 8O 2S

Π ðÞO I Π ¼ hjC ðÞO I jiC Π ð28Þ and we want to maximize C C 0 0 C ÀÁÀÁ ~ ~ λmax λmin ¼ tr Geff G ¼ tr G?G ; ð34Þ for O 2S, which implies properties (1) and (2) because Lk and y fi ~ LkLj are in S. Property (3) isÀÁ also satis ed by the code, because over matrices G of the form Eq. (32) subject to Eq. (33). Note that 2 = > ~ hiC0jjG C0 hiC1jjG C1 ¼ 2tr G? trjjG? 0, which means that G is the difference of two normalized density operators, and Π Π ~ ~ the diagonal elements of CG C are not equal when projected therefore satisfies tr G 2. In fact, though, if G obeys the onto the code space. Thus, we have demonstrated the existence of constraint Eq. (33), then the constraint is still satisfied if we ~ a code with properties (1) and (3). rescaleÀÁG by a real constant greater thanÀÁ one, which increases ~ ~ tr G ?G ; hence the maximum of tr G?G is achieved for fi ~ ρ~ ρ~ Code optimization. When HNLS is satis ed, we can use our tr G ¼ 2, which means that 0 and 1 have orthogonal support. 1 ρ ρ QEC code, along with fast and accurate quantum control, to Now recall that G? ¼ 2 ðÞtrjjG? ðÞ0 1 is also (up to achieve noiseless evolution of the error-corrected probe, governed normalization) a difference of density operators with orthogonal = Π Π = ω Π by the effective Hamiltonian Heff CH C Geff where C is support, and obeys the constraint Eq. (33). The quantity to be the orthogonal projection onto the code space. Because the maximized is proportional to optimal initial state Eq. (22) is a superposition of just two ρ ρ ρ~ ρ~ ρ ρ~ ρ ρ~ ρ ρ~ ρ ρ~ : fi tr½¼ðÞ0 1 ðÞ0 1 trðÞ0 0 þ 1 1 0 1 1 0 ð35Þ eigenstates of Geff, a two-dimensional QEC code suf ces for achieving the best possible precision. For a code with basis states If ρ and ρ are both rank 1, then the maximum is achieved by | 〉 | 〉 0 1 { C0 , C1 }, the effective Hamiltonian is ρ~ ρ ρ~ ρ – fi choosing 0 ¼ 0 and 1 ¼ 1. Conditions (1) (2) are satis ed by | 〉 | 〉 fi ρ ρ choosing C0 and C1 to be puri cations of 0 and 1 with Geff ¼ jiC0 hjC0 G?jiC0 hjC0 þ jiC1 hjC1 G?jiC1 hjC1 ; ð29Þ orthogonal support on HA. Thus, we have recovered the code we ρ ρ constructed previously. If 0 or 1 is higher rank, though, then a here we have ignored the contribution due to Gk, which is an different code achieves a higher maximum, and hence better irrelevant additive constant if the code satisfies condition (2). We precision for parameter estimation.

6 NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3 ARTICLE

Geometrical picture. There is an alternative description of the the precision of our estimate of ω, but only by a factor of 4 code optimization, with a pleasing geometrical interpretation. As if we use the optimal QEC code. HL scaling can still be discussed in the Methods, the optimization can be formulated as a maintained. The scaling δω^ 1=n2 of the optimal precision SDP with a feasible dual program. By solving the dual program arises from the nonlinear boson-boson interactions in the we find that, for the optimal QEC code, the QFI is Hamiltonian Eq. (39)51. fi ~2 } 2 ~ 2 To nd the code states, we note that the eigenstate of ðÞn FðÞ¼ρðtÞ 4t min G G ; 2 ~ ? k ð36Þ with the lowest eigenvalue n =8isjin ¼ n=2 , while the largest Gk2S eigenvalue þn2=8 has the two degenerate eigenstates |n = 0〉 and jin ¼ n . The code condition (2) requires that both code vectors where kk denotes the operator norm. In this sense, the QFI is † have the same expectation value of L L ∝ n, and we therefore may determined by the minimal distance between G? and S (Fig. 2b). We can recover the solution to the primal problem from the choose ~} ÀÁ solution to the dual problem. We denote by Gk the choice of = ; 1ffiffiffi ~ fi jiC0 ¼ jin 2 ji0 jiC1 ¼ p ji0 þjin ji1 ð42Þ Gk 2Sthat minimizes Eq. (36), and we de ne P A 2 P P A ~ } ~ } G :¼ G? G : ð37Þ k as the code achieving optimal precision. For n 4, the ancilla Then G~ that maximizes Eq. (34) has the form may be discarded, and we can use the simpler code ~ } } ÀÁ G ¼ ~ρ ~ρ ; ð38Þ 1ffiffiffi 0 1 jiC0 ¼ jin=2 ; jiC1 ¼ p ji0 þjin ; ð43Þ P 2 P P ρ~} ~} where 0 is a density operator supported on the eigenspace of G ρ~} with the maximal eigenvalue, and 1 is a density operator which is easier to realize experimentally. Eqs. (17) and (18) are supported on the eigenspace of G~} with the minimal eigenvalue. still satisfied without the ancilla, because the states ~ The minimization in Eq. (36) ensures that G of this form can be fgjiC0 ; jiC1 ; aCji0 ; aCji1 are all mutually orthogonal. This chosen to obey the constraint Eq. (33). encoding Eq. (43) belongs to the family of “binomial quantum In the noiseless case ðÞS¼spanfIg , the minimum in Eq. (36) codes” which, as discussed in ref. 52, can protect against loss of ~ occurs when the maximum and minimum eigenvalues G? Gk bosonic excitations. have the same absolute value, and then the operator norm is half An experimental realization of this coding scheme can be the difference of the maximum and minimum eigenvalues of G?. achieved using tools from circuit , by Hence, we recover the result Eq. (23). When noise is introduced, coupling a single transmon qubit to two microwave waveguide S swells and the minimal distance shrinks, lowering the QFI and resonators. For example, when n is a multiple of 4, jiC0 and jiC1 reducing the precision of parameter estimation. If HNLS fails, both have even photon parity while aCji0 and aCji1 both have then the minimum distance is zero, and no QEC code can achieve odd parity. Then QEC can be carried out by the following HL scaling, in accord with Theorem 1. procedure: (1) a quantum non-demolition parity measurement is performed to check whether photon loss has occurred38,53. (2) If Kerr effect with photon loss. To illustrate how the optimization photon loss is detected, the initial logical encoding is restored 38,39 procedure works, consider a bosonic mode with the nonlinear using optimal control pulses . (3) If there is no photon loss, (Kerr effect50) Hamiltonian the is projected onto the code space ÀÁ ; 54 2 spanfgjiC0 jiC1 . The probability of an uncorrectable logical HðωÞ¼ω aya ; ð39Þ error becomes arbitrarily small if the QEC procedure is sufficiently fast compared to the photon loss rate. Meanwhile, where our objective is to estimate ω. In this case, the probe is the Kerr signal accumulates coherently in the relative phase of | infinite dimensional, but suppose we assume that the occupation 〉 | 〉 † C0 and C1 , so that HL scaling can be attained for arbitrarily fast number n = a a is bounded: n n, where n is even. The noise quantum control. For integer values of n that are not a multiple of source is photon loss, with Lindblad jump operator L / a. Can 4, coding schemes can still be constructed that protect against we find a QEC code that protects the probe against loss and photon loss, as described in ref. 52. achieves HL scaling for estimation of ω? fi α β γ δ To solve the dual program, we nd real parameters , , , , Approximate error correction. Generic Markovian noise is full which minimize the operator norm of rank, which means that the span S is the full Hilbert space HP of n~2 :¼ n2 þ αn þ βa þ γay þ δ; ð40Þ the probe; hence the HNLS criterion of Theorem 1 is violated for any probe Hamiltonian H(ω), and asymptotic SQL scaling cannot † where n n. Since a and a are off-diagonal in the occupation be surpassed. Therefore, for any Markovian noise model that number basis, we should set β and γ to zero for the purpose of meets the HNLS criterion, the HL scaling achieved by our QEC minimizing the difference between the largest and smallest code is not robust against generic small perturbations of the noise eigenvalue of n~2. After choosing α such that n~2 is minimized at model. n ¼ n=2, and choosing δ so that the maximum and minimum We should therefore emphasize that a substantial improvement eigenvalues of n~2 are equal in absolute value and opposite in sign, in precision can be achieved using a QEC code even in cases we have where HNLS is violated. Consider in particular a Markovian  master equation with Lindblad operators divided into two sets ÀÁ 2 } 1 1 n~2 ¼ n n n2; ð41Þ {Lk}(L-type noise) and {Jm}(J-type noise), where the J-type noise 2 8 is parametrically weak, with noise strength

X ~2 } 2= ϵ : y which has operator norm ðÞn ¼ n 8; hence the optimal ¼ JmJm ð44Þ QFI after evolution time t is FðÞ¼ρðtÞ t2n4=16, according to m Eq. (36). For comparison, the minimal operator norm is n2=2 (kk denotes the operator norm). If we use the optimal code for a noiseless bosonic mode with n n. We see that loss reduces that protects against L-type noise, then the joint logical state of

NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications 7 ARTICLE NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3 probe and ancilla evolves according to a modified master Methods = Π Π Linear scaling of the QFI equation, with Hamiltonian Heff CH C, and effective Lindblad . Here we prove that the QFI scales linearly with the operators J acting within the code space, where evolution time t in the case where the HNLS condition is violated. We follow the m,j proof in ref. 37, which applies when the probe is a qubit, and generalize their proof to the case where the probe is d-dimensional. We approximate the quantum channel X y ϵ: Jm; j Jm; j ð45Þ E ðÞ¼ρ ρ iω½G; ρ dt dt no m; j Pr ρ y 1 y ; ρ 2 ð46Þ þ Lk Lk 2 LkLk dt þ OdtðÞ k¼1 (See the Methods for further discussion.) This means that the state of the error-corrected probe deviates by the following one: ϵ 1 Xr by a distance OðÞt (in the L norm) from the (effectively ~ y E ðÞ¼ρ K ρK ; noiseless) evolution in the absence of J-type noise. Therefore, dt k k ð47Þ k¼0 using this code, the QFI of the error-corrected probe increases  P pffiffiffiffiffi quadratically in time (and the precision δω^ scales like 1/t)up ω 1 r y ≥ where K0 ¼ I þi G 2 k¼1 LkLk dt and Kk ¼ Lk dt for k 1. The =ϵ ~ 2 until an evolution time t / 1 , before crossing over to approximation is valid because the distance between Edt and EÀÁdt is O(dt ) and the t t 2 asymptotic SQL scaling. sensing time is divided into dt segments, meaning the error O dt dt ¼ OðtdtÞ introduced by this approximationÀÁ in calculatingÀÁ the QFI vanishesÀÁ as dt→0. Next, we _ y _ _ y calculate the operators α ¼ K ihK K ihK and β ¼ i K ihffiffiffiffiffiK K for ~ dt dt p Discussion the channel Edt ðρÞ, and expand these operators as a power series in dt: Noise limits the precision of quantum sensing. Quantum error pffiffiffiffiffi  α αð0Þ αð1Þ αð2Þ 3=2 ; correction can suppress the damaging effects of noise, thereby dt ¼ þ dt þ dt þ Odt ð48Þ improving the fidelity of quantum information processing and fi quantum communication, but whether QEC improves the ef - pffiffiffiffiffi ÀÁ β βð0Þ βð1Þ βð2Þ βð3Þ 3=2 2 : cacy of quantum sensing depends on the structure of the noise dt ¼ þ dt þ dt þ dt þ Odt ð49Þ and the signal Hamiltonian. Unless suitable conditions are met, We will now search for a Hermitian matrix h that sets low-order terms in each the QEC code that tames the noise might obscure the signal as power series to 0. pffiffiffiffiffi pffiffiffiffiffi well, nullifying the advantages of QEC. Expanding h as h ¼ hð0Þ þ hð1Þ dt þ hð2Þdt þ hð3Þdt3=2 þ OdtðÞ2 in dt, and ; ; ¼ ; T ð0Þ ð1Þ 1=2 ð2Þ fi Our study of quantum sensing using a noisy probe has focused using the notation ðÞK0 K1 Kr ¼ K ¼ K þ K dt þ K dt,we nd on whether the precision δ of parameter estimation scales Pr 2 αð0Þ ð0Þy ð0Þ ð0Þ ð0Þ ð0Þ δ ¼ K h h K ¼ h0k I ¼ 0 asymptoticallypffiffi with the total sensing time t as / 1/t (HL) or k¼0 ð50Þ δ = / 1 t (SQL). We have investigated this question in an idea- ) hð0Þ ¼ 0; 0 k r: lized setting, where the experimentalist has access to noiseless (or 0k (0) (0) = α(1) = β(0) = fi correctable) ancillas and can apply quantum controls that are Therefore h K 0 and 0 are automatically satis ed. Then, arbitrarily fast and accurate, and we have also assumed that the βð1Þ ¼Kð0Þyhð1ÞKð0Þ ¼hð1ÞI ¼ 0 ) hð1Þ ¼ 0: ð51Þ noise acting on the probe is Markovian. Under these assump- 00 00 tions, we have found the general criterion for HL scaling to be and achievable, the HNLS criterion. If HNLS is satisfied, a QEC code ð2Þy can be constructed that achieves HL scaling, and if HNLS is βð2Þ ¼ i K_ Kð0Þ Kð1Þyhð0ÞKð1Þ violated, then SQL scaling cannot be surpassed. ð0Þy ð1Þ ð1Þ ð1Þy ð1Þ ð0Þ ð0Þy ð2Þ ð0Þ K h K K h K K h K ð52Þ fi Pr Pr In the case where HNLS is satis ed, we have seen that the QEC ð0Þ y ð1Þ ð1Þ y ð2Þ ; ¼ G hjk LkLj h0k Lk þ hk0 Lk h00 I code achieving the optimal precision can be chosen to be two- k;j¼1 k¼1 dimensional, and we have described an algorithm for construct- ; ; y y ing this optimal code. The precision attained by this code has a which can be set to 0 if and only if G is a linear combination of I Lk Lk and LkLj geometrical interpretation in terms of the minimal distance (in (0 ≤ k, j ≤ r). the operator norm) of the signal Hamiltonian from the “Lindblad In addition, y y ” ð3Þ ð1Þy ð1Þ ð1Þ ð0Þy ð2Þ ð1Þ span S, the subspace spanned by I, Lk, Lk, and LkLj, where {Lk}is β ¼K h K K h K the set of Lindblad jump operators appearing in the probe’s ð1Þy ð2Þ ð0Þ ð0Þy ð3Þ ð0Þ K h K K h K Pr Pr ð53Þ Markovian master equation. ð1Þ y ð2Þ ð2Þ y ð3Þ ¼ hjk LkLj h0k Lk þ hk0 Lk h00 I ¼ 0 Many questions merit further investigation. We have focused k;j¼1 k¼1 on the dichotomy of HL vs. SQL scaling, but it is also worthwhile to characterize constant factor improvements in precision that can be satisfied by setting the above parameters (which do not appear in the can be achieved using QEC in cases where HNLS is violated55. expressions for α(0,1) and β(0,1,2)) all to 0 (other terms in β(3) are 0 because of the constraints on h(0) and h(1) in Eqs. (50) and (51)). Therefore, when G is a linear We should clarify the applications of QEC to sensing when ; ; y y α = β = combination of I Lk Lk and LkLj, there exists an h such that dt O(dt) and dt O quantum controls have realistic accuracy and speed. Finally, it is 2 ~ (dt ) for the quantum channel Edt ; therefore the QFI obeys interesting to consider probes subject to non-Markovian noise. In ÀÁ ÀÁpffiffiffiffiffiffiffiffiffiffiffi 56–59 t t 2 that case, tools such as dynamical decoupling can mitigate FðÞρðtÞ 4 kkþαdt 4 kkβ kkþβ 2 kkαdt dt ÀÁdt ffiffiffiffiffi dt dt p ð54Þ noise, but just as for QEC, we need to balance desirable sup- ¼ 4 αð2Þ t þ O dt ; pression of the noise against undesirable suppression of the signal ÀÁÀÁ y in order to formulate the most effective sensing strategy. in which αð2Þ ¼ hð1ÞKð0Þ þ hð0ÞKð1Þ hð1ÞKð0Þ þ hð0ÞKð1Þ under the constraint Note added: During the preparation of this manuscript, we β(2) = 0. became aware of related work by Demkowicz-Dobrzański et al.60, which provided a similar proof of the necessary condition in The QEC condition. Here we consider the quantum channel Eq. (2), which Theorem 1 and an equivalent description of the QEC conditions describes the joint evolution of a noisy quantum probe and noiseless ancilla over 60 time interval dt. Suppose that a QEC code obeys the conditions (1) and (2) in Eqs. Eqs. (17), (18), and (20). We and the authors of ref. obtained Π 60 (17) and (18), where C is the orthogonal projector onto the code space. We will this result independently. Both our paper and ref. generalize construct a recovery operator such that the error-corrected time evolution is 37 = ωΠ Π results obtained earlier in ref. . unitary to linear order in dt, governed by the effective Hamiltonian Heff CG C.

8 NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3 ARTICLE

ρ = Π ρΠ For a density operator C C in the code space, conditions (1) and (2) supported on the joint system HP HA of probe and ancilla. To search for a imply suitable inner code C′, we may use standard QEC methods; namely we seek an encoding of the logical ancilla with sufficient redundancy for Eqs. (63) and (64)to Π E ðρÞΠ ¼ ρ iω½Π GΠ ; ρ dt C dt C C C be satisfied. Pr ÀÁ λ 2 μ ρ 2 ; ð55Þ Given a code C that satisfies Eqs. (17), (18), and (20) for the case of a noiseless þ jjk kk dt þ OdtðÞ k¼1 ancilla, and a code C′ supported on a noisy ancilla that satisfies Eqs. (63) and (64), we construct the code C that achieves HL scaling for a noisy ancilla system by “ ” ′ Xr ÀÁ concatenating the inner code C and the outer code C. That is, if the basis states y | 〉 | 〉 Π ρ Π λ ρ λ 2 ; for the code C are { C0 , C1 }, where EEdt ð Þ E ¼ ðÞLk k Lk k dt þ Odt ð56Þ k¼1 Xd ji¼C CðÞjk jij jik ; Π = − Π Π Π i i P A ð65Þ where E I C. When acting on a state in the code space, EEdtðÞ E is an j;k¼1 operation with Kraus operators

pffiffiffiffiffi then the corresponding basis states for the code C are C0 ; C1 , where Kk ¼ ðÞI ΠC LkΠC dt; ð57Þ Xd ðÞjk ′ ; which obey the normalization condition Ci ¼ Ci jij P jiCk A ð66Þ ; Pr Pr j k¼1 y Π y Π Π Kk Kk ¼ CLkðÞI C Lk Cdt k¼1 k¼1 and jiC′k denotes the basis state of C′ which encodes |k〉. Using our fast quantum Pr ÀÁ ð58Þ μ λ 2 ; controls, the code C′ protects the ancilla against the Markovian noise, and the code ¼ kk jjk dt k¼1 C then protects the probe, so that HL scaling is achievable. In fact, the code that achieves HL scaling need not have this concatenated where we have used conditions (1) and (2). Therefore, if ρ is in the code space, then structure; any code that corrects both the noise acting on the probe and the noise a recovery channel REðÞ such that acting on the ancilla will do. For Markovian noise acting independently on probe and ancilla as in Eq. (62), the conditions Eqs. (17) and (18) on the QEC code Xr ÀÁÀÁ Π ρ Π λ 2 μ ρ 2 should be generalized to REðÞ¼EEdt ðÞ E jjk kk dt þ Odt ð59Þ k¼1 Π ′ Π Π ; ′ ′; C ðÞO O C / C 8O 2Sand O 2S ð67Þ r nono can be constructed, provided that the operators fgL λ satisfy the standard y y y y – k k k¼1 here S¼span I; L ; L ; L L ; 8k; j , S′ ¼ span I; L′ ; L′ ; L′ L′ ; 8k; j , and Π is QEC conditionsÀÁ31 33. Indeed, these conditions are satisfied because k k j k k k j k C y the projector onto the code C supported on H H . The condition Eq. (20) Π L λ L λ Π ¼ μ λλ Π , for all k, j. Therefore, the quantum P A C k k j j C kj k j C remains the same as before, but now applied to the code C: channel Π Π ≠ Π fi CðG IÞ C constant C. When these conditions are satis ed, the noise acting RðÞσ ¼ ΠCσΠC þREðÞΠEσΠE ð60Þ on probe and ancilla is correctable; rapidly applying QEC makes the evolution of the probe effectively unitary (and nontrivial), to linear order in dt. completely reverses the effects of the noise. The channel describing time evolution for time dt followed by an instantaneous recovery step is Robustness of the QEC scheme. We consider the following quantum channel, ÀÁ r2 2 where the “J-type noise,” with Lindblad operators fJmg , is regarded as a small REðÞ¼dt ðÞρ ρ iω½ΠCGΠC; ρ dt þ Odt ; ð61Þ m¼1 perturbation: 2 no a noiseless unitary channel with effective Hamiltonian ωΠ GΠ if O(dt ) Pr1 C C E ðÞ¼ρ ρ iω½G; ρ dt þ L ρLy 1 LyL ; ρ dt corrections are neglected. dt k k 2 k k ω k¼1 ð68Þ The dependence of the Hamiltonian on can be detected, for a suitable initial Pr2 ÀÁÈÉ ρ Π Π ρ y 1 y ; ρ 2 : code state in, if and only if CG C has at least two distinct eigenvalues. Thus, for þ Jm Jm 2 JmJm dt þ OdtðÞ Π Π ≠ m¼1 nontrivial error-corrected sensing we require condition (3): CG C constant × Π “ ” r1 C. We assume that the L-type noise, with Lindblad operators fgLk k¼1, obeys the QEC conditions (1) and (2), and that R is the recovery operation that corrects this ρ Error-correctable noisy ancillas. In the main text, we assumed that a noiseless noise. By applying this recovery step after the action of Edt on a state in the code space, we obtain a modified channel with residual J-type noise. P ancilla system is available for the purpose of constructing the QEC code. Here, we σ s σ y SupposeP that R has the Kraus operator decomposition RðÞ¼ j¼1 Rj Rj , relax that assumption. We suppose instead that the ancilla is subject to Markovian s y = Π noise, which is uncorrelated with noise acting on the probe. Hence, the joint where j¼1 Rj Rj ¼ I. We also assume that Rj CRj, because the recovery evolution of probe and ancilla during the infinitesimal time interval dt is described procedure has been constructed such that the state after recovery is always in the by the quantum channel code space. Then E ðÞρ ¼ ρ iω½G I; ρ dt dt no Pr REðÞ¼dt ðÞρ ρ iω½ΠCGΠC ; ρ dt ρ y 1 y ; ρ þ ðÞLk I Lk I 2 LkLk I dt ð69Þ k¼1 ð62Þ no no Pr2 Ps Pr′ ðCÞρ ðCÞy 1 ðCÞy ðCÞ; ρ 2 ; ′ ρ ′y 1 ′y ′ ; ρ 2 ; þ Jm;j Jm;j 2 Jm;j Jm;j dt þ OdtðÞ þ ðÞI Lk I Lk 2 I Lk Lk dt þ OdtðÞ m¼1 j¼1 k′¼1 no ðCÞ Π Π where {L } are Lindblad jump operators acting on the probe, and fgL′ are Lindblad where Jm;j ¼ CRjJm C are the effective Lindblad operators acting on code k k states. jump operators acting on the ancilla. 1 31 In this case, we may be able to protect the probe using a code C scheme with The trace (L ) distance between the unitarily evolving state Eq. (61) and the — “ ” ′ “ ” state subjected to the residual noise Eq. (69) is bounded above by two layers an inner code C and an outer code C. Assuming as before that P arbitrarily fast and accurate quantum processing can be performed, and that the 1 ðCÞ ðCÞy maxρ tr ; J ; ρJ ; dt Markovian noise acting on the ancilla obeys a suitable condition, an effectively 2 m j m j m j P P noiseless encoded ancilla can be constructed using the inner code. Then, the QEC 1 ðCÞy ðCÞ ðCÞy ðCÞ þ maxρ tr ; J ; J ; ρ þ ρ ; J ; J ; dt scheme that achieves HL scaling can be constructed using the same method as in 4 m j m j m j m j m j m j ð70Þ P P ÀÁP the main text, but with the encoded ancilla now playing the role of the noiseless r2 s ðCÞy ðCÞ Π r2 y Π m¼1 j¼1 Jm;j Jm;j dt ¼ C m¼1 JmJm C dt ancilla used in our previous construction. P r Π ′ ′ 2 y Errors on the ancilla can be corrected if the projector C onto the inner code C m¼1 JmJm dt satisfies the conditions. ′ Π ′ Π λ′ Π ; ; to first order in dt, where kk denotes the operator norm. If the noise strength ½1 C′Lk C′ ¼ k C′ 8k ð63Þ

Xr2 ϵ :¼ Jy J ð71Þ ′ Π ′y ′ Π μ′ Π ; ; : m m ½2 C′Lj Lk C′ ¼ jk C′ 8k j ð64Þ m¼1

′ r2 Eqs. (63) and (64) resemble Eqs. (17) and (18), except that the inner code C is of the Lindblad operators fgJm m¼1 is low, the evolution is approximately unitary supported only on the ancilla system HA, while the code C in Eqs. (17) and (18)is when t 1=ϵ. In this sense, the QEC scheme is robust against small J-type noise.

NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications 9 ARTICLE NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3

Code optimization as a semidefinite program. Optimization of the QEC code 4. McKenzie, K., Shaddock, D. A., McClelland, D. E., Buchler, B. C. & Lam, P. K. can be formulated as the following optimization problem: Experimental demonstration of a squeezing-enhanced power-recycled ÀÁ michelson interferometer for gravitational wave detection. Phys. Rev. Lett. 88, maximize tr GG~ ÀÁ ? ÀÁ ÀÁ 231102 (2002).

subject to tr G~ 2 and tr G~ ¼ tr GL~  k ð72Þ 5. Lee, H., Kok, P. & Dowling, J. P. A quantum rosetta stone for interferometry. J. Mod. Opt. 49, 2325–2338 (2002). ¼ tr GL~ yL ¼ 0; 8j; k: k j 6. Bollinger, J., Itano, W. M., Wineland, D. & Heinzen, D. Optimal frequency This optimization problem is convex (because tr|·| is convex) and satisfies the measurements with maximally correlated states. Phys. Rev. A 54, R4649 (1996). Slater’s condition,ÀÁ so it can be solved by solving its Lagrange dual problem61. The 7. Leibfried, D. et al. Toward heisenberg-limited spectroscopy with multiparticle ~ – Lagrangian L G; λ; ν is defined for λ ≥ 0 and νk 2 R: entangled states. Science 304, 1476 1478 (2004). ÀÁÀÁÀÁÀÁ X ÀÁ 8. Valencia, A., Scarcelli, G. & Shih, Y. Distant clock synchronization using ~; λ; ν ~ λ ~ ν ~ ; L G ¼ tr GG? tr G 2 þ ktr EkG ð73Þ entangled photon pairs. Appl. Phys. Lett. 85, 2655–2657 (2004). k 9. de Burgh, M. & Bartlett, S. D. Quantum methods for clock synchronization: beating the standard quantum limit without entanglement. Phys. Rev. A 72, where {E } is any basis of S. The optimal value is obtained by taking the minimum k 042301 (2005). of the dual ÀÁ 10. Giovannetti, V., Lloyd, S. & Maccone, L. Quantum-enhanced measurements: ~ gðÞ¼λ; ν max~ L G; λ; ν beating the standard quantum limit. Science 306, 1330–1336 (2004). G  P 11. Giovannetti, V., Lloyd, S. & Maccone, L. Quantum metrology. Phys. Rev. Lett. ν ~ λ ~ λ ¼ maxG~ tr G? þ kEk G G þ 2 96, 010401 (2006). 0 k 12. Giovannetti, V., Lloyd, S. & Maccone, L. Advances in quantum metrology. Nat. P ð74Þ Photonics 5, 222–229 (2011). B 2λλ G? þ νkEk B 13. Huelga, S. F. et al. Improvement of frequency standards with quantum B k ¼ @ P entanglement. Phys. Rev. Lett. 79, 3865 (1997). λ ν 1 G? þ kEk 14. Demkowicz-Dobrzański, R. et al. Quantum phase estimation with lossy k interferometers. Phys. Rev. A 80, 013825 (2009). 15. Fujiwara, A. & Imai, H. A fibre bundle over manifolds of quantum channels over λ and {ν }, where kk ¼ max ψ jjhjψ jiψ is the operator norm. Hence the k ji and its application to quantum statistics. J. Phys. A Math. Theor. 41, 255304 optimal value of the primal problem is (2008). X 16. Escher, B., de Matos Filho, R. & Davidovich, L. General framework for min gðÞ¼λ; ν 2 min G þ ν E ¼ 2 min G G~ : ð75Þ λ;ν ν ? k k ~ ? k estimating the ultimate precision limit in noisy quantum-enhanced metrology. k Gk2S k Nat. Phys. 7, 406–411 (2011). 61 The optimization problem Eq. (75) is equivalent to the following SDP: 17. Demkowicz-Dobrzański, R., Kołodyński, J. & Guţǎ, M. The elusive Heisenberg limit in quantum-enhanced metrology. Nat. Commun. 3, 1063 (2012). minimize 0s P 1 18. Kołodyński, J. & Demkowicz-Dobrzański, R. Efficient tools for quantum sI G? þ νkEk B P k C ð76Þ metrology with uncorrelated noise. New J. Phys. 15, 073043 (2013). subject to @ A 0 ł ń G? þ νkEk sI 19. Chaves, R., Brask, J., Markiewicz, M., Ko ody ski, J. & Acn, A. Noisy metrology k beyond the standard quantum limit. Phys. Rev. Lett. 111, 120401 (2013). 20. Plenio, M. B. & Huelga, S. F. Sensing in the presence of an observed ν R “δ ” fi for variables k 2 and s 0. Here 0 denotes positive semide nite matrices. environment. Phys. Rev. A 93, 032123 (2016). SDPs can be solved using the Matlab-based package CVX62. 21. Albarelli, F., Rossi, M. A., Paris, M. G. & Genoni, M. G. Ultimate quantum Once we have the solution to the dual problem, we can use it to find the limits for noisy magnetometry via time-continuous measurements. New J. Phys. } } solution to the primal problem. We denote by λ and ν the values of λ and ν 19, 123011 (2017). where g(λ,ν) attains its minimum, and define fi X 22. Matsuzaki, Y., Benjamin, S. C. & Fitzsimons, J. Magnetic eld sensing beyond G~} ¼ G þ ν}E : the standard quantum limit under the effect of decoherence. Phys. Rev. A 84, ? k k ð77Þ 012103 (2011). ÀÁ k ÀÁ } ~ } 23. Chin, A. W., Huelga, S. F. & Plenio, M. B. Quantum metrology in non- The minimum g λ ; ν} matches the value ofÀÁ the Lagrangian L G; λ ; ν} ~ ~ ~ ~ Markovian environments. Phys. Rev. Lett. 109, 233601 (2012). when G ¼ G is the value of G that maximizes tr GG? subject to the constraints. ł ń ń This means that 24. Smirne, A., Ko ody ski, J., Huelga, S. F. & Demkowicz-Dobrza ski, R. Ultimate ÀÁ precision limits for noisy frequency estimation. Phys. Rev. Lett. 116, 120801 ~ ~ } ~} : ð78Þ ÀÁ tr G G ¼ 2 G (2016).

Since we require tr G~ ¼ 0 and tr G~ ¼ 2, and because minimizing g(λ,ν) 25. Kessler, E. M., Lovchinsky, I., Sushkov, A. O. & Lukin, M. D. Quantum error enforces that the maximum and minimal eigenvalues of G~} have the same absolute correction for metrology. Phys. Rev. Lett. 112, 150802 (2014). value and opposite sign, we conclude that 26. Arrad, G., Vinkler, Y., Aharonov, D. & Retzker, A. Increasing sensing resolution with error correction. Phys. Rev. Lett. 112, 150801 (2014). ~ ~ρ} ~ρ}; G ¼ 0 1 ð79Þ 27. Dür, W., Skotiniotis, M., Froewis, F. & Kraus, B. Improved quantum metrology using quantum error correction. Phys. Rev. Lett. 112, 080801 (2014). ρ~} ~ } where 0 is a density operator supported on the eigenspace of G with the 28. Ozeri, R. Heisenberg limited metrology using quantum error-correction codes. maximal eigenvalue, and ~ρ} is a density operator supported on the eigenspace of Preprint at http://arxiv.org/abs/arXiv:1310.3432 (2013). ~ 1 ~ G} with the minimal eigenvalue. A G of this form which satisfies the constraints 29. Lu, X.-M., Yu, S. & Oh, C. Robust quantum metrological schemes based on of the primal problem is guaranteed to exist. protection of quantum fisher information. Nat. Commun. 6, 7282 (2015). 30. Matsuzaki, Y. & Benjamin, S. Magnetic-field sensing with quantum error Data availability. Data sharing not applicable to this article as no data sets were detection under the effect of energy relaxation. Phys. Rev. A 95, 032303 (2017). generated or analyzed during the current study. 31. Nielsen, M. A. & Chuang, I. L. Quantum Computation and Quantum Information (Cambridge University Press, Cambridge, 2010). 32. Knill, E. & Laflamme, R. Theory of quantum error-correcting codes. Phys. Rev. Received: 7 June 2017 Accepted: 5 December 2017 A 55, 900 (1997). 33. Gottesman, D. An introduction to quantum error correction and fault-tolerant quantum computation. in Quantum Information Science and its Contributions to Mathematics, Proceedings of Symposia in Applied Mathematics Vol. 68, 13–58 (American Mathematical Society, Providence, 2009). 34. Unden, T. et al. Quantum metrology enhanced by repetitive quantum error References correction. Phys. Rev. Lett. 116, 230502 (2016). 1. Caves, C. M. Quantum-mechanical noise in an interferometer. Phys. Rev. D 23, 35. Gorini, V., Kossakowski, A. & Sudarshan, E. C. G. Completely positive 1693 (1981). dynamical semigroups of n-level systems. J. Math. Phys. 17, 821–825 (1976). 2. Wineland, D., Bollinger, J., Itano, W., Moore, F. & Heinzen, D. Spin squeezing 36. Lindblad, G. On the generators of quantum dynamical semigroups. Commun. and reduced in spectroscopy. Phys. Rev. A 46, R6797 (1992). Math. Phys. 48, 119–130 (1976). 3. Holland, M. & Burnett, K. Interferometric detection of optical phase shifts at 37. Sekatski, P., Skotiniotis, M., Kołodyński, J. & Dür, W. Quantum metrology with the heisenberg limit. Phys. Rev. Lett. 71, 1355 (1993). full and fast quantum control. Quantum 1, 27 (2017).

10 NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | DOI: 10.1038/s41467-017-02510-3 ARTICLE

38. Ofek, N. et al. Extending the lifetime of a quantum bit with error correction in 62. Grant, M. & Boyd, S. Cvx: Matlab software for disciplined convex superconducting circuits. Nature 536, 441–445 (2016). programming. http://cvxr.com/cvx/ (2017). 39. Heeres, R. W. et al. Implementing a universal gate set on a logical qubit encoded in an oscillator. Nat. Commun. 8, 94 (2017). Acknowledgements 40. Rosenblum, S. et al. A cnot gate between multiphoton qubits encoded in two cavities. Preprint at http://arxiv.org/abs/arXiv:1709.05425 (2017). We thank Fernando Brandão, Yanbei Chen, Steve Girvin, Linshu Li, Mikhail Lukin, 41. Lidar, D. A., Chuang, I. L. & Whaley, K. B. Decoherence-free subspaces for Changling Zou for inspiring discussions. We acknowledge support from the ARL-CDQI quantum computation. Phys. Rev. Lett. 81, 2594 (1998). (W911NF-15-2-0067), ARO (W911NF-14-1-0011, W911NF-14-1-0563), ARO MURI 42. Demkowicz-Dobrzański, R. & Maccone, L. Using entanglement against noise in (W911NF-16-1-0349), AFOSR MURI (FA9550-14-1-0052, FA9550-15-1-0015), NSF quantum metrology. Phys. Rev. Lett. 113, 250801 (2014). (EFMA-1640959), Alfred P. Sloan Foundation (BR2013-049), and Packard Foundation 43. Yuan, H. Sequential feedback scheme outperforms the parallel scheme for (2013-39273). The Institute for Quantum Information and Matter is an NSF Physics Hamiltonian parameter estimation. Phys. Rev. Lett. 117, 160801 (2016). Frontiers Center with support from the Gordon and Betty Moore Foundation. 44. Fujiwara, A. Strong consistency and asymptotic efficiency for adaptive quantum estimation problems. J. Phys. A Math. General 39, 12489–12504 (2006). Author contributions 45. Layden, D. & Cappellaro, P. Error-corrected quantum sensing with parallel J.P. and L.J. conceived this project. S.Z. proved linear scaling of the QFI and constructed signal and noise. Preprint at http://arxiv.org/abs/arXiv:1708.06729 (2017). the QEC code. S.Z., M.Z. and L.J. formulated the QEC condition. S.Z., J.P. and L.J. wrote 46. Helstrom, C. W. Quantum Detection and Estimation Theory (Academic Press, the manuscript. New York, 1976). 47. Braunstein, S. L. & Caves, C. M. Statistical distance and the geometry of quantum states. Phys. Rev. Lett. 72, 3439 (1994). Additional information 48. Holevo, A. S. Probabilistic and Statistical Aspects of Quantum Theory, Vol. 1 Supplementary Information accompanies this paper at https://doi.org/10.1038/s41467- (Springer Science & Business Media, Berlin, 2011). 017-02510-3. 49. Kolodynski, J. Precision Bounds in Noisy Quantum Metrology (Ph.D. thesis, fi University of Warsaw, 2014). Competing interests: The authors declare no competing nancial interests. 50. Walls, D. F. & Milburn, G. J. (Springer Science & Business Media, Heidelberg, 2007). Reprints and permission information is available online at http://npg.nature.com/ 51. Boixo, S., Flammia, S. T., Caves, C. M. & Geremia, J. M. Generalized limits for reprintsandpermissions/ single-parameter quantum estimation. Phys. Rev. Lett. 98, 090401 (2007). 52. Michael, M. H. et al. New class of quantum error-correcting codes for a bosonic Publisher's note: Springer Nature remains neutral with regard to jurisdictional claims in fi mode. Phys. Rev. X 6, 031006 (2016). published maps and institutional af liations. 53. Sun, L. et al. Tracking photon jumps with repeated quantum non-demolition parity measurements. Nature 511, 444–448 (2014). 54. Shen, C. et al. Quantum channel construction with circuit quantum electrodynamics. Phys. Rev. B 95, 134501 (2017). Open Access This article is licensed under a Creative Commons 55. Herrera-Mart, D. A., Gefen, T., Aharonov, D., Katz, N. & Retzker, A. Quantum Attribution 4.0 International License, which permits use, sharing, error-correction-enhanced magnetometer overcoming the limit imposed by adaptation, distribution and reproduction in any medium or format, as long as you give relaxation. Phys. Rev. Lett. 115, 200501 (2015). appropriate credit to the original author(s) and the source, provide a link to the Creative 56. Viola, L., Knill, E. & Lloyd, S. Dynamical decoupling of open quantum systems. Commons license, and indicate if changes were made. The images or other third party Phys. Rev. Lett. 82, 2417 (1999). material in this article are included in the article’s Creative Commons license, unless 57. Uhrig, G. S. Keeping a quantum bit alive by optimized π-pulse sequences. Phys. indicated otherwise in a credit line to the material. If material is not included in the Rev. Lett. 98, 100504 (2007). article’s Creative Commons license and your intended use is not permitted by statutory 58. Maze, J. et al. Nanoscale magnetic sensing with an individual electronic spin in regulation or exceeds the permitted use, you will need to obtain permission directly from diamond. Nature 455, 644–647 (2008). the copyright holder. To view a copy of this license, visit http://creativecommons.org/ 59. Biercuk, M. J. et al. Optimized dynamical decoupling in a model quantum licenses/by/4.0/. memory. Nature 458, 996–1000 (2009). 60. Demkowicz-Dobrzański, R., Czajkowski, J. & Sekatski, P. Adaptive quantum metrology under general markovian noise. Phys. Rev. X 7, 041009 (2017). © The Author(s) 2017 61. Boyd, S. & Vandenberghe, L. Convex Optimization (Cambridge University Press, New York, 2004).

NATURE COMMUNICATIONS | 20189:78 | DOI: 10.1038/s41467-017-02510-3 | www.nature.com/naturecommunications 11