ARTICLE https://doi.org/10.1038/s41467-019-13735-9 OPEN Tensor-network approach for quantum metrology in many-body quantum systems

Krzysztof Chabuda1, Jacek Dziarmaga2, Tobias J. Osborne3 & Rafał Demkowicz-Dobrzański 1*

Identification of the optimal quantum metrological protocols in realistic many particle quantum models is in general a challenge that cannot be efficiently addressed by the state-of- the-art numerical and analytical methods. Here we provide a comprehensive framework exploiting matrix product operators (MPO) type tensor networks for quantum metrological problems. The maximal achievable estimation precision as well as the optimal probe states in previously inaccessible regimes can be identified including models with short-range noise correlations. Moreover, the application of infinite MPO (iMPO) techniques allows for a direct and efficient determination of the asymptotic precision in the limit of infinite particle num- bers. We illustrate the potential of our framework in terms of an atomic clock stabilization (temporal noise correlation) example as well as magnetic field sensing (spatial noise cor- relations). As a byproduct, the developed methods may be used to calculate the fidelity susceptibility—a parameter widely used to study phase transitions.

1 Faculty of Physics, University of Warsaw, ul. Pasteura 5, 02-093 Warszawa, Poland. 2 Institute of Physics, Jagiellonian University, Łojasiewicza 11, 30-348 Kraków, Poland. 3 Institut für Theoretische Physik, Leibniz Universität Hannover, Appelstraße 2, 30167 Hannover, Germany. *email: [email protected]

NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications 1 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9

uantum metrology1–6 is plagued by the same computa-  x  fi fl 0 Λ Π (x) Qtional dif culties af icting all pro- x cessing technologies, namely, the exponential growth of the dimension of many particle Hilbert space7,8. Apart from idealized Fig. 1 A scheme of a standard quantum metrological task. A probe state 1 ρ noiseless models as well as models operating within the fully 0 is subject to a parameter-dependent quantum evolution, mathematically symmetric subspace9 (where the Hilbert space dimension grows represented by a parameter-dependent Λφ. A POVM type Π linearly with the number of particles) only small-scale problems are measurement f xgx is then carried out yieldingÀÁ a conditional probability p x φ ρ Π ρ Λ ρ feasible via direct numerical study, and even a slight increase in the distribution ð j Þ¼Trð φ xÞ, where φ ¼ φ 0 . Given the conditional number of elementary objects makes such an approach intractable. probability distribution pðxjφÞ the objective is to estimate the value of the Interestingly, in case of uncorrelated noise models, easily compu- unknown parameter φ. To this end one employs an estimator function φeðxÞ table fundamental precision bounds are available10–16 and hence a to produce a given estimate for φ given the measurement outcome x. deep-physical insight may be obtained even if direct numerical optimization is infeasible. However, in cases when one deals with In this paper, we will use the following formula for the QFI9,33: metrological models involving correlated noise, or whenever states   ρ ρ ; ; ρ ; ρ0 ρ 2 ; outside the fully symmetric subspace are involved, there are no Fð φÞ¼sup Fð φ LÞ Fð φ LÞ¼2Tr φL À Tr φL efficient methods that can be applied. L Correlated noise appears naturally in a number of highly rele- ð2Þ 0 vant metrological problems. Temporal noise correlations are where ρφ is the derivative of ρφ with respect to φ. This form is 17 present in the atomic clock stabilization problem , making equivalent to the standard definition of the QFI31,32, as can identification of the optimal stabilization strategies 18–20 be seen by solving the above maximization problem with respect a highly non-trivial task . An even more challenging case to L—this is formally a quadratic function in matrix L and involves models where time-correlated noise cannot be effectively 21 the resulting extremum condition yields the standard linear described via some classical stochastic process and as such equation for the symmetric logarithmic derivative (SLD) L, manifests non-Markovian features of quantum dynamics22, as e.g., ρ0 ¼ 1 ðLρ þ ρ LÞ. When the solution for L is plugged into the in NV-center sensing models23. A second natural setting exhi- φ 2 φ φ ρ ρ 2 biting non-trivial noise correlations is that of many-body systems above formula it yields Fð φÞ¼Trð φL Þ in agreement with the such as, e.g., chains. Here, typically, spatially correlated noise standard definition of the QFI. emerges, which is of crucial relevance for any models where the The above QFI formula has an advantage over the standard effective signal is obtained from spatially distributed probes24–26. one, when one wants to additionally perform optimization of the ρ fi Temporal noise correlations usually decay rapidly. Similarly, in QFI over the input states 0 in order to nd the optimal quantum the spatially correlated case one expects on dimensional and metrological protocol. This problem can be written as a double energetic grounds that noise will be short-range correlated. The maximization problem: most successful approach for classical simulating short-range Λ ρ Λ ρ ; : F ¼ sup F½ φð 0ފ ¼ sup F½ φð 0Þ LŠ ð3Þ correlated many-body systems is via the variational tensor- ρ ρ ;L 27 0 0 network state (TNS) ansatz . Among many ansatz classes, that Λ fi Λ ρ ρ led to unparalleled insights into the physics of quantum many- With φ xed F½ φð 0ފ is effectively a function of 0, so in what ρ body systems, the most relevant for the present work is the matrix follows for the sake of simplicity of notation we will write Fð 0Þ, 28 ρ ; ρ ρ ; product operator (MPO) ansatz for density operators and also and Fð 0 LÞ instead of Fð φÞ, Fð φ LÞ. The Figure of Merit fi fi 29 ρ ; ρ its in nite particle limit known as in nite MPO (iMPO) . (FoM) Fð 0 LÞ is linear in 0 and quadratic in L. This In this paper, building upon experience obtained from uncor- formulation leads to an extremely efficient iterative numerical related noise metrological studies30, where the optimal input states procedure for determining the optimal input probe state: start where shown to be efficiently described as matrix product states with some random (or an educated guess for an) input state, (MPS), we develop a comprehensive tensor-network-based fra- determine the corresponding optimal L by performing the mework allowing to (i) calculate relevant metrological quantities relevant optimization. Then, for the L just found, reverse the (such as the Quantum Fisher Information (QFI) or a Bayesian- procedure and look for the optimal input state. This procedure type cost), (ii) optimize input probe states and as a result (iii) converges very quickly and yields the optimal input probe state, identify the optimal metrological protocol. All this is accomplished as well as the corresponding QFI. This approach was first while remaining fully within the tensor-network formalism and proposed in refs. 9,34 in the Bayesian estimation context, and then thus avoiding the curse of dimensionality along the way. applied to the QFI FoM in ref. 33 (recently the method has been rediscovered in a slightly modified incarnation in ref. 35 and Results proved useful in studying metrological properties of states with Efficient identification of the optimal quantum metrological a positive partial transpose). The above considerations are valid protocol. A paradigmatic task in quantum metrology is sche- whenever the quantity to be optimized is given in the form of 0 matically depicted in Fig. 1. The central goal is to find the best Eq. (2): ρφ need not necessarily be the derivative of the state with ρ input probe state 0, the best measurement and estimator so as to respect to the estimated parameter. As such, this procedure is minimize the average uncertainty Δ2φe ¼hðφe À φÞ2i, where the applicable in the Bayesian approach, and also in case of less trivial expectation is over all measurement results x. FoMs (see the atomic clock stabilization example). This task is somewhat facilitated by exploiting a fundamental We consider metrological models involving N distinguishable result in quantum metrology, namely, the Cramér-Rao d-dimensionalN probes, so that the total Hilbert space is inequality31,32, which lower-bounds the average uncertainty of H¼ N Cd. We assume that the parameter φ is unitarily φe n¼1 the best possible estimator ðxÞ encoded in the output state ρφ according to a product of unitaries

2 1 given by the exponential of local generators (or Hamiltonians): Δ φe  ; ð1Þ FðρφÞ XN ρ Λ ρ ÀiHφΛ ρ iHφ; ½nŠ; φ ¼ φð 0Þ¼e ð 0Þe H ¼ h ð4Þ where FðρφÞ is the QFI of the output state. n¼1

2 NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 ARTICLE where h½nŠ is the generator acting on the nth particle. Most following form: importantly for this paper, the noise, represented above by the operator Λ, is not assumed to be local, but admits the possibility of noise correlations. In order to be able to make use of MPO approach efficiently we assume that the noise correlations are short-range, i.e., Λ may be effectively approximated as a product of single, two-, three-, etc. particle maps up to some cutoff point after which to is assumed that noise correlations do not extend beyond r neighboring particles—see Supplementary Note 1 for a more detailed and more physical discussion of this approximation.

Expressing the optimization problem using the MPO formal- ism. The optimization scheme described above is completely where we place X operators in a skewed orientation in order to general and, provided the systems considered are small enough, it maintain a manifestly translation invariant model. can be implemented numerically using the standard quantum The operator X is defined with respect to a product basis state representation. For larger systems, however, this will not be jiα ¼ jij; k for the doubled legs and it acts on two possible in general, and one way to circumvent this difficulty is to neighboringP subsystems jiα and jiβ , i.e., it is the tensor implement the above algorithm using the MPO formalism. α0 α β0 β fi ρ X ¼ α0;α;β0;βXα0;α;β0;βjihj jihj.Wemaynowperform In order to do so, we rst write the initial N particle state 0 as an MPO (see Supplementary Note 4 for a short introduction to the singular value decomposition (SVD) of tensor X,which tensor networks): has the following graphical representation: X  j j j ρ ¼ Tr R ½1Š 1 R ½2Š 2 ¼ R ½NŠ N jij hjk ; 0 0 k1 0 k2 0 kN ð5Þ j;k

Here, we regard the two vertical legs of X on the left as a ; ¼ ; where ji¼j j1 jN denotes the standard product basis for doubled leg acting on a single virtual system and the two ; ¼ ; N-particle states, with jn ¼ 0 d À 1 being the physical vertical legs on the right as acting on a second virtual system: jn indices, while R ½nŠ are Dρ ´ Dρ matrices (for which entries in this way one can think of X as a simple matrix acting on a 0 kn 0 0 are identified by virtual indices α; β ¼ 1; ¼ ; Dρ ) and Dρ is virtual system and we can then apply the SVD. pffiffiffi 0 0 We apply the SVD to each X operator and absorb S into the referred to as the bond-dimension of the MPO. The above state is y depicted diagrammatically below U tensor from the right (respectively, into the V tensor from the left). Let Dð2Þ (the upper index indicates two-particle nature of the noise) be the number of non-zero (or more practically non- negligible) singular values sγ of matrix S. Introduction of pffiffiffi pffiffiffi T ¼ U S, W ¼ SVy finalizes the decomposition of the X-layer of the tensor-network:

where the contracted lines represent virtual indices and ρ uncontracted lines physical indices. We may vectorize 0 and obtain its MPS representation by formally bending the vertical The final step to obtain an MPO representation for ρ is to legs upward (jij hjk ! jij; k ), which results in φ combine the tensors R0½nŠ, T, W, Y, and a tensor T Z ¼ eÀihφ ðeihφÞ —which represents the unitary phase encoding process—into a single new MPS tensor Rφ½nŠ:

where a thick vertical line ranges over a doubled physical index ðj; kÞ. Our next step is to find the tensor-network representation of ρ Λ ρ fi φ ¼ φð 0Þ.Forde niteness, we focus on the situation when the noise operator Λ can be described by a subsequent action of singe- particle Λ½nŠ and two-particle terms Λ½n;nþ1Š—which in the following are denoted by Y and X, respectively. Physically this is the case when single and two-particle evolution terms commute The doubled horizontal legs in the scheme above can be now and no particle is distinguished—generalizations to more combined into thicker horizontal legs to obtain the MPO ρ complex situations are tedious but straightforward. In the tensor- representation of φ (note that we have split back the vertical network representation the action of the Λ operator takes the legs so we have a proper , and not its vectorized

NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications 3 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 form): of the vectorized tensor, which we want to optimize. This gives us a condition for the extremum in a form of a linear equation for the components of this tensor, which we solve using the Moore–Penrose pseudo-inverse. The second iteration step, where the optimization over the initial state is performed, is similar in concept but varies in details. One can show that the optimal input state is pure and then using the of the evolution process express the optimization As a result we end up with an MPO with the bond-dimension problem as a minimization of a Rayleight quotient involving a ð2Þ Hermitian operator and the respective input state. When the Dρ ¼ Dρ D . The generalization of this derivation beyond the 0 Hermitian operator is interpreted as a Hamiltonian then such case of nearest-neighbor correlations will lead to an MPO ρ a problem reduces to the well known variational method in representation of the densityQ matrix φ with bond-dimension , which when the MPS formalism is r ðsÞ Dρ ¼ Dρ D . Here, D ¼ D represents the contribution to incorporated can be efficiently solved using the DMRG 0 r r s¼2 the effective bond-dimension of the output state resulting from algorithm27. the action of the correlated noise, where DðsÞ is the number of Note that in the above process we have an outer iteration loop non-zero singular values that will appear when considering the related with the iteration process where we subsequently optimize ρ ρ ; s-particle noise term. L and 0 in the FoM quantity Fð 0 LÞ and at the same time we Operator ρ0 can be efficiently written as an MPO as well have an inner iteration loop in each of these steps where we φ fi thanks to the fact that it is as a commutator of ρφ with H, where iterate over sites of the relevant tensor-network in order to nd H is a sum of local Hamiltonians the optimal solution within a given class of MPO. Furthermore, while running the algorithm, one has to choose the bond- hi XN dimensions for the input state, as well as for the L operator. We ρ0 ρ ; ½nŠ : φ ¼ i φ h ð6Þ start with low bond-dimensions (typically 1 or 2) and then n¼1 increase them subsequently only when the increase yields a In what follows we assume that the basis jij associated with the noticable change (>1%) in the optimized FoM. In this way we physical indices j isP chosen to be the eigenbasis of the local achieve the desired accuracy while keeping the bond-dimensions ϵ ϵ fi Hamiltonian h, h ¼ j jjij hjj , where j are the corresponding as low as possible thus guaranteeing the ef ciency of the 0 eigenvalues. The MPO representation of ρφ can be written at the algorithm. This procedure may be implemented both in the finite particle number regime as well in the asymptotic limit of cost of doubling the bond-dimension (Dρ0 ¼ 2Dρ Dr): X 0 infinite number of particles by utilizing the iMPO—see the 0 0 j1 0 j2 0 jN ρφ ¼ Tr R ½1Š R ½2Š ¼ R ½NŠ jij hjk ; Methods section. This latter approach provides us with a unique k1 k2 kN ð7Þ j;k insight into the asymptotic efficiency of the quantum enhanced j metrological protocols. where R0½nŠ n is equal to Below we present three applications of our framework chosen 8 kn > iðϵ À ϵ Þ 1 in a way so as to highlight the possibility of applying the > k1 j1 j1 > Rφ½1Š for n ¼ 1; framework to a variety of qualitatively different physical > k1 > 00! problems and therefore demonstrate versatility of the approach. > < 10 jn Rφ½nŠ for n 2½2; ¼ ; N À 1Š; fi ϵ ϵ kn Magnetic eld sensing with locally correlated noise. Consider N > ið k À j Þ 1 > n n ! particles each with spin-1, which interact for a fixed time t with an > 2 > 10 fi > jN external magnetic eld B (assumed to be in the z direction) whose > Rφ½NŠ for n ¼ N: : ϵ ϵ kN strength fluctuates. The fluctuations induce an effective dephasing ið k À j Þ 0 N N process on the particles and apart from the uncorrelated ð8Þ dephasing contribution10,36 we will also take into account corre- fi fl The 2 ´ 2 matrices that appear in the above construction are lations between eld uctuations at the nearest-neighbor particle fi ½nŠ δ ½nŠ responsible for the increase of the bond-dimension but guarantee sites. The magnetic eld at site n is given as B ðtÞ¼B þ B ðtÞ, fi that the effect of trace in Eq. (7) is equivalent to that resulting where B is the mean value of the eld to be estimated. Here, we fl from the sum of ρφ MPO acted upon consecutively by the assume that uctuations are Gaussian and have no relevant temporal correlations. The corresponding variance as well as commutator of the local Hamiltonians corresponding to different fl particles. the nearest-neighbor correlation functions of the uctuating fi δ ½nŠ δ ½nŠ 0 σ2δ 0 δ ½nŠ δ ½nþ1Š 0 Finally, the optimization algorithm needs to be implemen- eld read: h B ðtÞ B ðt Þi ¼ ðt À t Þ, h B ðtÞ B ðt Þi ¼ χδ 0 χ ted using the MPO structures introduced above. Here, we just ðt À t Þ, where represents the strength of correlations and — sketch how the two-step iterative process of identifying the may be both positive and negative (anti-correlation) for sim- ρ plicity, we assume periodic boundary conditions, so in fact also optimal L and 0 is implemented within the MPO framework in order to arrive at the solution of Eq. (3)—see the Methods the particles N and 1 are correlated. This model corresponds to ½nŠ ½nŠ section for a detailed description. In the first iteration step we the choice h ¼ σz =2, φ ¼ gBt (where g is the gyromagnetic ρ ; seek the maximum of the Fð 0 LÞ over a Hermitian operator L ratio for the particle), whereas using the standard cumulant fi ρ fi fl with a xed initial density matrix 0 (QFI is a quadratic expansion techniques the eld uctuations lead to: function of L). We use the MPO representation of L and, X 1 T Λ ρ ρ À2ðjÀkÞ CðjÀkÞ ; instead of trying to optimize the whole operator L at once, we ð 0Þ¼ hjj 0jik e jij hjk ð9Þ iteratively optimize each tensor site by site in a loop up to the j;k desired convergence of the FoM. During the one-site ; ; ; ¼ ; T 1 optimization step we express our FoM as a quadratic function where j k are column vectors j ¼ðj1 j2 jN Þ (jn ¼ ± 2), and

4 NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 ARTICLE

C is the correlation matrix a 0.6 .. . ¼ . ... ¼ ; C ¼ c 1c20 c2c2c1c20c2c1 c2 c1 ð10Þ N / 0.5 σ2 2 χ 2 F where c1 ¼ g t, c2 ¼ g t represent, respectively, local and correlated dephasing strength—see Supplementary Note 2 for extended discussion. 0.4 In order to write the evolution manifestly in the MPO 101 102 103 formalism, we will replace jij hj!k ji j ji k , which forms a basis for N ρ Λ ρ the vectorized input density matrix 0 . The action of on 0 is Γ ρ b 2.0 identical to the action of the operator e on 0 , i.e., Λ ρ Γ ρ ð 0Þ ¼ e 0 , where XN XN c ; Γ 1 ϒ½nŠ Ξ½n nþ1Š; 1.5 ¼À À c2 ð11Þ 2 n¼1 n¼1 1 with c  2 1.0 ϒ½nŠ ¼ h½nŠ 1 À 1 h½nŠ ; ð12Þ 1.6 3.2 1.6

and N N / 0.8 / 0.8 F 0.5 F ½n;nþ1Š ½nŠ ½nŠ ½nþ1Š ½nþ1Š 0.4 Ξ 1 1 1 1 : c ¼ h À h h À h 0.4 2 0.2 c1 –0.5 0.0 0.5 0.5 1.0 1.5 2.0

ð13Þ –0.5 0.0 0.5 c Note that the ϒ½nŠ and Ξ½n;nþ1Š mutually commute with each other, 2 so that F/N 0.20.4 0.8 1.6 3.2 6.4 YN Γ Àc1ϒ½nŠ Àc Ξ½n;nþ1Š e ¼ e 2 e 2 : ð14Þ Fig. 2 Quantum Fisher Information for the magnetic field sensing model. n¼1 a Comparison of the QFI per particle for a magnetic field sensing problem in ½nŠ Àc1ϒ½nŠ ½n;nþ1Š Àc Ξ½n;nþ1Š presence of locally correlated dephasing as a function of the number of spins Denoting Y ¼ e 2 and X ¼ e 2 we finally obtain N c in a chain (for dephasing noise model with local noise parameter 1 ¼ 1and YN c : fi Γ ½nŠ ½n;nþ1Š; correlation parameter 2 ¼ 0 1) calculated using the nite MPO approach e ¼ Y X ð15Þ (black dots) with asymptotic value obtained using the iMPO approach (black n¼1 solid line). Gray crosses indicate results obtained via the standard full-Hilbert which is the form of evolution the same as discussed in Result space description. Gray lines show state-of-the-art bounds on QFI=N section guaranteeing efficient MPO description. obtained by decomposing the dynamics into effectively independent channels After evolution through quantum channel Λ, the phase is of increasing complexity (dotted, dash-dotted, dashed)—see Supplementary imprinted in our state through unitary evolution according to Note 2 for details. For comparison, the solid gray line corresponds to the ½nŠ— Eq. (4) with local Hamiltonians h in theQ tensor-network bound obtained when all correlations are neglected and only local dephasing N ½nŠ noise is taken into account. b Asymptotic value (obtained using iMPOs) of picture this is represented by the action of n¼1Z , where T QFI per particle for dephasing type noise in function of local c and between ½nŠ Àih½nŠφ ih½nŠφ 0 1 Z ¼ e ðe Þ . Written in the basis jij , ρφ ¼ i½ρφ; HŠ c nearest neighbors 2 noise parameters. Black equipotential lines are in reads: c X XÀÁ logarithmic scale. Left inset shows a slice of the main plot along 1 ¼ 1and 0 presents the results obtained using the iMPO approach (black dots) ρφ ¼ hjj ρφjik i k À j jij hjk : n n ð16Þ compared with the exact asymptotic result for a weakly squeezed state j;k n strategy (light gray line), and the gray lines show state-of-the-art bounds on Figure 2(a) presents a comparison of results of the QFI QFI/N (dotted, dash-dotted, dashed). Right inset shows a slice of the main c optimization procedure for exemplary noise parameters obtained plot along 2 ¼ 0 and presents result obtained using iMPO approach (black using the finite number of particles N MPO approach and the dots) compared with the known exact result for strictly local noise F=N ¼ c = asymptotic value of the QFI per particle obtained using the iMPO η2=ð1 À η2Þ with η ¼ eÀ 1 2 (light gray line). approach. The results obtained via the two approaches are in very good agreement. This is a numerical confirmation that indeed the iMPO approach, which, as described in the Methods section is obtained from quantum error-correction-based metrology where much more conceptually involved, yields correct results. In purely anti-correlated noise may be even completely removed Fig. 2b we present the contour plot depicting the asymptotic value recovering the Heisenberg scaling26. of the QFI per particle as a function of noise parameters, where In case of purely local dephasing it is known that in the limit of bottom left inset also demonstrates that state-of-the-art methods large number of particles the fundamental bound, developed with uncorrelated noise models in mind yield bounds F=N ¼ η2=ð1 À η2Þ, can be saturated by protocols involving that are far from satisfactory in case of correlated noise models. weakly spin-squeezed states10,37. We have performed analogous The main qualitative feature that clearly emerges is the decrease analysis in case of correlated noise, see Supplementary Note 2, and of the optimal QFI with the increase of correlated noise part found out that asymptotically the strategy involving optimally parameter c2. At the same time going into the anti-correlation squeezed states and standardpffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi Ramsey measurement lead to the fi Δφe Àc Àc = Àc regime (negative c2) allows for a signi cant increase in the asymptotic precision ¼ ð1 À e 1 þ 2e 1 sinh c2Þ ðNe 1 Þ, achievable QFI—this is to be expected based on intuition which can be related with the corresponding Fisher information

NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications 5 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 per particle equal to: ref. 20 a lower bound on the achievable AVAR was introduced the

Àc1 quantum Allan Variance (QAVAR): F e : ¼ Àc Àc ð17Þ N 1 À e 1 þ 2e 1 sinh c2 σ2 τ σ2 τ 1 τ; ρ ; ; ; Qð Þ¼ LOð ÞÀ sup FAð 0 L TÞ ð23Þ ω2 ρ ; ; We have checked that this formula agrees with our numerical results 0 0 L T up to the desired accuracy (<1%), and the representative comparison hi  of the numerical data and this formula is provided in the left inset of τ; ρ ; ; ρ0 ρ 2 = ; Fig. 2b. This implies that similarly as in the uncorrelated dephasing FAð 0 L TÞ¼ 2Tr L À Tr L 2 ð24Þ models, weakly spin-squeezed states are asymptotically optimal. σ2 τ 1 τ; ρ ; ; Using the above formula, we may also go back to the original where LOð Þ is the AVAR of free running LO, ω2 FAð 0 L TÞ 0 problem of magnetic field sensing. Utilizing the relation φ ¼ gBt represents a correction to it from the feedback loop and T is the we get the corresponding magnetic field sensing precision: rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi interrogation time. We do not provide here explicit forms of the ρ ρ0 20 Àσ2g2t Àσ2g2t χ 2 operators and , and refer the interested reader to ref. , but just Δe 1 Δφe 1 1 À e þ 2e sinhð g tÞ: B ¼ ¼ 2 2 ð18Þ note that the structure of the formulas are similar to that in Eq. (2). t gt gt NeÀσ g t The important information is that, if the atoms with which the The above formula assumes a fixed interrogation time t. We may atomic clock interacts are described via states on some d generalize the considerations, and fix the total interrogation time dimensional Hilbert space H, then the ρ and ρ0 objects act on a T, which we allow to split into T/t independent interrogation tensor space H N ,whereN ¼ 2ðτ=TÞÀ1 is the number of atomic steps. The corresponding estimation uncertainty reads: sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi cycles that need to be considered in order to calculate QAVAR. 1 1 À eÀσ2g2t þ 2eÀσ2g2t sinhðχg2tÞ In Fig. 3a we present the exemplary results for an atomic clock Δe pffiffiffiffiffiffiffiffi Δe ; ð19Þ operating on one two-level atom, where the LO fluctuations are BT ¼ Bt ¼ 2 Àσ2g2t T=t g tTNe characterized by the autocorrelation function RðtÞ, which is a which when optimized over t reaches the minimal value when combination of Ornstein-Uhlenbeck (OU) process and white γ 2 t ! 0 and yields: Gaussian frequency noise RðtÞ¼αeÀ t þ βδðtÞ (α ¼ 1 ðrad=sÞ , rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi β ¼ 0:1 ðrad=sÞ2s, γ ¼ 2sÀ1) (see more detailed discussion of the σ2 þ 2χ ΔBe ¼ : ð20Þ model in Supplementary Note 3). In the long averaging time limit TN σ2 τ = τω2 QAVAR takes the form Qð Þ’c ð 0Þ with some constant c, Based on the above results we can expect that weakly spin- which we will refer to as asymptotic coefficient. The results squeezed states should also be optimal in case of a more general indicate that completely neglecting noise correlations in the dephasing noise, provided the range of correlations r is finite and analysis of the clock performance is unjustified. These calcula- we consider the asymptotic limit N !1. In this case, following tions have been attempted in ref. 20 using the full-Hilbert space analogous calculations, we would arrive at the optimal magnetic description, but were not capable of approaching the regime field sensing precision of the form where the character of the scaling of the QAVAR and the rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiP r coefficient could be unambiguously read out. σ2 þ 2 χ ΔBe ¼ s¼2 s; ð21Þ Following this approach we calculate the QAVAR asymptotic TN coefficient c and the corresponding optimal interrogation time T χ fi where s represent magnetic eld correlations for particles at as a function of the number of atoms in the clock, see Fig. 3b. δ ½nŠ δ ½nþsÀ1Š 0 χ δ 0 From this figure we see that the differences in QAVAR between distance s À 1: h B ðtÞ B ðt Þi ¼ s ðt À t Þ. Comparing cases with strictly local noise and when nearest-neighbor this result with the performance of the GHZ states forp theffiffi same model, see ref. 38, we notice that there is the e factor noise correlations are included only grow with the increasing improvement in performance of the optimally spin-squeezed number of atoms. This implies that noise correlations play an states over the GHZ states familiar from uncorrelated dephasing important role in the accurate analysis of clock performance. We considerations36,37. confront the results (which are optimized over the input state) with values obtained usingpffiffiffi a NOON/GHZ states as an input, ψ = Atomic clock stabilization. A typical atomic clock operates in a ji¼ðji0 þ jiÞd À 1 2. The NOON states are highly prone to feedback loop where the local oscillator (LO, e.g., laser) is stabilized dephasing noise, and hence the optimal interrogation times will to atomic reference frequency by periodically interrogating atoms be necessary reduced compared to the optimal, more robust (using radiation from the LO) and based on the measured response, states. This is a manifestation of a generic poor performance of the frequency of the LO is corrected17. One of the main goals in the the NOON/GHZ states in realistic (noisy) scenarios with 10,11,36 design of the clock interrogation scheme is to achieve the lowest increasing particle number N . instability typically quantifiedbytheAllanvariance(AVAR) *+ Z τ Z τ 2 Fidelity susceptibility for many-body thermalp statesffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi. In con- 1 2 fi φ; φ ε pρffiffiffiffiffiρ pρffiffiffiffiffi σ2 τ ω ω ; densed matter context, delity Fð þ Þ¼Tr φ φþε φ ð Þ¼ 2 dt ðtÞÀ dt ðtÞ ð22Þ 2τ2ω τ ρ ρ 0 0 between many-body states φ and φþε, that differ by a small φ where hiÁ represents averaging over frequency fluctuations of the LO variation of a parameter in a Hamiltonian, is a mean to identify φ 41,42 fi describedbysomestochasticprocess,τ denotes averaging time, ω the location c of a phase transition . This is where the delity 0 χ fi φ; φ ε 1 χ ε2 atomic reference angular frequency and ωðtÞ time-dependent angular susceptibility φ,dened by Fð þ Þ1 À 2 φ , has a frequency of the LO. The key feature from our perspective is the fact maximum indicating a fundamental change in the state of the that the LO frequency fluctuations are temporally correlated and lead system. This concept was employed in ref. 43 to evaluate the effectively to a temporarily correlated dephasing of atoms. usefulness of a quantum phase transition, that happens at zero- Fixing the physical properties of the atoms the goal is to temperature, for precise sensing of the parameter φ in a realistic optimize their initial states, interrogations times, measurements system at a finite temperature. QFI defines a metric in the space and feedback corrections in order to minimize the AVAR. of quantum states (the Bures metric)32 and is directly related with Performing such a comprehensive optimization is not feasible. In the fidelity susceptibility, namely F ¼ 4χφ.

6 NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 ARTICLE

105 a 100 ] 2 104 10–1  [(rad/s)  2 0 3

 –2 10 ) 10  ( 2 Q  Number of atoms = 1 2 –3 10 10 21 22 23 24 25 10–1 100 101 102 103  [s]  b Fig. 4 Fidelity susceptibility for the thermal state. Exact fidelity susceptibility for a thermal many-body state (dots connected by the line) β 1.0 at the critical point in function of dimensionless inverse temperature in the XX model (Eq. 26) with 64 spins. The shaded band shows the bounds Z 39,40 ] (Eq. 25). As predicted in refs. , the exact value tends to the upper/ 2 lower bound for high/low temperatures. Y X [s(rad/s) 0 2

 0.5  ) Nevertheless, we obtain satisfying results with relative error % ε À4 around 1 for ¼ 10 and DL ¼ 4. → ∞ 

( This example demonstrates that the scheme for calculating 2 Q  fidelity susceptibility is a useful byproduct of our general algorithm. Beyond the present metrological context, it paves a 0.0 fi 12345678910way to generalize the zero-temperature delity approach to 41,42 Number of atoms detecting quantum phase transitions —by now standard in condensed matter physics—to phase transitions in quantum Fig. 3 Quantum Allan Variance in the atomic clock stabilization model. many-body systems at finite temperature. ω2 τ a QAVAR (times 0) as a function of the averaging time for the atomic clock (based on one atom) with the local oscillator (LO) noise, which is strictly local Discussion (yellow line) or also includes the nearest neighbors correlations (orange line), We have provided a comprehensive framework for optimization plotted against the AVAR of uncorrected LO (black line). b QAVAR asymptotic of quantum metrological protocols using the tensor-network coefficient as a function of the number of atoms in the atomic clock with LO formalism. The potential to deal effectively with correlated noise noise, which is strictly local (yellow dots connected by solid line/light gray dots models, as well as directly access the asymptotic N !1is what connected by dotted line) or also includes the nearest neighbors correlations makes this framework unique. We also expect that this frame- (orange dots connected by solid line/gray dots connected by dotted line) for work may be adapted to deal with even more challenging the optimal/NOON state, plotted against the AVAR asymptotic coefficient of metrological problems including noisy multiparameter uncorrected LO (black dots connected by solid line). The sphere depicts Husimi estimation44,45, waveform estimation46,47,orthestudyofthe Q distribution on the Bloch sphere for the optimal state of ten atoms with effectiveness of adaptive metrological protocols, including marked equipotential lines where quasiprobability is equal to 0.1 for coherent quantum error-correction-based schemes16,26,48,49.Wealso spin state (black dashed line) and for this optimal state (black solid line), which expect that this numerical framework may be crucial for shows that the state is squeezed. understanding better metrological models with temporally cor- related noise especially of non-Markovian nature22,where effective tools to find the optimal metrological protocols in such Unlike at zero-temperature, the fidelity between a thermal cases are yet to be developed. many-body states represented by MPOs is not tractable in general. This is why a quasi-fidelity was employed Fðe φ; φ þ εÞ¼ Methods qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffiffiffiffiffi ffiffiffiffiffiffiffiffiffi We have implemented all of our algorithms in MATLAB with the help of ncon() pρ pρ fi e φ; φ ε function50 for tensor contraction. Tr φ φþε de ning a quasi-susceptibility, Fð þ Þ 1 eχ ε2 fi 1 À 2 φ , that provides bounds for the exact delity suscept- Optimization in the finite number of particles regime. As discussed in the main 40 ρ ; ibility text maximization of our FoM Fð 0 LÞ, see Eq. (3), leading to the maximal possible QFI for a given metrological model is a two-step iterative process. First, we show e e fi ρ χφ  χφ  2χφ: ð25Þ how to maximize the FoM over a Hermitian operator L with xed 0, and then we ρ fi focus on the maximization over the input state 0 with xed L. 43 1 We search for the optimal L in the form of an MPO The Hamiltonian considered in ref. was the spin-2 XX model X   L ¼ Tr S½1Šj1 S½2Šj2 ¼ S½NŠjN jij hjk ; XNÀ1 XN k1 k2 kN ð27Þ σ½nŠσ½nþ1Š σ½nŠσ½nþ1Š φ σ½nŠ; j;k H ¼À x x þ y y þ x ð26Þ n¼1 n¼1 with a finite bond-dimension D . Without loss of generality, each S½nŠjn is assumed L kn φ Hermitian in its physical indices, with a quantum critical point at c ¼ 0. Taking the MPOs studied 43 in ref. , we bypass the tractability problem employing the part of jn kn ; S½nŠ ¼ S½nŠj ð28Þ ρ0 ρ ρ =ε kn n our scheme with φ ¼ð φþε À φÞ to calculate the QFI to ensure that L is Hermitian. We call this condition a Hermitian gauge. F ¼ 4χφ. This exact susceptibility for the chain with 64 spins is The bond-dimension DL for L is expected to be small for weakly correlated shown in Fig. 4, together with the upper and lower bounds noise models. Indeed, in the limit of an uncorrelated product state ρ ¼ ϱ N , L is a P φ φ (Eq. 25). The accuracy of the fidelity susceptibility is limited by the N ½nŠ ½nŠ sum of local operators, L ¼ n¼1L . Here, L is the SLD for the single-particle fi fi ε ρ0 nite bond-dimension DL as well the nite parameter difference . problem applied to particle n. In a similar way as for φ presented in the main text,

NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications 7 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 the sum can be represented by an MPO with a bond-dimension 2. Therefore, which can be also written in a compact way as DL ¼ 2 is the limiting value for uncorrelated noise models. X X ρ ; Fðρ ; LÞ¼2 bαS½2Š À S½2Š AαβS½2Š : Graphical representation of the FoM Fð 0 LÞ reads: 0 α α β ð29Þ α αβ

Here, bα are the elements of the vector jib , and Aα;β are the elements of the matrix A. Both jib and A describe the entire tensor-network complementing the distinguished vector jiS½2Š in the two respective terms of the S½2Š-FoM. After taking a derivative with respect to S½2Šα, we obtain a linear equation for the extremum: 1 ÀÁ A þ AT jiS½2Š ¼ jib : ð30Þ 2 ÀÁ 2 2 ´ 2 2 e 1 T The d DL d DL matrix A ¼ 2 A þ A typically has a non-zero kernel and the linear equation does not have a unique solution. We use the Moore–Penrose þ þ pseudo-inverse, Ae , to obtain a solution ji¼S½2Š Ae jib that does not contain any zero modes of Ae. If the linear equation was non-singular, then its exact solution would satisfy the Hermitian gauge (Eq. 28). For the typical singular case, using an SVD of Ae to construct its pseudo-inverse, we have to truncate singular values falling below a small but finite cutoff, set by κ multiplied by the highest singular value. As the cutoff solution jiS½2Š need not satisfy the Hermitian gauge condition exactly, we filter out its small anti-Hermitian part with the substitution:  1 j2 j2 k2 : S½2Š ! S½2Š þ S½2Šj ð31Þ k2 2 k2 2 From experience, this substitution can improve numerical stability but is not κ Maximization of the FoM over L is equivalent to a joint maximization over each necessary when all initial S½nŠ are in the Hermitian gauge (Eq. 28) and is large tensor S½nŠ. We relax this optimization problem by iterating an optimization loop. enough to suppress the anti-Hermitian part of the solution. However, with too fi In the loop we first find the optimal S½1Š, then S½2Š, and so on up to S½NŠ, after large a cutoff the nal optimized L does not reach the maximal possible value of the κ which we go back to S½1Š. The optimization over each S½nŠ is performed with all QFI. Therefore, we adjust to obtain the highest QFI achievable without other tensors fixed. The loop is repeated until the FoM converges. compromising the stability. ρ After fixing the other tensors, the FoM becomes quadratic in S½nŠ and the Now we move on to the maximization of the FoM over the input state 0 for a fi ρ ; optimal S½nŠ is found as a solution to a linear equation. For definiteness, to explain xed L. We start by rewriting Fð 0 LÞ as the procedure, we focus on the generic example of S½2Š. We start by vectorizing ρ ; ρ0 ρ 2 S½2Š!jiS½2Š : Fð 0 LÞ¼2Trð φLÞÀTrð φL Þ Λ ρ ; Λ ρ 2 ¼ 2Trði½ φð 0Þ HŠLÞÀTrð φð 0ÞL Þ ð32Þ ρ ; Λà ρ Λà 2 ; ¼ 2Trð 0i½H φðLÞŠÞ À Trð 0 φðL ÞÞ

à where by ΛφðÁÞ we denote the channel, which is dual to ΛφðÁÞ (the evolution written in the Heisenberg picture). We can rewrite this as ρ ; ρ 0à à ; Fð 0 LÞ¼Tr½ 0ð2Lφ À L2;φފ ð33Þ

à à Λà 0à dLφ ; à à Λà 2 where we introduce Lφ ¼ φðLÞ, Lφ ¼ dφ ¼ i½H LφŠ and L2;φ ¼ φðL Þ.By ρ Λ ρ This allows us to represent the S½2Š-FoM as: analogy with the construction of the MPO representation for φ ¼ φð 0Þ and ρ0 ρ ; à 0à φ ¼ i½ φ HŠ, we can easily construct the MPO representation of L2;φ and Lφ from à 0à the known MPO form of L. The tensors determining the MPO form of L2;φ and Lφ 0 are denoted by S2½nŠ and S ½nŠ, respectively, and their respective bond-dimensions 2 are D ¼ D D and D 0 ¼ 2D D . L2 L r L L r ρ ; ρ The quantity Fð 0 LÞ in Eq. (33) is maximal when 0 is a projection on the eigenvector associated with the maximal eigenvalue of the Hermitian operator 0à à 2Lφ À L2;φ. Hence, without loss of generality, we can assume a pure input state ρ ψ ψ ψ 0 ¼ jihjwith jibeing an MPS with bond-dimension Dψ : X ÀÁ ψ j1 j2 ¼ jN : ji¼ Tr P½1Š P½2Š P½NŠ jij ð34Þ j

2 The input state ρ has bond-dimension Dρ ¼ Dψ and its MPO tensors are 0 0 j j k R ½nŠ n ¼ P½nŠ n P½nŠ n . 0 kn ρ ; ψ The maximization of Fð 0 LÞ over the input state jiis equivalent to the variational optimization for the of a many-body “Hamiltonian” à 0à L2;φ À 2Lφ , a problem widely discussed in the many-body physics MPS literature27,51,52. After reinterpreting our problem as a variational minimization of the “energy”

à 0à hjψ L ;φ À 2Lφ jiψ ÀFðρ ; LÞ¼ 2 ; ð35Þ 0 hiψjψ we proceed iteratively in a similar way as in the case of the maximization of ρ ; Fð 0 LÞ over L. For example, in order to find the minimum over P½2Š, we begin by vectorizing the tensor P½2Š!jiP½2Š and expressing the “energy” (Eq. 35) as a Rayleigh quotient hiP½2ŠjFjP½2Š ÀFðρ ; LÞ¼ : ð36Þ 0 hiP½2ŠjN jP½2Š

8 NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 ARTICLE

2 2 The tensor-network form of dDψ ´ dDψ matrices F and N is given by full-Hilbert space computation, it may sometimes be not enough to reach the asymptotic limit and determine the quantum enhancement coefficient with the desired precision. For this reason, we would like to have a procedure that allows us to go directly to the infinite particle limit, calculate the maximal achievable QFI per particle and, as a result, determine the maximal quantum enhancement coefficient. For this purpose, we exploit the infinite MPO/MPS (iMPO/iMPS) approach, see e.g., ref. 29. We assume that all tensors are translationally invariant (TI). Then we take the limit of infinite N. Technically this limit is most natural in the case of PBCs, where it is enough to notice that, for any TI transfer matrix E, the spectral decomposition of EN is dominated by the leading eigenvalue and eigenvector of E. This is why in the following discussion we proceed with PBCs. In the OBC case, which is arguably more natural in some metrological contexts, one has in principle to consider the boundary conditions at infinity. However, Ek applied to a boundary vector gives the leading eigenvector of E when k becomes longer than the finite correlation range (just as in the Lanczos algorithm). Therefore, in the bulk (i.e., far from the boundaries), all equations the TI tensors have to satisfy become the same as for the PBC. When the input state jiψ is TI then the final state ρφ is TI as well. There is a 0 problem, however, with the operator ρφ. Its construction as an MPO in Eq. (8)is not TI. Because of this, instead of calculating the derivative exactly, we approximate it by a difference of two TI iMPOs:

ρ À ρ ρ0 φþε φ φ ¼ ε ð38Þ

with infinitesimal parameter ε. Motivated by the defining equation for the SLD

0 1 ρφ ¼ ðLρφ þ ρφLÞ; ð39Þ 2

we can consider a similar to Eq. (38) expansion of the operator L:

e 1 L À : ð40Þ L ¼ ε

e 1 ρ0 ρ Here, L and are solutions of Eq. (39) when φ is replaced by, respectively, φþε ρ e After taking the derivative of Eq. (36) we obtain the condition for the extremum: and φ. We search for the optimal L, which is better suited for the TI formalism than the original operator L. Let us denote by ρ ; ; FjiP½2Š ¼ÀFð 0 LÞNjiP½2Š ð37Þ ρ ; which is a generalized eigenvalue problem with eigenvalue ÀFð 0 LÞ.By 1 f ðρ ; eLÞ¼ Fðρ ; LÞ ð41Þ multiplying it with a pseudo-inverse of matrix N we bring it into the form of 0 N 0 ordinary eigenvalue problem, for which we obtain the lowest eigenvalue and its corresponding eigenvector using the Lanczos algorithm. Modification of the entire tensor-network framework to calculate the maximal the QFI per particle that we want to maximize: QFI for systems with open boundary conditions (OBC) poses no problem and, for systems, which are not sensitive to boundary conditions, is even advisable. In OBC hi the MPS representing jiψ can be brought to a canonical form, where the matrix N e 1 e e2 f ðρ ; LÞ¼ 2Tr ρφ εL À Tr ρφL À 1 : ð42Þ becomes an identity and Eq. (37) reduces to a standard eigenvalue problem. There 0 Nε2 þ is no need to pseudo-invert N . To summarize the procedure: one needs to iteratively determine the optimal L ρ ρ A TI iMPO is defined by only one tensor, which we assign, respectively, as: for a given 0 and then the optimal 0 for a given L, until one observes convergence fi : % fi ψ ρ ρ e e eà e eà e of the nal result, e.g., the FoM does not change more than, say, 0 1 after a xed ji!P, 0 ! R0, φ ! Rφ, L ! S, Lφ ! Sφ, L2;φ ! S2. number of steps. From our numerical experience this happens very rapidly, Optimization of a tensor-network consisting of identical tensors A is a highly fi ρ typically after ve iterations of the 0 and L optimization steps. nonlinear problem in A and one might think that an approach similar to the While running the algorithm, one has to choose the bond-dimensions for the one used in the previous subsection is not applicable here. Fortunately, an input state, Dψ , as well as for the SLD, DL, over which the optimization is efficient method for the problem was developed in ref. 53. The main idea is fi performed. As in all tensor-network algorithms, keeping the bond-dimension as to nd the optimal tensor Anew at one-site, treating all other tensors A as fi fi fl low as possible is essential for their ef ciency. In our calculations, we typically xed, and then rather then replacing all tensors by Anew perform a exible started with a product input state, Dψ ¼ 1, and optimized for L with a minimal substitution, non-trivial DL ¼ 2. Then we increased one of the bond-dimensions, either Dψ or D , each time repeating the optimization procedure, until we found that the QFI L λπ λπ ; did not change when increasing the D’s more than by, e.g., 1% and hence assumed A ! Anew sinðÞÀA cosðÞ ð43Þ that relative error of our method is around 1%.

with a mixing angle λ.Theangleisoptimizedtoyield the best possible FoM. Optimization in the asymptotic limit. The previous subsection described an We now apply this approach to our two-step iterative procedure. First we need algorithm that functions for a system with a finite number of particles N.For to find the optimal eL, which is equivalent to the determination of the optimal local quantum metrological problems in the presence of decoherence, it is the generic e situation that the optimal quantum enhancement thanks to the use of entan- tensor S. glement leads asymptotically (for large N) to an improvement by a constant As explained in Supplementary Note 4, the trace of an operator represented as fi factor over product-state strategies. Even though the finite-system MPO an iMPO is de ned by its transfer matrix, so we start by introducing transfer ρ e ρ e2 approach allows us to achieve values of N that are inaccessible via exact matrices E1 and E2 associated with, respectively, φþεL and φL , which are

NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications 9 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 depicted below alongside their eigendecomposition: calculate the associated value of our FoM per particle:

e 1 N N f ðρ ; LÞ¼ ð2λ ; À λ ; À 1Þ; ð46Þ 0 Nε2 1 1 2 1

but going back to Eq. (2) we see that FoM per particle should have form ρ ; e f ð 0 LÞ¼2f 1 À f 2, where f 1 and f 2 are of the same order of magnitude as the asymptotic limit of the QFI per particle. Assuming that our calculations are in the regime of N !1, ε ! 0, and Nε2 ! 0, and remembering binomial expansion

ε2 N ε2 ε2 2 ; ð1 þ f iÞ ¼ 1 þ N f i þ O½ðN Þ Š ð47Þ

it is to be expected that the highest eigenvalues of the transfer matrices have the form:

λ ε2 ; λ ε2 ; 1;1 ¼ 1 þ f 1 2;1 ¼ 1 þ f 2 ð48Þ

which after inserting into Eq. (46) and using binomial expansion to the first order ρ ; e give us exactly f ð 0 LÞ¼2f 1 À f 2. Note that, it means that we can calculate value of FoM per particle in a simple way:

e 1 f ðρ ; LÞ ð2λ ; À λ ; À 1Þ: ð49Þ 0 ε2 1 1 2 1

λNÀ1 It is clear now that for the purpose of solving Eq. (45) we can approximate 1;1 λNÀ1 e and 2;1 by ones and, hence, bring the condition for the optimal S to a simpler form:

1 ÀÁ A þ AT jeS i¼jbi: ð50Þ   2 ρ e N ρ e2 N Using this transfer matrices we can write Tr φþεL ¼ TrE1 ,Tr φL ¼ TrE2 N This equation is solved with a pseudo-inverse and its anti-Hermitian part is filtered and with the fact that Ei is determined by its leading eigenvalue we can write N NÀ1 out at every iteration step. TrE ¼ λ ; ðl ; jE jr ; Þ. Now we can construct iMPO representation of the FoM: i i 1 i 1 i i 1 SLD is always traceless in any unitary parameter estimation problem,P which can ρ λ λ λ be seen by solving Eq. (39) for the SLD using eigenbasis of φ ¼ j jj jih jj:

X λ ρ0 λ 2h jj φjik L ¼ jλ ihjλ ; ð51Þ λ þ λ j k j;k j k

λ ρ0 λ λ ; ρ λ and taking into account that h jj φj ji¼ih jj½H φŠj ji¼0. We can ensure that solution eS has proper normalization using the condition TrL ¼ 0 or, equivalently TreL ¼ Tr1 ¼ dN , which in the language of transfer matrices means that the highest eigenvalue of the transfer matrix associated with operator eL has to be equal to d. Now we turn to the second part of our optimization procedure, namely the variational minimization over the input state. This step does not introduce any qualitatively new challenges, so we only briefly discuss it for completeness. As for 0 0à the ρφ, we approximate the exact derivative of Lφ by its discrete version:

à à Lφ ε À Lφ 0à þ : ð52Þ Lφ ¼ ε

After the expansion L ¼ðeL À 1Þ=ε, our task becomes equivalent to minimization of the “energy density”:

ψ eà eà 1 ψ hjL ;φ À 2Lφþε þ ji Àf ðρ ; eLÞ¼ 2 ð53Þ 0 Nε2hiψjψ

over jiψ . We can depict Eq. (53) in a diagrammatic form:

ρ ; e e where we depicted f ð 0 LÞ and its version with tensor S distinguished (after performing vectorization). This FoM can be also expressed in form of equation: P P NÀ1 e NÀ1 e e λ ; α bαSα À λ ; αβ SαAαβSβ À 1 f ðρ ; eLÞ¼ 1 1 2 1 ; ð44Þ 0 Nε2 which give us condition for an extremum: ÀÁ 1 NÀ1 T e NÀ1 λ ; A þ A jSi¼λ ; jbi: ð45Þ 2 1 1 2 1 For N !1the powers of the eigenvalues may seem to pose a problem. e Fortunately, however, this problem can be circumvented. For a given L we can where we have used transfer matrices E3, E4, and E5 associated with, respectively,

10 NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9 ARTICLE

ψ eà ψ ψ eà ψ ψ ψ While performing the numerics one should choose ε to be small but not too hjL2;φji, hjLφþεji, and hij that are represented graphically as small as too small values may lead to numerical instabilities. Our general strategy in obtaining numerical results in the examples presented, was to lower the value of ε until we observed no noticeable change in the obtained results, while still remaining in the regime where algorithm was stable. In all the examples we studied in this paper this approach resulted in the choice of ε  10À3À10À4 (instabilities started to appear for ε < 10À6). Notice that in the asymptotic iMPO approach described above we required Nε2 to be small—on the order of the precision we expect from the numerical results. In other words setting the precision requirements to 10À2 this implies that Nε2  10À2, and hence N  104 À 106. What this physically means is that in our set-up the QFI per particle does not change in any noticeable way for larger N and hence the asymptotic behavior in the actual N !1limit may be inferred from this results.

Data availability The data that support the findings of this study are available from the authors upon request.

Code availability The code used to implement the algorithms developed in the study are available from the authors upon request.

Received: 1 August 2019; Accepted: 21 November 2019;

References λ ε2 fi As previously, we expect that i;1 ¼ 1 þ f i and for the purpose of nding the 1. Giovannetti, V., Lloyd, S. & Maccone, L. Quantum metrology. Phys. Rev. Lett. λNÀ1 λNÀ1 optimal tensor P, we can approximate 3;1 and 4;1 by ones. After taking the 96, 010401 (2006). derivative we obtain the condition for the extremum: 2. Paris, M. G. A. Quantum estimation for quantum technologies. Int. J. Quantum Inf. 07, 125–137 (2009). ; Fji¼P gN jiP ð54Þ 3. Demkowicz-Dobrzanski, R., Jarzyna, M., & Kolodynski, J., in Progress in Optics, Vol. 60 (ed. Wolf, E.) 345–435 (Elsevier, 2015). where g ¼Àf ðρ ; eLÞNε2 À λNÀ1 is a generalized eigenvalue, whereas the matrices 0 5;1 4. Schnabel, R. Squeezed states of light and their applications in laser F and N have the following tensor-network representation interferometers. Phys. Rep. 684,1–51 (2017). 5. Pezzè, L., Smerzi, A., Oberthaler, M. K., Schmied, R. & Treutlein, P. Quantum metrology with nonclassical states of atomic ensembles. Rev. Mod. Phys. 90, 035005 (2018). 6. Pirandola, S., Bardhan, B. R., Gehring, T., Weedbrook, C. & Lloyd, S. Advances in photonic quantum sensing. Nat. Photonics 12, 724–733 (2018). 7. Cramer, M. et al. Efficient tomography. Nat. Commun. 1, 149 (2010). 8. Aolita, L., Gogolin, C., Kliesch, M. & Eisert, J. Reliable quantum certification of photonic state preparations. Nat. Commun. 6, 8498 (2015). 9. Macieszczak, K., Fraas, M. & Demkowicz-Dobrzański, R. Bayesian quantum frequency estimation in presence of collective dephasing. N. J. Phys. 16, 113002 (2014). 10. Escher, B. M., de Matos Filho, R. L. & Davidovich, L. General framework for estimating the ultimate precision limit in noisy quantum-enhanced metrology. Nat. Phys. 7, 406 (2011). 11. Demkowicz-Dobrzanski, R., Kolodynski, J. & Guta, M. The elusive heisenberg limit in quantum-enhanced metrology. Nat. Commun. 3, 1063 (2012). 12. Kołodyński, J. & Demkowicz-Dobrzański, R. Efficient tools for quantum metrology with uncorrelated noise. N. J. Phys. 15, 073043 (2013). 13. Demkowicz-Dobrzański, R. & Maccone, L. Using entanglement against noise in quantum metrology. Phys. Rev. Lett. 113, 250801 (2014). 14. Sekatski, P., Skotiniotis, M., Kołodyński, J. & Dür, W. Quantum metrology with full and fast quantum control. Quantum 1, 27 (2017). 15. Demkowicz-Dobrzański, R., Czajkowski, J. & Sekatski, P. Adaptive quantum metrology under general markovian noise. Phys. Rev. X 7, 041009 (2017). The matrix N is a tensor product of three matrices, r5;1, the identity, and l5;1, hence 16. Zhou, S., Zhang, M., Preskill, J. & Jiang, L. Achieving the heisenberg limit in its pseudo-inverse N þ can be obtained as a tensor product of (pseudo-)inverses of quantum metrology using . Nat. Commun. 9,78 the smaller matrices. Applying N þ to Eq. (54) we bring it into the form of a (2018). standard eigenvalue problem. We solve this eigenproblem with respect to the 17. Ludlow, A. D., Boyd, M. M., Ye, J., Peik, E. & Schmidt, P. O. Optical atomic smallest eigenvalue and its corresponding eigenvector jiψ and require that jiψ is clocks. Rev. Mod. Phys. 87, 637–701 (2015). λ normalized so that 5;1 ¼ 1. Then we calculate the asymptotic value of the QFI per 18. André, A., Sørensen, A. S. & Lukin, M. D. Stability of atomic clocks based on particle: entangled atoms. Phys. Rev. Lett. 92, 230801 (2004). 19. Kessler, E. M. et al. Heisenberg-limited atom clocks based on entangled qubits. 1 Àf ðρ ; eLÞ¼ ðλN À 2λN þ 1Þ Phys. Rev. Lett. 112, 190403 (2014). 0 ε2 3;1 4;1 N ð55Þ 20. Chabuda, K., Leroux, I. D. & Demkowicz-Dobrzański, R. The quantum allan 1 λ λ : variance. N. J. Phys. 18, 083035 (2016).  f 3 À 2f 4 ¼ ð 3;1 À 2 4;1 þ 1Þ ε2 21. Szańkowski, P., Ramon, G., Krzywda, J., Kwiatkowski, D. & Cywiński, Ł. Just as for the finite N, iterating the eL and jiψ optimization steps leads to the Environmental noise spectroscopy with qubits subjected to dynamical optimal solution with the maximal QFI per particle. decoupling. J. Phys.: Condens. Matter 29, 333001 (2017).

NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications 11 ARTICLE NATURE COMMUNICATIONS | https://doi.org/10.1038/s41467-019-13735-9

22. Chin, A. W., Huelga, S. F. & Plenio, M. B. Quantum metrology in non- 50. Pfeifer, R.N.C., Evenbly, G., Singh, S., & Vidal, G. Ncon: a tensor network Markovian environments. Phys. Rev. Lett. 109, 233601 (2012). contractor for matlab, Preprint at http://arxiv.org/abs/1402.0939 (2014). 23. Rondin, L. et al. Magnetometry with nitrogen-vacancy defects in diamond. 51. White, S. R. Density matrix formulation for quantum renormalization groups. Rep. Prog. Phys. 77, 056503 (2014). Phys. Rev. Lett. 69, 2863–2866 (1992). 24. Jeske, J., Cole, J. H. & Huelga, S. F. Quantum metrology subject to spatially 52. Schollwöck, U. The density-matrix renormalization group in the age of matrix correlated markovian noise: restoring the heisenberg limit. N. J. Phys. 16, product states. Ann. Phys. 326,96–192 (2011). 073039 (2014). 53. Corboz, P. Variational optimization with infinite projected entangled-pair 25. Altenburg, S., Oszmaniec, M., Wölk, S. & Gühne, O. Estimation of gradients states. Phys. Rev. B 94, 035133 (2016). in quantum metrology. Phys. Rev. A 96, 042319 (2017). 26. Layden, D. & Cappellaro, P. Spatial noise filtering through error correction for quantum sensing. npj Quantum Inf. 4, 30 (2018). Acknowledgements 27. Bridgeman, J. C. & Chubb, C. T. Hand-waving and interpretive dance: an We would like to thank Marek M. Rams, David Layden, Maciej Lewenstein, Shi-Ju Ran, introductory course on tensor networks. J. Phys. A: Math. Theor. 50, 223001 Piet O. Schmidt, and Ian D. Leroux for fruitful discussions. We are also indebt to Marek (2017). M. Rams for sharing with us the data from ref. 43. K.Ch. and R.D.D. acknowledge 28. Verstraete, F., García-Ripoll, J. J. & Cirac, J. I. Matrix product density support from the National Science Center (Poland) grant No. 2016/22/E/ST2/00559. operators: simulation of finite-temperature and dissipative systems. Phys. Rev. Work of J.D. was funded by the National Science Center (Poland) together with Eur- Lett. 93, 207204 (2004). opean Union through QuantERA ERA NET program 2017/25/Z/ST2/03028. T.J.O. was 29. Cincio, L. & Vidal, G. Characterizing topological order by studying the ground supported, in part, by the DFG through SFB 1227 (DQmat), the RTG 1991, and the states on an infinite cylinder. Phys. Rev. Lett. 110, 067208 (2013). cluster of excellence EXC 2123 QuantumFrontiers. 30. Jarzyna, M. & Demkowicz-Dobrzański, R. Matrix product states for quantum metrology. Phys. Rev. Lett. 110, 240405 (2013). Author contributions 31. Helstrom, C. W. Quantum Detection and Estimation Theory (Academic Press, K.Ch. played the leading role in the development and implementation of the optimi- 1976). zation algorithms, as well as performed all numerical and part of analytical calculations. 32. Braunstein, S. L. & Caves, C. M. Statistical distance and the geometry of J.D. and T.J.O. provided crucial conceptual contribution to the development of the MPO quantum states. Phys. Rev. Lett. 72, 3439–3443 (1994). algorithms as well as participated in numerous discussions. R.D.D. conceived and closely 33. Macieszczak, K., Quantum fisher information: variational principle and simple supervised the project as well as performed part of analytical calculations. All authors iterative algorithm for its efficient computation, Preprint at http://arxiv.org/ contributed to the preparation of the manuscript with the leading role played by K.Ch. abs/1312.1356 (2013). and R.D.D. 34. Demkowicz-Dobrzański, R. Optimal phase estimation with arbitrary a priori knowledge. Phys. Rev. A 83, 061802(R) (2011). 35. Tóth, G. & Vértesi, T. Quantum states with a positive partial transpose are Competing interests useful for metrology. Phys. Rev. Lett. 120, 020506 (2018). The authors declare no competing interests. 36. Huelga, S. F. et al. Improvement of frequency standards with quantum – entanglement. Phys. Rev. Lett. 79, 3865 3868 (1997). Additional information 37. Ulam-Orgikh, D. & Kitagawa, M. Spin squeezing and decoherence limit in Supplementary information ramsey spectroscopy. Phys. Rev. A 64, 052106 (2001). is available for this paper at https://doi.org/10.1038/s41467- 019-13735-9. 38. Layden, D., Zhou, S., Cappellaro, P. & Jiang, L. Ancilla-free quantum error correction codes for quantum metrology. Phys. Rev. Lett. 122, 040502 Correspondence (2019). and requests for materials should be addressed to R.D.-D. 39. Albuquerque, A. F., Alet, F., Sire, C. & Capponi, S. Quantum critical scaling of Peer review information fidelity susceptibility. Phys. Rev. B 81, 064418 (2010). Nature Communications thanks the anonymous reviewer(s) for 40. Sirker, J. Finite-temperature fidelity susceptibility for one-dimensional their contribution to the peer review of this work. Peer reviewer reports are available. quantum systems. Phys. Rev. Lett. 105, 117203 (2010). Reprints and permission information 41. Zanardi, P. & Paunković, N. Ground state overlap and quantum phase is available at http://www.nature.com/reprints transitions. Phys. Rev. E 74, 031123 (2006). fi Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in 42. Rams, M. M. & Damski, B. Quantum delity in the thermodynamic limit. fi Phys. Rev. Lett. 106, 055701 (2011). published maps and institutional af liations. 43. Rams, M. M., Sierant, P., Dutta, O., Horodecki, P. & Zakrzewski, J. At the limits of criticality-based quantum metrology: Apparent super-heisenberg scaling revisited. Phys. Rev. X 8, 021022 (2018). Open Access This article is licensed under a Creative Commons 44. Ragy, S., Jarzyna, M. & Demkowicz-Dobrzański, R. Compatibility in Attribution 4.0 International License, which permits use, sharing, multiparameter quantum metrology. Phys. Rev. A 94, 052108 (2016). adaptation, distribution and reproduction in any medium or format, as long as you give 45. Baumgratz, T. & Datta, A. Quantum enhanced estimation of a appropriate credit to the original author(s) and the source, provide a link to the Creative multidimensional field. Phys. Rev. Lett. 116, 030801 (2016). Commons license, and indicate if changes were made. The images or other third party 46. Tsang, M., Wiseman, H. M. & Caves, C. M. Fundamental quantum limit to material in this article are included in the article’s Creative Commons license, unless waveform estimation. Phys. Rev. Lett. 106, 090401 (2011). indicated otherwise in a credit line to the material. If material is not included in the 47. Berry, D. W., Hall, M. J. W. & Wiseman, H. M. Stochastic heisenberg article’s Creative Commons license and your intended use is not permitted by statutory limit: optimal estimation of a fluctuating phase. Phys. Rev. Lett. 111, 113601 regulation or exceeds the permitted use, you will need to obtain permission directly from (2013). the copyright holder. To view a copy of this license, visit http://creativecommons.org/ 48. Arrad, G., Vinkler, Y., Aharonov, D. & Retzker, A. Increasing sensing licenses/by/4.0/. resolution with error correction. Phys. Rev. Lett. 112, 150801 (2014). 49. Dür, W., Skotiniotis, M., Fröwis, F. & Kraus, B. Improved quantum metrology using quantum error correction. Phys. Rev. Lett. 112, 080801 (2014). © The Author(s) 2020

12 NATURE COMMUNICATIONS | (2020) 11:250 | https://doi.org/10.1038/s41467-019-13735-9 | www.nature.com/naturecommunications