A stochastic evaluation of quantum Fisher information matrix with generic Hamiltonians

Quantum Fisher information matrix (QFIM) is a fundamental quantity in quantum physics, which closely links to diverse fields such as quantum metrology, phase transitions, entanglement witness, and quantum speed limit. It is crucial in quantum parameter estimation, central to the ultimate Cramér-Rao bound. Recently, the evaluation of QFIM using quantum circuit algorithms has been proposed for systems with multiplicative parameters Hamiltonian. However, systems with generic Hamiltonians still lack these proposed schemes. This work introduces a quantum-circuit-based approach for evaluating QFIM with generic Hamiltonians. We present a time-dependent stochastic parameter-shift rule for the derivatives of evolved quantum states, whereby the QFIM can be obtained. The scheme can be executed in universal quantum computers under the family of parameterized gates. In magnetic field estimations, we demonstrate the consistency between the results obtained from the stochastic parameter-shift rule and the exact results, while the results obtained from a standard parameter-shift rule slightly deviate from the exact ones. Our work sheds new light on studying QFIM with generic Hamiltonians using quantum circuit algorithms.


Introduction
The objective of quantum metrology is that using nonclassical quantum resources to enhance the precision in the estimation of unknown parameters [1,2], including entanglement [3][4][5][6][7][8][9] and squeezing states [10][11][12].Its cornerstone is the quantum estimation theory, which imposes the lower bound of precision by the quantum Cramér-Rao inequality [13].The bound is associated with quantum Fisher information (QFI) for single-parameter estimation and quantum Fisher information matrix (QFIM) for multiparameter estimation.Beyond the estimation theory, QFI and QFIM also connect to various aspects of quantum physics, including quantum phase transitions, entanglement witness, and the Fubini-Study metric, making them being fundamental quantities with broad applications (See Ref. [14] and references therein).Therefore, the evaluation of QFI and QFIM is crucial for studying these concepts.
While the estimation with generic Hamiltonians shares some typical properties with the multiplicative case, it likewise indicates other distinct features, such as getting high efficiency with time scaling [15] and quantum control [19,20].The study of QFI/QFIM in these generic cases will open a broad range of potential applications in quantum metrology, quantum computing, and others.
On the other side, quantum computers can outperform classical ones and open significant quantum advantages for exponentially speeding up various computational tasks [21,22].Specifically, using Noisy Intermediate-Scale Quantum computers [23] resulted in the brilliant growth of different quantum algorithms (see Refs. [24,25].)Among them, variational quantum algorithms [24] are the most promising approach for improving the efficiency in noisy and few-qubits devices.These algorithms include variational quantum eigensolvers [26][27][28], quantum approximate optimization algorithms [29], new frontiers in quantum foundations [30][31][32], and so on.
Besides, many computational tools based on variational quantum circuits were developed, including the standard parameter-shirt rules (Stand.PSR) [33,34] and quantum natural gradient [35].The Stand.PSR allows us to get the exact partial derivatives of any function by calculating it with different shifted parameters in the circuits.However, it only applies to cases where the gate's generators commute.Otherwise, to apply the Stand.PSR, additional treatments are required, such as Hamiltonian simulation techniques [36].Recently, Banchi and Crooks in their seminal work, have developed a stochastic parametershift rule (Stoc.PSR) for general quantum evolutions, which relies on the stochastic repetitions of quantum measurement [37].
So far, different variational quantum algorithms for quantum metrology were developed, which open a new way to achieve quantum-enhanced precision [31,32,38,39].Moreover, the Stand.PSR was widely used in various aspects, including finding the QFI with multiplicative Hamiltonians [40,41].However, it is lacking in the study of generic Hamiltonians.
In reality, many systems are governed by generic Hamiltonians.Therefore, studying these cases using quantum algorithms is urgent.This paper introduces a general time-dependent Stoc.PSR and applies it to evaluate QFI/QFIM.We utilize the proposed Stoc.PSR for the derivatives of evolved quantum states, then compute the QFI/QFIM and examine the estimation precision in quantum metrology.Our scheme can execute in universal quantum computers under the family of parameterized gates.In magnetic field estimations, we show an excellent agreement between the results obtained from the Stoc.PSR and the exact results while the Stand.PSR's results deviate from the exact values.This observation suggests the significance of the Stoc.PSR for studying QFI/QFIM with generic Hamiltonians and its applicability to variational quantum metrology.Furthermore, we extend our approach to examine the precision in many-body Hamiltonian tomography, such as estimating unknown coupling constants in the Hamiltonian.

Quantum Fisher information for generic Hamiltonians
Estimation is a measurement process that uses a probe to extract information from an interesting system with d unknown parameters in a field B = φ 1 e 1 + • • • + φ d e d , where {e j } are unit vectors in {j} directions.The probe interacts with the system through a generic Hamiltonian H(φ) = B • H = d j=1 φ j H j , where the {H j } do not necessarily commute.The task of quantum parameters estimation is to evaluate these unknown coefficients by measuring the probe.
Let ρ 0 be the initial probe state, it evolves to ρ(φ) = U(φ)ρ 0 U † (φ) after the interaction, where U(φ) = e -itH(φ) is the unitary evolution during the interaction time t.Note that H(φ) is a general Hamiltonian, therefore U(φ) cannot be expanded in terms of multiplicative.By measuring the probe state in a general basis set, such as the positive operator-valued measure (POVM) E x for the outcome x, one can obtain the corresponding probability distribution p(x|φ) = tr[ρ(φ)E x ], which can be used to estimate the unknown parameters φ.
In the estimation theory, different estimators can be used to obtain the estimated value φ(x) of the unknown parameters φ, each yielding different precisions.The precision is characterized by the covariance matrix is the variance for estimating φ k , and the off-diagonal term C k,l is the covariance between φ k and φ l .An estimator is unbiased when E[ φk (x)] = φ k , ∀k ∈ {1, . . ., d}.The precision obeys classical and quantum Cramér-Rao bounds (CRBs) [13] where M is the number of repeated measurements, F(φ) is the classical Fisher information matrix (CFIM) defined by and the maximum over all possible measurements {E x } yields the quantum Fisher information matrix (QFIM) Q(φ) with elements where L k is the symmetric logarithmic derivative (SLD) that obeys 2∂ [13].For a single parameter estimation (such as φ), the CRBs simplify to are the classical and quantum Fisher information, respectively.Note that both CFIM and QFIM may depend on the parameters φ regardless of the unitary process.The QFI and QFIM set ultimate bounds for the estimation precision of any estimator.Therefore, it is crucial to derive these QFI and QFIM for the estimation theory with generic Hamiltonians.Let us start with the derivative of the unitary evolution [16,42] where Y j = t 0 e isH (φ) [∂ φ j H(φ)]e -isH(φ) ds is a Hermitian operator [16].Then, we obtain The QFIM (3) straightforwardly yields for ρ(φ) = λ p λ |λ λ|, and ∂ φ k ρ(φ) is given from Eq. ( 5).For pure quantum states, i.e., ρ 0 = |ψ 0 ψ 0 |, the QFIM is defined by [13] where |ψ(φ) = U(φ)|ψ 0 is the evolved probe state.Substituting Eq. ( 4) into Eq.( 7), it yields [7,16] Computing QFI and QFIM requires the derivatives of the probe state, i.e., ∂ φ j ρ(φ), ∀j ∈ {1, . . ., d}.Hereafter, we introduce a stochastic parameter-shift rule (Stoc.PSR) to compute these derivatives on quantum circuits, allowing for precision evaluation in different quantum computing platforms.

Stochastic parameter-shift rule
In this section, we present a time-dependent stochastic parameter-shift rule (Stoc.PSR) for evaluating QFI/QFIM with generic Hamiltonians, where we particularly calculate ∂ φ j ρ(φ) using quantum circuits.This method is thus helpful for studying different variational quantum algorithms [24], including variational quantum metrology [31,32,39] and evaluating Fubini-Study metric tensor in quantum natural gradient [35].
We first recast Eq. ( 5) in the following form where φ) .Referring to [37] and using the Baker-Campbell-Hausdorff formula [43] for e -itμO j ρ 0 e itμO je itμO j ρ 0 e -itμO j , (10) for all tμ / ∈ π 2 Z. See Methods section for the detailed proof.Recall that Ref. [37] fixes μ = π/4 and t = 1.Here, we consider any time t and introduce μ as an arbitrary parameter shift, which makes our scheme more general, especially in time-dependent and noisy metrology.For tμ = π/4, it reduces to Ref. [37] and maximizes the accuracy for parametershift approaches (se also Ref. [44].)Finally, using e -itμO j = e isH(φ) e -itμ[∂ φ j H(φ)] e -isH(φ) [42], and substituting Eq. ( 10) into Eq.( 9), we obtain (see the Methods section): which is the time-dependent stochastic parameter-shift rule (Stoc.PSR), where The algorithm for time-dependent Stoc.PSR is described in Algorithm 1, which is an extended version of the original (without time-dependent) in Ref. [37]. Figure 1 depicts a quantum circuit for the Stoc.PSR.To obtain ∂ φ j ρ(φ) for a given time t, we perform the following steps: (s1) generate a random number s from a normal distribution within the interval [0, t]; (s2) initialize the circuit with ρ 0 ; (s3) apply the quantum gates e -isH(φ) , e and e -i(t-s)H(φ) ; (s4) extract the final state ρ + from the circuit; (s5) repeat steps s2-s4, replacing e , and assign the quantum state to ρ -; (s6) repeat steps s1-s5 N times and compute the derivative via Apply the procedure for all j ∈ 1, . . ., d and use Eqs.( 6)-( 7) we can compute the QFIM.Finally, we repeat the scheme for other time instances.
Note that the scheme can be implemented in universal quantum computers.Assuming a programmable quantum computer that can execute a family of native quantum gates U(t, φ) = e -itH (φ) , where H(φ) = j φ j H j , the evolution terms e -i(t-s)H(φ) and e -isH(φ) in step 3 can be implemented by using the quantum gates U(ts, φ) and U(s, φ), respectively.The remaining term e -itμ[∂ φ j H(φ)] in step 3 yields e -itμH j , which can be implemented by the quantum gate U(tμ, e j ), where e j is a unit vector with 1 at the j th element and zeros , and e -i(t-s)H(φ) applies to the circuit and produces ρ + .We then repeat the scheme while replacing and compute ρ -.The derivative ∂ φ j ρ(φ) is obtained via ρ + -ρ -.The process is then repeated for all φ j to get the QFIM Q(φ).Then, we move to the next time t and do the same procedure for the others.Therefore, all the evolution terms can be implemented by the device.The density states ρ + and ρ -can be extracted and subtracted from each other using classical computers or quantum subtraction technology in real hardware, e.g., see Ref. [45].
So far, the accuracy of an approach (such as finite difference, Stand.PSR, and Stoc.PSR) is determined by its variance, which is a statistical error raising from a finite number of measurements.The variance of the Stoc.PSR is comparable with that of the Stand.PSR when an infinite number of measurements are taken.[37] Finally, the algorithm's complexity is calculated using the Big O notation (O).Following Ref. [46], the complexity of the evolution gate e -itH(φ) is O(N 3 ).When considering the set of three evolution terms shown in Fig. 1, the total complexity is O(3N 3 ), which can be simplified to O(N 3 ) by removing the constant term.

Applications
To demonstrate advantaged features of the Stoc.PSR method for evaluating QFIM, we scrutinize quantum metrology in two cases of single and multiple magnetic fields.We further discuss its application to Hamiltonian tomography in many-body systems, which involves determining unknown coupling constants in the Hamiltonian.

Single parameter estimation
Let us consider a magnetic field B = cos(φ)e x + sin(φ)e z , and our goal is to estimate the angle φ between the field's direction and the z axis [15].The field interacts with an exposed qubit probe and imprints its information into the probe via the interaction Hamiltonian where σ = (σ x , σ y , σ z ) are the Pauli matrices.The unitary evolution is given by U(t, φ) = e -itH(φ) .Applying this transformation, an initial probe state, i.e., |ψ 0 = (|0 + |1 )/ √ 2 evolves to |ψ(φ) = U(t, φ)|ψ 0 .The evolved probe state |ψ(φ) provides the best quantum strategy for the estimation of φ, which can be evaluated via the QFI, similar to Eq. ( 8) where φ) ds (see detailed in the Methods section).The QFI Q(φ) is time-dependent and achieves a maximum value of 4 at t = π/2, as shown by the solid curves in Fig. 2.This behavior is caused by the rotation of the probe state under magnetic field.Furthermore, the QFI depends on the true parameter value, it thus becomes a function of φ.In the limit φ → 0, the QFI yields Q(φ) = Q max = 4 sin 2 (t) [15].
Finally, let us compare the results with the Stand.PSR.To apply the Stand.PSR, we first decompose the evolution U(t, φ) into a sequence of sub-evolutions through Trotter-Suzuki transformation [47] U(t, φ) = lim m→∞ e -it cos(φ)σ x /m e -it sin(φ)σ z /m m , (21) where these sub-evolutions can be executed in quantum circuits through rotation gates, specifically Rx and Rz.The derivative ∂ φ |ψ(φ) now can be implemented by using the Stand.PSR.See detailed calculation in the Method section.
Figure 2 shows a comparison between the performance of Stand.PSR and Stoc.PSR with the exact theoretical result.The Stoc.PSR consistently demonstrates a good agreement with the exact results all the time while the Stand.PSR deviates from the exact results as time increases.It implies that using Stoc.PSR in quantum circuits for studying quantum systems with generic Hamiltonian is essential and cannot be replaced by similar approximation methods.This is further supported by considering the mean-square error (MSE), defined as 2 , where M denotes the number of data points, y i (t) represents the data obtained using the Stand.PSR or Stoc.PSR and f (t) represents the exact results given by Eq. ( 15).We emphasize that the MSE here plays no role with the error of the estimated parameter, it is rather a systematic error caused by different methods when comparing with the exact theoretical result.The MSEs are shown in the figure as the error bars and error areas.As we can see, the MSE for Stoc.PSR remains small throughout the duration, while that one for the Stand.PSR divers for large sensing time t.

Multiple parameters estimation
Next, we apply the Stoc.PSR scheme to estimate the components of a magnetic field pointing in an arbitrary direction.Consider the probe state initially prepared in n-qubit GHZ state |ψ 0 = (|00 , such that allows for obtaining the maximum QFIM [6].The interaction Hamiltonian is given by where φ = (φ x , φ y , φ z ) are three components of the given magnetic field that we want to estimate, and J j = n k=1 σ (k) j is a collective Pauli matrix.Potential platforms for the probe include spin-1/2 ensemble semiconductors, ions traps, NMR systems, and NV centers.In these systems, such as spin-1/2 ensemble, J j becomes the collective angular momentum operator [7].
The QFIM can be obtained theoretically from Eq. ( 8), and the total variance yields 2 φ = tr[Q -1 ].Concretely, with n = 3 qubits and φ x = φ y = φ z = ϕ, we obtain We show the exact theoretical results by the solid curves for various ϕ in Fig. 3a.For each ϕ, there is a minimum variance at a certain time t, which is caused by the rotation of the probe state under magnetic field.In the limit of small phase, i.e., ϕ → 0, the total variance is tr[Q -1 ] = 7 108t 2 , which results in the minimum of total variance.In the Stoc.PSR method, we model the probe in an n-qubit quantum circuit initially prepared in the GHZ state.The circuit can be implemented in the existing noisy intermediatescale quantum computers [23].Its state evolves under the transformation U(t, φ) = e -itH(φ) , and results in the evolved state |ψ(φ) = U(t, φ)|ψ 0 .As discussed above, this unitary evolution can be implemented in a universal quantum computer.Therefore, we employ the Stoc.PSR using Algorithm 1 to obtain ∂ φ j |ψ(φ) for all j and get the QFIM as in Eq. ( 7).The tr[Q -1 ] is shown in Fig. 3a (dotted curves) for the number of sampling N = 1000.The Stoc.PSR's results agree with the exact results.
We further apply the scheme to noisy cases, where the probe is described by mixed states.We consider time-dependent dephasing, which is given by a quantum channel E that acts on a single qubit as where we used the Kraus representation for the dephasing channel [31] The time-dependent probability is p(t) = e -γ t for the Markovian noise, where γ is the decay rate [31].
We apply the quantum channel E to all qubits in the probe during the interaction time and use Algorithm 1 to derive the QFIM.The results for the total variance versus the interaction time t are shown in Fig. 3b.We plot the results for several decay rates γ and compare the Stoc.PSR approach with the theoretical analysis.Again, they match excellently.

Hamiltonian tomography
We additionally discuss the application to Hamiltonian tomography in many-body systems, which involves determining unknown coupling constants in the Hamiltonian.Hamiltonian tomography aims to reconstruct a generic many-body Hamiltonian by measuring multiple pairs of the initial and time-evolving states.It is a challenging task due to the complexity of the many-body dynamics.So far, the progress is limited to particular Hamiltonians and small-size systems [48][49][50][51].For example, a simple task is to identify the Hamiltonian in an Ising model of a spin-1/2 chain placed under an external field.A generic Hamiltonian is given by H = j c j,j+1 σ x , where the coupling constants {c j,j+1 } and the external field strengths {h j } are unknown factors, j stands for the site j th in the chain.
Recently, Li et al. introduced a quantum quench approach for the Hamiltonian tomography that can apply to both analog and digital quantum simulators [52].Hereafter, we evaluate the quantum quench precision by using Stoc.PSR to calculate the classical Cramér-Rao bound.
A generic Hamiltonian of a many-body system can be decomposed into d-interaction terms as where {x j } are unknown coupling constants that need to be determined, and {H j } are Hermitian operators.An initial state ρ 0 evolves to ρ(x) = e -iHt ρ 0 e iHt after time t, for x = (x 1 , . . ., x d ) .The system obeys a conservation law [52] tr for every pair of given ρ 0 and ρ(x).To determine d coefficients {x j }, we need to solve at least p ≥ d -1 linear equations which form a matrix equation as Xx = 0, where X is a p × d matrix with the elements where k ∈ {1, . . ., p} and l ∈ {1, . . ., d} for different pairs of ρ (k) 0 , ρ (k) (x).Here, {ρ (k) 0 } is a set of (random) initial states and {ρ (k) (x)} is a set of evolved states.
For {H j } are measured observables, such as Pauli matrices, SIC-POVM, and polarization bases [53], the matrix elements {X k,l } become measured probabilities under the eigenbases of these observables.Thus, to evaluate the best estimation of {x j }, we examine the classical bound, i.e., via the CFIM Eq. (2).Firstly, from Eq. ( 28), we derive where ∂ρ (k) (x) ∂x j is given by Stoc.PSR Eq. (11).We later define the CFIM as and hence obtain the classical Cramér-Rao bound, i.e., 2 x ≥ tr[F -1 ].The equality can be achieved by an appropriate estimator.
The results are shown in Fig. 4 as functions of p.In principle, p = d -1 is sufficient to estimate d parameters.However, p > d -1 gives better statistical results [52].In this context, we compare the Stoc.PSR and finite difference approach, and find that they tend to converge when increasing p.While the finite difference method consistently produces better results, it also has a larger bias due to the computational challenges of computing ρ(x + ) and ρ(x -) in quantum circuits for 1.Furthermore, since p is equivalent with the number of repeated measurements, we can define the standard quantum limit (SQL) as ∝ 1/p and Heisenberg limit (HL) by ∝ 1/p 2 .We compare the bound in quantum quench with these limits and find that it scales slightly worse than the SQL, opening further exploring to improve the limit in quantum quench approaches.

Conclusions
We proposed a time-dependent stochastic parameter-shift rule (Stoc.PSR) framework for deriving the differential in studying quantum Fisher information matrix with generic Hamiltonian generators.This method allows for obtaining the exact derivative using universal quantum circuits.Different from the standard parameter-shift rule (Stand.PSR), which particularly replies on commuting Hamiltonians, here, the Stoc.PSR applies to generic Hamiltonians.
Using the Stoc.PSR approach, the evaluation of QFI/QFIM can be practically executed in quantum circuits.In all cases, the Stoc.PSR results have agreed with the exact theoretical analysis, while the Stand.PSR results have deviated from the exact values.This framework can also be used for Hamiltonian tomography in many-body systems.
While variational quantum algorithms are extensively developing, our framework uses these advantages for the development of quantum metrology and quantum measurement with generic Hamiltonian and makes them reliable for studying in the area of quantum computers.
Finally, we derive the quantum Fisher information as in Eq. ( 7): which results in Eq. ( 15).

Figure 2
Figure 2 Quantum Fisher information for single magnetic field estimation.Quantum Fisher information Q(φ) as a function of the interaction time t for different choices of φ, as shown in the figure.The solid curves are exact results from theoretical analysis Eq. (15), the dashed curves are obtained from the Trotter-Suzuki transformation and Stand.PSR, and the dotted curves are obtained from the Stoc.PSR.It can be observed that Q(φ) varies with time t and reaches its maximum at t = π /2.More importantly, the results show that the Stoc.PSR agrees with the exact analysis while the Stand.PSR gradually deviates from the exact one.The mean-square error (MSE) are plotted as error bars and error areas in the figure.They are systematic errors that caused by different calculation methods

Figure 3
Figure 3The total variance for multiphase magnetic field estimation.(a) The total variance 2 φ = tr[Q -1 ] as a function of the interaction time t for different choices of ϕ as shown in the figure.Here, we use φ x = φ y = φ z = ϕ for illustration (although in general, these values may differ).The solid curves are exact results, which are given by theoretical analysis, and the dotted curves are obtained from the Stoc.PSR.It can be observed that tr[Q -1 ] varies with t and reaches its minimum at a certain time.More importantly, the results show a good agreement between the Stoc.PSR and the exact theoretical analysis.(b) Plot of the total variance versus t under the time-dependent dephasing noise for various decay rates γ .Here, we fixed ϕ = π /10

Figure 4
Figure 4 The classical Cramér-Rao bound in single-qubit Hamiltonian tomography.The results are plotted for two different approaches: Stoc.PSR (down triangle) and finite difference (up triangle).The standard quantum limit (SQL) and Heisenberg limit (HL) are shown for comparison.Here, SQL ∝ 1/p and HL ∝ 1/p 2

From
now on, let us show the detailed calculation for the Trotter-Suzuki transformation and Stand.PSR for single parameter estimation.From the evolution (21), we set x = -2t m sin(φ), ∂ φ z = 2t m cos(φ).