Improving spin-based noise sensing by adaptive measurements

Localized spins in the solid state are attracting widespread attention as highly sensitive quantum sensors with nanoscale spatial resolution and fascinating applications. Recently, adaptive measurements were used to improve the dynamic range for spin-based sensing of deterministic Hamiltonian parameters. Here we explore a very different direction -- spin-based adaptive sensing of random noises. First, we identify distinguishing features for the sensing of magnetic noises compared with the estimation of deterministic magnetic fields, such as the different dependences on the spin decoherence, the different optimal measurement schemes, the absence of the modulo-2\pi phase ambiguity, and the crucial role of adaptive measurement. Second, we perform numerical simulations that demonstrate significant speed up of the characterization of the spin decoherence time via adaptive measurements. This paves the way towards adaptive noise sensing and coherence protection.

Recently, there were growing interest in using adaptive measurements to mitigate the modulo-2π phase ambiguity and hence improve the dynamic range of spin-based quantum sensing [63][64][65][66][67][68]. However, previous works focus on deterministic Hamiltonian parameters that drive the unitary evolution of the spin quantum sensor, leaving a large, important family of tasks unexplored -the spin-based quantum sensing of random noises that drive the non-unitary decoherence of the spin. It is important to identify the distinctions of spin-based noise sensing compared with the spin-based Hamiltonian parameter estimation, and further provide feasible methods to improve the key figure of merit -the sensing precision.
In this work, we explore theoretically the role of adaptive measurement in spin-based sensing of magnetic noises. * wenyang@csrc.ac.cn First, our general analysis identifies a series of distinguishing features for sensing a random magnetic field (i.e., magnetic noises) compared with the estimation of a deterministic magnetic field (which is a paradigmatic Hamiltonian parameter), including the different dependences on the spin decoherence, the different optimal measurement schemes, and the absence of the modulo-2π phase ambiguity. Moreover, optimizing noise sensing requires knowledge about the unknown noises to be estimated, so adaptive measurements are crucial for improving the sensing precision. By contrast, in the estimation of deterministic magnetic fields, adaptive measurements are usually alternatives to non-adaptive schemes for mitigating the modulo-2π phase ambiguity and hence improving the dynamic range [64,65] and non-adaptive measurements can even outperform adaptive ones in some cases [64]. Second, we perform numerical simulations and demonstrate that using adaptive measurements can speed up significantly the estimation of the spin decoherence time. These results pave the way towards spin-based adaptive sensing of noises. Since rapid characterization of decoherence allows us to design efficient schemes to suppress the decoherence, these results are also relevant to quantum computation. This rest of this paper is organized as follows. In Sec. II, we outline the basic steps of a general adaptive measurement, leaving a detailed introduction to every step in Appendices A-E. In Sec. III, we analyze general spin-based sensing of magnetic noises and identify its distinguishing features. In Sec. IV, we perform numerical simulations for the adaptive estimation of the spin decoherence time. In Sec. IV, we draw the conclusion.

II. ADAPTIVE QUANTUM PARAMETER ESTIMATION
A general parameter estimation protocol using a quantum system to estimate an unknown, real parameter ζ consists of three steps (Fig. 1 2. The quantum system undergoes a measurement, which produces an outcome according to certain probability distribution. In this step, the quantum Fisher information F (ζ) contained inρ ζ is transferred into the classical information in the measurement outcome. The information contained in each outcome is quantified by the classical Fisher information (CFI) F(ζ), which obeys 3. Steps 1-2 are repeated N times and the N outcomes are processed to yield an estimator ζ est to the unknown parameter ζ. In this step, the total CFI NF(ζ) contained in the N outcomes is converted to the estimation precision, as quantified by the statistical error of the estimator: where · · · denotes the average over a lot of estimators obtained by repeating steps 1-3 many times. For unbiased estimators obeying ζ est = ζ, the precision δζ is fundamentally limited by the inequality known as the Cramér-Rao bound [69,70].
For optimal performance, it is necessary to optimize each step of the above initialization-evolution-measurement cycle. In step 1, the initial stateρ in and the evolution process should be optimized to maximize F (ζ). In step 2, appropriate measurements should be designed to convert all the QFI contained inρ ζ into the CFI contained in the measurement outcome, so that F(ζ) attains its maximum value F (ζ) allowed by Eq. (1). In step 3, optimal unbiased estimators should be used to convert all the CFI NF(ζ) contained in the N outcomes into the useful information (δζ) −2 contained in the estimator. For example, for large N, the Bayesian estimator or the maximum likelihood estimator are unbiased and can saturate the Cramér-Rao bound Eq. (3).
In step 1 and step 2, F (ζ) and F(ζ) may depends on ζ, so the optimization for maximal F (ζ) and F(ζ) requires knowledge about the true value (denoted by ζ true ) of the unknown parameter ζ. A possible solution is adaptive measurements [71,72], i.e., using the measurement outcomes of previous initialization-evolution-measurement cycles to refine our knowledge about ζ and then use this knowledge to optimize the next cycle. In step 2-3, the probability distribution of the measurement outcome as a function of the unknown parameter ζ may be periodic, making it impossible to identify a unique estimator. This ambiguity problem is commonly encountered in estimating deterministic Hamiltonian parameters and can be mitigated by using either non-adaptive or adaptive measurements [64]. In this work, we explore the spin-based sensing of random noises and show that the ambiguity problem is absent, while the dependence of F (ζ) and F(ζ) on ζ true makes adaptive measurements critical for improving the sensing precision.
Our subsequent discussions are based on the general adaptive measurement protocol in Fig. 1, which involve many important concepts and techniques, such as the QFI, the CFI, optimal unbiased estimators (such as the Bayesian estimator and the maximum likelihood estimator), the Cramér-Rao bound, and adaptive measurements. A systematic, self-contained introduction to these concepts (including a simple example) are given in Appendices A-E.

III. ADAPTIVE SENSING OF MAGNETIC NOISES
The main purpose of this section is to identify the distinguishing features of spin-based noise sensing compared with the estimation of deterministic Hamiltonian parameters. For this purpose, we consider a generic pure-dephasing model describing the evolution of a spin-1/2Ŝ under a constant magnetic field B and a magnetic noiseB(t) along the z axis, where ω ≡ γB,ω(t) ≡ γB(t), and γ is the gyromagnetic ratio. This model is relevant to many experiments involving a localized electron spin in solid state environments (such as the semiconductor quantum dots and nitrogen-vacancy centers in diamond), where the dominant magnetic noises come from the surrounding electron spin bath or nuclear spin bath. The former can be modelled by a Ornstein-Uhlenbeck noise [41,[73][74][75], while the latter can be modelled by a quasi-static noise [76,77] (see Ref. 78 for a review). Next, we follow the standard steps outlined in Sec. II and further detailed in Appendices A-E to discuss the estimation of the noiseω(t) in comparison with the estimation of ω -a paradigmatic Hamiltonian parameter.
For step 1, we prepare the spin into a pure initial state parametrized by Θ. Next, under the Hamiltonian in Eq. (4), the spin evolves for an interval τ into a final mixed statê where e −χ ≡ e −i τ 0ω (t)dt is the average of the random phase over the noise distribution. For general noies, χ could be complex. Here we assumeω(t) is symmetric about zero, then χ is The red arrows denote the initial and final spin orientation and the solid (dashed) blue line denotes the optimal measurement axis for estimating ω (any noise parameter ζ).
real. Usually the fluctuation of the random phase grows with the evolution time τ, so e −χ decreases with τ, corresponding to the decay of the average spin in the xy plane or spin decoherence for short [78]. From Eq. (6), we see that all the information about ω is carried by the phase factor e −iωτ , while all the information about the noise is carried by the decoherence factor e −χ .
For ω and any parameter (denoted by ζ) that characterizes the noiseω(t), the QFI in the final stateρ(τ) can be computed by Eq. (A4) as Here F ω and F ζ show very different dependences on the decoherence factor χ. This highlights the first distinguishing feature of noise sensing compared with the estimation of a deterministic magnetic field. For estimating ω (ζ), we should maximize F ω (F ζ ) by tuning the controlling parameters [79] Θ and τ. The optimal value of Θ is Θ = π/2. The optimal value of τ should be chosen to maximize F ω (F ζ ). The optimal τ depends on the specific form of χ as a function of τ, which in turn is determined by the details of the noise (to be discussed shortly). For step 2, we consider a general projective measurement on the spin-1/2 along an axis with polar angle θ and azimuth ϕ. This measurement onρ(τ) gives an outcome ±1 according to the probability distribution Here P ±1 as a function of ω has a period 2π/τ, thus the measurement cannot distinguish ω and ω + 2nπ/τ (n ∈ Z). This is the commonly encountered modulo-2π ambiguity problem in Hamiltonian parameter estimation. By contrast, P ±1 are usually not periodic in the noise parameters, so the modulo-2π ambiguity is absent. This highlights the second distinguishing feature of noise sensing. Given the measurement distribution, we can compute the CFI from Eq. (B1) and obtain F ω = τ 2 sin 2 θ sin 2 (ωτ − ϕ) e 2χ − sin 2 θ cos 2 (ωτ − ϕ) , (9a) F ζ = (∂ ζ χ) 2 sin 2 θ cos 2 (ωτ − ϕ) e 2χ − sin 2 θ cos 2 (ωτ − ϕ) . (9b) We set θ = π/2 and ϕ = ωτ + π/2 (ϕ = ωτ), so the CFI attains the QFI: F ω = F ω (F ζ = F ζ ). Namely, the optimal measurement for estimating ω (ζ) is along an axis in the xy plane perpendicular (parallel) to the spin in the final state, as shown in Fig. 2. This highlights the third distinguishing feature of noise sensing. For step 3, we adopt the maximum likelihood estimator (see Appendix C for details and Appendix D for an example) and leave the detailed numerical simulation to the next section.
Finally, we discuss how to optimize the evolution time τ to maximize the QFI F ω = τ 2 e −2χ and F ζ = (∂ ζ χ) 2 /(e 2χ −1). For any classical noise (including static noises [80] and dynamical ones, Markovian noises and non-Markovian ones [78,80]), once the statistics of the noiseω(t) is given, we can determine χ and hence F ω and F ζ as functions of τ for any classical noise, at least in principle. Thus the method described here can be used to sensing an arbitrary classical noise, such as the abnormal static noises due to disorder averaging [80]. Moreover, although the discussions above are restricted to a single spin-1/2 (or equivalently a qubit), the method can also be used to infer the properties of noises on a general quantum system [80]. Compared with the spin-1/2 case, the difference is that the QFI should be calculated from Eq. (14) and the optimal measurement capable of converting all the QFI contained in the final density matrix of a general quantum system into the CFI is more complicated (see Appendix B).
Here for specificity we consider a widely used noise responsible for spin decoherence in electron spin baths [41,[73][74][75]: the Ornstein-Uhlenbeck noise, which is a Gaussian noise characterized by the auto-correlation function with b (τ c ) the amplitude (memory time) of the noise. The Wick's theorem for Gaussian noises gives [78] For τ ≪ τ c , the spin decoherence is Gaussian: For τ ≫ τ c , the spin decoherence is exponential e −χ ≈ e −τ/T ϕ on a time scale Substituting Eq. (10) into Eq. (7) gives the QFI's about ω, b, and τ c , respectively: increases monotonically with x till saturation. With increasing evolution time τ, the decoherence factor χ increases monotonically, so all the QFI's first increases for small spin decoherence and then begin to decrease when the spin decoherence becomes significant. For τ ≪ τ c , the QFI's are given by (12c) For τ ≫ τ c , the QFI's are given by Next, we discuss the the optimization of the evolution time τ to maximize the QFI. For Markovian noises (i.e., bτ c ≪ 1), the spin coherence decays exponentially e −χ ≈ e −τ/T ϕ on a time scale T ϕ , as shown in Fig. 3(a). Thus F ω is well approximated by Eq. (13a), shown as the black dotted line in Fig. 3(b). With increasing evolution time τ, F ω first increases quadratically and then decays exponentially. At the optimal evolution time τ ω,opt = T ϕ , it reaches the maximum F ω,opt = T 2 ϕ /e 2 , as shown in Fig. 3(b). For noise sensing, F b and F τ c as functions of τ differ from that of F ω in that they exhibit three stages [ Fig.  3 For estimating ω, the optimal evolution time τ ω,opt is independent of ω, thus adaptive measurements are not necessary. By contrast, for estimating the noise parameter b (τ c ), the optimal evolution time τ b,opt (τ τ c ,opt ) depend on the parameter b (τ c ) to be estimated, so adaptive measurements are crucial.
For non-Markovian noises (i.e., bτ c 1), the Gaussian decay e −χ = e −b 2 τ 2 /2 for the spin coherence and the QFI's [Eq. (12)] becomes appreciable even in the short-time regime τ ≪ τ c , as shown in Fig. 3(c) and (d). In general, the peak location of the QFI as a function of τ depends on both τ c and b, thus adaptive measurements are crucial for estimating b and τ c , as opposed to the estimation of ω.
The general analysis in this section have identified a series of distinguishing features for the sensing of noises compared to the estimation of deterministic magnetic fields, including the different dependences of the QFI's on the spin decoherence, the absence of the modulo-2π phase ambiguity, the different optimal measurement schemes, and the crucial role of adaptive measurements. In the next section, we perform numerical simulations to demonstrate the feasibility of adaptive measurements to improve the precision of noise sensing.

IV. ADAPTIVE MEASUREMENT OF SPIN DECOHERENCE TIME
Here we consider the decoherence of a localized spin caused by the surrounding electron spin bath in the solid state environment. The electron spin bath can be modelled by a Markovian noise [78] and leads to exponential spin decoherence e −χ ≈ e −τ/T ϕ on a time scale T ϕ [see Eq. (11)]. The spin decoherence time T ϕ is a key characteristics of spin qubits in solid state environments. Next, we consider the adaptive estimation of the spin decoherence time T ϕ . The rapid estimation of the spin decoherence time is not only important for the experimental characterization of the spin decoherence, but also allows us to design efficient coherence protection schemes to suppress the decoherence. Since T ϕ is a noise parameter, its adaptive estimation differs significantly from the estimation of a Hamiltonian parameter.
According to Sec. III, the optimal initial state of the spin is Eq. (5) with Θ = π/2. In the following we consider two different protocols to measure the spin decoherence time T ϕ : (i) Spin echo; (ii) Free evolution.
For spin echo, we first let the spin evolve under the Hamiltonian in Eq. (4) for an interval τ/2, next apply an instantaneous π-pulse to induce the flip between | ↑ and | ↓ , and finally let the spin evolve under the Hamiltonian in Eq. (4) for another interval τ/2 into the final stateρ(τ) where we have made its dependence on the evolution time τ explicit. This spin echo technique [81] can eliminate quasistatic noises (such as those from the surrounding nuclear spins of the host lattice) and single out the decoherence caused by the Markovian noise under consideration. Interestingly, it also eliminates the Larmor frequency ω, so that the final density matrixρ(τ) is independent of ω. Finally, we perform a projective measurement on the spin along the x axis. According to Sec. III, this measurement is optimal. Indeed, it gives an outcome ±1 according to the probability distribution and the CFI in each outcome attains the QFI: as shown in Fig. 4(a). For free evolution, we simply let the spin evolve under the Hamiltonian in Eq. (4) for an interval τ into the final statê ρ(τ) = 1/2 + (e −τ/T ϕ /2)[σ x cos(ωτ) +σ y sin(ωτ)], i.e., Eq. (6) with Θ = π/2 and χ = τ/T ϕ . This final state differs from that of the spin echo protocol in that it still depends sensitively on the Larmor frequency ω. Consequently, in order to measure T ϕ from this free-evolution final state, precise knowledge about ω is usually necessary (to be discussed shortly), although the QFI about T ϕ contained in this final state is still given by Eq. (14), i.e., the same as the spin echo protocol. Finally, we should perform an optimal measurement to convert all the QFI into the CFI. According to Sec. III, the optimal measurement is a projective one along the azimuth ωτ in the xy plane (dashed blue line in Fig. 2), whose CFI is equal to the QFI in Eq. (14). However, in our adaptive measurement scheme (to be discussed shortly), the parameter τ and hence the measurement axis will vary in different measurement cycles. The frequent change of the measurement axis may complicates its experimental realization. To avoid this problem, we fix the measurement axis to be along the x axis (i.e., we always measureσ x ), then the measurement distribution is (17) and the CFI in each outcome, shows rapidly oscillation as a function of τ, with its envelope coinciding with the QFI [see Fig. 4 In other words, the CFI still attains the QFI when τ is an integer multiple of π/ω, but does not attains the QFI for general τ. Fortunately, we can still tune τ to maximize the QFI and the CFI simultaneously. Now we optimize the evolution time τ. For spin echo, the optimal τ is [see Fig. 4

(a)]
For free evolution, under the realistic assumption ω ≫ 1/T ϕ , the optimal τ is an integer multiple of π/ω closest to 0.8T ϕ [see Fig. 4(b)]: For both the spin echo protocol and the free evolution protocol, choosing τ = τ opt gives the same maximal CFI and QFI, and hence the same optimal sensing precision for N repeated measurements. The difference is that in the spin echo (free evolution) protocol, τ opt is independent of (dependent on) the Larmor frequency ω. Specifically, in the free evolution protocol, the rapid oscillation of the CFI as a function of τ with a period π/ω [see Fig. 4(b)] requires precise knowledge about ω and high control precision of τ on the order of 1/ω to correctly locate the maximum [i.e., Eq. (20)] of the CFI. By contrast, in the spin echo protocol, the CFI as a function of τ is independent of ω [see Fig. 4(a)], so it requires no knowledge about ω and relatively low control precision of τ on the order of 1/T ϕ (≫ 1/ω) to correctly locate the maximum of the CFI. Unfortunately, for both protocols, τ opt depends on the unknown parameter T ϕ . Due to this dependence, adaptive schemes that update τ opt after each measurement cycle can outperform significantly non-adaptive ones. For each protocol, we consider three different measurement schemes involving different treatments of the evolution time τ: repeated measurements, adaptive measurements, and the least-square fitting that is commonly used in experiments.

A. Repeated measurement scheme
The evolution time τ is fixed during the entire estimation process. After repeating the initialization-evolutionmeasurement cycle N times, we get N outcomes u = (u 1 , u 2 , · · · , u N ). Using these outcomes, we refine our knowledge about T ϕ to the posterior distribution where N + (N − ) is the number of outcome +1 (−1) and P(±1|T ϕ ) is given by Eq. (15) for spin echo and Eq. (17) for free evolution. Finally, we construct the maximum likelihood estimator T M ≡ arg max P u (T ϕ ) and quantify its precision by [cf. Eq. (C3)] To analyze the performance of this scheme, we notice that for large N, the maximum likelihood estimator is known to be unbiased and can saturate the Cramér-Rao bound Eq. (3), so the sensing precision can be approximated by Here the CFI F(τ) is given by Eq. (16) for spin echo and Eq. (18) for free evolution (see Fig. 4). The evolution time τ directly determines the sensing precision, e.g., setting τ = τ opt would lead to the optimal sensing precision in Eq. (22). However, τ opt is unknown because it depends on the unknown parameter T ϕ to be estimated. This makes adaptive measurements crucial for achieving the optimal sensing precision.

B. Adaptive measurement schemes
The key idea is to use the outcomes of previous measurement to refine our knowledge about T ϕ and then use this knowledge to optimize τ. We consider two different adaptive schemes: the CFI-based scheme [82][83][84] and the locally optimal adaptive scheme [63,64,85,86], as introduced in Appendix E. The former updates the maximum likelihood estimator T M after every initialization-evolution-measurement cycle and then set the evolution time to for the spin echo protocol or τ = n π ω and τ ≈ 0.8T M (n ∈ Z) for the free evolution protocol. The latter optimizes τ to minimize the expected uncertainty of the estimator at the end of the next cycle (see Appendix E). Suppose at the end of the (n − 1)th cycle, our knowledge about T ϕ is quantified by the distribution P(T ϕ ) and the maximum likelihood estimator T M ≡ arg max P(T ϕ ) constructed from the outcomes of all the previous cycles. In the nth cycle with the evolution time τ, the measurement distribution P(±1|T ϕ ) [Eq. (15) or Eq. (17)] depends on T ϕ and τ. If the outcome is u, then our knowledge would be refined to P u (T ϕ ) ∼ P(T ϕ )P(u|T ϕ ), which in turn gives the maximum likelihood estimator T M (u, τ) ≡ arg max P u (T ϕ ) and its uncertainty [cf. Eq. (C3)] Since the probability for outcome u is estimated as P(u|T M ), we should choose τ in the nth cycle to minimize the expected uncertainty [cf. Eq. (E5)] For n = 1, i.e., the first cycle, there is no prior information, i.e., P(T ϕ ) is a constant, so T M is chosen randomly.
To analyze the performance, we notice that after a large number of adaptive steps, the estimator T M would approach the true decoherence time T ϕ . Consequently, according to Appendix E, the evolution time τ and hence the sensing precision for these two adaptive schemes would coincide with each other. In addition, the evolution time τ in Eqs. (25) and (26) would approach τ opt , so the corresponding sensing precision would approach the optimal precision (δT ϕ ) opt in Eq. (22).

C. Least-square fitting scheme
For a given range [0, τ max ] of the evolution time, we uniformly discretize it into M ≫ 1 grids τ k = k∆τ, where ∆τ = τ max /M. For each τ k , we repeat theσ x measurement ν times and calculate their average. Then we fit this average as a function of τ to the theoretical curve σ x = e −τ/T ϕ (for the spin echo protocol) or σ x = cos(ωτ)e −τ/T ϕ (for the free evolution protocol) to obtain an estimator to T ϕ . Finally, we repeat the procedures above for q ≫ 1 times to obtain many estimators T (1) ϕ,est , T (2) ϕ,est , · · · T (q) ϕ,est and determine the uncertainty δT ϕ of a single estimator as the square root of the statistical variance these estimators, i.e., whereT ϕ,est ≡ (1/q) q i=1 T (i) ϕ,est . According to the Cramér-Rao bound in Eq. (3), the sensing precision of this scheme can be roughly estimated as where N ≡ νM is the total number of measurements, degrades monotonically with increasing τ max . For free evolution, F(τ) in Eq. (18) shows rapid oscillations as a function of τ with an envelope coinciding with the CFI for spin echo [see Fig. 4(b)]. For τ max ≫ T ϕ , we have F ave ≈ 0.14/(T ϕ τ max ), which is about half that of the spin echo, thus (δT ϕ ) CRB ≈ τ max /T ϕ (δT ϕ ) opt also degrades with increasing τ max .

D. Numerical simulations
In the above, we have presented two protocols to measure the spin decoherence time T ϕ : the spin echo protocol and the free evolution protocol. For each protocol, we consider three kinds of schemes, which involve different treatments of the evolution time τ: (i) The repeated measurement scheme uses a fixed τ; (ii) The two adaptive measurement schemes update τ in every measurement cycle; (iii) The least-square fitting scheme scan τ over a fixed range. The spin echo protocol singles out the T ϕ process from all the other unwanted evolution, so the measurement distribution P(±1|T ϕ ) is independent of the Larmor frequency ω. Consequently, all the schemes applied to the spin echo protocol require no knowledge about ω and a relatively low control precision (on the order of 1/T ϕ ) over τ. By contrast, the free evolution protocol leaves the Larmor precession intact, so the measurement distribution P(±1|T ϕ ) [see Eq. (17)] depends sensitively on ω. Consequently, all the schemes applied to this protocol require precise knowledge about ω and much higher (on the order 1/ω) control precision over τ. Specifically: (i) In the repeated measurement scheme, since the posterior distribution P u (T ϕ ) depends on ω, we cannot find the maximum likelihood estimator T M ≡ arg max P u (T ϕ ) if ω is unknown; (ii) In the CFI-based adaptive scheme, we cannot set τ to Eq. (26) if ω is unknown; in the locally optimal adaptive scheme, the expected uncertainty δT ϕ (τ) depend on both τ and ω, so we cannot find the minimum of δT ϕ (τ) as a function of τ if ω is unknown. (iii) In the least-square fitting scheme, it would be difficult to choose the grid spacing ∆τ and to fit the measurement data to σ x = cos(ωτ)e −τ/T ϕ to extract T ϕ when ω is unknown. Therefore, the spin echo protocol is advantageous over the free evolution protocol if our knowledge about ω is limited or the available control precision over τ is low.
In all our numerical simulations, we take the true value T ϕ as the unit of time, i.e., T ϕ = 1, and take the true value of ω to be ω = 400π/3 ≫ 1/T ϕ .
To begin with, we check the sensing precision of the repeated measurement scheme applied to the spin echo protocol and the free evolution protocol. We consider three sets of evolution time: τ = 0.1, 0.8, and 3. For each case, our numerical simulations show that with increasing number N of repeated measurements, the uncertainty δT ϕ calculated from Eq. (23) gradually approaches the large-N limit (δT ϕ ) CRB [Eq. (24)] for both protocols. For example, the uncertainty δT ϕ for N = 10 4 repeated measurements agree well with (δT ϕ ) CRB , i.e., (δT ϕ ) −2 /N agree well with the CFI F(τ), as shown in Fig.  4(a) and 4(b).
Next, we consider the spin echo protocol and compare the adaptive scheme with the commonly used least-square fitting scheme with τ max = 10 and ν = q = 100. As shown in Fig.  5(a), the precision of the least-square fitting is well approximated by (δT ϕ ) CRB in Eq. (27), which is significantly worse than the optimal sensing precision (δT ϕ ) opt in Eq. (22). By contrast, the precision of both the CFI-based adaptive scheme and the locally optimal adaptive scheme approaches the optimal precision (δT ϕ ) opt after ∼ 100 measurements. Physically, this is because both adaptive schemes successively adjust the evolution time [e.g., Eqs. (25) and (26) for the CFI-based adaptive scheme applied to the spin echo protocol and the free evolution protocol] based on the newest knowledge about the unknown parameter T ϕ after every measurement. As shown in Fig. 5(b), after ∼ 100 measurements, the evolution time in both adaptive schemes already approaches the optimal evolution time τ opt [Eq. (19)].
Then, we turn to the free evolution protocol, which requires precise knowledge about ω and precise control over τ on the order 1/ω. Since the average spin σ x = cos(ωτ)e −τ/T ϕ exhibits rapid oscillations as functions of the evolution time τ, the best way to do least-square fitting is to let the grid spacing ∆τ be an integer multiple of π/ω, so that τ k = k∆τ samples the envelope of the σ x curve only. This also amounts to sampling the envelope of the rapidly oscillating CFI in Eq. (18), so that F(τ k ) = F (τ k ) attains the corresponding QFI. Therefore, the least-square fitting scheme applied to the free evolution protocol would give the same precision as it does for the spin echo protocol, so we do not simulate this case any more. For the two adaptive schemes applied to the free evolution protocol, as shown in Fig. 6(a), both the CFI-based one and the locally optimal one approach the optimal sensing precision (δT ϕ ) opt after ∼ 100 measurements, similar to the case of the spin echo protocol. As shown in Fig. 6(b), the adaptive schemes successively refine the evolution time [e.g., Eq. (26)] based on the newest knowledge about T ϕ after every measurement. After ∼ 100 measurements, the evolution time in both adaptive schemes approach the optimal evolution time τ opt [Eq. (20)].

V. CONCLUSION
Using localized spins as ultrasensitive quantum sensors is attracting widespread interest. Recently, adaptive measurements were used to improve the dynamic range for the spin-based estimation of deterministic Hamiltonian parameters such as the external magnetic field. Here we explore a very different direction -the use of adaptive measurements in spin-based sensing of random noises. We have performed general analysis that identifies a series of important differences between noise sensing and the estimation of deterministic magnetic fields, such as the different dependences on the spin decoherence, the different optimal measurement schemes, the absence of the modulo-2π phase ambiguity, and the crucial role of adaptive measurement. We have also performed numerical simulations that clearly demonstrate significant speed up of the characterization of the spin decoherence time via adaptive measurements compared with the commonly used least-square fitting method. This work paves the way towards adaptive noise sensing. The amount of information about ζ contained in a general ζ-dependent quantum stateρ ζ is quantified by its QFI [70] F ≡ Trρ ζL whereL ζ is the so-called symmetric logarithmic derivative operator: it is an Hermitian operator defined through [69] ∂ ζρζ = 1 2 (L ζρζ +ρ ζLζ ).
The QFI defined in Eq. (A1) remains invariant under any ζ-independent unitary transformations, i.e., such transformations conserves the quantum information. For a pure statê ρ ζ = |Φ Φ|, we haveL ζ = 2∂ ζρζ and hence where the last step applies to unitary evolution |Φ = e −iζĜ |Φ in and G rms ≡ ( Φ in |Ĝ 2 |Φ in − Φ in |Ĝ|Φ in 2 ) 1/2 is the root-mean-square fluctuation ofĜ in the initial state. For a general mixed state with the spectral decompositionρ ζ = n p n |Φ n Φ n |, its QFI is [87][88][89] (A3) where {p n } are nonzero eigenvalues ofρ ζ , {|Φ n } are the corresponding ortho-normalized eigenstates, and F n is the QFI of the pure state |Φ n [see Eq. (A2)]. This expression shows that the QFI of a non-full-rank state is completely determined by its support, i.e., the subset of {|Φ n Φ n |} with nonzero eigenvalues. For a two-level system, its density matrix can always be expressed in terms of the Pauli matricesσ asρ ζ = (1/2)(1 +σ · n), where n ≡ Trσρ ζ is the Bloch vector. The QFI for such a state is [90][91][92] where the second term is absent when |n| = 1, i.e., whenρ ζ is a pure state. Whenρ ζ =ρ (1) ζ ⊗· · ·⊗ρ (N) ζ is the direct product state of N quantum systems, its QFI is additive: ζ . Physically, the QFI measures the rate of variation ofρ ζ with the parameter ζ, e.g., if we regardρ ζ andL ζ as classical variables, then L ζ = ∂ ζ ln ρ ζ and Eq. (A1) becomes the average of (∂ ζ ln ρ ζ ) 2 over the state ρ ζ . Moreover, the Bures distance between two quantum statesρ 1 andρ 2 is defined as [93] where the second term Tr √ · · · on the right-hand side is the so-called Uhlmann fidelity [94]. For neighboring statesρ ζ and ρ ζ+dζ , the Bures distance reduces to so the QFI measures the distinguishability between two neighboring states parametrized by ζ. The importance of the QFI for parameter estimation is manifested in the inequalities Eqs. (1) and (3). Namely, givenρ ζ and hence F (ζ), the precision of any unbiased estimator from N repetitions of any measurement is limited by the inequality known as the quantum Cramér-Rao bound [69,70]. Saturating this bound requires saturating Eqs. (1) and (3) simultaneously, i.e., using optimal measurements to convert all the QFI into the CFI and using optimal unbiased estimators to convert all the CFI into the precision of the estimator.

Appendix B: Measurement: classical Fisher information
A general measurement with discrete outcomes {u} is described by the positive-operator valued measure (POVM) elements {M u } satisfying the completeness relation uM † uMu = 1. Given a quantum stateρ ζ , it yields an outcome u according to the probability distribution P(u|ζ) ≡ TrM uρζM † u that depends on ζ. The amount of information about ζ contained in each outcome is quantified by the CFI [95]: For continuous outcomes, we need only replace u by du everywhere. Physically, the CFI quantifies the dependence of the measurement distribution P(u|ζ) on the parameter ζ. Actually, the Wootters' distance [96] between two probability distributions P (1) (u) and P (2) (u) is For neighboring distributions P (1) (u) = P(u|ζ) and P (2) (u) = P(u|ζ + dζ), the Wootters' distance reduces to D(P(u|ζ), P(u|ζ + dζ)) = 1 2 F(ζ)dζ, so the CFI measures the distinguishability between neighboring measurement distributions parametrized by ζ.
Since the probability distribution function is the classical counterpart of the quantum mechanical density matrix, the CFI (Wootters' distance) is the classical counterpart of the QFI (Bures distance). The inequality Eq. (1) expresses the simple fact that no new information about ζ can be generated in the measurement process: optimal (non-optimal) measurements convert all (part) of the QFI into the CFI. Givenρ ζ , the optimal measurement is not unique. The projective measurement on the symmetric logarithmic derivative operatorL ζ true has been identified [70] as an optimal measurement, but ζ true is not known. To circumvent this problem, the simplest way is to find other optimal measurements that do not depend on ζ true . Another solution [71] is to approximateL ζ true byL ζ est , where ζ est is our best guess to ζ true , i.e., the optimal unbiased estimator, as we discuss below.
Appendix C: Data processing: optimal unbiased estimators Given the measurement distribution P(u|ζ) and hence the CFI F(ζ) of each outcome, the precision δζ of any unbiased estimator ζ est (u) constructed from the outcomes u ≡ (u 1 , · · · , u N ) of N repeated measurements is limited by the Cramér-Rao bound Eq. (3), which expresses the simple fact that no new information about ζ can be generated in the data processing: optimal (non-optimal) unbiased estimators convert all (part) of the CFI into the useful information (δζ) −2 quantified by the precision δζ. Finding optimal unbiased estimators is an important step in parameter estimation. In the limit of large N, two kinds of estimators are known to be unbiased and optimal: the maximum likelihood estimator and the Bayesian estimator [95], as we introduce now.
Before any measurements, our prior knowledge about the unknown parameter ζ is quantified by certain probability distribution P 0 (ζ), e.g., a δ-like distribution corresponds to knowing ζ exactly, a flat distribution corresponds to completely no knowledge about ζ, while a Gaussian distribution P 0 (ζ) ∝ e −(ζ−ζ 0 ) 2 /(2σ 2 0 ) corresponds to knowing ζ to be ζ 0 with a typical uncertainty σ 0 .
Upon getting the first outcome u 1 , our knowledge about ζ is immediately refined from P 0 (ζ) to P u 1 (ζ) = P 0 (ζ)P(u 1 |ζ) N(u 1 ) according to the Bayesian rule [97], where N(u 1 ) ≡ dζP 0 (ζ)P(u 1 |ζ) is a normalization factor ensuring P u 1 (ζ) is normalized to unity: P u 1 (ζ)dζ = 1. Here P u 1 (ζ) is the posterior probability distribution of ζ conditioned on the outcome of the measurement being u 1 : its parametric dependence on u 1 means that different measurement outcomes leads to different refinement of knowledge about ζ.
Upon getting the second outcome u 2 , our knowledge is immediately refined from P u 1 (ζ) to where N(u 1 , u 2 ) = P 0 (ζ)P(u 1 |ζ)P(u 2 |ζ)dζ is a normalization factor for the posterior distribution P u 1 u 2 (ζ). If we omit the trivial normalization factors, then the measurementinduced knowledge refinement becomes Upon getting N outcomes u ≡ (u 1 , · · · , u N ), our knowledge about ζ is quantified by the posterior distribution P u (ζ) ∼ P 0 (ζ)P(u|ζ) up to a trivial normalization factor, where P(u|ζ) = P(u 1 |ζ) · · · P(u N |ζ) is the probability for getting the outcome u. The posterior distribution P u (ζ) completely describe our state of knowledge about ζ. Nevertheless, sometimes a single number, i.e., an unbiased estimator, is required as the best guess to ζ true . There are two well-known estimators: the maximum likelihood estimator [95] ζ M (u) ≡ arg max P u (ζ) (C1) is the peak position of P u (ζ) as a function of ζ, while the Bayesian estimator [95] ζ is the average of ζ. For large N, both estimators are unbiased and optimal: ζ α = ζ and δζ α = 1/ NF(ζ), where α = M or B, and · · · denotes the average over a large number of estimators obtained by repeating the N-outcome estimation scheme many times and δζ α is defined as Eq. (2) or For a simple understanding, we consider N → ∞, so the number of occurrence of a specific outcome u approaches NP(u|ζ true ). Then, up to a trivial normalization factor, the posterior distribution P u (ζ) approaches u [P(u|ζ)] NP(u|ζ true ) = exp which exhibits a sharp peak at ζ = ζ true . For large N, P u (ζ) is nonzero only in the vicinity of ζ true . This justifies a Taylor expansion around ζ true , leading to the Gaussian form P u (ζ) ∼ e −(ζ−ζ true ) 2 /(2σ 2 ) with a standard deviation σ ≡ 1/ NF(ζ true ). Then we have ζ M = ζ B = ζ true and δζ M = δζ B = σ, so both estimators are unbiased and optimal in the large N limit. Usually, calculating ζ M [Eq. (C1)] or ζ B [Eq. (C2)] requires intensive computational costs. The situation simplifies when the data comes from binary-outcome measurements, i.e., measurements that yield only two possible outcomes (denoted by + and −) according to the probability distribution P(±|ζ). In this case, let N + (N − ) denote the number of outcome + (outcome −) from the N measurements, then solving P(+|ζ) − P(−|ζ) = (N + − N − )/N for ζ gives a simple estimator that is unbiased and optimal for large N [98]. In this work, we always adopt the maximum likelihood estimator.

Appendix D: An example
Here we follow the three standard steps outlined in Fig. 1 to estimate the level splitting ω of a spin-1/2 Hamiltonian by monitoring its free precession. For convenience we define e ϕ as a unit vector in the xy plane with azimuth ϕ.
For step 1, we assume the initial state to be |ψ in = cos(Θ/2)| ↑ + e iΦ sin(Θ/2)| ↓ , where the controlling parameters Θ and Φ are to be optimized. Next, the spin-1/2 undergoes ω-dependent free precession for an interval τ into the final state |ψ ω = e −iωτσ z /2 |ψ in . The QFI in the final state is calculated by Eq. (A2) as which is independent of Φ. To maximize F , we set Θ = π/2, and leave Φ arbitrary, i.e., any initial state whose average spin lies in the xy plane is optimal. For specificity, we set Φ = 0, so the initial state is theσ x = +1 eigenstate and the final state is theσ · e ωτ = +1 eigenstate, as shown in Fig. 7. Interestingly, the QFI can be increased indefinitely by increasing the evolution time τ, indicating the time as a valuable quantum resource.
To maximize F, we set θ = π/2, then F = τ 2 attains the QFI, i.e., measuring the spin-1/2 along an arbitrary axis in the xy plane form a family of optimal measurements. For specificity we set ϕ = 0, corresponding to measuringσ x . For step 3, suppose we have no prior knowledge about ω before the measurements. Next we repeat the initializationevolution-measurement cycle twice and obtain two outcomes u ≡ (u 1 , u 2 ). Upon getting these outcomes, our knowledge about ω is immediately refined to (up to a constant normalization factor) P u (ω) ∼ P(u 1 |ω)P(u 2 |ω), e.g., if both outcomes are +1, then P u (ω) ∼ cos 4 (ωτ/2) shows many peaks at integer multiples of 2π/τ, corresponding to an infinite number of maximum likelihood estimators ω M = 2nπ/τ (n ∈ Z). If both outcomes are −1, then P u (ω) ∼ sin 4 (ωτ/2) shows maxima at odd multiples of π/τ, corresponding to ω M = (2n + 1)π/τ (n ∈ Z). If one outcome is +1 and the other is −1, then P u (ω) ∼ sin(ωτ) and ω M = (2n + 1)π/(2τ) (n ∈ Z). In any case, the maximum likelihood estimator is not unique, because the measurement distribution P(u|ω) is an even function of ω with a period 2π/τ, so ω and −ω (or ω and ω+2π/τ) give exactly the same measurement distribution and hence cannot be distinguished. Such ambiguity can be eliminated by combining the information gained from measurements with different evolution time τ [63,64].
Appendix E: Feedback: adaptive measurement protocols As mentioned before, usually the CFI depends on the parameter ζ to be estimated, so optimizing the initial state, the evolution process, and the measurement scheme requires knowledge about ζ, which is unknown. A standard solution is adaptive measurement protocols: after each initializationevolution-measurement cycle, the measurement outcome is immediately used to refine our knowledge about ζ, which in turn is used to optimize the next cycle, as shown in Fig. 1.
There are two categories of adaptive protocols. The first category focuses on maximizing the CFI [82][83][84]. Suppose the CFI F(ζ, θ) depends on ζ and some parameters θ that control the initialization, evolution, and measurement processes. The simplest idea is to tune θ to maximize the F(ζ, θ). However, usually the optimal θ leading to maximal CFI depends on the unknown parameter ζ. Suppose at the end of the (n − 1)th initialization-evolution-measurement cycle, our knowledge is quantified by a distribution P(ζ), then a natural solution is to choose θ in the nth cycle to maximize the CFI averaged over the distribution of ζ, i.e., where the second step is valid when the maximum of P(ζ) at ζ M ≡ arg max P(ζ) is very sharp compared with F(ζ, θ).
The second category focuses on optimizing the expected information gain from the estimator [63,64,85,86]. At the end of the (n − 1)th cycle, our knowledge about ζ is quantified by the distribution P(ζ). In the nth cycle with the controlling parameters θ, the measurement distribution is P θ (u|ζ), which depend on ζ and θ. If the measurement outcome of this cycle is u, then our knowledge about ζ would be updated to the distribution P u,θ (ζ) ∼ P(ζ)P θ (u|ζ), the maximum likelihood estimator would be ζ M (u, θ) ≡ arg max P u,θ (ζ), and its uncertainty δζ(u, θ) would be given by Eq. (C3) with P u (ζ) → P u,θ (ζ) and ζ α (u) → ζ M (u, θ).
The key idea of this adaptive scheme is to optimize the controlling parameters of the next cycle to minimize the expected uncertainty at the end of that cycle [Eq. (E4) or (E5)], so it is known as the locally optimal adaptive scheme [85,86]. A straightforward extension is to optimize simultaneously the M controlling parameters of the next M cycles to minimize the expected uncertainty at the end of these cycles. Increasing M improves the performance at the cost of exponentially increasing computational cost [99], so the M = 1 scheme is the most widely used one in Hamiltonian parameter estimation [63,64,85,86]. Although both the CFI-based adaptive scheme and the locally optimal adaptive scheme have been widely used, their connection remains unclear. Here we prove their equivalence in the limit of very accurate knowledge P(ζ) at the beginning of the nth initialization-evolution-measurement cycle, as quantified by a sharp Gaussian distribution P(ζ) = e −(ζ−ζ M ) 2 /(2σ 2 ) /( √ 2πσ) with a small standard deviation σ. This justifies a Taylor expansion of Eq. (E3) around ζ M , which gives P u,θ (ζ) ∼ e −(ζ−ζ u,θ ) 2 /(2σ 2 u,θ ) with Then we have ζ M (u, θ) = ζ u,θ and δζ(u, θ) = σ u,θ , so the expected uncertainty in Eq. (E5) becomes δζ(θ) ≈ σ − 1 2 σ 3 F(ζ M , θ), thus minimizing δζ(θ) amounts to maximizing F(ζ M , θ) in Eq. (E1).