Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Neural Wavefunction Representations

    Two wavefunctions can assign exactly the same probabilities to every spin configuration and still predict different measurements. A neural representation of a quantum state must therefore describe amplitudes and relative phases. Reproducing a histogram is enough only for observables diagonal in the sampled basis.

    This article constructs a small complex neural state, fits it to an exactly known two-spin target, and checks probabilities, phases and observables separately. The product-state energy estimate fixed the estimator without fitting amplitudes. Here the target is the state itself, including its relative phase.

    Preparation: normalized state vectors, Pauli matrices and the variational principle. We use the state and Schrödinger conventions of the common convention source.

    A state is more than its sampling distribution

    Let s=(s0,…,sN−1)s=(s_0,\ldots,s_{N-1}), with si=±1s_i=\pm1, label an orthonormal spin basis. For an unnormalized complex function ψθ(s)\psi_\theta(s), define

    Nθ=∑s∣ψθ(s)∣2,∣Ψθ⟩=1Nθ∑sψθ(s)∣s⟩.\mathcal N_\theta=\sum_s|\psi_\theta(s)|^2, \qquad |\Psi_\theta\rangle= \frac{1}{\sqrt{\mathcal N_\theta}} \sum_s\psi_\theta(s)|s\rangle.

    The Born probability is pθ(s)=∣ψθ(s)∣2/Nθp_\theta(s)=|\psi_\theta(s)|^2/\mathcal N_\theta. Where the amplitude is nonzero, one can write

    ψθ(s)=eAθ(s)+iΦθ(s).\psi_\theta(s)=e^{A_\theta(s)+i\Phi_\theta(s)}.

    A real network for AA describes a positive state; a second phase output can describe complex interference. A common additive constant in AA disappears upon normalization, and a common constant in Φ\Phi is an unobservable global phase. Relative phases remain physical. For a general operator,

    ⟨O⟩θ=∑s,s′ψθ(s)∗Oss′ψθ(s′)Nθ,\langle O\rangle_\theta= \frac{\sum_{s,s'}\psi_\theta(s)^*O_{ss'}\psi_\theta(s')} {\mathcal N_\theta},

    so off-diagonal matrix elements connect amplitudes whose relative phases a probability model does not determine.

    The logarithmic parameterization also has a restriction: finite AA never gives an exact zero. Nodes require a limit, a separate nodal factor, or an ansatz that can vanish. At a zero, the phase and logarithmic derivative need not be defined even when the wavefunction and its direct derivatives are perfectly regular. This matters for both fermionic nodes and the tangent metric used in stochastic reconfiguration.

    Summing hidden spins gives a tractable amplitude

    A restricted Boltzmann machine wavefunction introduces hidden spins hj=±1h_j=\pm1 and sums them exactly:

    ψθ(s)=∑h1,…,hMexp⁡ ⁣[∑iaisi+∑jbjhj+∑ijWijsihj]=ea⋅s∏j=1M2cosh⁡ ⁣(bj+∑iWijsi).\begin{aligned} \psi_\theta(s) &=\sum_{h_1,\ldots,h_M} \exp\!\left[ \sum_i a_i s_i+\sum_j b_jh_j+ \sum_{ij}W_{ij}s_ih_j\right]\\ &=e^{a\cdot s} \prod_{j=1}^{M}2\cosh\!\left(b_j+\sum_iW_{ij}s_i\right). \end{aligned}

    The parameters may be complex. The hidden sum factorizes because there are no hidden-hidden couplings. Evaluating one amplitude costs a number of operations proportional to NMNM; normalizing over all 2N2^N visible configurations still costs exponentially unless a separate sampling or normalization method is available. This architecture is the starting construction in Carleo and Troyer, “Neural-Network Quantum States”.

    Put uj=bj+∑iWijsiu_j=b_j+\sum_iW_{ij}s_i. Away from zeros,

    ∂ailog⁡ψ=si,∂bjlog⁡ψ=tanh⁡uj,∂Wijlog⁡ψ=sitanh⁡uj.\partial_{a_i}\log\psi=s_i, \qquad \partial_{b_j}\log\psi=\tanh u_j, \qquad \partial_{W_{ij}}\log\psi=s_i\tanh u_j.

    At a zero of cosh⁡uj\cosh u_j, use the direct product derivative instead:

    ∂bjψ=ea⋅s 2sinh⁡uj∏k≠j2cosh⁡uk.\partial_{b_j}\psi =e^{a\cdot s}\,2\sinh u_j \prod_{k\ne j}2\cosh u_k.

    This expression does not divide by the vanishing factor. The companion evaluates it with prefix and suffix products. Multiplying a zero amplitude by an infinite tanh⁡uj\tanh u_j is an avoidable numerical failure; it is not a definition of the derivative.

    Symmetries can also be imposed on amplitudes. For global spin flip F∣s⟩=∣−s⟩F|s\rangle=|-s\rangle,

    ψ±(s)=ψ(s)±ψ(−s)2\psi_\pm(s)=\frac{\psi(s)\pm\psi(-s)}{2}

    belongs to the corresponding parity sector, provided it is not the zero state. Differentiate this projection before normalizing. The odd projection can create nodes even when the original real RBM is positive. A symmetry label must refer to an operator that actually commutes with the Hamiltonian; it does not follow from a network's name or its parameter count.

    A known two-spin state with a nontrivial phase

    Take one open bond and Pauli matrices, with

    H2=−Z0Z1−g(X0+X1),g=0.8.H_2=-Z_0Z_1-g(X_0+X_1),\qquad g=0.8.

    This is not a two-site periodic convention that counts the bond twice. In the even basis

    ∣A⟩=∣00⟩+∣11⟩2,∣B⟩=∣01⟩+∣10⟩2,|A\rangle=\frac{|00\rangle+|11\rangle}{\sqrt2}, \qquad |B\rangle=\frac{|01\rangle+|10\rangle}{\sqrt2},

    the matrix is

    H2,+=(−1−2g−2g1).H_{2,+}=\begin{pmatrix}-1&-2g\\-2g&1\end{pmatrix}.

    Solving this two-dimensional problem gives

    d=1+4g2,k=d−12g,∣Ω⟩=∣A⟩+k∣B⟩1+k2,E0=−d.d=\sqrt{1+4g^2},\qquad k=\frac{d-1}{2g},\qquad |\Omega\rangle=\frac{|A\rangle+k|B\rangle}{\sqrt{1+k^2}}, \qquad E_0=-d.

    Now apply a diagonal unitary with a fixed phase:

    ∣Ψ⋆⟩=eiφZ0Z1∣Ω⟩,φ=0.35.|\Psi_\star\rangle=e^{i\varphi Z_0Z_1}|\Omega\rangle, \qquad \varphi=0.35.

    Its amplitudes, in integer order 0,1,2,30,1,2,3 with site 0 the least significant bit, are

    Ψ⋆=12(1+k2)(eiφke−iφke−iφeiφ).\Psi_\star= \frac{1}{\sqrt{2(1+k^2)}} \begin{pmatrix} e^{i\varphi}\\ k e^{-i\varphi}\\ k e^{-i\varphi}\\ e^{i\varphi} \end{pmatrix}.

    Thus the probabilities of 0000 and 1111 are 0.38249973500.3824997350 each; those of 0101 and 1010 are 0.11750026500.1175002650 each. Relative to the first component, the two antiparallel configurations have phase −0.7-0.7. Removing all phases preserves these four probabilities exactly.

    The tied one-hidden-unit ansatz

    ψw(s0,s1)=2cosh⁡[w(s0+s1)]\psi_w(s_0,s_1)=2\cosh[w(s_0+s_1)]

    has aligned-to-antialigned amplitude ratio cosh⁡(2w)\cosh(2w). Therefore it can represent the target if

    cosh⁡(2w)=k−1e2iφ.\cosh(2w)=k^{-1}e^{2i\varphi}.

    The analytic value w⋆=0.639519102574+0.388595573232iw_\star=0.639519102574+0.388595573232i is an independent representability check. The actual calculation separately minimizes

    L(w)=1−∣⟨Ψ⋆∣ψw⟩∣2⟨ψw∣ψw⟩\mathcal L(w)=1- \frac{|\langle\Psi_\star|\psi_w\rangle|^2} {\langle\psi_w|\psi_w\rangle}

    in the two real coordinates of ww, using analytic derivatives and three fixed starts. The optimizer is not initialized at w⋆w_\star.

    Initial wwFinal aligned state distanceTermination
    0.1+0.1i0.1+0.1i2.50×10−92.50\times10^{-9}precision-loss report
    0.5−0.2i0.5-0.2i4.61×10−134.61\times10^{-13}gradient criterion met
    −0.4+0.3i-0.4+0.3i3.34×10−113.34\times10^{-11}gradient criterion met

    The aligned distance is min⁡γ∥eiγΨw−Ψ⋆∥2\min_\gamma\|e^{i\gamma}\Psi_w-\Psi_\star\|_2. Start 0 remains the designated fit even though its solver status is unsuccessful: its state is accurate, but the requested optimizer stopping condition was not established. The negative final ww from start 2 represents the same function because cosh⁡\cosh is even. All starts and statuses are retained.

    Checking observables exposes a phase error

    For the untwisted ground state, ⟨X0+X1⟩=4g/d\langle X_0+X_1\rangle=4g/d. Conjugating the Pauli operators by eiφZ0Z1e^{i\varphi Z_0Z_1} gives

    ⟨Z0Z1⟩⋆=1d,⟨X0+X1⟩⋆=4gdcos⁡(2φ),⟨Y0Z1+Z0Y1⟩⋆=−4gdsin⁡(2φ).\begin{aligned} \langle Z_0Z_1\rangle_\star&=\frac1d,\\ \langle X_0+X_1\rangle_\star&=\frac{4g}{d}\cos(2\varphi),\\ \langle Y_0Z_1+Z_0Y_1\rangle_\star&=-\frac{4g}{d}\sin(2\varphi). \end{aligned}

    The standard Pauli convention Y=(0−ii0)Y=\left(\begin{smallmatrix}0&-i\\i&0\end{smallmatrix}\right) fixes the last sign.

    ObservableComplex targetSame probabilities, phases removed
    Z0Z1Z_0Z_10.52999894000.52999894000.52999894000.5299989400
    X0+X1X_0+X_11.29716975531.29716975531.69599660801.6959966080
    Y0Z1+Z0Y1Y_0Z_1+Z_0Y_1−1.0925910124-1.092591012400
    Equal Born probabilities for a complex two-spin target and a phase-blind state, alongside their different relative phases and off-diagonal observables.

    The fitted complex amplitude reproduces the target's density and relative phase. The phase-blind control has the same density but gives a different expectation of X0+X1X_0+X_1 and misses the nonzero Y0Z1+Z0Y1Y_0Z_1+Z_0Y_1 signal. The plotted fit is the fixed first start, including its retained precision-loss status.

    The example is exactly representable with one tied hidden unit. It does not prove that an arbitrary many-body state is compactly representable, that an optimizer will find such a representation, or that fermionic phase cancellations have disappeared. Those are separate statements with separate tests.

    From spin amplitudes to field wavefunctionals

    A finite spin state is a function on a discrete basis with counting measure. A scalar-field wavefunctional, after a spatial regulator is chosen, is a function of continuous field coordinates. Its norm is an integral with the declared configuration measure, and its energy includes kinetic derivatives and boundary conditions. Changing a neural width does not change that measure or remove a field cutoff.

    The continuous-wavefunctional calculation makes those extra controls explicit. The present spin example instead isolates representation and phase. Its reproducible companion directory, examples/computational-qft/neural-quantum-states/, retains the target, all fitted parameters, direct-derivative checks and selected observables. Verification and plotting read those outputs without fitting again.

    Summary

    A neural wavefunction represents a complex ray in Hilbert space. Probabilities, relative phases, symmetries and nodes all constrain that representation. The two-spin fit tests each of these directly: a phase-blind model passes the density test and fails off-diagonal observables, while a complex hidden-unit amplitude reproduces the target with explicitly recorded optimization accuracy.

    Exercises

    1. Differentiate through a hidden-factor zero

    Sum one hidden spin h=±1h=\pm1 in ea⋅s+hu(s)e^{a\cdot s+h u(s)}. Derive the direct derivative with respect to a parameter bb entering u=b+W⋅su=b+W\cdot s. Evaluate it at a=0a=0 and u=iπ/2u=i\pi/2. Explain why the logarithmic derivative is unsuitable there.

    Solution

    The sum is ea⋅s(eu+e−u)=2ea⋅scosh⁡ue^{a\cdot s}(e^u+e^{-u})=2e^{a\cdot s}\cosh u. Its derivative is 2ea⋅ssinh⁡u2e^{a\cdot s}\sinh u. At the stated point the amplitude vanishes but the derivative is 2i2i. The quotient ∂bψ/ψ=tanh⁡u\partial_b\psi/\psi=\tanh u is undefined. The direct derivative remains finite and can change the amplitude of a configuration that currently has zero probability. With several hidden spins, the same derivative multiplies every other 2cosh⁡uk2\cosh u_k; no division by the zero factor is needed.

    2. A density test at a quarter-turn phase

    Keep the two-spin ground state above but choose φ=π/4\varphi=\pi/4. Find its probabilities and the expectations of X0+X1X_0+X_1 and Y0Z1+Z0Y1Y_0Z_1+Z_0Y_1. Compare with the state obtained by removing its phases.

    Solution

    The unitary is diagonal, so the probabilities remain 1/[2(1+k2)]1/[2(1+k^2)] on each aligned configuration and k2/[2(1+k2)]k^2/[2(1+k^2)] on each antialigned configuration. For A=Z0Z1A=Z_0Z_1 and an operator BB anticommuting with AA,

    e−iφABeiφA=Bcos⁡(2φ)−iABsin⁡(2φ).e^{-i\varphi A}Be^{i\varphi A} =B\cos(2\varphi)-iAB\sin(2\varphi).

    Using ZX=iYZX=iY and ZY=−iXZY=-iX gives the conjugations required above. The untwisted state is real and has vanishing YZ+ZYYZ+ZY expectation. At φ=π/4\varphi=\pi/4, the twisted expectations are therefore 00 and −4g/d-4g/d, respectively. Removing phases restores 4g/d4g/d and 00. Neither the normalization nor any diagonal probability detects this difference.

    References

    • G. Carleo and M. Troyer, “Solving the Quantum Many-Body Problem with Artificial Neural Networks,” Science 355, 602–606 (2017), doi:10.1126/science.aag2302, arXiv:1606.02318v1. The section “Neural-Network Quantum States” contains the hidden-spin sum and product construction.
    • 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.3 and 3.5, especially the nodal qualification in footnote 14. This article uses the mathematical constructions, not a NetKet installation.

    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.