Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Learning Phases and Collective Variables

    A projection of spin configurations can reveal a collective coordinate without being told the magnetization. The next question is physical: what does that coordinate measure, which information has it discarded, and what survives a change of volume?

    We answer these questions with principal-component analysis (PCA) on exact independent samples of two small periodic Ising systems. Their complete finite-volume distributions are available, so sampling error can be compared with an exact covariance. The learned leading direction closely follows magnetization. The finite boxes nevertheless have no thermodynamic singularity, and a single coordinate does not determine their energy.

    Preparation. Covariance matrices, the variational characterization of an eigenvector, and the distinction between training and testing a physical observable. The equivariant-map article addresses a different question: imposing a transformation law on a map before fitting it.

    A finite ensemble with a known answer

    Let sx=±1s_x=\pm1 on the periodic square ΛL=ZL2\Lambda_L=\mathbb Z_L^2, with N=L2N=L^2. In units J=1J=1 the Hamiltonian and probability are

    H(s)=−∑x∈ΛL(sxsx+e^1+sxsx+e^2),PT(s)=e−H(s)/TZL(T).(1)H(s)=-\sum_{x\in\Lambda_L} \left(s_xs_{x+\hat e_1}+s_xs_{x+\hat e_2}\right), \qquad P_T(s)=\frac{e^{-H(s)/T}}{Z_L(T)}. \tag{1}

    Each positive-coordinate bond is counted once. The periodic boundary condition is part of the model. Define total magnetization M=∑xsxM=\sum_xs_x, magnetization density m=M/Nm=M/N, and energy density e=H/Ne=H/N.

    At zero external field, PT(−s)=PT(s)P_T(-s)=P_T(s), so ⟨M⟩=0\langle M\rangle=0 in every finite box. This does not imply that a typical low-temperature configuration has small ∣M∣|M|. It means that the two signs have equal probability. The original PCA study of raw Ising configurations provides the motivating example; its numerical system sizes and Monte Carlo data are distinct from the finite exact calculation here. Wang 2016, Eqs. (1)–(4) and Fig. 1 discussion.

    For L=3,4L=3,4, there are respectively 512512 and 65 53665\,536 states. We enumerate them, compute their Boltzmann weights, and draw directly from the resulting categorical distribution. The fixed temperatures are

    T=1.6, 2.0, 2.3, 2.6, 3.2.(2)T=1.6,\ 2.0,\ 2.3,\ 2.6,\ 3.2. \tag{2}

    Each size and temperature supplies 10241024 training configurations and another 10241024 independent test configurations. This removes Markov-chain equilibration and autocorrelation as issues in this particular experiment. It does not remove finite-sample fluctuations.

    The partition function has an independent row-transfer check. For row configurations a,b∈{±1}La,b\in\{\pm1\}^L, put

    h(a)=∑j=0L−1ajaj+1,v(a,b)=∑j=0L−1ajbj,(3)h(a)=\sum_{j=0}^{L-1}a_ja_{j+1}, \qquad v(a,b)=\sum_{j=0}^{L-1}a_jb_j, \tag{3}

    and

    Tab=exp⁡ ⁣[h(a)+h(b)2T+v(a,b)T],ZL(T)=tr⁡TL.(4)\mathcal T_{ab} =\exp\!\left[\frac{h(a)+h(b)}{2T}+\frac{v(a,b)}{T}\right], \qquad Z_L(T)=\operatorname{tr}\mathcal T^L. \tag{4}

    In a product of row-transfer factors, each row's two half-horizontal contributions add to one complete horizontal energy, and each adjacent row pair contributes its vertical bonds once. The trace closes the second periodic direction. The largest difference between this calculation and complete enumeration is 1.8×10−151.8\times10^{-15} in log⁡Z\log Z over the retained cases. This tests the ensemble normalization and edge counting independently of PCA.

    The learned direction is an optimization result

    At one fixed size, concatenate the five training groups into a matrix X∈Rntr×NX\in\mathbb R^{n_{\rm tr}\times N}, where ntr=5120n_{\rm tr}=5120. Every row is a raw spin configuration. No energy, magnetization or temperature labels enter the eigensolve.

    Use the empirical training mean and covariance,

    sˉ=1ntr∑α=1ntrs(α),C^=1ntr−1∑α=1ntr(s(α)−sˉ)(s(α)−sˉ)T.(5)\bar s=\frac1{n_{\rm tr}}\sum_{\alpha=1}^{n_{\rm tr}}s^{(\alpha)}, \qquad \widehat C=\frac1{n_{\rm tr}-1} \sum_{\alpha=1}^{n_{\rm tr}} (s^{(\alpha)}-\bar s)(s^{(\alpha)}-\bar s)^{\mathsf T}. \tag{5}

    For a unit vector vv, the variance of the projected centered data is vTC^vv^{\mathsf T}\widehat C v. A Lagrange multiplier for vTv=1v^{\mathsf T}v=1 gives

    C^vℓ=λ^ℓvℓ,λ^1≥λ^2≥⋯≥0.(6)\widehat C v_\ell=\widehat\lambda_\ell v_\ell, \qquad \widehat\lambda_1\geq\widehat\lambda_2\geq\cdots\geq0. \tag{6}

    The leading vector maximizes that variance; the following vectors maximize it subject to orthogonality. For a rank-kk orthogonal projection, the mean squared reconstruction loss is the sum of omitted eigenvalues, up to the normalization used in (5). Thus PCA optimizes a specified quadratic compression criterion. It does not optimize sensitivity to every physical observable.

    The explained-variance fractions are

    fℓ=λ^ℓtr⁡C^.(7)f_\ell=\frac{\widehat\lambda_\ell} {\operatorname{tr}\widehat C}. \tag{7}

    A large f1f_1 means that one linear direction captures much of this ensemble's variation.

    Why the exact leading direction is uniform

    The exact covariance of the equally weighted temperature mixture is

    Cxy=15∑j=15⟨sxsy⟩Tj.(8)C_{xy}=\frac15\sum_{j=1}^5 \langle s_xs_y\rangle_{T_j}. \tag{8}

    No mean subtraction appears because the exact spin means vanish. Translation invariance makes every row sum equal. Consequently the normalized uniform vector ux=1/Nu_x=1/\sqrt N is an eigenvector, with eigenvalue

    λunif=∑yCxy=⟨M2⟩mixN.(9)\lambda_{\rm unif} =\sum_y C_{xy} =\frac{\langle M^2\rangle_{\rm mix}}{N}. \tag{9}

    Why is it the leading eigenvector? For a connected finite ferromagnet at positive inverse temperature, every two-point function is strictly positive. One way to see the sign is to expand each bond factor as esxsy/T=cosh⁡(1/T)[1+sxsytanh⁡(1/T)]e^{s_xs_y/T}=\cosh(1/T)[1+s_xs_y\tanh(1/T)]. The partition-function spin sum selects edge subsets with even degree at every vertex. In the numerator of ⟨sxsy⟩\langle s_xs_y\rangle, it instead selects odd degree at x,yx,y and even degree elsewhere. Every surviving term is positive, and a path joining xx and yy supplies at least one such term.

    Therefore CC is an entrywise strictly positive matrix. The Perron–Frobenius theorem gives a unique positive leading eigenvector. Since uu is already positive and an eigenvector, it is that leading vector. This derives the magnetization interpretation without imposing uu on the empirical fit:

    uTs=MN,uTsN=m.(10)u^{\mathsf T}s=\frac{M}{\sqrt N}, \qquad \frac{u^{\mathsf T}s}{\sqrt N}=m. \tag{10}

    At infinite temperature the conclusion changes. Independent spins give C=IC=I, so all eigenvalues are equal and no direction is preferred. Translation symmetry alone does not select a unique principal component. Similarly, constraining M=0M=0 removes the uniform fluctuation entirely; other correlations must then carry the variation.

    Centering changes the coordinate's transformation law

    Orient the fitted v1v_1 by requiring v1Tu>0v_1^{\mathsf T}u>0. Its sign is otherwise arbitrary. Retain two coordinates,

    y(s)=v1T(s−sˉ),q(s)=v1Ts,y(s)=q(s)−v1Tsˉ.(11)y(s)=v_1^{\mathsf T}(s-\bar s), \qquad q(s)=v_1^{\mathsf T}s, \qquad y(s)=q(s)-v_1^{\mathsf T}\bar s. \tag{11}

    The centered score yy is the conventional PCA coordinate. The coordinate qq is exactly odd under spin flip:

    q(−s)=−q(s),y(−s)+y(s)=−2v1Tsˉ.(12)q(-s)=-q(s), \qquad y(-s)+y(s)=-2v_1^{\mathsf T}\bar s. \tag{12}

    An empirical centering offset can therefore move the apparent symmetry center of a scatter plot. It is not evidence for a physical external field. Our training samples were not artificially paired with their spin flips. Such pairing would enforce a zero empirical mean but would not create twice as many independent observations.

    The fitted vectors are close to uniform:

    SizeLeading variance fractionOverlap with uuCentering offset
    3×33\times30.776150.776150.99998840.99998840.031620.03162
    4×44\times40.714090.714090.99998270.9999827−0.02787-0.02787

    The exact pooled leading eigengaps are 6.67526.6752 and 10.966610.9666, respectively; the empirical covariance differs from the exact one in operator norm by 0.042150.04215 and 0.078020.07802. The stable leading direction has a quantitative spectral explanation. These numbers describe two separately fitted maps, with different input dimensions.

    The figure compares the actual variance spectrum with a physical test of the learned coordinate. The latter uses independent configurations and the exact finite-volume magnetization variance.

    One principal component dominates at both sizes; independent squared learned coordinates follow the exact finite-volume magnetization variance.

    Left: empirical explained-variance fractions from separate pooled-temperature PCA fits. Right: independent-test means of q2/Nq^2/N with configuration standard errors, compared with exact ⟨m2⟩\langle m^2\rangle at each temperature. The points and curves are nearly coincident because the fitted leading vectors are close to uniform. The smooth finite-volume change is not a determination of a thermodynamic critical point.

    Test against observables, not only clusters

    At T=2.3T=2.3, independent tests give the following comparisons. The RMSE is between q/Nq/\sqrt N and the exact configuration magnetization mm; the correlation is between q2/Nq^2/N and ee.

    SizeCoordinate RMSEEnergy correlationTest ⟨m2⟩\langle m^2\rangle
    L=3L=37.46×10−47.46\times10^{-4}−0.9881-0.98810.8020±0.00950.8020\pm0.0095
    L=4L=48.24×10−48.24\times10^{-4}−0.9769-0.97690.7531±0.00920.7531\pm0.0092

    The errors on the means use 10241024 independent configurations. They are conditional on the one fitted training map; they do not estimate variation across retraining experiments. All temperatures and both sizes are retained in the companion results.

    The strong energy correlation has a simple interpretation: strongly aligned configurations tend to have both large m2m^2 and low energy. It is not an invertible relation. Domain walls change the energy even at fixed magnetization, as the second exercise makes explicit.

    A size-independent normalized interpretation, q/N≃mq/\sqrt N\simeq m, is useful. It is still not zero-shot size transfer of a single PCA model. A vector with nine entries cannot directly act on a sixteen-component spin array. The periodic local-prediction example supplies a genuinely shared local rule that can act on both sizes.

    Finally, for every fixed finite LL, ZL(T)Z_L(T) is a finite sum of positive exponentials for T>0T>0. Its logarithm and the observables above are analytic. Separated clusters or a rapid variation can suggest an order parameter and motivate a finite-size study. Establishing a phase transition requires control of a thermodynamic limit and its scaling, not a classifier boundary or these two tiny boxes. Odd L=3L=3 also has odd NN, so an exactly zero magnetization configuration is absent; even the discrete support of a plot depends on volume.

    To test critical behavior, the finite-square Ising crossing calculation compares dimensionless magnetization moments across sizes. A direction learned from configurations at one size can identify a magnetization coordinate without establishing its infinite-volume scaling.

    Reproduction

    The pure ensemble is implemented in ising_samples.py; collective_checks.py creates or reuses the fixed sample archive and writes collective-results.json under examples/computational-qft/machine-learning/. It retains all temperature cells, exact covariance spectra, empirical centering, independent sample errors and partition checks. The data seeds are fixed before drawing; no fluctuation was replaced. The plotter reads those results without resampling. The chapter companion README gives the commands and archive contract.

    Summary

    A principal component is a variance-maximizing direction for a specified distribution. In the finite ferromagnetic Ising ensemble its leading exact direction is uniform, so a learned leading coordinate can be identified with magnetization and tested quantitatively. Centering, finite volume, sector constraints and omitted observables determine what that identification does—and does not—establish.

    Exercises

    1. Covariance, susceptibility and a finite peak

    Add a uniform field through Hh=H−hMH_h=H-hM. Derive the susceptibility per site χ=∂⟨m⟩h/∂h∣h=0\chi=\partial\langle m\rangle_h/\partial h|_{h=0} and relate it to the uniform covariance eigenvalue at one temperature. Explain why a peak of χ(T)\chi(T) on a finite lattice is not by itself a phase-transition proof.

    Solution

    Differentiating a normalized Gibbs expectation gives

    ∂⟨M⟩h∂h=1T(⟨M2⟩h−⟨M⟩h2).(13)\frac{\partial\langle M\rangle_h}{\partial h} =\frac1T\left(\langle M^2\rangle_h-\langle M\rangle_h^2\right). \tag{13}

    At zero field the finite system has ⟨M⟩=0\langle M\rangle=0. Translation invariance gives Cu=λunifuC u=\lambda_{\rm unif}u and λunif=⟨M2⟩/N\lambda_{\rm unif}=\langle M^2\rangle/N. Hence

    χ=⟨M2⟩NT=λunifT.(14)\chi=\frac{\langle M^2\rangle}{NT} =\frac{\lambda_{\rm unif}}{T}. \tag{14}

    This relation is for a single-temperature covariance. A covariance pooled over temperatures is a mixture; one cannot assign it a single susceptibility by inserting an arbitrary temperature.

    The finite partition sum and its derivatives are analytic for T>0T>0, and ∣M∣≤N|M|\leq N bounds χ≤N/T\chi\leq N/T. A smooth peak records enhanced finite-volume fluctuations. A singular thermodynamic response requires an appropriate growing-volume limit, with systematic finite-size analysis.

    2. Same magnetization, different energy

    On a periodic 4×44\times4 square, compare the stripe sx1,x2=(+,+,−,−)x2s_{x_1,x_2}=(+,+,-,-)_{x_2} with the checkerboard sx1,x2=(−1)x1+x2s_{x_1,x_2}=(-1)^{x_1+x_2}. Compute M,HM,H for each. What does this imply for a magnetization-only representation? How does empirical centering affect its spin-flip parity?

    Solution

    Both configurations have eight positive and eight negative spins, so M=0M=0. In the stripe, the sixteen bonds in the constant direction all have product +1+1. In the other direction, each row has two aligned and two anti-aligned bonds; their sum is zero. Thus Hstripe=−16H_{\rm stripe}=-16.

    Every nearest-neighbor checkerboard bond is anti-aligned. There are 2N=322N=32 such bonds, so Hchecker=+32H_{\rm checker}=+32. Therefore the exact uniform coordinate M/NM/\sqrt N assigns the same value to configurations whose energies differ by 4848. A small empirical nonuniformity in v1v_1 does not turn a single approximate magnetization coordinate into a complete energy representation.

    For any fixed linear vector vv, the uncentered coordinate vTsv^{\mathsf T}s is odd. Centering gives y(−s)=−y(s)−2vTsˉy(-s)=-y(s)-2v^{\mathsf T}\bar s. The origin of the centered plot is a statistical convention, while the physical spin-flip center is fixed by the transformation of the input.

    References

    • L. Wang, “Discovering Phase Transitions with Unsupervised Learning,” Physical Review B 94, 195105 (2016), journal article; arXiv:1606.00318v2, especially Eqs. (1)–(4) and the unconstrained and fixed-magnetization examples.

    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.