Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Stochastic Reconfiguration and Natural Gradients

    A small change of neural parameters need not be a small change of quantum state. Some parameter directions merely rescale the wavefunction; others change its correlations strongly. Ordinary gradient descent measures steps in parameter coordinates. Stochastic reconfiguration instead uses the distance between normalized states to choose a direction.

    We derive that metric, explain its null directions and regularization, and compare ordinary gradients with two shifted-metric updates on the same six-spin state. Every method receives the same number of samples and the same fixed update schedule. The two shifted updates let us compare the regularization strengths at fixed sample budget.

    Preparation: neural amplitudes and phases, local energies and normalized gradients, and positive semidefinite matrices.

    Remove changes that do not change the quantum ray

    Let ψ(θ)\psi(\theta) be an unnormalized state and N=⟨ψ∣ψ⟩\mathcal N=\langle\psi|\psi\rangle. The parameter derivative contains a component parallel to the state, which changes its scale or phase. Define the projective tangent vector

    ∣Di⟩=1N(∣∂iψ⟩−∣ψ⟩⟨ψ∣∂iψ⟩N).|D_i\rangle= \frac1{\sqrt{\mathcal N}} \left( |\partial_i\psi\rangle- |\psi\rangle\frac{\langle\psi|\partial_i\psi\rangle}{\mathcal N} \right).

    It satisfies ⟨Ψ∣Di⟩=0\langle\Psi|D_i\rangle=0 for Ψ=ψ/N\Psi=\psi/\sqrt{\mathcal N}. Its Gram matrix is the quantum geometric tensor:

    Sij=⟨Di∣Dj⟩=⟨∂iψ∣∂jψ⟩N−⟨∂iψ∣ψ⟩⟨ψ∣∂jψ⟩N2.S_{ij}=\langle D_i|D_j\rangle =\frac{\langle\partial_i\psi|\partial_j\psi\rangle}{\mathcal N} -\frac{\langle\partial_i\psi|\psi\rangle \langle\psi|\partial_j\psi\rangle}{\mathcal N^2}.

    For real parameter displacements, the infinitesimal squared distance between rays is

    ds2=∑ijδθi Re⁡Sij δθj.ds^2=\sum_{ij}\delta\theta_i\,\operatorname{Re}S_{ij}\,\delta\theta_j.

    For a holomorphic complex parameterization it is δθ†Sδθ\delta\theta^\dagger S\delta\theta. This follows by expanding the normalized overlap, or the Fubini–Study distance arccos⁡∣⟨Ψ(θ)∣Ψ(θ+δθ)⟩∣\arccos|\langle\Psi(\theta)|\Psi(\theta+\delta\theta)\rangle|, to second order. The direct formula and its covariance form are given in Vicentini et al., §3.5, Eqs. (21)–(23).

    When the amplitudes have suitable support, Oi(s)=∂ilog⁡ψ(s)O_i(s)=\partial_i\log\psi(s) gives

    Sij=Ep[(Oi−⟨Oi⟩)∗(Oj−⟨Oj⟩)].S_{ij}=\mathbb E_p[(O_i-\langle O_i\rangle)^* (O_j-\langle O_j\rangle)].

    This identity does not authorize division at a moving node. If ψ(s)=0\psi(s)=0 but ∂iψ(s)≠0\partial_i\psi(s)\ne0, the direct Gram matrix can contain a contribution absent from the Born covariance. The two-component node example has direct metric 1 while the support-restricted covariance gives 0.

    For a real positive wavefunction, ∂ilog⁡p=2(Oi−⟨Oi⟩)\partial_i\log p=2(O_i-\langle O_i\rangle), so the classical Fisher matrix of the Born distribution is 4S4S. A complex state can change its relative phases without changing pp; that classical Fisher matrix then misses part of the quantum geometry.

    The projected imaginary-time direction

    Normalized imaginary-time evolution satisfies

    ∂τ∣Ψ⟩=−(H−E)∣Ψ⟩.\partial_\tau|\Psi\rangle=-(H-E)|\Psi\rangle.

    Restrict the change to the variational tangent space and minimize

    ∥∑jθ˙j∣Dj⟩+(H−E)∣Ψ⟩∥2\left\| \sum_j\dot\theta_j|D_j\rangle +(H-E)|\Psi\rangle \right\|^2

    over real velocities. The normal equations are

    ∑jRe⁡Sijθ˙j=−Re⁡Fi,Fi=⟨∂iψ∣(H−E)∣ψ⟩N.\sum_j\operatorname{Re}S_{ij}\dot\theta_j =-\operatorname{Re}F_i, \qquad F_i=\frac{\langle\partial_i\psi|(H-E)|\psi\rangle}{\mathcal N}.

    The real energy gradient is gi=2Re⁡Fig_i=2\operatorname{Re}F_i. An optimization update written as

    (Re⁡S+δI)d=g,θ←θ−ηd(\operatorname{Re}S+\delta I)d=g, \qquad \theta\leftarrow\theta-\eta d

    therefore uses twice the force appearing in the imaginary-time equation. With no shift and in the infinitesimal limit, this convention corresponds to imaginary-time increment 2η2\eta. The learning rate is not silently identified with physical time.

    Equivalently, unregularized natural gradient chooses the steepest energy decrease at fixed infinitesimal state distance. This local geometric statement does not guarantee global minimization of a nonconvex energy landscape. The projection and singular-direction treatment originate in Sorella's stochastic-reconfiguration formulation, §V.2, Eqs. (39)–(45), whose discussion also recognizes local minima.

    Real-time variational dynamics is a different projection: with the convention i∂tΨ=HΨi\partial_t\Psi=H\Psi, real parameters satisfy Re⁡S θ˙=Im⁡F\operatorname{Re}S\,\dot\theta=\operatorname{Im}F in the corresponding least-squares formulation. Holomorphic complex parameters give Sθ˙=−iFS\dot\theta=-iF. The real-time article checks that evolution against an exact quench; optimizing the energy is not a substitute for it.

    Null directions and noisy weak directions

    If ∂iψ=ciψ\partial_i\psi=c_i\psi, then Di=0D_i=0. A redundant global amplitude and global phase are exact examples. More generally, a vector vv lies in the metric null space when ∑iviDi=0\sum_i v_iD_i=0. An exact force has no component along an exact redundant direction, but an inverse of a numerically nearly singular matrix can magnify roundoff or statistical fluctuations.

    A zero tangent can also occur at a poorly chosen parameter point. In the real, even-projected RBM, setting every visible bias, hidden bias and weight to zero produces a uniform state. The visible-bias derivatives are odd and vanish under the even projection; the hidden derivatives contain sinh⁡0=0\sinh0=0. Thus every first derivative vanishes at that point even though the uniform state's energy is not minimal. No inversion of the zero metric can create a missing first-order tangent. The production fits begin at fixed nonzero random parameters, rather than claiming that SR resolves such a stationary parameterization automatically.

    For independent samples, the retained estimators use

    S^ij=1B−1∑b=1B(Oi(b)−O‾i)∗(Oj(b)−O‾j),\widehat S_{ij}= \frac1{B-1}\sum_{b=1}^B (O_i^{(b)}-\overline O_i)^* (O_j^{(b)}-\overline O_j),

    and the analogous covariance with local energy for F^\widehat F. These are unbiased at a fixed state. The matrix has limited rank, however, and a finite batch can omit configurations that distinguish weak tangent directions. Inverting S^+δI\widehat S+\delta I is nonlinear:

    E[(S^+δI)−1g^]≠(S+δI)−1g\mathbb E[(\widehat S+\delta I)^{-1}\widehat g] \ne(S+\delta I)^{-1}g

    in general. Unbiased input covariances do not imply an unbiased natural-gradient step.

    A positive diagonal shift stabilizes the solve but penalizes motion in the chosen parameter coordinates. It is not the same operation as removing a known exact gauge direction. Eigenvalue truncation is another choice, with its own threshold dependence. Neither procedure should be described merely as making an otherwise unchanged algorithm faster.

    A controlled comparison on six spins

    Use the same periodic Pauli Hamiltonian,

    H=−∑i=05ZiZi+1−0.8∑i=05Xi,H=-\sum_{i=0}^{5}Z_iZ_{i+1}-0.8\sum_{i=0}^{5}X_i,

    and the same even-projected real RBM with M=3M=3 hidden spins and 2727 parameters. Every trajectory starts from the identical parameter vector, drawn once with seed components (961025,10,3,0)(961025,10,3,0) and standard deviation 0.050.05.

    Three methods are fixed before sampling: ordinary gradients, SR with δ=10−3\delta=10^{-3}, and SR with δ=10−2\delta=10^{-2}. Each performs 10001000 updates. The learning rate is 0.030.03 for updates 0–499 and 0.010.01 thereafter. If the proposed parameter update has Euclidean norm above 0.20.2, it is rescaled to that norm. This cap is part of all three algorithms and its activations are counted.

    For each method we run one enumerated trajectory and eight sampled trajectories. Each sampled update uses 512512 iid draws from the fully enumerated Born distribution. Replicas have independent streams; corresponding replicas across methods share uniforms, producing paired comparisons. The total is 12,288,00012{,}288{,}000 training draws. Enumerating the distribution and computing the metric add work beyond the shared sample budget.

    The table uses direct final state energies evaluated after the fixed number of updates.

    MethodEnumerated final E−E0E-E_0Sampled mean final E−E0E-E_0Between-replica SD
    gradient1.867×10−21.867\times10^{-2}1.869×10−21.869\times10^{-2}9.97×10−49.97\times10^{-4}
    SR, δ=10−3\delta=10^{-3}4.384×10−54.384\times10^{-5}7.595×10−57.595\times10^{-5}4.38×10−64.38\times10^{-6}
    SR, δ=10−2\delta=10^{-2}1.537×10−41.537\times10^{-4}2.056×10−42.056\times10^{-4}8.14×10−58.14\times10^{-5}

    Here E0=−7.04880447500955E_0=-7.04880447500955. The SD is the spread of eight optimizer outcomes, not a standard error for one state's energy and not an uncertainty in the exact reference. The shift changes the finite-budget result materially. Under this schedule, ordinary gradients leave a larger energy excess at the final step.

    The update cap never activates for ordinary gradients. It activates 8–9 times in each sampled shift-10−310^{-3} run and 6 times in each shift-10−210^{-2} run. The largest scaled residual of any shifted linear solve is 3.68×10−163.68\times10^{-16}. That validates the linear algebra at the chosen shifts; it does not establish that the unshifted physical tangent or its weak directions were estimated accurately.

    For example, the initial enumerated metric's smallest eigenvalue is 7.85×10−127.85\times10^{-12} and its largest is 0.09160.0916. The recorded numerical rank is 26 using the declared threshold 10−1010^{-10} times the largest eigenvalue. At the last sampled update of the designated shift-10−310^{-3} run, the recorded rank is 25. Small negative eigenvalues of order 10−1710^{-17} are consistent with roundoff in a covariance Gram matrix; materially negative values would stop the calculation. No eigenvalue flooring or silent inverse cutoff is used in these updates.

    Exact energy excess along ordinary-gradient and two shifted-SR trajectories, with individual sampling replicas and enumerated controls, plus their final spread.

    All curves evaluate the current state energy directly every ten updates. Thin curves retain the eight sampled trajectories; dashed curves use enumerated forces and metrics. The methods share initial parameters, sample budgets and learning-rate schedule. Their differing shift and cap effects remain part of the comparison.

    What the comparison establishes

    SR exploits state geometry effectively for this fixed finite problem, but the final gradients are nonzero and the prescribed budgets are not convergence proofs. The independent energy-coverage study uses fresh samples only after the states are frozen. Its uncertainty measures the estimator at a fixed state; it does not cover optimizer bias or regulator error.

    The shared checks compare the direct Gram matrix with Born covariances where support permits, verify added amplitude/phase null directions, and test real and imaginary derivatives independently. Learned parameter vectors and all plotted trajectories are retained in examples/computational-qft/neural-quantum-states/. The default verification commands read those states without repeating the fits or sampling.

    The calculation also distinguishes an exact coordinate redundancy from an uncertain small eigenvalue. Removing the former is a geometric identity. Suppressing the latter is an approximation whose effect should be measured through physical observables and alternative declared regularization choices.

    Summary

    Stochastic reconfiguration measures parameter changes through their effect on the normalized quantum state. Its Gram matrix makes redundant directions visible and supplies an imaginary-time-inspired descent direction. Sampling, diagonal shifts and finite steps change that ideal projection. The six-spin comparison retains each of those choices and shows their effects without turning a successful shifted solve into a claim of converged many-body physics.

    Exercises

    1. Global amplitude and phase are null directions

    Extend any nonzero state family by ψ~a,b=ea+ibψ\widetilde\psi_{a,b}=e^{a+ib}\psi, with real a,ba,b. Compute its projective derivatives in the two added directions. Compare the resulting quantum metric with the Fisher matrix of its Born probabilities.

    Solution

    The derivatives are ∂aψ~=ψ~\partial_a\widetilde\psi=\widetilde\psi and ∂bψ~=iψ~\partial_b\widetilde\psi=i\widetilde\psi. Subtracting the parallel component in the definition of DiD_i gives zero for both. Their metric rows and columns therefore vanish, as do their exact forces because ⟨ψ~∣(H−E)∣ψ~⟩=0\langle\widetilde\psi|(H-E)|\widetilde\psi\rangle=0.

    The Born probabilities are unchanged under either parameter, so their classical scores and Fisher rows also vanish. This agreement holds for these global changes. For a relative-phase parameter, such as ψα=(1,eiα)T/2\psi_\alpha=(1,e^{i\alpha})^T/\sqrt2, the Born probabilities remain constant while the projective metric is Sαα=1/4S_{\alpha\alpha}=1/4. The classical Fisher matrix is zero and misses this physical phase direction.

    2. Descent and the coordinate dependence of a shift

    Let G=Re⁡SG=\operatorname{Re}S be positive semidefinite, let gg be the exact real energy gradient, and let δ>0\delta>0. Show that Δθ=−η(G+δI)−1g\Delta\theta=-\eta(G+\delta I)^{-1}g is a nonascending infinitesimal direction. Then take G=I2G=I_2 and change coordinates by θ=Au\theta=A u, where A=diag⁡(c,1)A=\operatorname{diag}(c,1) and c>0c>0. Compare applying the same numerical shift in the two coordinate systems.

    Solution

    The first-order energy change is

    gTΔθ=−ηgT(G+δI)−1g≤0g^T\Delta\theta =-\eta g^T(G+\delta I)^{-1}g\le0

    for η≥0\eta\ge0, because the shifted matrix is positive definite. A positive cap factor preserves this first-order sign. Higher-order terms can spoil descent for a finite step, and a noisy estimated gradient need not have the same sign as the true directional derivative.

    In uu coordinates, Gu=ATGA=diag⁡(c2,1)G_u=A^TGA=\operatorname{diag}(c^2,1) and gu=ATgg_u=A^Tg. Applying δI\delta I there and mapping back gives

    Δθ=−η(c2c2+δ0011+δ)g.\Delta\theta =-\eta \begin{pmatrix} \dfrac{c^2}{c^2+\delta}&0\\ 0&\dfrac1{1+\delta} \end{pmatrix}g.

    Shifting directly in θ\theta coordinates gives −ηg/(1+δ)-\eta g/(1+\delta) in both components. The directions agree when c=1c=1 or in the unshifted nonsingular limit, but not generally. A shift proportional to the identity therefore specifies a penalty in a particular coordinate system; it is not an invariant part of the Fubini–Study metric.

    References

    • S. Sorella, “Generalized Lanczos Algorithm for Variational Quantum Monte Carlo,” Physical Review B 64, 024512 (2001), doi:10.1103/PhysRevB.64.024512, arXiv:cond-mat/0009149v1. Section II and §V.2, especially Eqs. (39)–(45), for projection, optimization and singular directions.
    • F. Vicentini et al., “NetKet 3: Machine Learning Toolbox for Many-Body Quantum Systems,” SciPost Physics Codebases 7 (2022), doi:10.21468/SciPostPhysCodeb.7, arXiv:2112.10526v2. Sections 3.5, 4.1 and 4.3: direct quantum geometry, nodal condition, gradient convention and time-dependent projection. No package benchmark is reproduced here.

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.