QuantumCore

Lesson 49 · 95 min · advanced

Quantum Natural Gradient & the Fubini–Study Metric

Loading progress…

Gradient descent measures the length of a step in parameter space, although only the change of the quantum state matters. This lesson derives the natural distance between quantum states, the Fubini–Study distance between rays, and its infinitesimal form, the metric gij=Re[⟨∂iψ∣∂jψ⟩−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩]g_{ij}=\mathrm{Re}\big[\langle\partial_i\psi\vert\partial_j\psi\rangle-\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle\big], which is invariant under parameter-dependent global phases. For layered circuits it proves that the in-layer blocks of gg are covariances ⟨KiKj⟩−⟨Ki⟩⟨Kj⟩\langle K_iK_j\rangle-\langle K_i\rangle\langle K_j\rangle of the gate generators, measurable on hardware; it derives the quantum natural gradient θ←θ−η g−1∇L\theta\leftarrow\theta-\eta\,g^{-1}\nabla L as steepest descent under a metric constraint by Lagrange multipliers, together with its pseudo-inverse and Tikhonov forms and its invariance under reparametrisation; it computes the metric of a qubit, ds2=14(dθ2+sin⁡2θ dϕ2)\mathrm ds^2=\tfrac14\big(\mathrm d\theta^2+\sin^2\theta\,\mathrm d\phi^2\big), in two ways; and it relates gg to the quantum Fisher information FQ=4gF_Q=4g, to Amari's natural gradient and to imaginary-time evolution.

Prerequisites: The Parameter-Shift Rule, The Bloch Sphere

Objectives and key results
  • Expand the fidelity of two nearby states to second order and derive the Fubini–Study metric gij=Re[⟨∂iψ∣∂jψ⟩−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩]g_{ij}=\mathrm{Re}\big[\langle\partial_i\psi\vert\partial_j\psi\rangle-\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle\big] of a parameterised state, and prove that it does not depend on a parameter-dependent global phase.

  • Prove that for a layer of commuting gates e−iθiKie^{-i\theta_iK_i} the metric block equals ⟨KiKj⟩−⟨Ki⟩⟨Kj⟩\langle K_iK_j\rangle-\langle K_i\rangle\langle K_j\rangle on the state before the layer, state what the block-diagonal and diagonal approximations discard, and explain how the variances are measured on hardware.

  • Derive the quantum natural gradient δ∝−g−1∇L\delta\propto-g^{-1}\nabla L as the solution of min⁡δ∇L⊤δ\min_\delta\nabla L^\top\delta subject to δ⊤g δ=ϵ2\delta^\top g\,\delta=\epsilon^2, handle singular metrics with the pseudo-inverse and Tikhonov regularisation, and prove its invariance under reparametrisation to first order.

  • Compute the metric g=diag(14,14sin⁡2θ)g=\mathrm{diag}\big(\tfrac14,\tfrac14\sin^2\theta\big) of RZ(ϕ)RY(θ)∣0⟩R_Z(\phi)R_Y(\theta)\lvert0\rangle from the definition and from the layerwise formula, and recognise it as the round metric of a sphere of radius 12\tfrac12.

  • Derive the relation FQ=4gF_Q=4g between the metric and the quantum Fisher information of a pure state, state the Braunstein–Caves inequality FC≤FQF_C\le F_Q, and show that a natural-gradient step is an Euler step of variational imaginary-time evolution.

  • Perform natural-gradient updates by hand and with the platform's engine, and compare them with vanilla gradient descent.

definition · Fubini–Study metric of a parameterised state
gij(θ)=Re[⟨∂iψ∣∂jψ⟩−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩],1−∣⟨ψ(θ)∣ψ(θ+dθ)⟩∣2=∑ijgij dθi dθj+O(∣dθ∣3)g_{ij}(\theta)=\mathrm{Re}\Big[\langle\partial_i\psi\vert\partial_j\psi\rangle-\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle\Big],\qquad1-\lvert\langle\psi(\theta)\vert\psi(\theta+\mathrm d\theta)\rangle\rvert^2=\sum_{ij}g_{ij}\,\mathrm d\theta_i\,\mathrm d\theta_j+O(\lvert\mathrm d\theta\rvert^3)
theorem · Layerwise block of the metric
i,j∈layer ℓ:gij=⟨ψℓ−1∣KiKj∣ψℓ−1⟩−⟨ψℓ−1∣Ki∣ψℓ−1⟩⟨ψℓ−1∣Kj∣ψℓ−1⟩,gii=Varψℓ−1(Ki)i,j\in\text{layer }\ell:\qquad g_{ij}=\langle\psi_{\ell-1}\vert K_iK_j\vert\psi_{\ell-1}\rangle-\langle\psi_{\ell-1}\vert K_i\vert\psi_{\ell-1}\rangle\langle\psi_{\ell-1}\vert K_j\vert\psi_{\ell-1}\rangle,\qquad g_{ii}=\mathrm{Var}_{\psi_{\ell-1}}(K_i)
formula · Metric of a qubit
∣ψ⟩=RZ(ϕ)RY(θ)∣0⟩:g=(140014sin⁡2θ),ds2=14(dθ2+sin⁡2θ dϕ2)\lvert\psi\rangle=R_Z(\phi)R_Y(\theta)\lvert0\rangle:\qquad g=\begin{pmatrix}\frac14&0\\0&\frac14\sin^2\theta\end{pmatrix},\qquad\mathrm ds^2=\tfrac14\big(\mathrm d\theta^2+\sin^2\theta\,\mathrm d\phi^2\big)
algorithm · Quantum natural gradient update
θ←θ−η (g(θ)+λI)−1∇L(θ)(λ≥0; λ=0 with the pseudo-inverse g+)\theta\leftarrow\theta-\eta\,\big(g(\theta)+\lambda I\big)^{-1}\nabla L(\theta)\qquad(\lambda\ge0;\ \lambda=0\text{ with the pseudo-inverse }g^{+})
identity · Quantum Fisher information of a pure state
FQ,ij=12Tr(ρ{Li,Lj})=4 gij,FC≤FQF_{Q,ij}=\tfrac12\mathrm{Tr}\big(\rho\{L_i,L_j\}\big)=4\,g_{ij},\qquad F_C\le F_Q

Distances between quantum states#

The previous lessons of this module computed the gradient ∇L(θ)\nabla L(\theta) of a variational loss exactly with the parameter-shift rule. Vanilla gradient descent then updates θ←θ−η ∇L\theta\leftarrow\theta-\eta\,\nabla L. This update hides a choice of geometry: among all steps δ\delta of a fixed Euclidean length ∥δ∥2=ϵ\lVert\delta\rVert_2=\epsilon, the vector −ϵ ∇L/∥∇L∥2-\epsilon\,\nabla L/\lVert\nabla L\rVert_2 decreases the linearised loss the most. The Euclidean length of a parameter step, however, says little about how far the quantum state moves. On the Bloch sphere, a change of the azimuth ϕ\phi by 0.10.1 moves the state by a large amount on the equator and by nothing at all at the north pole, where ϕ\phi only multiplies the state by a global phase. A rescaling θ=3ξ\theta=3\xi of a rotation angle makes vanilla gradient steps nine times longer in θ\theta although the model is unchanged. The natural gradient removes this arbitrariness by measuring step lengths in the space of quantum states. This lesson constructs the required distance, computes it for circuits, and derives the resulting optimiser.

Definition

Rays, fidelity and the Fubini–Study distance

Two nonzero vectors ∣ψ⟩,∣φ⟩∈Cd\lvert\psi\rangle,\lvert\varphi\rangle\in\mathbb C^d describe the same physical state if ∣φ⟩=c ∣ψ⟩\lvert\varphi\rangle=c\,\lvert\psi\rangle for some c∈C∖{0}c\in\mathbb C\setminus\{0\}: no measurement distinguishes them. The equivalence class [ψ]={c∣ψ⟩}[\psi]=\{c\lvert\psi\rangle\} is a ray, and the set of rays is the projective Hilbert space CPd−1\mathbb{CP}^{d-1}. The fidelity of two rays is F(ψ,φ)=∣⟨ψ∣φ⟩∣2⟨ψ∣ψ⟩ ⟨φ∣φ⟩∈[0,1],F(\psi,\varphi)=\frac{\lvert\langle\psi\vert\varphi\rangle\rvert^2}{\langle\psi\vert\psi\rangle\,\langle\varphi\vert\varphi\rangle}\in[0,1], which is unchanged when either vector is multiplied by a nonzero constant, and the Fubini–Study distance is dFS(ψ,φ)=arccos⁡F(ψ,φ)∈[0,π2]d_{FS}(\psi,\varphi)=\arccos\sqrt{F(\psi,\varphi)}\in[0,\tfrac\pi2]. For normalised vectors F=∣⟨ψ∣φ⟩∣2F=\lvert\langle\psi\vert\varphi\rangle\rvert^2 is the probability that ∣φ⟩\lvert\varphi\rangle passes a projective test for ∣ψ⟩\lvert\psi\rangle.

Theorem

Infinitesimal distance between rays

Let ∣ψ⟩\lvert\psi\rangle be normalised and let ∣δψ⟩\lvert\delta\psi\rangle be a small displacement. Then 1−F(ψ,ψ+δψ)=⟨δψ∣δψ⟩−∣⟨ψ∣δψ⟩∣2+O(∥δψ∥3),1-F(\psi,\psi+\delta\psi)=\langle\delta\psi\vert\delta\psi\rangle-\lvert\langle\psi\vert\delta\psi\rangle\rvert^2+O\big(\lVert\delta\psi\rVert^3\big), the leading term equals ∥(I−∣ψ⟩⟨ψ∣) δψ∥2≥0\lVert(I-\lvert\psi\rangle\langle\psi\rvert)\,\delta\psi\rVert^2\ge0, the squared length of the component of δψ\delta\psi orthogonal to ∣ψ⟩\lvert\psi\rangle, and dFS(ψ,ψ+δψ)2d_{FS}(\psi,\psi+\delta\psi)^2 has the same expansion.

Proof (6 steps)
  1. Step 1:
    a=⟨ψ∣δψ⟩,b=⟨δψ∣δψ⟩:⟨ψ∣ψ+δψ⟩=1+a,⟨ψ+δψ∣ψ+δψ⟩=1+a+aˉ+b=1+2 Re a+ba=\langle\psi\vert\delta\psi\rangle,\quad b=\langle\delta\psi\vert\delta\psi\rangle:\qquad\langle\psi\vert\psi+\delta\psi\rangle=1+a,\qquad\langle\psi+\delta\psi\vert\psi+\delta\psi\rangle=1+a+\bar a+b=1+2\,\mathrm{Re}\,a+b
    Expand the inner products by sesquilinearity, using ⟨ψ∣ψ⟩=1\langle\psi\vert\psi\rangle=1 and ⟨δψ∣ψ⟩=aˉ\langle\delta\psi\vert\psi\rangle=\bar a.
  2. Step 2:
    ∣⟨ψ∣ψ+δψ⟩∣2=(1+a)(1+aˉ)=1+2 Re a+∣a∣2\lvert\langle\psi\vert\psi+\delta\psi\rangle\rvert^2=(1+a)(1+\bar a)=1+2\,\mathrm{Re}\,a+\lvert a\rvert^2
    ∣z∣2=zzˉ\lvert z\rvert^2=z\bar z.
  3. Step 3:
    F=1+2 Re a+∣a∣21+2 Re a+b=1−b−∣a∣21+2 Re a+bF=\frac{1+2\,\mathrm{Re}\,a+\lvert a\rvert^2}{1+2\,\mathrm{Re}\,a+b}=1-\frac{b-\lvert a\rvert^2}{1+2\,\mathrm{Re}\,a+b}
    Definition of the fidelity with ⟨ψ∣ψ⟩=1\langle\psi\vert\psi\rangle=1; add and subtract bb in the numerator.
  4. Step 4:
    b−∣a∣2=O(∥δψ∥2),11+2 Re a+b=1+O(∥δψ∥) ⇒ 1−F=b−∣a∣2+O(∥δψ∥3)b-\lvert a\rvert^2=O(\lVert\delta\psi\rVert^2),\qquad\frac1{1+2\,\mathrm{Re}\,a+b}=1+O(\lVert\delta\psi\rVert)\ \Rightarrow\ 1-F=b-\lvert a\rvert^2+O(\lVert\delta\psi\rVert^3)
    ∣a∣≤∥δψ∥\lvert a\rvert\le\lVert\delta\psi\rVert by Cauchy–Schwarz and b=∥δψ∥2b=\lVert\delta\psi\rVert^2; a geometric series expands the denominator, and the product of an O(∥δψ∥2)O(\lVert\delta\psi\rVert^2) term with an O(∥δψ∥)O(\lVert\delta\psi\rVert) correction is O(∥δψ∥3)O(\lVert\delta\psi\rVert^3).
  5. Step 5:
    P⊥=I−∣ψ⟩⟨ψ∣:∥P⊥δψ∥2=⟨δψ∣P⊥∣δψ⟩=⟨δψ∣δψ⟩−⟨δψ∣ψ⟩⟨ψ∣δψ⟩=b−∣a∣2P_\perp=I-\lvert\psi\rangle\langle\psi\rvert:\quad\lVert P_\perp\delta\psi\rVert^2=\langle\delta\psi\vert P_\perp\vert\delta\psi\rangle=\langle\delta\psi\vert\delta\psi\rangle-\langle\delta\psi\vert\psi\rangle\langle\psi\vert\delta\psi\rangle=b-\lvert a\rvert^2
    P⊥P_\perp is an orthogonal projector (P⊥†=P⊥=P⊥2P_\perp^\dagger=P_\perp=P_\perp^2), so ∥P⊥v∥2=⟨v∣P⊥∣v⟩\lVert P_\perp v\rVert^2=\langle v\vert P_\perp\vert v\rangle. The component of δψ\delta\psi along ∣ψ⟩\lvert\psi\rangle only rescales the vector (to first order it changes the norm and the global phase) and does not move the ray.
  6. Step 6:
    cos⁡2dFS=F ⇒ sin⁡2dFS=1−F,dFS2=sin⁡2dFS+O(dFS4)=1−F+O(∥δψ∥3)\cos^2d_{FS}=F\ \Rightarrow\ \sin^2d_{FS}=1-F,\qquad d_{FS}^2=\sin^2d_{FS}+O(d_{FS}^4)=1-F+O(\lVert\delta\psi\rVert^3)
    sin⁡2x=x2+O(x4)\sin^2x=x^2+O(x^4), and dFS2=O(1−F)=O(∥δψ∥2)d_{FS}^2=O(1-F)=O(\lVert\delta\psi\rVert^2), so dFS4=O(∥δψ∥4)d_{FS}^4=O(\lVert\delta\psi\rVert^4).

∎

Proposition

The Fubini–Study metric of a parameterised state

Let θ↦∣ψ(θ)⟩∈Cd\theta\mapsto\lvert\psi(\theta)\rangle\in\mathbb C^d, θ∈RP\theta\in\mathbb R^P, be twice continuously differentiable and normalised, and write ∣∂iψ⟩=∂∣ψ⟩/∂θi\lvert\partial_i\psi\rangle=\partial\lvert\psi\rangle/\partial\theta_i. Define the quantum geometric tensor Gij=⟨∂iψ∣∂jψ⟩−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩G_{ij}=\langle\partial_i\psi\vert\partial_j\psi\rangle-\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle and the Fubini–Study metric gij=Re Gijg_{ij}=\mathrm{Re}\,G_{ij}. Then 1−∣⟨ψ(θ)∣ψ(θ+dθ)⟩∣2=∑i,jgij dθi dθj+O(∣dθ∣3),1-\lvert\langle\psi(\theta)\vert\psi(\theta+\mathrm d\theta)\rangle\rvert^2=\sum_{i,j}g_{ij}\,\mathrm d\theta_i\,\mathrm d\theta_j+O(\lvert\mathrm d\theta\rvert^3), and gg is real, symmetric and positive semidefinite.

Proof (6 steps)
  1. Step 1:
    ∣δψ⟩=∣ψ(θ+dθ)⟩−∣ψ(θ)⟩=∑idθi ∣∂iψ⟩+O(∣dθ∣2)\lvert\delta\psi\rangle=\lvert\psi(\theta+\mathrm d\theta)\rangle-\lvert\psi(\theta)\rangle=\sum_i\mathrm d\theta_i\,\lvert\partial_i\psi\rangle+O(\lvert\mathrm d\theta\rvert^2)
    First-order Taylor expansion of the state; the second-order remainder contributes only at order ∣dθ∣3\lvert\mathrm d\theta\rvert^3 to the quadratic quantities below.
  2. Step 2:
    ⟨δψ∣δψ⟩=∑i,j⟨∂iψ∣∂jψ⟩ dθi dθj+O(∣dθ∣3)\langle\delta\psi\vert\delta\psi\rangle=\sum_{i,j}\langle\partial_i\psi\vert\partial_j\psi\rangle\,\mathrm d\theta_i\,\mathrm d\theta_j+O(\lvert\mathrm d\theta\rvert^3)
    Insert the expansion into both slots; the parameters dθi\mathrm d\theta_i are real, so they leave the bra unconjugated.
  3. Step 3:
    ∣⟨ψ∣δψ⟩∣2=⟨ψ∣δψ⟩‾ ⟨ψ∣δψ⟩=∑i,j⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩ dθi dθj+O(∣dθ∣3)\lvert\langle\psi\vert\delta\psi\rangle\rvert^2=\overline{\langle\psi\vert\delta\psi\rangle}\,\langle\psi\vert\delta\psi\rangle=\sum_{i,j}\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle\,\mathrm d\theta_i\,\mathrm d\theta_j+O(\lvert\mathrm d\theta\rvert^3)
    ⟨ψ∣∂iψ⟩‾=⟨∂iψ∣ψ⟩\overline{\langle\psi\vert\partial_i\psi\rangle}=\langle\partial_i\psi\vert\psi\rangle.
  4. Step 4:
    1−F=∑i,jGij dθi dθj+O(∣dθ∣3)1-F=\sum_{i,j}G_{ij}\,\mathrm d\theta_i\,\mathrm d\theta_j+O(\lvert\mathrm d\theta\rvert^3)
    Subtract the two lines and apply the theorem on the infinitesimal distance between rays.
  5. Step 5:
    Gij‾=⟨∂jψ∣∂iψ⟩−⟨∂jψ∣ψ⟩⟨ψ∣∂iψ⟩=Gji ⇒ ∑i,jGij dθidθj=∑i,jRe Gij dθidθj\overline{G_{ij}}=\langle\partial_j\psi\vert\partial_i\psi\rangle-\langle\partial_j\psi\vert\psi\rangle\langle\psi\vert\partial_i\psi\rangle=G_{ji}\ \Rightarrow\ \sum_{i,j}G_{ij}\,\mathrm d\theta_i\mathrm d\theta_j=\sum_{i,j}\mathrm{Re}\,G_{ij}\,\mathrm d\theta_i\mathrm d\theta_j
    GG is Hermitian, so Re G\mathrm{Re}\,G is symmetric and Im G\mathrm{Im}\,G is antisymmetric; an antisymmetric matrix contributes nothing to a quadratic form with a real vector.
  6. Step 6:
    v∈RP:v⊤g v=∑i,jvivjGij=∥P⊥∑ivi∣∂iψ⟩∥2≥0v\in\mathbb R^P:\quad v^\top g\,v=\sum_{i,j}v_iv_jG_{ij}=\Big\lVert P_\perp\sum_iv_i\lvert\partial_i\psi\rangle\Big\rVert^2\ge0
    The identity ⟨u∣u⟩−∣⟨ψ∣u⟩∣2=∥P⊥u∥2\langle u\vert u\rangle-\lvert\langle\psi\vert u\rangle\rvert^2=\lVert P_\perp u\rVert^2 of the previous proof with u=∑ivi∣∂iψ⟩u=\sum_iv_i\lvert\partial_i\psi\rangle: gg is positive semidefinite, and v⊤g v=0v^\top g\,v=0 exactly when moving along vv changes ∣ψ⟩\lvert\psi\rangle only along itself.

∎

Proposition

The quantum geometric tensor is invariant under parameter-dependent phases

Let α:RP→R\alpha:\mathbb R^P\to\mathbb R be differentiable and ∣ψ~(θ)⟩=eiα(θ)∣ψ(θ)⟩\lvert\tilde\psi(\theta)\rangle=e^{i\alpha(\theta)}\lvert\psi(\theta)\rangle. Then G~ij=Gij\tilde G_{ij}=G_{ij} for all i,ji,j, so g~=g\tilde g=g. In contrast, ⟨∂iψ~∣∂jψ~⟩=⟨∂iψ∣∂jψ⟩+i ∂jα ⟨∂iψ∣ψ⟩−i ∂iα ⟨ψ∣∂jψ⟩+∂iα ∂jα\langle\partial_i\tilde\psi\vert\partial_j\tilde\psi\rangle=\langle\partial_i\psi\vert\partial_j\psi\rangle+i\,\partial_j\alpha\,\langle\partial_i\psi\vert\psi\rangle-i\,\partial_i\alpha\,\langle\psi\vert\partial_j\psi\rangle+\partial_i\alpha\,\partial_j\alpha depends on α\alpha: the second term of GG is exactly what removes the unphysical phase.

Proof (5 steps)
  1. Step 1:
    ∣∂iψ~⟩=eiα(i ∂iα ∣ψ⟩+∣∂iψ⟩)\lvert\partial_i\tilde\psi\rangle=e^{i\alpha}\big(i\,\partial_i\alpha\,\lvert\psi\rangle+\lvert\partial_i\psi\rangle\big)
    Product rule; α\alpha is real, so eiα‾eiα=1\overline{e^{i\alpha}}e^{i\alpha}=1 in every inner product below.
  2. Step 2:
    ⟨∂iψ~∣∂jψ~⟩=(−i ∂iα ⟨ψ∣+⟨∂iψ∣)(i ∂jα ∣ψ⟩+∣∂jψ⟩)=∂iα ∂jα−i ∂iα ⟨ψ∣∂jψ⟩+i ∂jα ⟨∂iψ∣ψ⟩+⟨∂iψ∣∂jψ⟩\langle\partial_i\tilde\psi\vert\partial_j\tilde\psi\rangle=\big(-i\,\partial_i\alpha\,\langle\psi\vert+\langle\partial_i\psi\vert\big)\big(i\,\partial_j\alpha\,\lvert\psi\rangle+\lvert\partial_j\psi\rangle\big)=\partial_i\alpha\,\partial_j\alpha-i\,\partial_i\alpha\,\langle\psi\vert\partial_j\psi\rangle+i\,\partial_j\alpha\,\langle\partial_i\psi\vert\psi\rangle+\langle\partial_i\psi\vert\partial_j\psi\rangle
    The bra of i ∂iα∣ψ⟩i\,\partial_i\alpha\lvert\psi\rangle is −i ∂iα⟨ψ∣-i\,\partial_i\alpha\langle\psi\rvert; multiply out the four terms with ⟨ψ∣ψ⟩=1\langle\psi\vert\psi\rangle=1.
  3. Step 3:
    ⟨∂iψ~∣ψ~⟩=⟨∂iψ∣ψ⟩−i ∂iα,⟨ψ~∣∂jψ~⟩=⟨ψ∣∂jψ⟩+i ∂jα\langle\partial_i\tilde\psi\vert\tilde\psi\rangle=\langle\partial_i\psi\vert\psi\rangle-i\,\partial_i\alpha,\qquad\langle\tilde\psi\vert\partial_j\tilde\psi\rangle=\langle\psi\vert\partial_j\psi\rangle+i\,\partial_j\alpha
    The same expansion with one slot replaced by ∣ψ~⟩=eiα∣ψ⟩\lvert\tilde\psi\rangle=e^{i\alpha}\lvert\psi\rangle.
  4. Step 4:
    ⟨∂iψ~∣ψ~⟩⟨ψ~∣∂jψ~⟩=⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩+i ∂jα ⟨∂iψ∣ψ⟩−i ∂iα ⟨ψ∣∂jψ⟩+∂iα ∂jα\langle\partial_i\tilde\psi\vert\tilde\psi\rangle\langle\tilde\psi\vert\partial_j\tilde\psi\rangle=\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle+i\,\partial_j\alpha\,\langle\partial_i\psi\vert\psi\rangle-i\,\partial_i\alpha\,\langle\psi\vert\partial_j\psi\rangle+\partial_i\alpha\,\partial_j\alpha
    Multiply the two factors; (−i)(i)=1(-i)(i)=1 gives the last term.
  5. Step 5:
    G~ij=⟨∂iψ~∣∂jψ~⟩−⟨∂iψ~∣ψ~⟩⟨ψ~∣∂jψ~⟩=⟨∂iψ∣∂jψ⟩−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩=Gij\tilde G_{ij}=\langle\partial_i\tilde\psi\vert\partial_j\tilde\psi\rangle-\langle\partial_i\tilde\psi\vert\tilde\psi\rangle\langle\tilde\psi\vert\partial_j\tilde\psi\rangle=\langle\partial_i\psi\vert\partial_j\psi\rangle-\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle=G_{ij}
    The three α\alpha-dependent terms of the second line and the fourth line coincide and cancel in the difference.

∎

Quick check

Why does the Fubini–Study metric subtract ⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle from ⟨∂iψ∣∂jψ⟩\langle\partial_i\psi\vert\partial_j\psi\rangle?

Select one answer

The metric of a qubit: a sphere of radius ½#

The simplest nontrivial model has one qubit and two parameters: the circuit RY(θ)R_Y(\theta) followed by RZ(ϕ)R_Z(\phi), which prepares ∣ψ(θ,ϕ)⟩=RZ(ϕ)RY(θ)∣0⟩\lvert\psi(\theta,\phi)\rangle=R_Z(\phi)R_Y(\theta)\lvert0\rangle. Up to a global phase this is the Bloch-sphere parametrisation with polar angle θ\theta and azimuth ϕ\phi, so every pure qubit state is reached. The circuit below binds θ=π/3\theta=\pi/3 and ϕ=π/4\phi=\pi/4; its statevector is (e−iπ/8cos⁡π6, eiπ/8sin⁡π6)\big(e^{-i\pi/8}\cos\tfrac\pi6,\ e^{i\pi/8}\sin\tfrac\pi6\big). The metric is computed here directly from the definition; the next section obtains it a second time from the layerwise formula.

Circuit · 1 qubit

Quantum circuit on 1 qubitRY(theta) on q0; RZ(phi) on q0q0RY(theta)RZ(phi)

The model circuit RY(θ)R_Y(\theta) then RZ(ϕ)R_Z(\phi) with θ=π/3\theta=\pi/3, ϕ=π/4\phi=\pi/4. The statevector is e−iπ/832∣0⟩+eiπ/812∣1⟩≈(0.800103−0.331414 i)∣0⟩+(0.461940+0.191342 i)∣1⟩e^{-i\pi/8}\tfrac{\sqrt3}2\lvert0\rangle+e^{i\pi/8}\tfrac12\lvert1\rangle\approx(0.800103-0.331414\,i)\lvert0\rangle+(0.461940+0.191342\,i)\lvert1\rangle.

∣ψ⟩=(0.8001−0.3314i)∣0⟩+(0.4619+0.1913i)∣1⟩\lvert\psi\rangle = \left(0.8001 - 0.3314i\right)\lvert 0\rangle + \left(0.4619 + 0.1913i\right)\lvert 1\rangle
RZ(ϕ)RY(θ)=(e−iϕ/200eiϕ/2)(cos⁡θ2−sin⁡θ2sin⁡θ2cos⁡θ2)=(e−iϕ/2cos⁡θ2−e−iϕ/2sin⁡θ2eiϕ/2sin⁡θ2eiϕ/2cos⁡θ2)=θ=π/3, ϕ=π/4(e−iπ/832−e−iπ/812eiπ/812eiπ/832)R_Z(\phi)R_Y(\theta)=\begin{pmatrix}e^{-i\phi/2}&0\\0&e^{i\phi/2}\end{pmatrix}\begin{pmatrix}\cos\frac\theta2&-\sin\frac\theta2\\\sin\frac\theta2&\cos\frac\theta2\end{pmatrix}=\begin{pmatrix}e^{-i\phi/2}\cos\frac\theta2&-e^{-i\phi/2}\sin\frac\theta2\\e^{i\phi/2}\sin\frac\theta2&e^{i\phi/2}\cos\frac\theta2\end{pmatrix}\overset{\theta=\pi/3,\ \phi=\pi/4}{=}\begin{pmatrix}e^{-i\pi/8}\frac{\sqrt3}2&-e^{-i\pi/8}\frac12\\e^{i\pi/8}\frac12&e^{i\pi/8}\frac{\sqrt3}2\end{pmatrix}
R_Z(π/4) R_Y(π/3)2×2

Unitary verified: U†U=IU^\dagger U = I (max deviation 1.1e-16)

Derivation

The metric of R_Z(φ)R_Y(θ)|0⟩ from the definition

  1. Step 1:
    ∣ψ⟩=(e−iϕ/2ceiϕ/2s),c=cos⁡θ2, s=sin⁡θ2\lvert\psi\rangle=\begin{pmatrix}e^{-i\phi/2}c\\e^{i\phi/2}s\end{pmatrix},\qquad c=\cos\tfrac\theta2,\ s=\sin\tfrac\theta2
    The first column of the matrix RZ(ϕ)RY(θ)R_Z(\phi)R_Y(\theta) above.
  2. Step 2:
    ∣∂θψ⟩=12(−e−iϕ/2seiϕ/2c),∣∂ϕψ⟩=i2(−e−iϕ/2ceiϕ/2s)\lvert\partial_\theta\psi\rangle=\frac12\begin{pmatrix}-e^{-i\phi/2}s\\e^{i\phi/2}c\end{pmatrix},\qquad\lvert\partial_\phi\psi\rangle=\frac i2\begin{pmatrix}-e^{-i\phi/2}c\\e^{i\phi/2}s\end{pmatrix}
    ∂θc=−12s\partial_\theta c=-\tfrac12s, ∂θs=12c\partial_\theta s=\tfrac12c and ∂ϕe∓iϕ/2=∓i2e∓iϕ/2\partial_\phi e^{\mp i\phi/2}=\mp\tfrac i2e^{\mp i\phi/2}.
  3. Step 3:
    ⟨∂θψ∣∂θψ⟩=14(s2+c2)=14,⟨∂ϕψ∣∂ϕψ⟩=14(c2+s2)=14\langle\partial_\theta\psi\vert\partial_\theta\psi\rangle=\tfrac14(s^2+c^2)=\tfrac14,\qquad\langle\partial_\phi\psi\vert\partial_\phi\psi\rangle=\tfrac14(c^2+s^2)=\tfrac14
    The phases have modulus one, and c2+s2=1c^2+s^2=1.
  4. Step 4:
    ⟨∂θψ∣∂ϕψ⟩=12(−eiϕ/2s)i2(−e−iϕ/2c)+12e−iϕ/2c i2eiϕ/2s=i2 sc=i4sin⁡θ\langle\partial_\theta\psi\vert\partial_\phi\psi\rangle=\tfrac12(-e^{i\phi/2}s)\tfrac i2(-e^{-i\phi/2}c)+\tfrac12e^{-i\phi/2}c\,\tfrac i2e^{i\phi/2}s=\tfrac i2\,sc=\tfrac i4\sin\theta
    Conjugate the components of the bra; 2sc=sin⁡θ2sc=\sin\theta. The result is purely imaginary.
  5. Step 5:
    ⟨ψ∣∂θψ⟩=12(−cs+sc)=0,⟨ψ∣∂ϕψ⟩=i2(−c2+s2)=−i2cos⁡θ\langle\psi\vert\partial_\theta\psi\rangle=\tfrac12\big(-cs+sc\big)=0,\qquad\langle\psi\vert\partial_\phi\psi\rangle=\tfrac i2\big(-c^2+s^2\big)=-\tfrac i2\cos\theta
    Inner products with the state itself; c2−s2=cos⁡θc^2-s^2=\cos\theta.
  6. Step 6:
    G=(14−0i4sin⁡θ−0−i4sin⁡θ−014−∣−i2cos⁡θ∣2)=(14i4sin⁡θ−i4sin⁡θ14sin⁡2θ)G=\begin{pmatrix}\frac14-0&\frac i4\sin\theta-0\\-\frac i4\sin\theta-0&\frac14-\big\lvert-\frac i2\cos\theta\big\rvert^2\end{pmatrix}=\begin{pmatrix}\frac14&\frac i4\sin\theta\\-\frac i4\sin\theta&\frac14\sin^2\theta\end{pmatrix}
    Insert into Gij=⟨∂iψ∣∂jψ⟩−⟨ψ∣∂iψ⟩‾⟨ψ∣∂jψ⟩G_{ij}=\langle\partial_i\psi\vert\partial_j\psi\rangle-\overline{\langle\psi\vert\partial_i\psi\rangle}\langle\psi\vert\partial_j\psi\rangle; the projector term vanishes except in the ϕϕ\phi\phi entry, where it subtracts 14cos⁡2θ\tfrac14\cos^2\theta.
  7. Step 7:
    g=Re G=(140014sin⁡2θ),ds2=14(dθ2+sin⁡2θ dϕ2)g=\mathrm{Re}\,G=\begin{pmatrix}\frac14&0\\0&\frac14\sin^2\theta\end{pmatrix},\qquad\mathrm ds^2=\tfrac14\big(\mathrm d\theta^2+\sin^2\theta\,\mathrm d\phi^2\big)
    The off-diagonal entries of GG are imaginary, so the metric is diagonal and independent of ϕ\phi. At θ=π/3\theta=\pi/3: g=diag(14,316)g=\mathrm{diag}\big(\tfrac14,\tfrac3{16}\big).

Result

g(θ,ϕ)=diag(14, 14sin⁡2θ)\boxed{g(\theta,\phi)=\mathrm{diag}\big(\tfrac14,\ \tfrac14\sin^2\theta\big)}
Proposition

The Fubini–Study geometry of a qubit is the Bloch sphere of radius ½

For pure qubit states with Bloch vectors r⃗,r⃗ ′∈S2\vec r,\vec r\,'\in S^2, 1−F=14∥r⃗−r⃗ ′∥2,dFS=12∠(r⃗,r⃗ ′).1-F=\tfrac14\lVert\vec r-\vec r\,'\rVert^2,\qquad d_{FS}=\tfrac12\angle(\vec r,\vec r\,'). Consequently ds2=14∥dr⃗∥2=14(dθ2+sin⁡2θ dϕ2)\mathrm ds^2=\tfrac14\lVert\mathrm d\vec r\rVert^2=\tfrac14\big(\mathrm d\theta^2+\sin^2\theta\,\mathrm d\phi^2\big) is the round metric of a sphere of radius 12\tfrac12, and Fubini–Study distances are arc lengths on that sphere.

Proof (5 steps)
  1. Step 1:
    ρ=12(I+r⃗⋅σ⃗),ρ′=12(I+r⃗ ′⋅σ⃗) ⇒ F=Tr(ρρ′)=14(Tr I+∑a,brarb′ Tr(σaσb))=12(1+r⃗⋅r⃗ ′)\rho=\tfrac12(I+\vec r\cdot\vec\sigma),\quad\rho'=\tfrac12(I+\vec r\,'\cdot\vec\sigma)\ \Rightarrow\ F=\mathrm{Tr}(\rho\rho')=\tfrac14\Big(\mathrm{Tr}\,I+\sum_{a,b}r_ar'_b\,\mathrm{Tr}(\sigma_a\sigma_b)\Big)=\tfrac12\big(1+\vec r\cdot\vec r\,'\big)
    For pure states ∣⟨ψ∣ψ′⟩∣2=Tr(ρρ′)\lvert\langle\psi\vert\psi'\rangle\rvert^2=\mathrm{Tr}(\rho\rho'); the Pauli matrices are traceless with Tr(σaσb)=2δab\mathrm{Tr}(\sigma_a\sigma_b)=2\delta_{ab}.
  2. Step 2:
    ∥r⃗−r⃗ ′∥2=2−2 r⃗⋅r⃗ ′ ⇒ 1−F=12(1−r⃗⋅r⃗ ′)=14∥r⃗−r⃗ ′∥2\lVert\vec r-\vec r\,'\rVert^2=2-2\,\vec r\cdot\vec r\,'\ \Rightarrow\ 1-F=\tfrac12\big(1-\vec r\cdot\vec r\,'\big)=\tfrac14\lVert\vec r-\vec r\,'\rVert^2
    Pure states have unit Bloch vectors.
  3. Step 3:
    r⃗⋅r⃗ ′=cos⁡γ ⇒ F=12(1+cos⁡γ)=cos⁡2γ2 ⇒ dFS=arccos⁡F=γ2\vec r\cdot\vec r\,'=\cos\gamma\ \Rightarrow\ F=\tfrac12(1+\cos\gamma)=\cos^2\tfrac\gamma2\ \Rightarrow\ d_{FS}=\arccos\sqrt F=\tfrac\gamma2
    γ∈[0,π]\gamma\in[0,\pi] is the angle between the Bloch vectors; cos⁡γ2≥0\cos\frac\gamma2\ge0. Orthogonal states (antipodal points, γ=π\gamma=\pi) are at the maximal distance π2\frac\pi2.
  4. Step 4:
    r⃗=(sin⁡θcos⁡ϕ, sin⁡θsin⁡ϕ, cos⁡θ) ⇒ ∥dr⃗∥2=dθ2+sin⁡2θ dϕ2\vec r=(\sin\theta\cos\phi,\ \sin\theta\sin\phi,\ \cos\theta)\ \Rightarrow\ \lVert\mathrm d\vec r\rVert^2=\mathrm d\theta^2+\sin^2\theta\,\mathrm d\phi^2
    ∂θr⃗=(cos⁡θcos⁡ϕ,cos⁡θsin⁡ϕ,−sin⁡θ)\partial_\theta\vec r=(\cos\theta\cos\phi,\cos\theta\sin\phi,-\sin\theta) and ∂ϕr⃗=(−sin⁡θsin⁡ϕ,sin⁡θcos⁡ϕ,0)\partial_\phi\vec r=(-\sin\theta\sin\phi,\sin\theta\cos\phi,0) are orthogonal with squared lengths 11 and sin⁡2θ\sin^2\theta.
  5. Step 5:
    ds2=1−F(r⃗,r⃗+dr⃗)+O(∣dθ∣3)=14(dθ2+sin⁡2θ dϕ2)+O(∣dθ∣3)\mathrm ds^2=1-F\big(\vec r,\vec r+\mathrm d\vec r\big)+O(\lvert\mathrm d\theta\rvert^3)=\tfrac14\big(\mathrm d\theta^2+\sin^2\theta\,\mathrm d\phi^2\big)+O(\lvert\mathrm d\theta\rvert^3)
    Combine the exact identity 1−F=14∥Δr⃗∥21-F=\tfrac14\lVert\Delta\vec r\rVert^2 with Δr⃗=dr⃗+O(∣dθ∣2)\Delta\vec r=\mathrm d\vec r+O(\lvert\mathrm d\theta\rvert^2); this agrees with the direct derivation of gg, as the proposition on the Fubini–Study metric requires.

∎

Quick check

For the model ∣ψ⟩=RZ(ϕ)RY(θ)∣0⟩\lvert\psi\rangle=R_Z(\phi)R_Y(\theta)\lvert0\rangle, what is the metric entry gϕϕg_{\phi\phi} at θ=π/6\theta=\pi/6?

tolerance ±0.0001

The layerwise block-diagonal approximation#

For a general circuit with PP parameters the metric has P(P+1)/2P(P+1)/2 independent entries, each an overlap of two derivative states. A simulator computes them exactly from the statevector, which is what the platform's engine does. On hardware, overlaps such as ⟨∂iψ∣∂jψ⟩\langle\partial_i\psi\vert\partial_j\psi\rangle require interference circuits (Hadamard tests with controlled generators) for every pair (i,j)(i,j). Stokes, Izaac, Killoran and Carleo observed that a large and cheap part of the metric needs no interference at all: when the parameters of a circuit are arranged in layers of commuting gates, every in-layer block is a covariance matrix of the generators in a state that the circuit prepares anyway.

Definition

Layered parameterised circuit

A layered circuit prepares ∣ψ(θ)⟩=VL UL(θ(L))⋯V2 U2(θ(2)) V1 U1(θ(1))∣ψ0⟩,Uℓ(θ(ℓ))=∏i∈Sℓe−iθiKi,\lvert\psi(\theta)\rangle=V_L\,U_L(\theta^{(L)})\cdots V_2\,U_2(\theta^{(2)})\,V_1\,U_1(\theta^{(1)})\lvert\psi_0\rangle,\qquad U_\ell(\theta^{(\ell)})=\prod_{i\in S_\ell}e^{-i\theta_iK_i}, where the parameters are partitioned into layers S1,…,SLS_1,\dots,S_L, the VℓV_\ell are fixed unitaries, and the Hermitian generators of one layer commute pairwise, [Ki,Kj]=0[K_i,K_j]=0 for i,j∈Sℓi,j\in S_\ell; the standard case is a layer of Pauli rotations RP(θi)=e−iθiP/2R_{P}(\theta_i)=e^{-i\theta_iP/2} on distinct qubits, with Ki=P/2K_i=P/2 acting on qubit qiq_i. The state immediately before layer ℓ\ell is ∣ψℓ−1⟩=Vℓ−1Uℓ−1⋯V1U1∣ψ0⟩\lvert\psi_{\ell-1}\rangle=V_{\ell-1}U_{\ell-1}\cdots V_1U_1\lvert\psi_0\rangle, which depends only on the parameters of the earlier layers, and expectation values in it are written ⟨A⟩ℓ−1=⟨ψℓ−1∣A∣ψℓ−1⟩\langle A\rangle_{\ell-1}=\langle\psi_{\ell-1}\vert A\vert\psi_{\ell-1}\rangle.

Theorem

In-layer blocks of the metric are generator covariances

For a layered circuit and i,ji,j in the same layer SℓS_\ell, gij=Gij=⟨KiKj⟩ℓ−1−⟨Ki⟩ℓ−1⟨Kj⟩ℓ−1,gii=Varψℓ−1(Ki).g_{ij}=G_{ij}=\langle K_iK_j\rangle_{\ell-1}-\langle K_i\rangle_{\ell-1}\langle K_j\rangle_{\ell-1},\qquad g_{ii}=\mathrm{Var}_{\psi_{\ell-1}}(K_i). Entries gijg_{ij} with i∈Sℓi\in S_\ell, j∈Smj\in S_m, ℓ≠m\ell\ne m, depend on the gates between the two layers and are in general nonzero. The block-diagonal approximation replaces gg by gbd=g(1)⊕⋯⊕g(L)g^{\text{bd}}=g^{(1)}\oplus\cdots\oplus g^{(L)}, dropping all cross-layer blocks; the diagonal approximation keeps only giig_{ii}.

Proof (8 steps)
  1. Step 1:
    ∣ψ⟩=Wℓ Uℓ ∣ψℓ−1⟩,Wℓ=VL UL⋯Uℓ+1Vℓ\lvert\psi\rangle=W_\ell\,U_\ell\,\lvert\psi_{\ell-1}\rangle,\qquad W_\ell=V_L\,U_L\cdots U_{\ell+1}V_\ell
    Split the circuit at layer ℓ\ell. Neither the unitary WℓW_\ell (the gates after the layer) nor ∣ψℓ−1⟩\lvert\psi_{\ell-1}\rangle (the gates before it) depends on a parameter θi\theta_i with i∈Sℓi\in S_\ell.
  2. Step 2:
    Uℓ=∏k∈Sℓe−iθkKk=exp⁡(−i∑k∈SℓθkKk),∂Uℓ∂θi=−iKiUℓ=−iUℓKiU_\ell=\prod_{k\in S_\ell}e^{-i\theta_kK_k}=\exp\Big(-i\sum_{k\in S_\ell}\theta_kK_k\Big),\qquad\frac{\partial U_\ell}{\partial\theta_i}=-iK_iU_\ell=-iU_\ell K_i
    Commuting generators: eAeB=eA+Be^Ae^B=e^{A+B} for [A,B]=0[A,B]=0. Differentiating the factor e−iθiKie^{-i\theta_iK_i} gives −iKie−iθiKi-iK_ie^{-i\theta_iK_i}, and KiK_i commutes with every other factor, so it can be placed on either side of UℓU_\ell.
  3. Step 3:
    ∣∂iψ⟩=−i WℓUℓKi∣ψℓ−1⟩(i∈Sℓ)\lvert\partial_i\psi\rangle=-i\,W_\ell U_\ell K_i\lvert\psi_{\ell-1}\rangle\qquad(i\in S_\ell)
    Product rule: only UℓU_\ell depends on θi\theta_i.
  4. Step 4:
    ⟨∂iψ∣∂jψ⟩=⟨ψℓ−1∣KiUℓ†Wℓ†WℓUℓKj∣ψℓ−1⟩=⟨ψℓ−1∣KiKj∣ψℓ−1⟩\langle\partial_i\psi\vert\partial_j\psi\rangle=\langle\psi_{\ell-1}\vert K_iU_\ell^\dagger W_\ell^\dagger W_\ell U_\ell K_j\vert\psi_{\ell-1}\rangle=\langle\psi_{\ell-1}\vert K_iK_j\vert\psi_{\ell-1}\rangle
    The bra of −iWℓUℓKi∣ψℓ−1⟩-iW_\ell U_\ell K_i\lvert\psi_{\ell-1}\rangle is i⟨ψℓ−1∣KiUℓ†Wℓ†i\langle\psi_{\ell-1}\rvert K_iU_\ell^\dagger W_\ell^\dagger (KiK_i Hermitian), and (i)(−i)=1(i)(-i)=1. Unitary invariance: Wℓ†Wℓ=IW_\ell^\dagger W_\ell=I and Uℓ†Uℓ=IU_\ell^\dagger U_\ell=I, so all gates after the layer drop out.
  5. Step 5:
    ⟨ψ∣∂jψ⟩=−i ⟨ψℓ−1∣Uℓ†Wℓ†WℓUℓKj∣ψℓ−1⟩=−i ⟨Kj⟩ℓ−1,⟨∂iψ∣ψ⟩=i ⟨Ki⟩ℓ−1\langle\psi\vert\partial_j\psi\rangle=-i\,\langle\psi_{\ell-1}\vert U_\ell^\dagger W_\ell^\dagger W_\ell U_\ell K_j\vert\psi_{\ell-1}\rangle=-i\,\langle K_j\rangle_{\ell-1},\qquad\langle\partial_i\psi\vert\psi\rangle=i\,\langle K_i\rangle_{\ell-1}
    The same cancellation with one derivative replaced by the state; the second identity is the complex conjugate of the first with j→ij\to i (expectation values of Hermitian operators are real).
  6. Step 6:
    Gij=⟨KiKj⟩ℓ−1−(i⟨Ki⟩ℓ−1)(−i⟨Kj⟩ℓ−1)=⟨KiKj⟩ℓ−1−⟨Ki⟩ℓ−1⟨Kj⟩ℓ−1G_{ij}=\langle K_iK_j\rangle_{\ell-1}-\big(i\langle K_i\rangle_{\ell-1}\big)\big(-i\langle K_j\rangle_{\ell-1}\big)=\langle K_iK_j\rangle_{\ell-1}-\langle K_i\rangle_{\ell-1}\langle K_j\rangle_{\ell-1}
    Definition of the quantum geometric tensor.
  7. Step 7:
    (KiKj)†=KjKi=KiKj ⇒ ⟨KiKj⟩ℓ−1∈R ⇒ gij=Re Gij=Gij,gii=⟨Ki2⟩−⟨Ki⟩2=Var(Ki)(K_iK_j)^\dagger=K_jK_i=K_iK_j\ \Rightarrow\ \langle K_iK_j\rangle_{\ell-1}\in\mathbb R\ \Rightarrow\ g_{ij}=\mathrm{Re}\,G_{ij}=G_{ij},\qquad g_{ii}=\langle K_i^2\rangle-\langle K_i\rangle^2=\mathrm{Var}(K_i)
    The product of two commuting Hermitian operators is Hermitian, so the in-layer block of GG is already real.
  8. Step 8:
    i∈Sℓ, j∈Sm, ℓ<m:Gij=⟨φ∣Ki M†KjM∣φ⟩−⟨φ∣Ki∣φ⟩⟨φ∣M†KjM∣φ⟩,∣φ⟩=Uℓ∣ψℓ−1⟩,M=Vm−1Um−1⋯Uℓ+1Vℓi\in S_\ell,\ j\in S_m,\ \ell<m:\quad G_{ij}=\langle\varphi\vert K_i\,M^\dagger K_jM\vert\varphi\rangle-\langle\varphi\vert K_i\vert\varphi\rangle\langle\varphi\vert M^\dagger K_jM\vert\varphi\rangle,\qquad\lvert\varphi\rangle=U_\ell\lvert\psi_{\ell-1}\rangle,\quad M=V_{m-1}U_{m-1}\cdots U_{\ell+1}V_\ell
    The same computation with ∣∂jψ⟩=−iWmUmKjM∣φ⟩\lvert\partial_j\psi\rangle=-iW_mU_mK_jM\lvert\varphi\rangle and Wℓ=WmUmMW_\ell=W_mU_mM: the gates after layer mm cancel, but the gates MM between the layers do not. The entry is a covariance of KiK_i with the generator M†KjMM^\dagger K_jM transported back through MM, which in general does not commute with KiK_i; it depends on the intermediate gates and is complex. The approximation sets these blocks to zero: it is exact when they vanish (as for the qubit model below) and an approximation otherwise.

∎

Derivation

The qubit metric from the layerwise formula

  1. Step 1:
    S1={θ}, Kθ=Y2, ∣ψ0⟩=∣0⟩;S2={ϕ}, Kϕ=Z2, ∣ψ1⟩=RY(θ)∣0⟩S_1=\{\theta\},\ K_\theta=\tfrac Y2,\ \lvert\psi_0\rangle=\lvert0\rangle;\qquad S_2=\{\phi\},\ K_\phi=\tfrac Z2,\ \lvert\psi_1\rangle=R_Y(\theta)\lvert0\rangle
    The circuit RY(θ)R_Y(\theta) then RZ(ϕ)R_Z(\phi) consists of two one-gate layers with V1=V2=IV_1=V_2=I; RP(t)=e−itP/2R_P(t)=e^{-itP/2} has generator P/2P/2.
  2. Step 2:
    gθθ=Var∣0⟩(Y2)=14(⟨0∣Y2∣0⟩−⟨0∣Y∣0⟩2)=14(1−0)=14g_{\theta\theta}=\mathrm{Var}_{\lvert0\rangle}\big(\tfrac Y2\big)=\tfrac14\Big(\langle0\vert Y^2\vert0\rangle-\langle0\vert Y\vert0\rangle^2\Big)=\tfrac14(1-0)=\tfrac14
    Y2=IY^2=I and ⟨0∣Y∣0⟩=0\langle0\vert Y\vert0\rangle=0.
  3. Step 3:
    ⟨Z⟩1=cos⁡2θ2−sin⁡2θ2=cos⁡θ ⇒ gϕϕ=Var∣ψ1⟩(Z2)=14(1−cos⁡2θ)=14sin⁡2θ\langle Z\rangle_1=\cos^2\tfrac\theta2-\sin^2\tfrac\theta2=\cos\theta\ \Rightarrow\ g_{\phi\phi}=\mathrm{Var}_{\lvert\psi_1\rangle}\big(\tfrac Z2\big)=\tfrac14\big(1-\cos^2\theta\big)=\tfrac14\sin^2\theta
    RY(θ)∣0⟩=cos⁡θ2∣0⟩+sin⁡θ2∣1⟩R_Y(\theta)\lvert0\rangle=\cos\frac\theta2\lvert0\rangle+\sin\frac\theta2\lvert1\rangle and Z2=IZ^2=I. The state before the RZR_Z gate matters: on ∣0⟩\lvert0\rangle the variance of Z/2Z/2 would be 00.
  4. Step 4:
    gbd=(140014sin⁡2θ)=gg^{\text{bd}}=\begin{pmatrix}\frac14&0\\0&\frac14\sin^2\theta\end{pmatrix}=g
    The block-diagonal approximation drops the cross-layer entry gθϕg_{\theta\phi}; the direct derivation showed that its exact value is Re(i4sin⁡θ)=0\mathrm{Re}\big(\tfrac i4\sin\theta\big)=0. For this model the approximation is exact: block-diagonal == full metric.

Result

gθθ=Var∣0⟩(Y2)=14,gϕϕ=VarRY(θ)∣0⟩(Z2)=14sin⁡2θ\boxed{g_{\theta\theta}=\mathrm{Var}_{\lvert0\rangle}\big(\tfrac Y2\big)=\tfrac14,\qquad g_{\phi\phi}=\mathrm{Var}_{R_Y(\theta)\lvert0\rangle}\big(\tfrac Z2\big)=\tfrac14\sin^2\theta}

Quick check

Two qubits are prepared in the Bell state 12(∣00⟩+∣11⟩)\tfrac1{\sqrt2}\big(\lvert00\rangle+\lvert11\rangle\big) (a Hadamard on qubit 0, then a CNOT), followed by one layer RZ(a)⊗RZ(b)R_Z(a)\otimes R_Z(b). What is the in-layer metric entry gabg_{ab}?

tolerance ±0.0001

The natural gradient as steepest descent#

With the metric in hand, a step δ\delta in parameter space has a physical length: by the proposition on the Fubini–Study metric, the state moves by the distance δ⊤g δ\sqrt{\delta^\top g\,\delta} to leading order. The natural gradient asks for the step that lowers the linearised loss the most among all steps that move the state by a fixed distance. This idea goes back to Amari's natural gradient for statistical models, where the metric is the classical Fisher information; Stokes et al. transferred it to parameterised quantum circuits with the Fubini–Study metric.

Theorem

Steepest descent under a metric constraint

Let g∈RP×Pg\in\mathbb R^{P\times P} be symmetric positive definite, ∇L∈RP∖{0}\nabla L\in\mathbb R^P\setminus\{0\} and ϵ>0\epsilon>0. The problem min⁡δ∈RP ∇L⊤δsubject toδ⊤g δ=ϵ2\min_{\delta\in\mathbb R^P}\ \nabla L^\top\delta\qquad\text{subject to}\qquad\delta^\top g\,\delta=\epsilon^2 has the unique solution δ∗=−ϵ∇L⊤g−1∇L  g−1∇L,\delta^\ast=-\frac{\epsilon}{\sqrt{\nabla L^\top g^{-1}\nabla L}}\;g^{-1}\nabla L, with minimal value −ϵ∇L⊤g−1∇L-\epsilon\sqrt{\nabla L^\top g^{-1}\nabla L}. For g=Ig=I it is the direction of vanilla gradient descent.

Proof (6 steps)
  1. Step 1:
    L(δ,μ)=∇L⊤δ+μ2(δ⊤g δ−ϵ2)\mathcal L(\delta,\mu)=\nabla L^\top\delta+\frac\mu2\big(\delta^\top g\,\delta-\epsilon^2\big)
    Lagrangian of the equality-constrained problem with multiplier μ∈R\mu\in\mathbb R; the factor 12\frac12 is a convenient normalisation. The constraint set is a compact ellipsoid and the objective is continuous, so a minimiser exists and satisfies the Lagrange conditions (the constraint gradient 2gδ2g\delta is nonzero on the ellipsoid).
  2. Step 2:
    ∇δL=∇L+μ g δ=0 ⇒ δ=−1μ g−1∇L(μ≠0)\nabla_\delta\mathcal L=\nabla L+\mu\,g\,\delta=0\ \Rightarrow\ \delta=-\frac1\mu\,g^{-1}\nabla L\qquad(\mu\ne0)
    ∇δ(δ⊤gδ)=(g+g⊤)δ=2gδ\nabla_\delta(\delta^\top g\delta)=(g+g^\top)\delta=2g\delta for symmetric gg. μ=0\mu=0 would force ∇L=0\nabla L=0, which is excluded, and gg is invertible.
  3. Step 3:
    δ⊤g δ=1μ2∇L⊤g−1g g−1∇L=∇L⊤g−1∇Lμ2=ϵ2 ⇒ μ=±∇L⊤g−1∇Lϵ\delta^\top g\,\delta=\frac1{\mu^2}\nabla L^\top g^{-1}g\,g^{-1}\nabla L=\frac{\nabla L^\top g^{-1}\nabla L}{\mu^2}=\epsilon^2\ \Rightarrow\ \mu=\pm\frac{\sqrt{\nabla L^\top g^{-1}\nabla L}}{\epsilon}
    Insert into the constraint; g−1g^{-1} is symmetric, and ∇L⊤g−1∇L>0\nabla L^\top g^{-1}\nabla L>0 because g−1g^{-1} is positive definite.
  4. Step 4:
    ∇L⊤δ=−1μ ∇L⊤g−1∇L=∓ ϵ∇L⊤g−1∇L\nabla L^\top\delta=-\frac1\mu\,\nabla L^\top g^{-1}\nabla L=\mp\,\epsilon\sqrt{\nabla L^\top g^{-1}\nabla L}
    The two stationary points are the steepest descent (μ>0\mu>0, negative value) and the steepest ascent (μ<0\mu<0); the minimum is attained at μ>0\mu>0, which gives δ∗\delta^\ast.
  5. Step 5:
    ⟨u,v⟩g=u⊤g v:∇L⊤δ=⟨g−1∇L,δ⟩g≥−∥g−1∇L∥g ∥δ∥g=−∇L⊤g−1∇L  ϵ\langle u,v\rangle_g=u^\top g\,v:\qquad\nabla L^\top\delta=\langle g^{-1}\nabla L,\delta\rangle_g\ge-\lVert g^{-1}\nabla L\rVert_g\,\lVert\delta\rVert_g=-\sqrt{\nabla L^\top g^{-1}\nabla L}\;\epsilon
    An independent proof of global optimality and uniqueness: gg defines an inner product, and the Cauchy–Schwarz inequality holds with equality only if δ\delta is a negative multiple of g−1∇Lg^{-1}\nabla L; the constraint fixes the multiple.
  6. Step 6:
    L(θ+δ)=L(θ)+∇L⊤δ+O(∥δ∥2),dFS(ψ(θ),ψ(θ+δ))2=δ⊤g δ+O(∥δ∥3)L(\theta+\delta)=L(\theta)+\nabla L^\top\delta+O(\lVert\delta\rVert^2),\qquad d_{FS}\big(\psi(\theta),\psi(\theta+\delta)\big)^2=\delta^\top g\,\delta+O(\lVert\delta\rVert^3)
    The objective is the first-order change of the loss and the constraint fixes the first-order Fubini–Study length of the step. Absorbing ϵ/∇L⊤g−1∇L\epsilon/\sqrt{\nabla L^\top g^{-1}\nabla L} into a learning rate η>0\eta>0 gives the quantum natural gradient update θ←θ−η g−1∇L\theta\leftarrow\theta-\eta\,g^{-1}\nabla L.

∎

Proposition

Singular metrics: the gradient lies in the range of g

Let L(θ)=⟨ψ(θ)∣H∣ψ(θ)⟩L(\theta)=\langle\psi(\theta)\vert H\vert\psi(\theta)\rangle for a Hermitian HH and let v∈ker⁡gv\in\ker g. Then v⊤∇L=0v^\top\nabla L=0. Hence ∇L∈range(g)\nabla L\in\mathrm{range}(g), the Moore–Penrose pseudo-inverse g+g^{+} satisfies g g+∇L=∇Lg\,g^{+}\nabla L=\nabla L, and δ=−η g+∇L\delta=-\eta\,g^{+}\nabla L is the solution of minimal Euclidean norm of g δ=−η ∇Lg\,\delta=-\eta\,\nabla L.

Proof (6 steps)
  1. Step 1:
    g v=0 ⇒ v⊤g v=∥P⊥∣∂vψ⟩∥2=0 ⇒ ∣∂vψ⟩=c ∣ψ⟩,c=⟨ψ∣∂vψ⟩g\,v=0\ \Rightarrow\ v^\top g\,v=\big\lVert P_\perp\lvert\partial_v\psi\rangle\big\rVert^2=0\ \Rightarrow\ \lvert\partial_v\psi\rangle=c\,\lvert\psi\rangle,\quad c=\langle\psi\vert\partial_v\psi\rangle
    ∣∂vψ⟩=∑ivi∣∂iψ⟩\lvert\partial_v\psi\rangle=\sum_iv_i\lvert\partial_i\psi\rangle is the directional derivative; the last step of the proposition on the Fubini–Study metric shows v⊤gv=∥P⊥∂vψ∥2v^\top gv=\lVert P_\perp\partial_v\psi\rVert^2, and a vector with no component orthogonal to ∣ψ⟩\lvert\psi\rangle is a multiple of it.
  2. Step 2:
    0=∂v⟨ψ∣ψ⟩=⟨∂vψ∣ψ⟩+⟨ψ∣∂vψ⟩=2 Re c ⇒ c=iβ, β∈R0=\partial_v\langle\psi\vert\psi\rangle=\langle\partial_v\psi\vert\psi\rangle+\langle\psi\vert\partial_v\psi\rangle=2\,\mathrm{Re}\,c\ \Rightarrow\ c=i\beta,\ \beta\in\mathbb R
    The state is normalised for every θ\theta.
  3. Step 3:
    v⊤∇L=∂vL=⟨∂vψ∣H∣ψ⟩+⟨ψ∣H∣∂vψ⟩=2 Re(c ⟨ψ∣H∣ψ⟩)=2 Re(iβ⟨H⟩)=0v^\top\nabla L=\partial_vL=\langle\partial_v\psi\vert H\vert\psi\rangle+\langle\psi\vert H\vert\partial_v\psi\rangle=2\,\mathrm{Re}\big(c\,\langle\psi\vert H\vert\psi\rangle\big)=2\,\mathrm{Re}\big(i\beta\langle H\rangle\big)=0
    ⟨H⟩\langle H\rangle is real, so iβ⟨H⟩i\beta\langle H\rangle is purely imaginary. Moving along vv only changes the global phase, which no expectation value detects.
  4. Step 4:
    g=∑kμkukuk⊤,g+=∑k: μk>0μk−1ukuk⊤,g g+=∑k: μk>0ukuk⊤=Πrange(g)g=\sum_k\mu_ku_ku_k^\top,\quad g^{+}=\sum_{k:\,\mu_k>0}\mu_k^{-1}u_ku_k^\top,\quad g\,g^{+}=\sum_{k:\,\mu_k>0}u_ku_k^\top=\Pi_{\mathrm{range}(g)}
    Spectral theorem for the real symmetric positive semidefinite gg with orthonormal eigenvectors uku_k; gg+gg^{+} is the orthogonal projector onto range(g)=(ker⁡g)⊥\mathrm{range}(g)=(\ker g)^\perp.
  5. Step 5:
    ∇L⊥ker⁡g ⇒ ∇L∈range(g) ⇒ g(−η g+∇L)=−η ∇L\nabla L\perp\ker g\ \Rightarrow\ \nabla L\in\mathrm{range}(g)\ \Rightarrow\ g\big(-\eta\,g^{+}\nabla L\big)=-\eta\,\nabla L
    The first three steps show ∇L⊥ker⁡g\nabla L\perp\ker g; for symmetric gg, (ker⁡g)⊥=range(g)(\ker g)^\perp=\mathrm{range}(g). Every solution of gδ=−η∇Lg\delta=-\eta\nabla L is −ηg+∇L+w-\eta g^{+}\nabla L+w with w∈ker⁡gw\in\ker g, and −ηg+∇L∈range(g)⊥w-\eta g^{+}\nabla L\in\mathrm{range}(g)\perp w has the smallest norm.
  6. Step 6:
    θ=0:g=diag(14,0),∇L=(∂θL,0),g+∇L=(4 ∂θL, 0)\theta=0:\quad g=\mathrm{diag}\big(\tfrac14,0\big),\quad\nabla L=(\partial_\theta L,0),\quad g^{+}\nabla L=\big(4\,\partial_\theta L,\ 0\big)
    At the north pole of the qubit model ϕ\phi is a pure phase direction, so ∂ϕL=0\partial_\phi L=0 for every observable, and the pseudo-inverse leaves ϕ\phi unchanged.

∎

Derivation

Tikhonov regularisation and the proximal form of the update

  1. Step 1:
    δλ=arg⁡min⁡δ[∇L⊤δ+12η δ⊤(g+λI) δ],λ>0\delta_\lambda=\arg\min_\delta\Big[\nabla L^\top\delta+\frac1{2\eta}\,\delta^\top(g+\lambda I)\,\delta\Big],\qquad\lambda>0
    Replace the hard constraint by a quadratic penalty on the step length in the regularised metric g+λIg+\lambda I, which is positive definite even when gg is singular.
  2. Step 2:
    ∇L+1η(g+λI) δλ=0 ⇒ δλ=−η (g+λI)−1∇L\nabla L+\frac1\eta(g+\lambda I)\,\delta_\lambda=0\ \Rightarrow\ \delta_\lambda=-\eta\,(g+\lambda I)^{-1}\nabla L
    The objective is strictly convex (positive definite Hessian 1η(g+λI)\frac1\eta(g+\lambda I)), so the unique minimiser is its stationary point.
  3. Step 3:
    (g+λI)−1=∑k1μk+λ ukuk⊤ → λ→0+  g+ on range(g)(g+\lambda I)^{-1}=\sum_k\frac{1}{\mu_k+\lambda}\,u_ku_k^\top\ \xrightarrow{\ \lambda\to0^+\ }\ g^{+}\ \text{on }\mathrm{range}(g)
    Eigen-decomposition of gg. Directions with tiny eigenvalues μk≪λ\mu_k\ll\lambda are damped to 1/λ1/\lambda instead of being amplified by 1/μk1/\mu_k, which keeps the step finite near singular points; since ∇L∈range(g)\nabla L\in\mathrm{range}(g), the limit is the pseudo-inverse step.
  4. Step 4:
    λ→∞:δλ=−ηλ ∇L+O(λ−2)\lambda\to\infty:\quad\delta_\lambda=-\frac\eta\lambda\,\nabla L+O(\lambda^{-2})
    A large regulariser turns the natural gradient back into vanilla gradient descent with learning rate η/λ\eta/\lambda. The platform's engine uses λ=ε=10−8\lambda=\varepsilon=10^{-8} (a numerical safeguard for a Cholesky solve) and the QNGvsGD widget uses λ=0.01\lambda=0.01 by default.

Result

θ←θ−η (g(θ)+λI)−1∇L(θ)\boxed{\theta\leftarrow\theta-\eta\,\big(g(\theta)+\lambda I\big)^{-1}\nabla L(\theta)}
Proposition

The natural gradient is invariant under reparametrisation

Let θ=Φ(ξ)\theta=\Phi(\xi) with a differentiable map Φ\Phi whose Jacobian J=∂θ/∂ξJ=\partial\theta/\partial\xi is invertible, and let g(θ)g^{(\theta)}, g(ξ)g^{(\xi)} be the metrics in the two coordinates. Then ∇ξL=J⊤∇θL\nabla_\xi L=J^\top\nabla_\theta L, g(ξ)=J⊤g(θ)Jg^{(\xi)}=J^\top g^{(\theta)}J, and the natural-gradient step in ξ\xi induces the parameter change Φ(ξ+δξ)−Φ(ξ)=−η (g(θ))−1∇θL+O(η2),\Phi(\xi+\delta\xi)-\Phi(\xi)=-\eta\,\big(g^{(\theta)}\big)^{-1}\nabla_\theta L+O(\eta^2), the natural-gradient step in θ\theta. The vanilla step in ξ\xi induces −η JJ⊤∇θL+O(η2)-\eta\,JJ^\top\nabla_\theta L+O(\eta^2), which differs from the vanilla step in θ\theta unless JJ⊤=IJJ^\top=I.

Proof (5 steps)
  1. Step 1:
    ∂L∂ξa=∑i∂θi∂ξa∂L∂θi=∑iJia∂L∂θi ⇒ ∇ξL=J⊤∇θL\frac{\partial L}{\partial\xi_a}=\sum_i\frac{\partial\theta_i}{\partial\xi_a}\frac{\partial L}{\partial\theta_i}=\sum_iJ_{ia}\frac{\partial L}{\partial\theta_i}\ \Rightarrow\ \nabla_\xi L=J^\top\nabla_\theta L
    Chain rule.
  2. Step 2:
    ∣∂ξaψ⟩=∑iJia∣∂θiψ⟩ ⇒ Gab(ξ)=∑i,jJiaJjb Gij(θ) ⇒ g(ξ)=J⊤g(θ)J\lvert\partial_{\xi_a}\psi\rangle=\sum_iJ_{ia}\lvert\partial_{\theta_i}\psi\rangle\ \Rightarrow\ G^{(\xi)}_{ab}=\sum_{i,j}J_{ia}J_{jb}\,G^{(\theta)}_{ij}\ \Rightarrow\ g^{(\xi)}=J^\top g^{(\theta)}J
    Both terms of GG are linear in each tangent vector and JJ is real; take real parts. Equivalently, ds2=dθ⊤g(θ)dθ\mathrm ds^2=\mathrm d\theta^\top g^{(\theta)}\mathrm d\theta with dθ=J dξ\mathrm d\theta=J\,\mathrm d\xi is a property of the states, not of the coordinates.
  3. Step 3:
    δξ=−η (J⊤g(θ)J)−1J⊤∇θL=−η J−1(g(θ))−1J−⊤J⊤∇θL=−η J−1(g(θ))−1∇θL\delta\xi=-\eta\,\big(J^\top g^{(\theta)}J\big)^{-1}J^\top\nabla_\theta L=-\eta\,J^{-1}\big(g^{(\theta)}\big)^{-1}J^{-\top}J^\top\nabla_\theta L=-\eta\,J^{-1}\big(g^{(\theta)}\big)^{-1}\nabla_\theta L
    (ABC)−1=C−1B−1A−1(ABC)^{-1}=C^{-1}B^{-1}A^{-1} for invertible square matrices.
  4. Step 4:
    Φ(ξ+δξ)−Φ(ξ)=J δξ+O(∥δξ∥2)=−η (g(θ))−1∇θL+O(η2)\Phi(\xi+\delta\xi)-\Phi(\xi)=J\,\delta\xi+O(\lVert\delta\xi\rVert^2)=-\eta\,\big(g^{(\theta)}\big)^{-1}\nabla_\theta L+O(\eta^2)
    First-order Taylor expansion of Φ\Phi; δξ=O(η)\delta\xi=O(\eta). For an affine Φ\Phi the remainder vanishes and the two steps agree exactly.
  5. Step 5:
    δξGD=−η ∇ξL=−η J⊤∇θL ⇒ Φ(ξ+δξGD)−Φ(ξ)=−η JJ⊤∇θL+O(η2)\delta\xi_{\text{GD}}=-\eta\,\nabla_\xi L=-\eta\,J^\top\nabla_\theta L\ \Rightarrow\ \Phi(\xi+\delta\xi_{\text{GD}})-\Phi(\xi)=-\eta\,JJ^\top\nabla_\theta L+O(\eta^2)
    The vanilla step depends on the coordinates through JJ⊤JJ^\top.

∎

Derivation

Example: rescaling the rotation angle, θ = 3ξ

  1. Step 1:
    RY(3ξ) then RZ(ϕ):J=∂θ∂ξ=3,gξξ(ξ)=9⋅14=94R_Y(3\xi)\ \text{then}\ R_Z(\phi):\quad J=\frac{\partial\theta}{\partial\xi}=3,\qquad g^{(\xi)}_{\xi\xi}=9\cdot\tfrac14=\tfrac94
    The same states, parameterised by ξ=θ/3\xi=\theta/3; the metric transforms with J2J^2.
  2. Step 2:
    L=cos⁡θ=cos⁡3ξ,θ=π6:∂θL=−12,∂ξL=−3sin⁡3ξ=−32L=\cos\theta=\cos3\xi,\quad\theta=\tfrac\pi6:\qquad\partial_\theta L=-\tfrac12,\qquad\partial_\xi L=-3\sin3\xi=-\tfrac32
    Chain rule at ξ=π/18\xi=\pi/18.
  3. Step 3:
    η=0.1:ΔθGD,θ=0.1⋅12=0.05,ΔθGD,ξ=3⋅0.1⋅32=0.45\eta=0.1:\quad\Delta\theta_{\text{GD},\theta}=0.1\cdot\tfrac12=0.05,\qquad\Delta\theta_{\text{GD},\xi}=3\cdot0.1\cdot\tfrac32=0.45
    Vanilla gradient descent: the same learning rate produces a nine times longer step after the rescaling, JJ⊤=9JJ^\top=9.
  4. Step 4:
    ΔθQNG,θ=0.1⋅1/21/4=0.2,ΔθQNG,ξ=3⋅0.1⋅3/29/4=0.2\Delta\theta_{\text{QNG},\theta}=0.1\cdot\frac{1/2}{1/4}=0.2,\qquad\Delta\theta_{\text{QNG},\xi}=3\cdot0.1\cdot\frac{3/2}{9/4}=0.2
    The natural-gradient steps coincide, as the proposition predicts; the TypeScript cell below reproduces both with the engine (an affine scale of a gate angle is a valid circuit parameter).

Result

θ=π6 → π6+0.2 (QNG in either coordinate),π6+0.05 or π6+0.45 (GD)\boxed{\theta=\tfrac\pi6\ \to\ \tfrac\pi6+0.2\ \text{(QNG in either coordinate)},\qquad\tfrac\pi6+0.05\ \text{or}\ \tfrac\pi6+0.45\ \text{(GD)}}
Derivation

Natural-gradient updates for the qubit model

  1. Step 1:
    L=⟨Z⟩=cos⁡θ:∇L=(−sin⁡θ, 0),g−1∇L=(−4sin⁡θ, 0)(0<θ<π)L=\langle Z\rangle=\cos\theta:\quad\nabla L=(-\sin\theta,\,0),\quad g^{-1}\nabla L=\big(-4\sin\theta,\,0\big)\quad(0<\theta<\pi)
    The ϕ\phi-component is 0/gϕϕ=00/g_{\phi\phi}=0; at the poles the pseudo-inverse gives the same 00.
  2. Step 2:
    QNG: θ←θ+4ηsin⁡θ,GD: θ←θ+ηsin⁡θ\text{QNG: }\theta\leftarrow\theta+4\eta\sin\theta,\qquad\text{GD: }\theta\leftarrow\theta+\eta\sin\theta
    For this loss the natural gradient is vanilla gradient descent with a four times larger learning rate, because gθθ=14g_{\theta\theta}=\frac14 is constant.
  3. Step 3:
    L=⟨X⟩=sin⁡θcos⁡ϕ:∇L=(cos⁡θcos⁡ϕ, −sin⁡θsin⁡ϕ),g−1∇L=(4cos⁡θcos⁡ϕ, −4sin⁡ϕsin⁡θ)L=\langle X\rangle=\sin\theta\cos\phi:\quad\nabla L=(\cos\theta\cos\phi,\,-\sin\theta\sin\phi),\quad g^{-1}\nabla L=\Big(4\cos\theta\cos\phi,\ -\frac{4\sin\phi}{\sin\theta}\Big)
    Divide each gradient component by the corresponding diagonal metric entry.
  4. Step 4:
    Δsϕ=12sin⁡θ ∣Δϕ∣:GD: 12ηsin⁡2θ ∣sin⁡ϕ∣,QNG: 2η ∣sin⁡ϕ∣\Delta s_\phi=\tfrac12\sin\theta\,\lvert\Delta\phi\rvert:\qquad\text{GD: }\tfrac12\eta\sin^2\theta\,\lvert\sin\phi\rvert,\qquad\text{QNG: }2\eta\,\lvert\sin\phi\rvert
    The Fubini–Study length of the azimuthal part of a step is the arc on the circle of latitude of radius 12sin⁡θ\frac12\sin\theta. Near the pole the vanilla step barely moves the state, while the natural step moves it by a distance independent of θ\theta.

Result

θt+1=θt−η (g−1∇L)θ,L=⟨Z⟩: θt+1=θt+4ηsin⁡θt\boxed{\theta_{t+1}=\theta_t-\eta\,\big(g^{-1}\nabla L\big)_\theta,\qquad L=\langle Z\rangle:\ \theta_{t+1}=\theta_t+4\eta\sin\theta_t}

The widget above minimises L=⟨Z⟩L=\langle Z\rangle from (θ0,ϕ0)=(0.4,0.3)(\theta_0,\phi_0)=(0.4,0.3) with η=0.05\eta=0.05 and the regulariser λ=0.01\lambda=0.01. Both trajectories run down a meridian towards the south pole, where ⟨Z⟩=−1\langle Z\rangle=-1; the natural gradient travels almost four times as fast in θ\theta, as the update rule θ←θ+4ηsin⁡θ\theta\leftarrow\theta+4\eta\sin\theta predicts (with the regulariser the factor is 1/(14+λ)≈3.851/(\tfrac14+\lambda)\approx3.85). The second instance starts close to the north pole at (0.3,2.5)(0.3,2.5) and minimises ⟨X⟩\langle X\rangle, whose minimum −1-1 lies on the equator at ϕ=π\phi=\pi. Vanilla gradient descent first crawls in ϕ\phi, because ∂ϕL=−sin⁡θsin⁡ϕ\partial_\phi L=-\sin\theta\sin\phi is small near the pole, while the natural gradient rescales that component by 4/sin⁡2θ4/\sin^2\theta and turns towards the minimum along a nearly geodesic path.

The TypeScript cell below uses the engine functions fubiniStudyMetric, parameterShiftGradient and qngStep. It prints the exact metric of the qubit model for three polar angles, performs one natural-gradient step and one vanilla step on ⟨Z⟩\langle Z\rangle from θ=π/6\theta=\pi/6, runs both optimisers for 4040 steps on ⟨X⟩\langle X\rangle from (0.3,2.5)(0.3,2.5), and repeats the reparametrisation example θ=3ξ\theta=3\xi. After ten steps the natural gradient has reached L≈−0.984L\approx-0.984, while vanilla gradient descent is still at L≈−0.538L\approx-0.538.

TypeScriptrunnable
import { fubiniStudyMetric, parameterShiftGradient, qngStep } from '@/lib/quantum-simulator';

// The model |psi(theta, phi)> = RZ(phi) RY(theta)|0>: RY acts first, then RZ, with R_P(t) = exp(-i t P / 2).
const model = {
  version: 1, numQubits: 1, numClbits: 0,
  parameters: [{ name: 'theta', value: 0 }, { name: 'phi', value: 0 }],
  ops: [
    { kind: 'gate', gate: 'RY', targets: [0], params: [{ param: 'theta' }] },
    { kind: 'gate', gate: 'RZ', targets: [0], params: [{ param: 'phi' }] },
  ],
};
const Z = [{ coeff: 1, ops: 'Z' }];
const X = [{ coeff: 1, ops: 'X' }];
const fmt = (v: number) => (Math.abs(v) < 5e-13 ? 0 : v).toFixed(6);

// (1) The exact Fubini-Study metric is diag(1/4, sin^2(theta)/4), whatever the value of phi.
for (const theta of [Math.PI / 6, Math.PI / 2, 2.5]) {
  const g = fubiniStudyMetric(model, { bindings: { theta, phi: 0.7 } }).metric;
  console.log('theta = ' + fmt(theta) + ': g = [[' + fmt(g[0][0]) + ', ' + fmt(g[0][1]) + '], [' + fmt(g[1][0]) + ', ' + fmt(g[1][1]) + ']]  sin^2(theta)/4 = ' + fmt(Math.sin(theta) ** 2 / 4));
}

// (2) One step on L = <Z> = cos(theta) from (pi/6, 0) with eta = 0.1: the natural step is 4 times longer in theta.
const start = { theta: Math.PI / 6, phi: 0 };
const grad = parameterShiftGradient(model, Z, { bindings: start });
const natural = qngStep(model, Z, 0.1, { bindings: start });
console.log('gradient (' + fmt(grad.gradient.theta) + ', ' + fmt(grad.gradient.phi) + ')  GD theta = ' + fmt(start.theta - 0.1 * grad.gradient.theta) + '  QNG theta = ' + fmt(natural.bindings.theta) + ', phi = ' + fmt(natural.bindings.phi));

// (3) Minimise L = <X> = sin(theta) cos(phi) from (0.3, 2.5), close to the pole where the phi-gradient is small.
const lr = 0.05;
let gd = { theta: 0.3, phi: 2.5 };
let ng = { theta: 0.3, phi: 2.5 };
for (let k = 0; k <= 40; k++) {
  const a = parameterShiftGradient(model, X, { bindings: gd });
  const b = qngStep(model, X, lr, { bindings: ng });
  if (k % 10 === 0) console.log('step ' + k + ': GD L = ' + fmt(a.value) + ' at (' + fmt(gd.theta) + ', ' + fmt(gd.phi) + ')   QNG L = ' + fmt(b.value) + ' at (' + fmt(ng.theta) + ', ' + fmt(ng.phi) + ')');
  gd = { theta: gd.theta - lr * a.gradient.theta, phi: gd.phi - lr * a.gradient.phi };
  ng = { theta: b.bindings.theta, phi: b.bindings.phi };
}

// (4) Reparametrise theta = 3 xi. Gradient descent changes, the natural-gradient step does not.
const scaled = { ...model, parameters: [{ name: 'xi', value: 0 }, { name: 'phi', value: 0 }], ops: [{ kind: 'gate', gate: 'RY', targets: [0], params: [{ param: 'xi', scale: 3 }] }, model.ops[1]] };
const at = { xi: Math.PI / 18, phi: 0 };
const gXi = parameterShiftGradient(scaled, Z, { bindings: at });
const nXi = qngStep(scaled, Z, 0.1, { bindings: at });
console.log('in xi: g_xixi = ' + fmt(nXi.metric[0][0]) + ', dL/dxi = ' + fmt(gXi.gradient.xi) + '  GD theta = ' + fmt(3 * (at.xi - 0.1 * gXi.gradient.xi)) + '  QNG theta = ' + fmt(3 * nXi.bindings.xi));

Expected output

theta = 0.523599: g = [[0.250000, 0.000000], [0.000000, 0.062500]]  sin^2(theta)/4 = 0.062500
theta = 1.570796: g = [[0.250000, 0.000000], [0.000000, 0.250000]]  sin^2(theta)/4 = 0.250000
theta = 2.500000: g = [[0.250000, 0.000000], [0.000000, 0.089542]]  sin^2(theta)/4 = 0.089542
gradient (-0.500000, 0.000000)  GD theta = 0.573599  QNG theta = 0.723599, phi = 0.000000
step 0: GD L = -0.236754 at (0.300000, 2.500000)   QNG L = -0.236754 at (0.300000, 2.500000)
step 10: GD L = -0.537879 at (0.667508, 2.623782)   QNG L = -0.984420 at (1.394575, 3.127851)
step 20: GD L = -0.774000 at (0.975289, 2.778876)   QNG L = -0.999819 at (1.551806, 3.140133)
step 30: GD L = -0.906291 at (1.198246, 2.908859)   QNG L = -0.999998 at (1.568757, 3.141436)
step 40: GD L = -0.964375 at (1.343799, 2.998404)   QNG L = -1.000000 at (1.570577, 3.141576)
in xi: g_xixi = 2.250000, dL/dxi = -1.500000  GD theta = 0.973599  QNG theta = 0.723599

Quick check

For the loss L=⟨Z⟩L=\langle Z\rangle of the qubit model at any 0<θ<π0<\theta<\pi, by what factor is the θ\theta-component of the natural-gradient step larger than that of the vanilla gradient step with the same learning rate?

tolerance ±0.000001

Fisher information and imaginary-time evolution#

The Fubini–Study metric is not an isolated construction. In quantum estimation theory it appears, up to a factor 44, as the quantum Fisher information, which bounds how precisely a parameter can be inferred from measurements on ∣ψ(θ)⟩\lvert\psi(\theta)\rangle. In statistics, Amari's natural gradient uses the classical Fisher information of a probability model as its metric. And in quantum simulation, the variational approximation to imaginary-time evolution turns out to be a continuous-time natural-gradient flow. This section derives the first and the last of these relations and states the second.

Theorem

The quantum Fisher information of a pure state is 4g

Let ρ(θ)=∣ψ(θ)⟩⟨ψ(θ)∣\rho(\theta)=\lvert\psi(\theta)\rangle\langle\psi(\theta)\rvert be a smooth family of pure states. The symmetric logarithmic derivatives LiL_i, defined by ∂iρ=12(Liρ+ρLi)\partial_i\rho=\tfrac12\big(L_i\rho+\rho L_i\big), can be chosen as Li=2 ∂iρL_i=2\,\partial_i\rho, and the quantum Fisher information FQ,ij=12Tr(ρ{Li,Lj})F_{Q,ij}=\tfrac12\mathrm{Tr}\big(\rho\{L_i,L_j\}\big) equals FQ,ij=4 Re[⟨∂iψ∣∂jψ⟩−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩]=4 gij.F_{Q,ij}=4\,\mathrm{Re}\Big[\langle\partial_i\psi\vert\partial_j\psi\rangle-\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle\Big]=4\,g_{ij}.

Proof (6 steps)
  1. Step 1:
    ρ2=ρ ⇒ ∂iρ=(∂iρ)ρ+ρ(∂iρ)=12((2∂iρ)ρ+ρ(2∂iρ))\rho^2=\rho\ \Rightarrow\ \partial_i\rho=(\partial_i\rho)\rho+\rho(\partial_i\rho)=\tfrac12\big((2\partial_i\rho)\rho+\rho(2\partial_i\rho)\big)
    Differentiate the projector identity ρ2=ρ\rho^2=\rho of a pure state with the product rule: Li=2∂iρL_i=2\partial_i\rho solves the defining equation.
  2. Step 2:
    FQ,ij=12Tr(ρLiLj)+12Tr(ρLjLi)=Re Tr(ρLiLj)=4 Re Tr(ρ ∂iρ ∂jρ)F_{Q,ij}=\tfrac12\mathrm{Tr}\big(\rho L_iL_j\big)+\tfrac12\mathrm{Tr}\big(\rho L_jL_i\big)=\mathrm{Re}\,\mathrm{Tr}\big(\rho L_iL_j\big)=4\,\mathrm{Re}\,\mathrm{Tr}\big(\rho\,\partial_i\rho\,\partial_j\rho\big)
    Tr(ρLiLj)‾=Tr((ρLiLj)†)=Tr(LjLiρ)=Tr(ρLjLi)\overline{\mathrm{Tr}(\rho L_iL_j)}=\mathrm{Tr}\big((\rho L_iL_j)^\dagger\big)=\mathrm{Tr}(L_jL_i\rho)=\mathrm{Tr}(\rho L_jL_i) for Hermitian ρ,Li,Lj\rho,L_i,L_j, so the two traces are complex conjugates.
  3. Step 3:
    ∂iρ=∣∂iψ⟩⟨ψ∣+∣ψ⟩⟨∂iψ∣,ai=⟨ψ∣∂iψ⟩,ai+aˉi=∂i⟨ψ∣ψ⟩=0\partial_i\rho=\lvert\partial_i\psi\rangle\langle\psi\rvert+\lvert\psi\rangle\langle\partial_i\psi\rvert,\qquad a_i=\langle\psi\vert\partial_i\psi\rangle,\qquad a_i+\bar a_i=\partial_i\langle\psi\vert\psi\rangle=0
    Product rule for the outer product; normalisation makes aia_i purely imaginary.
  4. Step 4:
    Tr(ρ ∂iρ ∂jρ)=⟨ψ∣∂iρ ∂jρ∣ψ⟩=(ai⟨ψ∣+⟨∂iψ∣)(∣∂jψ⟩+aˉj∣ψ⟩)\mathrm{Tr}(\rho\,\partial_i\rho\,\partial_j\rho)=\langle\psi\vert\partial_i\rho\,\partial_j\rho\vert\psi\rangle=\big(a_i\langle\psi\rvert+\langle\partial_i\psi\rvert\big)\big(\lvert\partial_j\psi\rangle+\bar a_j\lvert\psi\rangle\big)
    Tr(∣ψ⟩⟨ψ∣A)=⟨ψ∣A∣ψ⟩\mathrm{Tr}(\lvert\psi\rangle\langle\psi\rvert A)=\langle\psi\vert A\vert\psi\rangle; ⟨ψ∣∂iρ=ai⟨ψ∣+⟨∂iψ∣\langle\psi\rvert\partial_i\rho=a_i\langle\psi\rvert+\langle\partial_i\psi\rvert and ∂jρ∣ψ⟩=∣∂jψ⟩+aˉj∣ψ⟩\partial_j\rho\lvert\psi\rangle=\lvert\partial_j\psi\rangle+\bar a_j\lvert\psi\rangle.
  5. Step 5:
    =aiaj+aiaˉj+⟨∂iψ∣∂jψ⟩+aˉiaˉj=⟨∂iψ∣∂jψ⟩+aiaj=a_ia_j+a_i\bar a_j+\langle\partial_i\psi\vert\partial_j\psi\rangle+\bar a_i\bar a_j=\langle\partial_i\psi\vert\partial_j\psi\rangle+a_ia_j
    Multiply out, using ⟨ψ∣ψ⟩=1\langle\psi\vert\psi\rangle=1 and ⟨∂iψ∣ψ⟩=aˉi\langle\partial_i\psi\vert\psi\rangle=\bar a_i; with aˉ=−a\bar a=-a the terms aiaˉj=−aiaja_i\bar a_j=-a_ia_j and aˉiaˉj=aiaj\bar a_i\bar a_j=a_ia_j.
  6. Step 6:
    aiaj=−aˉi aj=−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩ ⇒ Tr(ρ ∂iρ ∂jρ)=Gij,FQ,ij=4 Re Gij=4 gija_ia_j=-\bar a_i\,a_j=-\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert\partial_j\psi\rangle\ \Rightarrow\ \mathrm{Tr}(\rho\,\partial_i\rho\,\partial_j\rho)=G_{ij},\qquad F_{Q,ij}=4\,\mathrm{Re}\,G_{ij}=4\,g_{ij}
    Again ai=−aˉia_i=-\bar a_i. The trace is the quantum geometric tensor, and its real part is the metric.

∎

Derivation

Fidelity susceptibility and the Bures distance

  1. Step 1:
    F(θ,θ+dθ)=∣⟨ψ(θ)∣ψ(θ+dθ)⟩∣2=1−∑i,jgij dθi dθj+O(∣dθ∣3)F(\theta,\theta+\mathrm d\theta)=\lvert\langle\psi(\theta)\vert\psi(\theta+\mathrm d\theta)\rangle\rvert^2=1-\sum_{i,j}g_{ij}\,\mathrm d\theta_i\,\mathrm d\theta_j+O(\lvert\mathrm d\theta\rvert^3)
    The proposition on the Fubini–Study metric.
  2. Step 2:
    −∂2F(θ,θ+dθ)∂(dθi) ∂(dθj)∣dθ=0=2 gij=12FQ,ij-\frac{\partial^2F(\theta,\theta+\mathrm d\theta)}{\partial(\mathrm d\theta_i)\,\partial(\mathrm d\theta_j)}\bigg\rvert_{\mathrm d\theta=0}=2\,g_{ij}=\tfrac12F_{Q,ij}
    Differentiate the quadratic form twice; gg is symmetric. The QFI is minus twice the Hessian of the fidelity, the fidelity susceptibility; the tests of this lesson compute it by finite differences and compare it with 4g4g.
  3. Step 3:
    dB2=2(1−F)=∑i,jgij dθi dθj+O(∣dθ∣3)=14∑i,jFQ,ij dθi dθj+O(∣dθ∣3)d_B^2=2\big(1-\sqrt F\big)=\sum_{i,j}g_{ij}\,\mathrm d\theta_i\,\mathrm d\theta_j+O(\lvert\mathrm d\theta\rvert^3)=\tfrac14\sum_{i,j}F_{Q,ij}\,\mathrm d\theta_i\,\mathrm d\theta_j+O(\lvert\mathrm d\theta\rvert^3)
    1−x=1−x2+O(x2)\sqrt{1-x}=1-\frac x2+O(x^2). This is the Bures distance, whose infinitesimal form Braunstein and Caves identified with 14FQ\frac14F_Q; for pure states it reduces to the Fubini–Study metric.

Result

FQ=4g,dsBures2=14∑i,jFQ,ij dθi dθj\boxed{F_Q=4g,\qquad\mathrm ds^2_{\text{Bures}}=\tfrac14\sum_{i,j}F_{Q,ij}\,\mathrm d\theta_i\,\mathrm d\theta_j}

The Braunstein–Caves inequality. Measuring the state with a POVM {Ek}\{E_k\} produces outcome probabilities pk(θ)=Tr(Ekρ(θ))p_k(\theta)=\mathrm{Tr}\big(E_k\rho(\theta)\big), whose classical Fisher information is FC,ij(θ)=∑k: pk>0∂ipk ∂jpk/pkF_{C,ij}(\theta)=\sum_{k:\,p_k>0}\partial_ip_k\,\partial_jp_k/p_k. Braunstein and Caves (1994) proved FC(θ)≤FQ(θ)F_C(\theta)\le F_Q(\theta) in the sense of quadratic forms, for every POVM, with equality for a single parameter when one measures in the eigenbasis of the symmetric logarithmic derivative. By the Cramér–Rao bound, NN repetitions of an unbiased estimate of one parameter have variance at least 1/(NFC)≥1/(NFQ)1/(N F_C)\ge1/(N F_Q), so FQ=4gF_Q=4g is the largest information about θ\theta that any measurement can extract. Amari's natural gradient preconditions the gradient of a statistical model p(x∣θ)p(x\vert\theta) with FC−1F_C^{-1}, the inverse of the Fisher–Rao metric, which is the essentially unique metric invariant under sufficient statistics (Chentsov's theorem). The quantum natural gradient replaces FCF_C by FQ/4=gF_Q/4=g: it measures distance in the space of quantum states instead of the space of measurement distributions of one fixed measurement. A constant factor between the two metrics only rescales the learning rate.

Derivation

Classical versus quantum Fisher information for a Z measurement on the qubit model

  1. Step 1:
    p0=∣⟨0∣ψ⟩∣2=cos⁡2θ2,p1=sin⁡2θ2p_0=\lvert\langle0\vert\psi\rangle\rvert^2=\cos^2\tfrac\theta2,\qquad p_1=\sin^2\tfrac\theta2
    The phases e∓iϕ/2e^{\mp i\phi/2} drop out of the moduli: the ZZ statistics do not depend on ϕ\phi.
  2. Step 2:
    ∂θp0=−12sin⁡θ,∂θp1=12sin⁡θ ⇒ FC,θθ=14sin⁡2θcos⁡2θ2+14sin⁡2θsin⁡2θ2=14sin⁡2θcos⁡2θ2sin⁡2θ2=1\partial_\theta p_0=-\tfrac12\sin\theta,\quad\partial_\theta p_1=\tfrac12\sin\theta\ \Rightarrow\ F_{C,\theta\theta}=\frac{\frac14\sin^2\theta}{\cos^2\frac\theta2}+\frac{\frac14\sin^2\theta}{\sin^2\frac\theta2}=\frac{\frac14\sin^2\theta}{\cos^2\frac\theta2\sin^2\frac\theta2}=1
    2sin⁡θ2cos⁡θ2=sin⁡θ2\sin\frac\theta2\cos\frac\theta2=\sin\theta for 0<θ<π0<\theta<\pi; common denominator with cos⁡2+sin⁡2=1\cos^2+\sin^2=1.
  3. Step 3:
    FQ=4g=(100sin⁡2θ),FC=(1000)≤FQF_{Q}=4g=\begin{pmatrix}1&0\\0&\sin^2\theta\end{pmatrix},\qquad F_C=\begin{pmatrix}1&0\\0&0\end{pmatrix}\le F_Q
    ∂ϕpk=0\partial_\phi p_k=0, so all ϕ\phi-entries of FCF_C vanish. The ZZ measurement is optimal for θ\theta (equality) and blind to ϕ\phi; estimating ϕ\phi requires measuring in the xyxy-plane of the Bloch sphere.

Result

FC,θθ=FQ,θθ=1,FC,ϕϕ=0<FQ,ϕϕ=sin⁡2θ\boxed{F_{C,\theta\theta}=F_{Q,\theta\theta}=1,\qquad F_{C,\phi\phi}=0<F_{Q,\phi\phi}=\sin^2\theta}
Derivation

Variational imaginary-time evolution is a natural-gradient flow

  1. Step 1:
    ∣ψ(τ)⟩=e−τH∣ψ0⟩∥e−τH∣ψ0⟩∥ ⇒ ∂τ∣ψ⟩=−(H−E)∣ψ⟩,E=⟨ψ∣H∣ψ⟩\lvert\psi(\tau)\rangle=\frac{e^{-\tau H}\lvert\psi_0\rangle}{\lVert e^{-\tau H}\lvert\psi_0\rangle\rVert}\ \Rightarrow\ \partial_\tau\lvert\psi\rangle=-(H-E)\lvert\psi\rangle,\qquad E=\langle\psi\vert H\vert\psi\rangle
    Differentiate the normalised state: ∂τe−τH=−He−τH\partial_\tau e^{-\tau H}=-He^{-\tau H} and ∂τ∥e−τHψ0∥−1=E ∥e−τHψ0∥−1\partial_\tau\lVert e^{-\tau H}\psi_0\rVert^{-1}=E\,\lVert e^{-\tau H}\psi_0\rVert^{-1}. For large τ\tau the state converges to a ground state of HH (when ∣ψ0⟩\lvert\psi_0\rangle overlaps it).
  2. Step 2:
    min⁡θ˙∥∑jθ˙j∣∂~jψ⟩+(H−E)∣ψ⟩∥2,∣∂~jψ⟩=P⊥∣∂jψ⟩\min_{\dot\theta}\Big\lVert\sum_j\dot\theta_j\lvert\tilde\partial_j\psi\rangle+(H-E)\lvert\psi\rangle\Big\rVert^2,\qquad\lvert\tilde\partial_j\psi\rangle=P_\perp\lvert\partial_j\psi\rangle
    McLachlan's variational principle: choose the parameter velocity whose tangent vector is closest to the exact one. The projected tangent vectors remove the global-phase direction, which does not change the ray.
  3. Step 3:
    ∑jRe⟨∂~iψ∣∂~jψ⟩ θ˙j=−Re⟨∂~iψ∣(H−E)∣ψ⟩\sum_j\mathrm{Re}\langle\tilde\partial_i\psi\vert\tilde\partial_j\psi\rangle\,\dot\theta_j=-\mathrm{Re}\langle\tilde\partial_i\psi\vert(H-E)\vert\psi\rangle
    Normal equations of the real least-squares problem: the derivative of ∥∑jθ˙jvj+w∥2\lVert\sum_j\dot\theta_jv_j+w\rVert^2 with respect to θ˙i\dot\theta_i is 2 Re⟨vi∣∑jθ˙jvj+w⟩2\,\mathrm{Re}\langle v_i\vert\sum_j\dot\theta_jv_j+w\rangle.
  4. Step 4:
    Re⟨∂~iψ∣∂~jψ⟩=Re⟨∂iψ∣P⊥∣∂jψ⟩=gij\mathrm{Re}\langle\tilde\partial_i\psi\vert\tilde\partial_j\psi\rangle=\mathrm{Re}\langle\partial_i\psi\vert P_\perp\vert\partial_j\psi\rangle=g_{ij}
    P⊥†P⊥=P⊥P_\perp^\dagger P_\perp=P_\perp and the definition of the metric.
  5. Step 5:
    Re⟨∂~iψ∣(H−E)∣ψ⟩=Re⟨∂iψ∣H∣ψ⟩−E Re⟨∂iψ∣ψ⟩−Re(⟨∂iψ∣ψ⟩⟨ψ∣(H−E)∣ψ⟩)=12 ∂iE\mathrm{Re}\langle\tilde\partial_i\psi\vert(H-E)\vert\psi\rangle=\mathrm{Re}\langle\partial_i\psi\vert H\vert\psi\rangle-E\,\mathrm{Re}\langle\partial_i\psi\vert\psi\rangle-\mathrm{Re}\big(\langle\partial_i\psi\vert\psi\rangle\langle\psi\vert(H-E)\vert\psi\rangle\big)=\tfrac12\,\partial_iE
    ⟨ψ∣(H−E)∣ψ⟩=0\langle\psi\vert(H-E)\vert\psi\rangle=0, Re⟨∂iψ∣ψ⟩=0\mathrm{Re}\langle\partial_i\psi\vert\psi\rangle=0 by normalisation, and ∂iE=2 Re⟨∂iψ∣H∣ψ⟩\partial_iE=2\,\mathrm{Re}\langle\partial_i\psi\vert H\vert\psi\rangle.
  6. Step 6:
    g θ˙=−12∇E ⇒ θ˙=−12 g−1∇E ⇒ θ(τ+Δτ)≈θ(τ)−Δτ2 g−1∇Eg\,\dot\theta=-\tfrac12\nabla E\ \Rightarrow\ \dot\theta=-\tfrac12\,g^{-1}\nabla E\ \Rightarrow\ \theta(\tau+\Delta\tau)\approx\theta(\tau)-\tfrac{\Delta\tau}2\,g^{-1}\nabla E
    An explicit Euler step of the variational imaginary-time flow is a quantum natural-gradient step on the energy with learning rate η=Δτ/2\eta=\Delta\tau/2 (McArdle et al. 2019).
  7. Step 7:
    H=Z:θ˙=−12⋅4⋅(−sin⁡θ)=2sin⁡θ;e−τZRY(θ0)∣0⟩∝e−τcos⁡θ02∣0⟩+eτsin⁡θ02∣1⟩H=Z:\quad\dot\theta=-\tfrac12\cdot4\cdot(-\sin\theta)=2\sin\theta;\qquad e^{-\tau Z}R_Y(\theta_0)\lvert0\rangle\propto e^{-\tau}\cos\tfrac{\theta_0}2\lvert0\rangle+e^{\tau}\sin\tfrac{\theta_0}2\lvert1\rangle
    For the qubit model with E=cos⁡θE=\cos\theta and ϕ=0\phi=0. The exact state stays real, so it is RY(θ(τ))∣0⟩R_Y(\theta(\tau))\lvert0\rangle with tan⁡θ(τ)2=e2τtan⁡θ02\tan\frac{\theta(\tau)}2=e^{2\tau}\tan\frac{\theta_0}2.
  8. Step 8:
    12sec⁡2θ2 θ˙=2tan⁡θ2 ⇒ θ˙=4sin⁡θ2cos⁡θ2=2sin⁡θ\tfrac12\sec^2\tfrac\theta2\,\dot\theta=2\tan\tfrac\theta2\ \Rightarrow\ \dot\theta=4\sin\tfrac\theta2\cos\tfrac\theta2=2\sin\theta
    Differentiate tan⁡θ2=e2τtan⁡θ02\tan\frac\theta2=e^{2\tau}\tan\frac{\theta_0}2 in τ\tau. The variational flow coincides with the exact evolution, because the ansatz reaches every state that the evolution visits; the NumPy cell confirms θ(0.5)=0.779612\theta(0.5)=0.779612 for θ0=0.3\theta_0=0.3.

Result

θ˙=−12 g−1∇E(McLachlan; QNG step with η=Δτ/2)\boxed{\dot\theta=-\tfrac12\,g^{-1}\nabla E\qquad(\text{McLachlan; QNG step with }\eta=\Delta\tau/2)}

Quick check

What is the quantum Fisher information FQ,ϕϕF_{Q,\phi\phi} of the qubit model RZ(ϕ)RY(θ)∣0⟩R_Z(\phi)R_Y(\theta)\lvert0\rangle on the equator, θ=π/2\theta=\pi/2?

tolerance ±0.0001

Numerical checks and the lab#

The NumPy cell below verifies the derivations of this lesson independently of the platform's engine. It builds the quantum geometric tensor of the qubit model from finite-difference tangent vectors and recovers g=diag(14,316)g=\mathrm{diag}\big(\tfrac14,\tfrac3{16}\big) at θ=π/3\theta=\pi/3 together with Im Gθϕ=14sin⁡θ\mathrm{Im}\,G_{\theta\phi}=\tfrac14\sin\theta; it multiplies the state by the parameter-dependent phase ei(θ2+3ϕ)e^{i(\theta^2+3\phi)} and shows that GG is unchanged while ⟨∂iψ∣∂jψ⟩\langle\partial_i\psi\vert\partial_j\psi\rangle changes completely; it compares the infidelity 1−∣⟨ψ(θ)∣ψ(θ+δv)⟩∣21-\lvert\langle\psi(\theta)\vert\psi(\theta+\delta v)\rangle\rvert^2 with δ2 v⊤g v\delta^2\,v^\top g\,v for shrinking δ\delta; it computes FQ=4gF_Q=4g and the classical Fisher information of a ZZ measurement; it evaluates the lab's natural-gradient and vanilla steps; and it integrates the imaginary-time flow θ˙=2sin⁡θ\dot\theta=2\sin\theta with a fourth-order Runge–Kutta method.

Pythonrunnable
import numpy as np

def ry(t):
    c, s = np.cos(t / 2), np.sin(t / 2)
    return np.array([[c, -s], [s, c]], dtype=complex)

def rz(t):
    return np.diag([np.exp(-0.5j * t), np.exp(0.5j * t)])

ket0 = np.array([1, 0], dtype=complex)

def psi(th, ph, alpha=lambda th, ph: 0.0):
    # |psi> = RZ(phi) RY(theta)|0>, optionally multiplied by a parameter-dependent global phase e^{i alpha}
    return np.exp(1j * alpha(th, ph)) * (rz(ph) @ ry(th) @ ket0)

def tangents(th, ph, alpha=lambda th, ph: 0.0, h=1e-6):
    d_th = (psi(th + h, ph, alpha) - psi(th - h, ph, alpha)) / (2 * h)
    d_ph = (psi(th, ph + h, alpha) - psi(th, ph - h, alpha)) / (2 * h)
    return psi(th, ph, alpha), [d_th, d_ph]

def qgt(th, ph, alpha=lambda th, ph: 0.0):
    # quantum geometric tensor G_ij = <d_i psi|d_j psi> - <d_i psi|psi><psi|d_j psi>
    p, d = tangents(th, ph, alpha)
    return np.array([[np.vdot(a, b) - np.vdot(a, p) * np.vdot(p, b) for b in d] for a in d])

def naive(th, ph, alpha=lambda th, ph: 0.0):
    _, d = tangents(th, ph, alpha)
    return np.array([[np.vdot(a, b) for b in d] for a in d])

def show(m):
    m = np.where(np.abs(m) < 5e-9, 0.0, m)
    return "[[" + "], [".join(", ".join(f"{v:.6f}" for v in row) for row in m) + "]]"

th, ph = np.pi / 3, 0.4
G = qgt(th, ph)
print("g = Re G at (pi/3, 0.4):", show(G.real), "| diag(1/4, sin^2(theta)/4) =", show(np.diag([0.25, np.sin(th) ** 2 / 4])))
print(f"Im G_theta_phi = {G[0, 1].imag:.6f} = sin(theta)/4 = {np.sin(th) / 4:.6f}")

# Phase invariance: a parameter-dependent global phase leaves G unchanged but changes <d_i psi|d_j psi>.
alpha = lambda th, ph: th ** 2 + 3 * ph
print("max |G' - G| < 1e-8 under psi -> e^{i(theta^2 + 3 phi)} psi:", bool(np.abs(qgt(th, ph, alpha) - G).max() < 1e-8),
      "| naive <d psi|d psi> changes from", show(naive(th, ph).real), "to", show(naive(th, ph, alpha).real))

# Projective distance: 1 - |<psi(theta)|psi(theta + delta)>|^2 = g(delta, delta) + O(delta^3).
v = np.array([0.6, -0.8])
for delta in (1e-1, 1e-2, 1e-3):
    infid = 1 - abs(np.vdot(psi(th, ph), psi(th + delta * v[0], ph + delta * v[1]))) ** 2
    print(f"delta = {delta:.0e}: (1 - F)/delta^2 = {infid / delta ** 2:.8f}, v^T g v = {v @ G.real @ v:.8f}")

# Quantum Fisher information 4g versus the classical Fisher information of a Z measurement.
def fisher_z(th, ph, i, h=1e-6):
    p = lambda a, b: np.abs(psi(a, b)) ** 2
    dp = (p(th + h, ph) - p(th - h, ph)) / (2 * h) if i == 0 else (p(th, ph + h) - p(th, ph - h)) / (2 * h)
    return float(np.sum(dp ** 2 / p(th, ph)))
print(f"F_Q = 4g = {show(4 * G.real)}; classical Fisher of a Z measurement: F_theta = {fisher_z(th, ph, 0):.6f}, F_phi = {fisher_z(th, ph, 1):.6f}")

# One QNG step and one vanilla step on L = <Z> = cos(theta) from (pi/3, 0) with eta = 0.1.
eta, t0 = 0.1, np.pi / 3
grad = np.array([-np.sin(t0), 0.0])
g = np.diag([0.25, np.sin(t0) ** 2 / 4])
print(f"QNG: theta' = {t0 - eta * np.linalg.solve(g, grad)[0]:.10f}  (pi/3 + 0.2 sqrt 3 = {t0 + 0.2 * np.sqrt(3):.10f});  GD: theta' = {t0 - eta * grad[0]:.10f}")

# Imaginary-time evolution under H = Z: the variational flow theta' = -1/2 g^{-1} dE/dtheta = 2 sin(theta) is exact.
tau, n = 0.5, 1000
flow = lambda t: 2 * np.sin(t)
t, dt = 0.3, tau / n
for _ in range(n):  # classical Runge-Kutta 4 integration of the parameter flow
    k1 = flow(t); k2 = flow(t + dt * k1 / 2); k3 = flow(t + dt * k2 / 2); k4 = flow(t + dt * k3)
    t += dt * (k1 + 2 * k2 + 2 * k3 + k4) / 6
exact = 2 * np.arctan(np.exp(2 * tau) * np.tan(0.3 / 2))
evolved = np.diag([np.exp(-tau), np.exp(tau)]) @ ry(0.3) @ ket0
evolved /= np.linalg.norm(evolved)
print(f"imaginary time tau = {tau}: flow theta = {t:.6f}, 2 atan(e^(2 tau) tan(0.15)) = {exact:.6f}, from e^(-tau Z) = {2 * np.arctan2(evolved[1].real, evolved[0].real):.6f}")

Expected output

g = Re G at (pi/3, 0.4): [[0.250000, 0.000000], [0.000000, 0.187500]] | diag(1/4, sin^2(theta)/4) = [[0.250000, 0.000000], [0.000000, 0.187500]]
Im G_theta_phi = 0.216506 = sin(theta)/4 = 0.216506
max |G' - G| < 1e-8 under psi -> e^{i(theta^2 + 3 phi)} psi: True | naive <d psi|d psi> changes from [[0.250000, 0.000000], [0.000000, 0.250000]] to [[4.636491, 5.759587], [5.759587, 7.750000]]
delta = 1e-01: (1 - F)/delta^2 = 0.21384541, v^T g v = 0.21000000
delta = 1e-02: (1 - F)/delta^2 = 0.21041262, v^T g v = 0.21000000
delta = 1e-03: (1 - F)/delta^2 = 0.21004154, v^T g v = 0.21000000
F_Q = 4g = [[1.000000, 0.000000], [0.000000, 0.750000]]; classical Fisher of a Z measurement: F_theta = 1.000000, F_phi = 0.000000
QNG: theta' = 1.3936077127  (pi/3 + 0.2 sqrt 3 = 1.3936077127);  GD: theta' = 1.1338000916
imaginary time tau = 0.5: flow theta = 0.779612, 2 atan(e^(2 tau) tan(0.15)) = 0.779612, from e^(-tau Z) = 0.779612

With the larger learning rate η=0.2\eta=0.2 the natural gradient on ⟨Z⟩\langle Z\rangle overshoots less than one might fear: the update θ←θ+4ηsin⁡θ=θ+0.8sin⁡θ\theta\leftarrow\theta+4\eta\sin\theta=\theta+0.8\sin\theta is a contraction near the minimum θ=π\theta=\pi, since the derivative of the update map there is 1+0.8cos⁡π=0.21+0.8\cos\pi=0.2. (The widget keeps its default regulariser λ=0.01\lambda=0.01, so its factor is η/(14+λ)=0.2/0.26≈0.77\eta/(\tfrac14+\lambda)=0.2/0.26\approx0.77 instead of 0.80.8, and the derivative at θ=π\theta=\pi is ≈0.23\approx0.23.) For 4η>24\eta>2 the fixed point would become unstable, so a natural-gradient learning rate must still be chosen with the local curvature in mind. The lab asks for the metric of the qubit model at θ=π/3\theta=\pi/3 and for one natural-gradient step on ⟨Z⟩\langle Z\rangle from (π/3,0)(\pi/3,0) with η=0.1\eta=0.1.

References

  1. J. Stokes, J. Izaac, N. Killoran and G. Carleo, Quantum natural gradient, Quantum 4, 269 (2020).doi:10.22331/q-2020-05-25-269
  2. S. Amari, Natural gradient works efficiently in learning, Neural Computation 10(2), 251–276 (1998).doi:10.1162/089976698300017746
  3. S. L. Braunstein and C. M. Caves, Statistical distance and the geometry of quantum states, Physical Review Letters 72, 3439–3443 (1994).doi:10.1103/PhysRevLett.72.3439
  4. S. McArdle, T. Jones, S. Endo, Y. Li, S. C. Benjamin and X. Yuan, Variational ansatz-based quantum simulation of imaginary time evolution, npj Quantum Information 5, 75 (2019).doi:10.1038/s41534-019-0187-2
  5. J. J. Meyer, Fisher information in noisy intermediate-scale quantum applications, Quantum 5, 539 (2021).doi:10.22331/q-2021-09-09-539
  6. J. P. Provost and G. Vallee, Riemannian structure on manifolds of quantum states, Communications in Mathematical Physics 76, 289–301 (1980).doi:10.1007/BF02193559

Hands-on labs

  • The Fubini–Study metric and one natural-gradient step

    2 steps · auto-graded

    Compute the Fubini–Study metric of the single-qubit model ∣ψ(θ,ϕ)⟩=RZ(ϕ)RY(θ)∣0⟩\lvert\psi(\theta,\phi)\rangle=R_Z(\phi)R_Y(\theta)\lvert0\rangle at θ=π/3\theta=\pi/3, then use it to take one quantum-natural-gradient step on the loss L=⟨Z⟩L=\langle Z\rangle and compare it with the vanilla gradient step.

    Open lab