Contextual quantum metrology

Quantum metrology promises higher precision measurements than classical methods. Entanglement has been identified as one of quantum resources to enhance metrological precision. However, generating entangled states with high fidelity presents considerable challenges, and thus attaining metrological enhancement through entanglement is generally difficult. Here, we show that contextuality of measurement selection can enhance metrological precision, and this enhancement is attainable with a simple linear optical experiment. We call our methodology"contextual quantum metrology"(coQM). Contextuality is a nonclassical property known as a resource for various quantum information processing tasks. Until now, it has remained an open question whether contextuality can be a resource for quantum metrology. We answer this question in the affirmative by showing that the coQM can elevate precision of an optical polarimetry by a factor of 1.4 to 6.0, much higher than the one by quantum Fisher information, known as the limit of conventional quantum metrology. We achieve the contextuality-enabled enhancement with two polarization measurements which are mutually complementary, whereas, in the conventional method, some optimal measurements to achieve the precision limit are either theoretically difficult to find or experimentally infeasible. These results highlight that the contextuality of measurement selection is applicable in practice for quantum metrology.


INTRODUCTION
Precision measurement has played a crucial role in the development of natural science and engineering since measurement is a means for observing nature.As a technology for precision measurement, quantum metrology has recently drawn attention with a wide range of applications such as microscopy [1], imaging [2,3], patterning [4,5], gravitational wave detection [6][7][8], and time keeping [9,10].Quantum metrology enables measurements going beyond precision of the standard quantum limit which can be obtained from the most-classical state in quantum physics.One of the resources for the precision enhancement is entanglement, a nonclassical property of quantum states [11][12][13][14].However, an entangled state can easily lose its property through interaction with other objects, while the interaction is inevitable in metrology.This makes it challenging to generate and manipulate an entangled state.Due to the limitations, it is difficult in practice to attain the entanglement-enabled enhancement of precision.If easy-to-implement resources for metrology are found, the performance of quantum metrology can be greatly enhanced, as well as its practicality.In this work, we demonstrate that contextuality of measurement selection [15], another nonclassical property, is an easy-to-implement resource for quantum metrology.
Specifically, contextuality here refers to dependency of quantum systems on measurement context [16].Unlike classical predictions, quantum predictions for a given measurement can change depending on whether another measurement is performed simultaneously or not.
Bell-Kochen-Specker theorem first showed that quantum physics is contextual [17,18], and this has been experimentally proved on various quantum systems [19][20][21][22].Also, it has been revealed that the contextuality can be a resource for quantum information processing tasks such as quantum key distribution [23,24], universal quantum computing [25], quantum state discrimination [26], and quantum machine learning [27,28].Yet, whether the contextuality can be a resource for quantum metrology remains a question.
To demonstrate the precision enhancement from the contextuality of measurement selection, we propose a method which we call contextual quantum metrology (coQM).Unlike conventional quantum metrology, the coQM utilizes two measurement settings and their contextuality.In our experiment, we adopt an optical polarimetry devised to measure concentration of sucrose solution [29], and modify its scheme for the coQM.Our experiment employs two polarization measurements in mutually unbiased (or complementary) bases, and their selection context is implemented by toggling a polarizing beam splitter 'in' and 'out' from its optical path.Our setup is scalable in that the size of the experiment does not increase along with the increase of the number of probe photons.Also, the enhanced precision is attainable without error correction or mitigation which requires overhead [30,31].We finally show that the precision of coQM can go beyond the precision limit of conventional quantum metrology [32][33][34] by a factor of 1.4 to 6.0.

CONTEXTUAL QUANTUM METROLOGY
Fig. 1 shows an experimental schematic for the coQM.Here, the coQM estimates the concentration of sucrose solution by following four steps: preparing a polarized sin- gle photon as a probe light (see Methods), interacting the photon with the sucrose solution, measuring the polarization, and calculating an estimate via maximum likelihood estimator (MLE) using the operational quasiprobability which will be discussed later as in Eq. ( 1).The photon interacts with the sucrose solution as it propagates through the solution.Afterwards, the photon polarization rotates by angle αcl, where α, c, and l are the specific rotation of the sucrose solution, the concentration of the solution, and traveling length of light in the solution, respectively [29].We can decide the concentration by measuring the polarization change for a given specific rotation and traveling length.All the procedures here look similar to those of the conventional quantum metrology [35], but the measurement and the estimation are steps that differentiate the coQM from the conventional approach.
In the measurement step, the coQM employs two different polarization measurement settings A and B to utilize the contextuality of measurement selection there-from [15].A measures the polarization in a specific basis {|H⟩, |V ⟩} and B does in a basis {|D⟩, |A⟩} tilted 45 • from the basis of A by half-wave plate.Our basic setup is the measurement by B, and we consider a context of whether measurement A is selected to be performed or not, prior to performing B. If A is not selected, the measurement B only is performed, and probability is given by p(b|B) for a binary value b.If A is selected, the experimental setup runs the consecutive measurement performing A first and B later.In this case, probability is given by p(a, b|AB) for an outcome pair (a, b), where a is a binary outcome of A. In our experiment (Fig. 1), the context of selecting A is implemented by toggling 'in' and 'out' the state of polarizing beam splitter PBS1.Depending on the context, the quantum prediction of measurement B changes, so the two probabilities p(b|B) by B only and p(b|AB) = a p(a, b|AB) by the consecutive differ in general, i.e., p(b|B) ̸ = p(b|AB) [36].(We will discuss that this difference stems from the incompatibility of measurements [37].)Our metrology utilizes this effect to enhance precision of the polarimetry.
In the estimation step, we employ a noncontextual (or context-free) model, so-called operational quasiprobability [38,39], which is given by The context-free condition in our measurement setup is to assume that the prediction of measurement B is invariant under the context of selecting the measurement A. This is called the condition of no-signaling in time represented by p(b|B) = p(b|AB), ∀b [36].The crucial property of the operational quasiprobability is that, for the context-free condition, w is reduced to the probability by the consecutive measurement, w(a, b) = p(a, b|AB), ∀a, b.
To the contrary, the quantum predictions violate the condition in general, w(a, b) ̸ = p(a, b|AB), and w(a, b) can even be negative-valued [38,39].The conventional quantum metrology estimates a physical parameter θ with an estimator based on a conditional probability p(x|θ) for a data set {x i } Ns i=1 (see Supplementary Information).In the coQM, the operational quasiprobability plays a role of the conditional probability for the two data sets x B = {b i } Ns i=1 and x AB = {(a j , b j )} Ns j=1 .In other words, the coQM calculates an estimate of polarization θ with a maximum likelihood estimator given by θ s.t.
where l W (θ|x B , x AB ) is a log-likelihood function for w (see Methods).The possible problem caused by this replacement is that w can be negative unlike the conditional probability, so that the log-likelihood function diverges.However, we find that w remains positive for some range of parameters.We focus on the case for w to be applicable to the log-likelihood function without the divergence problem.Finally, for an initial polarization θ 0 , we derive the estimate of concentration č from the polarization change as č = ( θ − θ 0 )/αl.

RESULTS
Our goal is to demonstrate outperformance of the coQM over the conventional quantum metrology.We employ error of estimate ∆θ, the standard deviation that the estimate differs from the actual value, to quantify the performance of estimation.The smaller the error is, the more precise the estimate is.
As a baseline of performance, we take the conventional quantum metrology and its error given by quantum Fisher information (QFI) F q , ∆θ q = 1/ N s F q , where N s is the number of samples.This is known as the lower bound of error in the conventional method.In the coQM, we propose contextual Fisher information (coFI) to quan-tify the performance of the coQM, (3) In the asymptotic limit of N s → ∞, the error of the coQM ∆θ co approaches to 1/ √ N s F co (see Supplementary Information for the asymptotic property and estimator of coFI).
Contextuality-enabled enhancement The coQM gains precision enhancement over the conventional quantum metrology if Our method uses the two data sets x B and x AB .If each data set collects N s samples, the total number of samples is 2N s in our method.Reduction factor √ 2 in the error by the conventional is introduced, assuming the conventional takes 2N s samples (which is equivalent to comparing F co to 2F q ).
We here suggest specific cases satisfying the criterion (4).Instead of a theoretical proof, we briefly summarize the theory behind the enhancement of precision by following arguments: For the noncontextual model, the operational quasiprobability w(a, b|θ) becomes the joint probability of the consecutive measurement p(a, b|AB).In this case, the coQM is reduced and equivalent to the conventional quantum metrology using the consecutive measurement so that the ∆θ co equals or larger than ∆θ q (see Supplementary Information).For the contextual model, conversely, ∆θ co can be smaller than ∆θ q (see Ref. [40] for rigorous discussions).Fig. 2 a shows simulation results of the contextuality-enabled enhancement on the Bloch sphere.
We perform polarization estimation of θ with probe states prepared in |ψ⟩ = cos(θ/2)|H⟩+e iϕ sin(θ/2)|V ⟩ for 0.46π ≤ θ ≤ 0.55π and ϕ = 0.15π.For the probe states, the operational quasiprobability is given by w(a, b|θ) = 1 + (−1) a cos θ + (−1) b sin θ cos ϕ /4.We draw N s = 10 5 samples for each data set to construct the operational quasiprobability, and calculate an estimate with the estimator (2).For polarization estimation of θ, QFI F q = 1, so the coQM gains the contextuality-enabled en- The errors of the coQM are smaller than the error limit of the conventional quantum metrology for the whole selected range of θ (Fig. 2 b).The worst case in our results has ∆θ co ≈ 1.53 × 10 −3 around θ = π/2, and the best case has ∆θ co ≈ 3.7 × 10 −4 around each end of the range of θ.This demonstrates that our method elevates the precision of polarimetry by factor of 1.4 to 6.0 from the limit of conventional quantum metrology.
We estimate sucrose solutions of three different concentrations c = 0.1, 0.3 and 0.5 g ml −1 .We prepare the probe state with initial parameters θ 0 = 0.5π and ϕ = 0.15π.For each concentration, we repeat the estimation 10 times.The results (Fig. 2 d) show that the errors of estimates by the coQM, ∆c co , are smaller than the minimum error by the conventional quantum metrology (≈ 5.9 × 10 −2 ); For c = 0.1, 0.3 and 0.5 g ml −1 , the mean errors are ≈ 3.7 × 10 −2 , ≈ 3.3 × 10 −2 , and ≈ 2.8 × 10 −2 , respectively.This illustrates that the coQM exceeds the conventional quantum metrology by a wide margin.

MEASUREMENT INCOMPATIBILITY
The contextuality of measurement selection stems from the incompatibility of quantum measurements [37].In the scenario of the consecutive measurement, if the two measurements A and B commute, the consecutive measurement is de facto a single measurement; the probabilities p(b|B) and p(b|AB) are equal and the prediction for B is noncontextual.Otherwise, the prediction for the measurement B depends on whether performing the first measurement A and it is contextual except for a case when the initial state is prepared in an eigenstate of the A. Thus, the measurement incompatibility is necessary for the contextuality of measurement selection.
The noncommutation of observable operators defines the incompatibility among measurements, represented by projection-valued measures (PVM), which we assume in the present work.The notion of incompatibility needs to be generalized if the representation of measurement is generalized to positive operator-valued measure (POVM).This generalization is required, for example, if one considers an open quantum system in a noisy environment.Non-joint measurability (non-JM) is one of the generalizations [37].The non-JM plays an important role in a contextuality [41,42], as does the noncommutativity [43].In fact, non-JM and the contextuality of measurement selection are also closely related as the negativity of operational quasiprobability is the necessary and sufficient condition for non-JM [40,44].
Recently, there were studies in a similar vein to the present work [45,46], showing that the noncommutativity can be a resource for quantum metrology.However, their schemes employ a post-selection to discard unwanted measurement outcomes, so there is a tradeoff between success probability and Fisher information; success probability becomes small if Fisher information is large [47].Quantum post-selected metrology such as weak value amplification methods share this matter [48,49].
On the contrary, our method utilizes all of measurement outcomes for the estimation [38,39], implying that the coQM is free from such tradeoff.

OUTLOOK
This work demonstrates that utilizing the contextuality of measurement selection can enhance the precision measurement.The experiment attains precision beyond the limit of conventional quantum metrology [33,34].The coQM has advantages over the conventional method (see Supplementary Information): it can enhance the precision without optimizing the measurements if they are incompatible, and it works even without any entangled state of probe that has been regarded difficult to generate and manipulate.We use the heralded single-photon source to clearly show the performance of coQM per a unit particle of probe.We expect that a multi-photon source can also be adopted for the coQM with the similar settings of measurements [15].Our method is expected to be applicable to a quantum sensor [50] if the context of measurement selection can be implemented within the sensor's system.In addition, the approaches employed to demonstrate the contextuality-enabled enhancements can be utilized to characterize quantum devices (see Supplementary Information), which is a fundamental task required to implement quantum technologies.

M1. Heralded single photons
We generate the heralded single photon as following.High energy pump photons (p = 405.7 nm) from a continuous wave (CW) single mode laser (TOPMODE 405, TOPTICA) are sent to a periodically poled KTP (PPKTP) crystal.PPKTP splits the input photons into photon pairs (signal and idler photons) through type-II spontaneous parametric down conversion (SPDC) process.The polarizations of signal and idler photons are orthogonal each other, so that polarizing beam splitter (PBS) can separate them into two different optical paths.The idler photon is sent to an avalanche photodiode (APD) for triggering.The signal photon is sent to one of the four APDs (SPCM-QC4, Perkin Elmer).If the trigger APD is clicked, we count clicks on the four APDs.We control the count rate of the trigger APD to be 2 × 10 5 cps to sufficiently suppress multi photon events, i.e., |SPDC⟩ ≈ |00⟩ + ϵ|11⟩ for ϵ ≪ 1.The click signals are post-processed by a field programmable gate array (FPGA) with the time bin size of 25 ns.

M2. Input state preparation
We prepare an initial probe state by using a series of three wave plates (Fig. 1), one of half-wave plate (HWP) and two of quarter-wave plates (QWP).After passing QWP 1 , HWP, and QWP 2 sequentially, a horizontally polarized state |H⟩ becomes an initial state where p (q) is the angle of the fast axis of the half (quarter)-wave plate from the horizontal axis.The q value of QWP 2 is fixed at π/4.By adjusting the control parameters p and q to satisfy θ = π/2 − 2q and ϕ = 4p − 2q − π/2, we finally obtain the parameterized state |ψ⟩ in = cos(θ/2)|H⟩ + e iϕ sin(θ/2)|V ⟩.

M3. Maximum likelihood estimator using operational quasiprobability
Maximum likelihood estimation is a method to find a parameter of a probability model which best describes observed data.This method assumes a likelihood function of the model, and maximizes the function to determine the most likely value in the parameter space as an estimate.In this work, we take the operational quasiprobability as the model depending on the phase θ.
For the two data sets x B and x AB , we define the loglikelihood function as where For a small number of samples, N w (a, b) can be negative by statistical fluctuations.We test whether the number count N W is positive, and neglect cases where the count is negative.
In a broader sense, the coQM proposes an approach of integrating the two different ensembles for singleparameter estimation.To show that our estimator θ is unbiased and error of the estimate achieves Cramér-Rao bound [51,52], we propose a theory that describes the operational quasiprobability as an ensemble mixture model (see Supplementary Information).
The log-likelihood function satisfies following three conditions in the asymptotic limit of N → ∞ [53]: where F X (θ) is the Fisher information of probability p(x|X, θ).
If we assume that an estimate θ is close to a true parameter value θ 0 , the difference between the estimate and the true value can approximate to The first order moment of the difference determines biasedness, quantifying how much the estimate is shifted from the true value.The second order moment of the difference corresponds to estimation error.The conditions (C.1) and (C.2) imply that the MLE is an unbiased estimator: The (C.2) and (C.3) imply that MLE is an efficient estimator; the estimation error ∆ 2 θ attains Cramér-Rao bound in the asymptotic limit of N → ∞, The unbiasedness and the efficiency finally imply that MLE satisfies asymptotic normality in the limit N → ∞, i.e., where N is normal distribution of zero mean and variance F −1 X (θ 0 ).Purpose of following sections is to prove that the MLEOQ has the asymptotic noramlity.

S2-2. Log-likelihood function of operational quasiprobability
Whereas the typical MLE is based on a single ensemble X represented by a conditional probability p(x|X, θ), MLE in the contextual quantum metrology (coQM) utilizes the two ensembles B and AB represented by the probabilities p(b|B) and p(a, b|AB), respectively.To represent the probabilities from these two ensembles at once, we employ the operational quasiprobability (OQ) given by w(a, b|W, θ) = p(a, b|AB, θ) + 1 2 (p(b|B, θ) − p(b|AB, θ)) .

(S9)
One can directly collect samples from the two ensembles B and AB through the experiment shown in Fig. 1, but the samples of W can only be deduced from those of B and AB as a mixture of two ensembles.In this sense, we call the ensembles B and AB observable, and W virtual.
Our approach uses the virtual ensemble W to estimate the parameter θ.MLE using OQ (MLEOQ) calculates an estimate as a value which gives an extremum of log-likelihood function of w function, which is defined by where x W is a composite data set of x B and x AB drawn from the observable ensembles A and AB, respectively.Note that we only consider positive OQ to apply the function w to the logarithmic function without divergence.We test whether the OQ is positive or not with negativity defined by a,b (|w(a, b|W, θ)| − w(a, b|W, θ)) /2.w is positive semidefinite if the negativity is zero.
A lot of work in quantum metrology have been done based on the theory of typical maximum likelihood estimation assuming a single observable ensemble.On the other hand, estimation based on an ensemble mixture has been drawn little attention in the field of quantum metrology.In this work, we propose a maximum likelihood estimation utilizing the two different ensembles.To do so, we suggest a theory of ensemble mixing and prove that MLEOQ satisfies the asymptotic normality.We call one of significant properties of the forward mixing as functional equivalence: expectation of an arbitrary function f by the virtual ensemble C can be decomposed into those by the observable ensembles A and B. In other words, where . This is a key property to show the asymptotic normality of MLEOQ.
To prove the functional equivalence, we analyze the fluctuation of number count N (x|X) for an outcome x of a data set x = {x 1 , x 2 , • • • , x N X } drawn from an ensemble X.For each outcome x, the number of count N (x|X) can approximate to mean value N (x|X) := N X p(x|X) with standard deviations σ = √ N X in the asymptotic limit N X → ∞ as Let a grand probability distribution of count numbers be p({N (x|X)}) = Π x p(N (x|X)).Each probability p(N (x|X)) respective to a number count follows a binomial distribution x|X) .In the asymptotic limit of N X → ∞, the Binomial distribution approximates to a Poisson distribution of mean value N (x|X).Furthermore, as the average number count increases along with the increase of N X , the Poisson distribution approximates to a normal distribution N ( N (x|X), N (x|X)).Thus, the grand probability finally approximates to the normal distribution as This implies that N (x|X) ≈ N (x|X) ± N X p(x|X) in the asymptotic limit of N X → ∞.By using the approximation of number count (S13), we show that the number count of virtual ensemble C is decomposed of those of A and B as From the relation (S11), we can derive that where we use Finally, using the relation (S14), we prove the functional equivalence.For the data set of ensemble C, x C , the expectation of function f can be read This implies that

Backward mixing of ensembles
We can describe the forward mixing in a different view that considers the observable ensemble A as a mixture of observable ensemble B and virtual ensemble C. We call this description as backward mixing of ensembles (see Fig. S1.b).In the backward mixing, we have a reciprocal relation of Eq. (S11), The backward mixing preserves the functional equivalence, i.e., In the backward problem, the number count satisfies a reciprocal relation of number counts of Eq. (S14).
Thus, the functional equivalence becomes This implies that Operational quasiprobability as a distribution of ensemble mixtures Now we are in a position to interpret the operational quasiprobability (OQ) as a model to represent the forward and backward mixture of ensembles.For the OQ, observable ensembles are RB, C AB , and C RB , where R is a random ensemble, B is the ensemble for the single B measurement, C AB is the ensemble for the consecutive measurement AB, and C RB is the marginal ensemble B of C AB .
The OQ is obtained by the backward mixing of a virtual ensemble, called E + , and the marginal ensemble C RB as where the virtual ensemble E + is defined by the forward mixing of observable ensembles RB and C AB as Based on the aforementioned asymptotic properties, we show that the log-likelihood function of OQ satisfies following three conditions: Note that we consider a positive w function.
Proof of (C ′ .1).-In the asymptotic limit of N W → ∞, the second order derivative of log-likelihood function of OQ can be read where Fisher information of w is defined by -By the functional equivalence in Eq. (S15) and Eq.(S19), E [∂ θ l W (θ|x W )] can be decomposed into the respective expectations of observable ensembles B and AB in the asymptotic limit of N W → ∞ as By the condition (C.2), each term in the right-hand side is zero.Thus, E [∂ θ l W (θ|x W )] is zero.■ Proof of (C ′ .3).-We use the condition (C ′ .2) to prove the condition (C ′ .3): The conditions (C ′ .1)and (C ′ .2) imiply that the MLEOQ is unbiased estimator: The (C ′ .2) and (C ′ .3)imply that MLEOQ is an efficient estimator as Thus, the MLEOQ satisfies the asymptotic normality, i.e., Based on these facts, to estimate the estimation error E θ − θ 0 2 in the asymptotic limit of N W → ∞, we employ an estimator for Fisher information [54,55] defined by Fig. S3 shows that, in a large sample size, the estimation of error closes to the theoretical predictions.In this Figure , we demonstrate the contextuality-enabled enhancement for θ and ϕ estimation.We apply a systematic error model to make the theoretical predictions.Explanation for the error model is presented in the next section.

S3-1. Systematic error model
We characterize systematic errors of our optical setting.The errors do not make our quantum system to lose its coherence, but they cause unwanted drift in experimental results.However, it is impossible to avoid misalignment of control parameters in experiment, so that one performs experiment by allowing a small amount of systematic errors.For example, the axes of wave-plates can be deviated 0.1 degrees in their alignment.
To anlyze the effect of systematic error, we model a quantum probe state ρ with Bloch representation as where ⃗ r s = r s (sin θ s cos ϕ s , sin θ s sin ϕ s , cos θ s ) satisfying |r s | ≤ 1 and ⃗ σ = (σ x , σ y , σ z ).For an element of POVM m of a binary outcome a, we use the representation including biasedness x and unsharpness µ of outcome, which is given by m where ⃗ µ = µ(sin θ cos ϕ, sin θ sin ϕ, cos θ) for 0 ≤ µ ≤ 1, and the condition for the measurement to be a POVM is |x| ≤ 1 − µ [56].We also represent overall drift of measurement parameters with a linear model where θ 0 and ϕ 0 represent shift of parameters, and θ 1 and ϕ 1 represent scaling of parameters.Finally, a probability obtained by the probe state and the measurement model is given by where we abbreviate the model parameters as t s = ⃗ r s and t = (x, ⃗ µ).Our goal is to find the model parameters that best describe the experiments.We collect empirical frequencies for each outcome a for a set of states R = {⃗ r i s |i = 1, 2 ).An estimate is a value to give an extremum of loglikelihood function l(t).We assume that the probabilities given by the model is a baseline.In this case, finding an extreme value of likelihood function becomes maximizing Kullback-Leibler divergence D KL , which is defined by  As the coQM utilizes the two measurements A and B, we collect empirical frequencies for each measurement, and consider a minimization problem to analyze the systematic errors: (S38) In summary, we characterize the measurements A and B with the model parameters t A = (x A , µ A , θ 0 , θ 1 , ϕ 0 , ϕ 1 ) and t B = (x B , µ B , θ 0 , θ 1 , ϕ 0 , ϕ 1 ), where meaning of each parameter is following; θ 0 : overall drift of θ ϕ 0 : overall drift of ϕ θ 1 : scaling factor of θ ϕ 1 : scaling factor of ϕ x A,B : biasedness of measurement A, B µ A,B : sharpness of measurement A, B θ A,B : shift of θ for measurement A, B ϕ A,B : shift of ϕ for measurement A, B The parameter values for the ideal (no error) case and for an exemplary case with sample size N s = 10 5 are shown in the table I.We apply these model parameters to make the theoretical prediction in Fig. S3.

FIG. 1 .
FIG.1.An experimental schematic for coQM.Our probe state is a polarization state of a heralded single-photon source (see Methods).The probe polarization rotates by angle αlc when it propagates through the sucrose solution, where α ≈ 34.1 deg ml dm −1 g −1 is the specific rotation of the sucrose solution, l = 0.1 dm is traveling length of light in the solution, and c g ml −1 is the concentration of the solution.We estimate the concentration c by measuring the polarization change.Here, we consider two measurement settings A and B, where A measures polarization in H/V basis and B does in a D/A basis tilted 45 • from the basis of A by half-wave plate (HWP).For triggered event, the probabilities of the polarization bases are determined from relative counts of four avalanche photodiodes (APDs), D00, D01, D10, and D11.When polarizing beam splitter PBS1 is 'out', the measurement setup corresponds to the B measurement, and the counts on D00 and D01 determine probabilities of |D⟩ and |A⟩, respectively.When the PBS1 is 'in', the measurement setup corresponds to the consecutive measurement performing A first and B later, and the counts of D00, D01, D10, and D11 represent joint probabilities of |HD⟩, |HA⟩, |V A⟩, and |V D⟩, respectively.We combine measuring data to construct operational quasiprobabiltiy (OQ) in Eq. (1), and an estimate is calculated with maximum likelihood estimator of OQ in Eq. (2).The coQM utilizes the context of selecting the measurement A to enhance its precision.Experimental results in Fig.2demonstrate the enhancement.

FIG. 2 .
FIG. 2. Simulation and experiment results of the coQM.a Landscape of error ratio of our ∆θco to the conventional ∆θq/ √ 2, R := log 10 √ 2∆θco/∆θq , on the Bloch sphere of a probe state |ψ⟩ = cos(θ/2)|H⟩ + e iϕ sin(θ/2)|V ⟩, obtained by Monte-Carlo (MC) simulation.The coQM gains the contextuality-enabled enhancement if R < 0. The operational quasiprobability (OQ) is negative in the white regions.b Experiment results of θ estimation.We prepare the probe states, |ψ⟩s, by selecting 149 equiangular points from range 0.46π ≤ θ ≤ 0.55π for a fixed ϕ = 0.15π.For each probe state |ψ⟩, we conduct θ estimation by drawing 10 5 samples (Ns = 10 5).Experiments (blue circles) assert that the coQM errors ∆θco are smaller than the minimum error in the conventional quantum metrology (cvQM) ∆θq/ √ 2 = 1/ 2NsFq (dashed line), where quantum Fisher information Fq = 1.The red solid line is the theoretical prediction, assuming the ideal optical setup.We characterize the actual experimental setup by applying a systematic error model and use the resultant model parameters to make the theoretical prediction (blue solid line) (see Supplementary Information).c Sample-size dependency of estimation error ∆θ.In experiment, we prepare a probe state with θ = 0.5π and ϕ = 0.1π.For small sample sizes, OQ can be negative by statistical fluctuation, which occasionally leads to estimation failures.For Ns = 10 2 , failure rate is 88%, whereas the failure rate becomes significantly low for larger sample sizes and it is negligible for Ns ≥ 7 × 10 3 .d We estimate concentrations c = 0.1, 0.3, and 0.5 g ml −1 with a probe state |ψ⟩ prepared with θ0 = 0.5π and ϕ = 0.15π.We draw Ns = 10 5 samples to estimate each concentration and repeat each estimation 10 times.The error of concentration ∆c comes from that of polarization ∆θ by ∆c = ∆θ/αl.Error bar at each individual point represents ∆cco.The green error bar in each concentration represents the minimum error by the cvQM, ∆cq/ √ 2.
is the number of counts for outcome b in the data set x B , and N AB (a, b) is the number of counts for outcome pair (a, b) in the data set x AB .N AB (b) is obtained by the marginal number of counts as N AB (b) = a N AB (a, b).

S2- 3 .
Forward mixing of ensemblesSuppose that a virtual ensemble C is a mixture of two observable ensembles A and B by following relationp(x|C) = p(x|A)p(A) + p(x|B)p(B),(S11)where p(x|X) is a probability which represents a ensemble X, and p(X) is a probability to choose ensemble X.If one draws N A samples from the ensemble A and N B from B, the number of samples of C is N C = N A + N B .Thus, in the asymptotic limit of N C → ∞, p(A) = N A /N C and P (B) = N B /N C .We describe the virtual ensemble C as a statistical mixture of two observable ensembles A and B. We call this description as forward mixing of ensembles.The forward mixing is depicted in Fig.S1.a.
FIG. S1.Diagram of forward and backward mixing of ensembles
FIG.S4.Effect of depolarization noise on contextual quantum metrology for ϕ estimation Estimation error of contextual quantum metrology changes depending on the purity of initial probe state λ.We prepare the initial states as |ψ⟩ = cos θ/2|H⟩ + e iϕ sin θ/2 for θ = π/5 and 0.4π ≤ ϕ ≤ 0.6π, and assume that they are pure states.We postprocess the probabilities of measurements A and B by following the depolarization model in Eq. (S40).The a and b show the results of Monte-Carlo simulation and experiment, respectively.Both cases use 2 × 10 5 samples.The dashed lines are the minimum error in the conventional quantum metrology (cvQM).This bound is given by quantum Fisher information of the pure probe states |ψ⟩s.The solid lines are theoretical predictions to which the systematic error model is not applied.
, • • • , N s } with a priori probability p(⃗ r i s ).By Bayes' theorem, the joint probability p(b, t s |t) is given by To estimate the parameter t of measurement model that best describes the experimental results N (a|t ij s ) for each lattice point (θ i s , ϕ j s ), we use Bayesian inference.We define a log-likelihood function as a N (a|t ij s A|t s )p(t s )∥p(A|t s , t)p(t s )] := KL is zero if the experimental frequency f (A, t s ) is equivalent to the model probability p(a, t s |t).The two approaches result in the same extreme value as 0 = ∂ t D KL [f (A|t s )p(t s )∥p(A|t s , t)p(t s )]

TABLE I .
The model parameters to describe the systematic errors.