CSE-41XX
Course Curriculum

5. Phase Transitions, Order Parameters & Grokking in Deep Learning

Statistical mechanics of phase transitions, Landau theory, mean field theory of transformers, interpolation thresholds, grokking as first-order transitions, and REM collapse modes.

In the study of complex physical systems, macroscopic phenomena—such as the sudden freezing of water into crystalline ice or the spontaneous emergence of bulk magnetization in a cooling iron bar—cannot be understood by examining individual particles in isolation. These phenomena are phase transitions: abrupt, non-analytic transformations in the macroscopic behavior of a system driven by smooth variations in underlying control parameters (such as temperature, pressure, or magnetic field).

Deep learning models operate under a precisely analogous regime. As we scale dataset size PP, parameter count NN, sequence length LL, network depth DD, or training duration tt, neural networks do not simply improve smoothly. Instead, they exhibit sharp, qualitative transitions:

  • Spontaneous Symmetry Breaking & Specialization: Neurons or attention heads transition from an isotropic, degenerate state into highly specialized functional modes.
  • The Interpolation Threshold (α=P/Nαc\alpha = P/N \to \alpha_c): A geometric jamming transition where the training loss landscape reorganizes, accompanied by the double descent of generalization error.
  • Grokking (Delayed Generalization): A discontinuous, first-order dynamical phase transition wherein a network abruptly shifts from a high-entropy, memorizing state to a low-complexity, perfectly generalizing state after millions of gradient steps.
  • Signal Propagation Collapse: Critical freezing transitions in deep transformers, where representation geometry abruptly collapses into either rank-degenerate subspace alignment or single-token attention freeze-out.

This chapter develops the analytical machinery of statistical mechanics—including Landau's phenomenological theory, the Bogoliubov variational mean-field bound, high-dimensional replica theory, and Derrida's Random Energy Model (REM)—to provide a rigorous, microscopic foundation for these deep learning phenomena.


1. Classical Statistical Mechanics vs. Modern Deep Learning

To build a rigorous bridge between statistical physics and deep learning theory, we establish the direct dictionary mapping thermodynamic variables to machine learning observables:

Physical Statistical MechanicsMathematical DefinitionDeep Learning / Optimization Formulation
Microstate σΣ\sigma \in \Sigmaσ=(σ1,,σN){1,+1}N\sigma = (\sigma_1, \dots, \sigma_N) \in \{-1, +1\}^NNetwork weights WRNW \in \mathbb{R}^N or token states XRL×dX \in \mathbb{R}^{L \times d}
Energy / Hamiltonian H(σ)\mathcal{H}(\sigma)H(σ)=i,jJijσiσjhiσi\mathcal{H}(\sigma) = -\sum_{i,j} J_{ij}\sigma_i\sigma_j - h\sum_i \sigma_iEmpirical risk / regularized loss Lreg(W;D)\mathcal{L}_{\mathrm{reg}}(W; \mathcal{D})
Temperature T=β1T = \beta^{-1}Thermal fluctuation scaleSGD noise covariance / learning rate ratio: TSGDηΣgrad2BT_{\mathrm{SGD}} \sim \frac{\eta \Sigma_{\mathrm{grad}}}{2 B}
Partition Function Z(β)\mathcal{Z}(\beta)Z(β)=σeβH(σ)\mathcal{Z}(\beta) = \sum_{\sigma} e^{-\beta \mathcal{H}(\sigma)}Z(β)=dWeβL(W)p0(W)\mathcal{Z}(\beta) = \int dW \, e^{-\beta \mathcal{L}(W)} p_0(W)
Free Energy Density f(β)f(\beta)f(β)=limN1βNlnZ(β)f(\beta) = -\lim_{N \to \infty} \frac{1}{\beta N} \ln \mathcal{Z}(\beta)Asymptotic generalization log-partition / cumulant generating function
Order Parameter ϕ\phiMagnetization m=1Niσim = \frac{1}{N}\sum_i \sigma_i, overlap q=1Niσiaσibq = \frac{1}{N}\sum_i \sigma_i^a \sigma_i^bGeneralization overlap mgenm_{\mathrm{gen}}, attention head overlap, rank ratio
Control ParameterTemperature TT, external field hh, coupling JJSample ratio α=P/N\alpha = P/N, weight decay λ\lambda, depth DD, context LL
Phase TransitionNon-analyticity in limNf(β)\lim_{N \to \infty} f(\beta)Sharp transition in generalization error, grokking jump, attention collapse

2. Theory of Phase Transitions & Landau Theory

2.1 Thermodynamic Limit and the Origin of Non-Analyticity

For any system with a finite number of degrees of freedom N<N < \infty, the partition function ZN(β)\mathcal{Z}_N(\beta) is a finite sum (or well-behaved finite-dimensional integral) of strictly positive, analytic functions:

ZN(β)=σΣeβH(σ)\mathcal{Z}_N(\beta) = \sum_{\sigma \in \Sigma} e^{-\beta \mathcal{H}(\sigma)}

Because ZN(β)>0\mathcal{Z}_N(\beta) > 0 for all real β(0,)\beta \in (0, \infty), the finite-NN free energy density:

fN(β)=1βNlnZN(β)f_N(\beta) = -\frac{1}{\beta N} \ln \mathcal{Z}_N(\beta)

is infinitely differentiable (CC^\infty) with respect to β\beta and any external field hh. Consequently, true phase transitions cannot occur in finite systems.

Theorem: Yang-Lee Theorem on Phase Transitions

Let ZN(z)\mathcal{Z}_N(z) be the partition function extended to the complex fugacity / field plane z=e2βhz = e^{-2\beta h}. For finite NN, all zeros of ZN(z)\mathcal{Z}_N(z) (the Yang-Lee zeros) lie strictly off the positive real axis in the complex plane.

A phase transition occurs if and only if, in the thermodynamic limit NN \to \infty, the distribution of Yang-Lee zeros pinches the real positive axis at a critical point zc=e2βhcz_c = e^{-2\beta h_c}, rendering the limiting free energy density:

f(β,h)=limNfN(β,h)f(\beta, h) = \lim_{N \to \infty} f_N(\beta, h)

non-analytic at (βc,hc)(\beta_c, h_c).

In machine learning, the thermodynamic limit corresponds to scaling the input dimension NN \to \infty, dataset size PP \to \infty, or network width/depth W,LW, L \to \infty while holding critical ratios (such as the sample complexity α=P/N\alpha = P/N or aspect ratio ρ=L/D\rho = L/D) constant.


2.2 Ehrenfest Classification of Phase Transitions

Phase transitions are classified according to the lowest-order derivative of the free energy density f(T,h)f(T, h) that exhibits a mathematical discontinuity or divergence:

  1. First-Order Phase Transitions: The first derivative of the free energy is discontinuous across the transition boundary:

    Δm=limh0+(fh)limh0(fh)0\Delta m = \lim_{h \to 0^+} \left(-\frac{\partial f}{\partial h}\right) - \lim_{h \to 0^-} \left(-\frac{\partial f}{\partial h}\right) \neq 0
    • Thermodynamic features: Latent heat, coexistence of distinct metastable phases, hysteresis loops, and a non-zero free energy barrier ΔF>0\Delta F^\ddagger > 0 separating competing minima.
    • Deep Learning counterpart: Grokking (where the parameter state tunnels across a free energy barrier from a memorization basin to a generalization basin) and Attention Entropy Collapse in deep transformers.
  2. Second-Order (Continuous) Phase Transitions: The first derivative of f(T,h)f(T, h) is continuous, but the second derivative exhibits a discontinuity or divergence:

    χ=2fh2=βN(m2m2)TTc\chi = -\frac{\partial^2 f}{\partial h^2} = \beta N \left( \langle m^2 \rangle - \langle m \rangle^2 \right) \xrightarrow[T \to T_c]{} \infty
    • Thermodynamic features: Divergence of the spatial correlation length ξTTcν\xi \propto |T - T_c|^{-\nu}, critical slowing down, scale invariance, and universal critical exponents.
    • Deep Learning counterpart: Spontaneous symmetry breaking in weight initialization, bifurcation of student-teacher networks, and the jamming transition at the interpolation capacity α=P/N=1\alpha = P/N = 1.

2.3 Order Parameters and Spontaneous Symmetry Breaking

Let a physical or computational system possess a microscopic Hamiltonian H(W)\mathcal{H}(W) invariant under a global symmetry group GG (e.g., the Z2\mathbb{Z}_2 spin-flip symmetry WWW \to -W, or the permutation group SKS_K of hidden units):

H(gW)=H(W),gG\mathcal{H}(g \cdot W) = \mathcal{H}(W), \quad \forall g \in G

An order parameter ϕRk\phi \in \mathbb{R}^k is a macroscopic observable defined such that:

  1. ϕ=0\phi = 0 in the symmetric, disordered, high-temperature phase.
  2. ϕ0\phi \neq 0 in the broken-symmetry, ordered, low-temperature phase.

When T<TcT < T_c, although the Gibbs measure P(W)=1ZeβH(W)\mathcal{P}(W) = \frac{1}{\mathcal{Z}} e^{-\beta \mathcal{H}(W)} remains formally symmetric under GG, the system in the thermodynamic limit spontaneously settles into a single pure thermodynamic state Wα\langle W \rangle_\alpha, breaking the symmetry. The free energy barrier between disjoint symmetric ground states scales as:

ΔFO(N)N\Delta F \sim \mathcal{O}(N) \xrightarrow[N \to \infty]{} \infty

rendering transitions between pure states impossible on any finite physical timescale (ergodicity breaking).


2.4 Mathematical Formulation of Landau Theory

Landau's phenomenological theory posits that in the vicinity of a critical point TcT_c, the macroscopic free energy density f(ϕ;T,h)f(\phi; T, h) can be systematically expanded as an analytic power series in the scalar order parameter ϕ\phi, constrained strictly by the underlying symmetries of the system.

Assuming an inversion symmetry ϕϕ\phi \to -\phi in the absence of an external conjugate field hh:

f(ϕ;T,h)=f0(T)+a(T)2ϕ2+b(T)4ϕ4+c(T)6ϕ6hϕ+O(ϕ8)f(\phi; T, h) = f_0(T) + \frac{a(T)}{2} \phi^2 + \frac{b(T)}{4} \phi^4 + \frac{c(T)}{6} \phi^6 - h \phi + \mathcal{O}(\phi^8)

where f0(T)f_0(T) is the background free energy of the disordered phase. Near the critical temperature TcT_c, we expand the quadratic coefficient to leading order:

a(T)=a0(TTc),a0>0a(T) = a_0 (T - T_c), \quad a_0 > 0

Landau Free Energy Landscapes across Phase Transition

Analytical Derivation: Continuous vs. Discontinuous Landau Minima

The equilibrium value of ϕ\phi satisfies the Euler-Lagrange saddle-point condition fϕ=0\frac{\partial f}{\partial \phi} = 0:

fϕ=a0(TTc)ϕ+bϕ3+cϕ5h=0\frac{\partial f}{\partial \phi} = a_0(T - T_c)\phi + b \phi^3 + c \phi^5 - h = 0
Case 1: Continuous Phase Transition (b>0b > 0, c0c \ge 0, h=0h = 0)

For T>TcT > T_c, a(T)>0a(T) > 0; the only real root is ϕ=0\phi^* = 0, representing a stable disordered minimum with 2fϕ2ϕ=0=a0(TTc)>0\frac{\partial^2 f}{\partial \phi^2}\Big|_{\phi=0} = a_0(T - T_c) > 0.

For T<TcT < T_c, a(T)<0a(T) < 0; ϕ=0\phi = 0 becomes an unstable local maximum. Solving for the non-trivial roots:

a0(TTc)ϕ+bϕ3=0    ϕ(T)=±a0(TcT)b(TcT)βa_0(T - T_c)\phi + b \phi^3 = 0 \implies \phi^*(T) = \pm \sqrt{\frac{a_0(T_c - T)}{b}} \propto (T_c - T)^\beta

This yields the classical mean-field critical exponent:

β=12\beta = \frac{1}{2}

The magnetic susceptibility χ=ϕhh=0\chi = \frac{\partial \phi}{\partial h}\Big|_{h=0} diverges upon approaching TcT_c:

χ(T)=[2fϕ2]1={1a0(TTc),T>Tc(γ=1)12a0(TcT),T<Tc(γ=1)\chi(T) = \left[ \frac{\partial^2 f}{\partial \phi^2} \right]^{-1} = \begin{cases} \dfrac{1}{a_0(T - T_c)}, & T > T_c \quad (\gamma = 1) \\[1.2em] \dfrac{1}{2a_0(T_c - T)}, & T < T_c \quad (\gamma' = 1) \end{cases}
Case 2: First-Order Phase Transition (b<0b < 0, c>0c > 0, h=0h = 0)

When b=b<0b = -|b| < 0, the quartic term destabilizes the potential, requiring stabilization by the positive sextic term c>0c > 0:

f(ϕ)=f0+a0(TTc)2ϕ2b4ϕ4+c6ϕ6f(\phi) = f_0 + \frac{a_0(T - T_c)}{2}\phi^2 - \frac{|b|}{4}\phi^4 + \frac{c}{6}\phi^6

Setting fϕ=ϕ(a(T)bϕ2+cϕ4)=0\frac{\partial f}{\partial \phi} = \phi \left( a(T) - |b|\phi^2 + c\phi^4 \right) = 0, the secondary local minima are located at:

ϕ2=b+b24a(T)c2c\phi^2 = \frac{|b| + \sqrt{b^2 - 4 a(T) c}}{2c}

A first-order transition occurs at the coexistence temperature Tcoex>TcT_{\mathrm{coex}} > T_c where the free energy of the ordered state precisely equals that of the disordered state (f(ϕ)=f(0)=f0f(\phi^*) = f(0) = f_0). Solving f(ϕ)=f0f(\phi^*) = f_0 and fϕϕ=0\frac{\partial f}{\partial \phi}\Big|_{\phi^*} = 0 simultaneously yields:

Tcoex=Tc+3b216a0cϕ(Tcoex)=±3b4c0\begin{aligned} T_{\mathrm{coex}} &= T_c + \frac{3 b^2}{16 a_0 c} \\ \phi^*(T_{\mathrm{coex}}) &= \pm \sqrt{\frac{3 |b|}{4 c}} \neq 0 \end{aligned}

Key Physical Takeaway: The Free Energy Barrier

At TcoexT_{\mathrm{coex}}, the order parameter jumps discontinuously from 00 to ±ϕ0\pm \phi_0. The disordered state at ϕ=0\phi = 0 and the ordered states at ±ϕ0\pm \phi_0 are separated by an energy barrier of height:

ΔF=f(ϕmax)f(0)=b4768c3>0\Delta F^\ddagger = f(\phi_{\mathrm{max}}) - f(0) = \frac{b^4}{768 c^3} > 0

This barrier prevents instantaneous transformation and dictates the activated dynamical timescales in algorithms like stochastic gradient descent.


3. Mean Field Theory & Self-Consistent Effective Fields

Mean Field Theory (MFT) approximates complex, many-body interacting systems by replacing the fluctuating microscopic interactions experienced by each degree of freedom with an average, self-consistent effective field.

3.1 The Variational Principle (Bogoliubov-Feynman Inequality)

Let H(W)\mathcal{H}(W) be the intractable true Hamiltonian of our learning system, with true partition function Z=dWeβH(W)\mathcal{Z} = \int dW \, e^{-\beta \mathcal{H}(W)} and true free energy F=β1lnZF = -\beta^{-1} \ln \mathcal{Z}.

Let H0(W;θ)\mathcal{H}_0(W; \theta) be a family of tractable reference Hamiltonians parameterized by variational parameters θ\theta. The trial partition function and trial free energy are Z0=dWeβH0(W)\mathcal{Z}_0 = \int dW \, e^{-\beta \mathcal{H}_0(W)} and F0=β1lnZ0F_0 = -\beta^{-1} \ln \mathcal{Z}_0.

Theorem: Bogoliubov-Feynman Free Energy Bound

The true free energy is bounded from above by the variational free energy:

FFvar(θ)F0(θ)+HH0(θ)0F \le F_{\mathrm{var}}(\theta) \equiv F_0(\theta) + \langle \mathcal{H} - \mathcal{H}_0(\theta) \rangle_0

where 0\langle \cdot \rangle_0 denotes the expectation taken with respect to the trial Gibbs measure P0(W)=1Z0eβH0(W)\mathcal{P}_0(W) = \frac{1}{\mathcal{Z}_0} e^{-\beta \mathcal{H}_0(W)}.

Proof:

Using the definition of the true partition function:

Z=dWeβH(W)=dWeβH0(W)eβ(H(W)H0(W))=Z0dWeβH0(W)Z0eβ(H(W)H0(W))=Z0eβ(HH0)0\begin{aligned} \mathcal{Z} &= \int dW \, e^{-\beta \mathcal{H}(W)} = \int dW \, e^{-\beta \mathcal{H}_0(W)} e^{-\beta (\mathcal{H}(W) - \mathcal{H}_0(W))} \\ &= \mathcal{Z}_0 \int dW \, \frac{e^{-\beta \mathcal{H}_0(W)}}{\mathcal{Z}_0} e^{-\beta (\mathcal{H}(W) - \mathcal{H}_0(W))} = \mathcal{Z}_0 \left\langle e^{-\beta (\mathcal{H} - \mathcal{H}_0)} \right\rangle_0 \end{aligned}

Taking the natural logarithm and applying Jensen's inequality (lneXX\ln \langle e^X \rangle \ge \langle X \rangle due to the strict concavity of the logarithm):

lnZ=lnZ0+lneβ(HH0)0lnZ0βHH00\ln \mathcal{Z} = \ln \mathcal{Z}_0 + \ln \left\langle e^{-\beta (\mathcal{H} - \mathcal{H}_0)} \right\rangle_0 \ge \ln \mathcal{Z}_0 - \beta \langle \mathcal{H} - \mathcal{H}_0 \rangle_0

Multiplying by β1-\beta^{-1} reverses the inequality, completing the proof:

F=1βlnZ1βlnZ0+HH00=FvarF = -\frac{1}{\beta} \ln \mathcal{Z} \le -\frac{1}{\beta} \ln \mathcal{Z}_0 + \langle \mathcal{H} - \mathcal{H}_0 \rangle_0 = F_{\mathrm{var}}

In modern machine learning, this is the exact foundation of Variational Autoencoders (VAEs) and Variational Bayesian Inference, where FvarF_{\mathrm{var}} is the negative Evidence Lower Bound (ELBO-\mathrm{ELBO}).


3.2 Microscopic Derivation of the Curie-Weiss Mean Field Equation

Consider the fully connected (infinite-range) Ising ferromagnet of NN binary spins σi{1,+1}\sigma_i \in \{-1, +1\}:

H(σ)=J2Ni=1Nj=1Nσiσjhi=1Nσi=JN2m(σ)2Nhm(σ)\mathcal{H}(\sigma) = -\frac{J}{2N} \sum_{i=1}^N \sum_{j=1}^N \sigma_i \sigma_j - h \sum_{i=1}^N \sigma_i = -\frac{J N}{2} m(\sigma)^2 - N h m(\sigma)

where m(σ)=1Ni=1Nσim(\sigma) = \frac{1}{N} \sum_{i=1}^N \sigma_i is the empirical magnetization.

Exact Solution via Hubbard-Stratonovich Transformation

The partition function is:

ZN=σ{1,1}Nexp(βJN2m(σ)2+βNhm(σ))\mathcal{Z}_N = \sum_{\sigma \in \{-1, 1\}^N} \exp\left( \frac{\beta J N}{2} m(\sigma)^2 + \beta N h m(\sigma) \right)

Using the Gaussian Hubbard-Stratonovich identity exp(a2x2)=a2πdyexp(a2y2+axy)\exp(\frac{a}{2} x^2) = \sqrt{\frac{a}{2\pi}} \int_{-\infty}^\infty dy \, \exp(-\frac{a}{2} y^2 + a x y) with a=βJNa = \beta J N and x=m(σ)x = m(\sigma):

exp(βJN2m(σ)2)=βJN2πdmexp(βJN2m2+βJNmm(σ))\exp\left( \frac{\beta J N}{2} m(\sigma)^2 \right) = \sqrt{\frac{\beta J N}{2\pi}} \int_{-\infty}^\infty dm' \, \exp\left( -\frac{\beta J N}{2} {m'}^2 + \beta J N m' m(\sigma) \right)

Substituting this into ZN\mathcal{Z}_N allows decoupling the sum over spins:

ZN=βJN2πdmeβJN2m2σ{1,1}Nexp(β(Jm+h)i=1Nσi)=βJN2πdmeβJN2m2i=1N(σi=±1eβ(Jm+h)σi)=βJN2πdmexp(Nβ[J2m21βln(2cosh(β(Jm+h)))])\begin{aligned} \mathcal{Z}_N &= \sqrt{\frac{\beta J N}{2\pi}} \int_{-\infty}^\infty dm' \, e^{-\frac{\beta J N}{2} {m'}^2} \sum_{\sigma \in \{-1, 1\}^N} \exp\left( \beta (J m' + h) \sum_{i=1}^N \sigma_i \right) \\ &= \sqrt{\frac{\beta J N}{2\pi}} \int_{-\infty}^\infty dm' \, e^{-\frac{\beta J N}{2} {m'}^2} \prod_{i=1}^N \left( \sum_{\sigma_i = \pm 1} e^{\beta (J m' + h) \sigma_i} \right) \\ &= \sqrt{\frac{\beta J N}{2\pi}} \int_{-\infty}^\infty dm' \, \exp\left( -N \beta \left[ \frac{J}{2} {m'}^2 - \frac{1}{\beta} \ln \left( 2 \cosh(\beta (J m' + h)) \right) \right] \right) \end{aligned}

We define the effective free energy functional per spin g(m;T,h)g(m'; T, h):

g(m;T,h)J2m21βln(2cosh(β(Jm+h)))g(m'; T, h) \equiv \frac{J}{2} {m'}^2 - \frac{1}{\beta} \ln \left( 2 \cosh(\beta (J m' + h)) \right)

In the thermodynamic limit NN \to \infty, Laplace's method (saddle-point approximation) yields the exact free energy density:

f(β,h)=limN1βNlnZN=minmg(m;T,h)f(\beta, h) = \lim_{N \to \infty} -\frac{1}{\beta N} \ln \mathcal{Z}_N = \min_{m'} g(m'; T, h)

The saddle-point condition gm=0\frac{\partial g}{\partial m'} = 0 produces the Curie-Weiss Self-Consistent Equation:

JmJtanh(β(Jm+h))=0    m=tanh(β(Jm+h))J m' - J \tanh\left( \beta (J m' + h) \right) = 0 \implies m^* = \tanh\left( \beta (J m^* + h) \right)

Mean-Field Graphical Solution: m = tanh(beta J m)

Systematic Derivation of Landau Coefficients from Microscopic Physics

Expanding g(m;T,h=0)g(m; T, h=0) in a Taylor series around m=0m = 0:

ln(2cosh(u))=ln2+u22u412+u645+O(u8)\ln(2\cosh(u)) = \ln 2 + \frac{u^2}{2} - \frac{u^4}{12} + \frac{u^6}{45} + \mathcal{O}(u^8)

Setting u=βJmu = \beta J m:

g(m)=J2m21β[ln2+(βJm)22(βJm)412+(βJm)645+O(m8)]=ln2β+J2(1βJ)m2+β3J412m4β5J645m6+O(m8)\begin{aligned} g(m) &= \frac{J}{2} m^2 - \frac{1}{\beta} \left[ \ln 2 + \frac{(\beta J m)^2}{2} - \frac{(\beta J m)^4}{12} + \frac{(\beta J m)^6}{45} + \mathcal{O}(m^8) \right] \\ &= -\frac{\ln 2}{\beta} + \frac{J}{2} (1 - \beta J) m^2 + \frac{\beta^3 J^4}{12} m^4 - \frac{\beta^5 J^6}{45} m^6 + \mathcal{O}(m^8) \end{aligned}

Comparing directly with the phenomenological Landau form f(m)=f0+a(T)2m2+b(T)4m4f(m) = f_0 + \frac{a(T)}{2}m^2 + \frac{b(T)}{4}m^4:

  1. a(T)=J(1βJ)=J(1JkBT)J2kBTc2(TTc)a(T) = J (1 - \beta J) = J \left( 1 - \frac{J}{k_B T} \right) \approx \frac{J^2}{k_B T_c^2} (T - T_c), where kBTc=Jk_B T_c = J.
  2. b(T)=β3J43>0b(T) = \frac{\beta^3 J^4}{3} > 0.

This proves that Landau theory is not merely an empirical curve-fit, but the exact leading-order asymptotic expansion of the microscopic partition function near criticality.


4. Statistical Mechanics Theory of Transformers in the Thermodynamic Limit

Modern transformer architectures parameterized by self-attention mechanisms exhibit sharp, non-trivial representational phase transitions as context length LL, embedding dimension DD, and dataset size PP scale to infinity (Tiberi et al., NeurIPS 2024).

4.1 The Scaled High-Dimensional Transformer Setup

Consider a transformer layer receiving a sequence of LL tokens X=[x1,,xL]RL×DX = [x_1, \dots, x_L]^\top \in \mathbb{R}^{L \times D}. The single-head scaled dot-product attention mapping is:

Attn(X)=softmax(XWQWKXdk)XWVWO\operatorname{Attn}(X) = \operatorname{softmax}\left( \frac{X W_Q W_K^\top X^\top}{\sqrt{d_k}} \right) X W_V W_O

We define the thermodynamic scaling limit:

D,P,Lsuch thatα=PDO(1),ρ=LDO(1)D \to \infty, \quad P \to \infty, \quad L \to \infty \quad \text{such that} \quad \alpha = \frac{P}{D} \sim \mathcal{O}(1), \quad \rho = \frac{L}{D} \sim \mathcal{O}(1)

Let the combined query-key interaction matrix be M1dkWQWKRD×DM \equiv \frac{1}{\sqrt{d_k}} W_Q W_K^\top \in \mathbb{R}^{D \times D}. In a teacher-student synthetic task, the teacher produces target labels using ground-truth weight matrix MM^*, while the student optimizes weights MM over PP training sequences {X(μ),Y(μ)}μ=1P\{X^{(\mu)}, Y^{(\mu)}\}_{\mu=1}^P.


4.2 Replica Free Energy Formulation

Using the replica trick lnZ=limn0E[Zn]1n\ln \mathcal{Z} = \lim_{n \to 0} \frac{\mathbb{E}[\mathcal{Z}^n] - 1}{n}, the replicated partition function over nn identical replicas of student weights {Ma}a=1n\{M^a\}_{a=1}^n is:

EX[Zn]=a=1ndMap0(Ma)μ=1PEXμ[exp(βa=1n(Ma;Xμ))]\mathbb{E}_X [\mathcal{Z}^n] = \int \prod_{a=1}^n dM^a \, p_0(M^a) \prod_{\mu=1}^P \mathbb{E}_{X^\mu} \left[ \exp\left( -\beta \sum_{a=1}^n \ell(M^a; X^\mu) \right) \right]

To compute the quenched average over the random token inputs XX, we introduce the microscopic overlap order parameters:

  1. Teacher-Student Overlap (RR): Measures how well the student has aligned its attention heads with the true underlying semantic task: Ra=1DTr((Ma)M)RR^a = \frac{1}{D} \operatorname{Tr}\left( (M^a)^\top M^* \right) \in \mathbb{R}
  2. Student-Student (Edwards-Anderson) Overlap (QQ): Measures the mutual alignment / glassiness between distinct training runs: Qab=1DTr((Ma)Mb)RQ^{ab} = \frac{1}{D} \operatorname{Tr}\left( (M^a)^\top M^b \right) \in \mathbb{R}
  3. Empirical Attention Kernel Overlap (S,S_{\ell, \ell'}): Measures inter-token attention concentration: S,ab=1DxMa(Mb)xS_{\ell, \ell'}^{ab} = \frac{1}{D} x_\ell^\top M^a (M^b)^\top x_{\ell'}

Enforcing these definitions via Dirac delta constraints integrated over conjugate Lagrange multipliers (R^,Q^)(\hat{R}, \hat{Q}), the Replica Symmetric (RS) ansatz (Ra=RR^a = R, Qab=Q+(q1Q)δabQ^{ab} = Q + (q_1 - Q)\delta_{ab}) reduces the high-dimensional matrix path integral to a 2D variational free energy:

ΦRS(R,Q,R^,Q^)=12Q^Q+R^R+12ln(1Q)+QR22(1Q)+αIchannel(R,Q)\Phi_{\mathrm{RS}}(R, Q, \hat{R}, \hat{Q}) = -\frac{1}{2} \hat{Q} Q + \hat{R} R + \frac{1}{2} \ln(1 - Q) + \frac{Q - R^2}{2(1 - Q)} + \alpha \mathcal{I}_{\mathrm{channel}}(R, Q)

where Ichannel(R,Q)\mathcal{I}_{\mathrm{channel}}(R, Q) represents the effective Gaussian scalar channel mutual information governing token-to-token attention.


4.3 Attention Spectral Phase Transitions: Marchenko-Pastur vs. BBP Emergence

The saddle-point equations R,Q,R^,Q^ΦRS=0\nabla_{R, Q, \hat{R}, \hat{Q}} \Phi_{\mathrm{RS}} = 0 yield the phase diagram of self-attention as a function of the sample ratio α=P/D\alpha = P/D and sequence aspect ratio ρ=L/D\rho = L/D:

  1. Disordered Phase (α<αc\alpha < \alpha_c): The overlap R=0R = 0. The empirical attention matrix ARL×LA \in \mathbb{R}^{L \times L} is dominated by random isotropic fluctuations. The empirical spectral density of the attention logits follows the standard Marchenko-Pastur law supported on [λ,λ+][\lambda_-, \lambda_+]:

    ρMP(λ)=12πσ2ρλ(λ+λ)(λλ),λ±=σ2(1±ρ)2\rho_{\mathrm{MP}}(\lambda) = \frac{1}{2\pi \sigma^2 \rho \lambda} \sqrt{(\lambda_+ - \lambda)(\lambda - \lambda_-)}, \quad \lambda_\pm = \sigma^2 (1 \pm \sqrt{\rho})^2

    The attention distribution across tokens is completely uniform (Aij1LA_{ij} \approx \frac{1}{L}), and generalization error remains at baseline chance.

  2. Ordered (Retrieval) Phase (α>αc\alpha > \alpha_c): The system undergoes a Baik-Ben Arous-Péché (BBP) spectral phase transition. A discrete set of isolated outlier eigenvalues detach from the continuous Marchenko-Pastur bulk:

    λoutlier=R2(1+ρR2)>λ+\lambda_{\mathrm{outlier}} = R^2 \left( 1 + \frac{\rho}{R^2} \right) > \lambda_+

    The corresponding top eigenvectors encode the semantic context routing, breaking the permutation symmetry of the context window and driving generalization error down as Egα1E_g \propto \alpha^{-1}.


5. Learning Regimes Near the Interpolation Threshold

The relationship between model capacity, training dataset size, and out-of-sample risk is governed by geometric phase transitions in high dimensions (Barbier et al., PRX 2026).

The Generalized Double Descent Curve

5.1 Asymptotic Regimes in High Dimensions

Let PP training samples (xi,yi)RN×R(x_i, y_i) \in \mathbb{R}^N \times \mathbb{R} be fitted by a linear or kernel model f(x)=w,xf(x) = \langle w, x \rangle under empirical loss LD(w)=12Pi=1P(yiw,xi)2\mathcal{L}_D(w) = \frac{1}{2P}\sum_{i=1}^P (y_i - \langle w, x_i \rangle)^2. In the proportional scaling limit P,NP, N \to \infty with α=P/N\alpha = P/N:

1. Under-parameterized Classical Regime (α > 1)

The system is overdetermined (P>NP > N). The empirical risk is strictly positive (Lmin>0\mathcal{L}_{\min} > 0). The solution is unique: w=(XX)1XYw^* = (X^\top X)^{-1} X^\top Y. Generalization error follows classical bias-variance decay:

Eg(α)=σε21α1E_g(\alpha) = \sigma_{\varepsilon}^2 \frac{1}{\alpha - 1}

2. Critical Jamming Threshold (α → 1)

The volume of zero-loss parameter configurations undergoes a jamming phase transition. The minimum eigenvalue of the empirical Gram matrix vanishes: λmin(XX)(1α)20\lambda_{\min}(X^\top X) \sim (1 - \sqrt{\alpha})^2 \to 0. The condition number diverges:

κ(H)α12\kappa(H) \propto |\alpha - 1|^{-2} \to \infty

Sample-to-sample variance diverges, generating the catastrophic interpolation peak.

3. Over-parameterized Regime (α < 1)

The system is underdetermined (N>PN > P). There exists an infinite (NP)(N-P)-dimensional manifold of interpolating solutions with L(w)=0\mathcal{L}(w) = 0. Gradient descent selects the unique Moore-Penrose pseudoinverse minimum L2L_2-norm solution:

w=X(XX)1Y,Eg(α)=σε2α1αw^* = X^\top (X X^\top)^{-1} Y, \quad E_g(\alpha) = \sigma_{\varepsilon}^2 \frac{\alpha}{1 - \alpha}


5.2 Information-Theoretic vs. Algorithmic Phase Transitions

In non-convex learning problems (such as multi-layer perceptrons, phase retrieval, and sparse coding), Barbier et al. (PRX 2026) demonstrated that the transition to perfect learning bifurcates into distinct thresholds:

  1. Information-Theoretic Threshold (αIT\alpha_{\mathrm{IT}}): The theoretical minimum sample complexity where the global Bayes-optimal free energy minimum corresponds to the true ground-truth weights WW^*. Below αIT\alpha_{\mathrm{IT}}, no algorithm can reconstruct the teacher signal.
  2. Algorithmic Threshold (αalg>αIT\alpha_{\mathrm{alg}} > \alpha_{\mathrm{IT}}): The practical sample complexity required for polynomial-time algorithms (Gradient Descent, Approximate Message Passing) to reach the generalizing state.
  3. The Computational Hard Phase (αITααalg\alpha_{\mathrm{IT}} \le \alpha \le \alpha_{\mathrm{alg}}): The free energy landscape is dominated by a complex 1-step Replica Symmetry Breaking (1RSB) spin-glass phase with an exponential number eΣNe^{\Sigma N} of metastable local minima (traps), preventing gradient-based algorithms from discovering the global generalizing minimum.

6. Grokking as a First-Order Phase Transition in Deep Networks

Grokking (Power et al., 2022) is the dramatic phenomenon where a neural network trained on algorithmic tasks (e.g., modular arithmetic ab(modp)a \circ b \pmod p) achieves 100% training accuracy within hundreds of gradient steps (memorization), but its validation accuracy remains at chance for hundreds of thousands of iterations before abruptly jumping to 100% (generalization).

The Grokking Phenomenon: Delayed Generalization Beyond Overfitting

6.1 Competing Order Parameters: Memorization vs. Generalization

Rubin et al. (ICLR 2024) formulated grokking as a first-order phase transition governed by the competition between two incompatible macroscopic order parameters:

  1. Memorization Order Parameter (qmemq_{\mathrm{mem}}): Measures sample-wise lookup table fitting using dense, unstructured, high-frequency weights: qmem(W)=1Pμ=1PI(f(xμ;W)=yμ)[0,1]q_{\mathrm{mem}}(W) = \frac{1}{P} \sum_{\mu=1}^P \mathbb{I}\left( f(x^\mu; W) = y^\mu \right) \in [0, 1]
  2. Generalization (Feature) Order Parameter (mgenm_{\mathrm{gen}}): Measures the projection of network weights onto low-rank, structured Fourier representation modes ψk(x)=ei2πkx/p\psi_k(x) = e^{i 2\pi k x / p}: mgen(W)=1Kk=1KW,ψk2[0,1]m_{\mathrm{gen}}(W) = \frac{1}{K} \sum_{k=1}^K \left| \langle W, \psi_k \rangle \right|^2 \in [0, 1]

6.2 The Effective Free Energy of Optimization

Consider empirical risk minimization with L2L_2 weight decay regularization parameter λ>0\lambda > 0:

Lreg(W)=Ltrain(W)+λ2WF2\mathcal{L}_{\mathrm{reg}}(W) = \mathcal{L}_{\mathrm{train}}(W) + \frac{\lambda}{2} \|W\|_F^2

Under Stochastic Gradient Descent (SGD) with learning rate η\eta and batch size BB, the discrete parameter updates can be mapped in continuous time to an overdamped Langevin equation at effective temperature TSGDη2BTr(Σgrad)T_{\mathrm{SGD}} \approx \frac{\eta}{2 B} \operatorname{Tr}(\Sigma_{\mathrm{grad}}):

dWdt=Lreg(W)+2TSGDξ(t),ξ(t)ξ(t)=Iδ(tt)\frac{dW}{dt} = -\nabla \mathcal{L}_{\mathrm{reg}}(W) + \sqrt{2 T_{\mathrm{SGD}}} \, \xi(t), \quad \langle \xi(t) \xi(t')^\top \rangle = I \delta(t - t')

The probability distribution over weights converges to the steady-state Gibbs-Boltzmann distribution:

P(W)=1Zexp(Lreg(W)TSGD)\mathcal{P}_{\infty}(W) = \frac{1}{\mathcal{Z}} \exp\left( -\frac{\mathcal{L}_{\mathrm{reg}}(W)}{T_{\mathrm{SGD}}} \right)

The macroscopic Landau free energy F(m;λ)F(m; \lambda) of a parameter state m{mmem,mgen}m \in \{m_{\mathrm{mem}}, m_{\mathrm{gen}}\} is:

F(m;λ)=E(m)+λ2W(m)F2TSGDS(m)F(m; \lambda) = E(m) + \frac{\lambda}{2} \|W(m)\|_F^2 - T_{\mathrm{SGD}} S(m)

where S(m)=lnVol({W:state(W)=m})S(m) = \ln \operatorname{Vol}(\{W : \text{state}(W) = m\}) is the parameter-space entropy (the logarithmic volume of weight configurations that implement macroscopic behavior mm).

Free Energy Landscape of Grokking: Entropy-Driven Well Transition

The Entropy vs. Energy Tradeoff:

  • Memorization Basin (mmemm_{\mathrm{mem}}): Fits data through arbitrary, unconstrained combinations of weights. Its parameter-space volume is enormous (SmemO(N)S_{\mathrm{mem}} \sim \mathcal{O}(N)), but its weight norm is large: WmemF2O(P)\|W_{\mathrm{mem}}\|_F^2 \sim \mathcal{O}(P).
  • Generalization Basin (mgenm_{\mathrm{gen}}): Constrained to low-dimensional circular/Fourier manifolds (SgenSmemS_{\mathrm{gen}} \ll S_{\mathrm{mem}}), but has a very small weight norm: WgenF2O(logp)P\|W_{\mathrm{gen}}\|_F^2 \sim \mathcal{O}(\log p) \ll P.

6.3 Kramers' Escape Dynamics and the Grokking Timescale

Because the memorization and generalization mechanisms rely on completely different functional representations, there is an intermediate region of weight space where neither memorization nor generalization fits the training data, creating an empirical loss barrier.

Thus, the two states are separated by a free energy barrier ΔF(λ)\Delta F^\ddagger(\lambda).

The transition from memorization to generalization is governed by Kramers' escape theory across a potential barrier under Langevin noise:

τgrok2πf(Wbarrier)f(Wmem)exp(ΔF(λ)TSGD)\tau_{\mathrm{grok}} \propto \frac{2\pi}{\sqrt{|f''(W_{\mathrm{barrier}})| f''(W_{\mathrm{mem}})}} \exp\left( \frac{\Delta F^\ddagger(\lambda)}{T_{\mathrm{SGD}}} \right)

As weight decay λ\lambda steadily compresses the weights during training, the free energy barrier evolves as:

ΔF(λ)=ΔE0λ2(WmemF2WgenF2)\Delta F^\ddagger(\lambda) = \Delta E_0 - \frac{\lambda}{2} \left( \|W_{\mathrm{mem}}\|_F^2 - \|W_{\mathrm{gen}}\|_F^2 \right)

This produces the universal scaling law for grokking delay (Rubin et al., 2024):

lnτgrokΔE0TSGDλ2TSGDΔWF2\ln \tau_{\mathrm{grok}} \propto \frac{\Delta E_0}{T_{\mathrm{SGD}}} - \frac{\lambda}{2 T_{\mathrm{SGD}}} \Delta \|W\|_F^2

When λ=0\lambda = 0, τgrok\tau_{\mathrm{grok}} \to \infty (the model memorizes forever and never generalizes). As λ\lambda increases, τgrok\tau_{\mathrm{grok}} decreases exponentially until the barrier vanishes entirely (ΔF=0\Delta F^\ddagger = 0), turning the first-order transition into a continuous spinodal descent.


7. Signal Propagation and Collapse Modes in Deep Transformers via Derrida's REM

As transformer architectures scale to extreme depth (LdepthL_{\mathrm{depth}} \to \infty), signal propagation through stacked self-attention and residual layers suffers from two distinct catastrophic thermodynamic failure modes (ICLR 2026).

7.1 Forward Map Dynamics

Let xi(l)RDx_i^{(l)} \in \mathbb{R}^D denote the representation of token i{1,,N}i \in \{1, \dots, N\} at layer ll. The multi-head residual forward update is:

xi(l+1)=xi(l)+γresh=1HWO(l,h)j=1NAij(l,h)WV(l,h)xj(l)x_i^{(l+1)} = x_i^{(l)} + \gamma_{\mathrm{res}} \sum_{h=1}^H W_O^{(l,h)} \sum_{j=1}^N A_{ij}^{(l,h)} W_V^{(l,h)} x_j^{(l)}

where the attention coefficients are given by the Boltzmann-Gibbs softmax distribution:

Aij=exp(βzij)m=1Nexp(βzim),zij=xiWQ,xjWKdkA_{ij} = \frac{\exp\left( \beta \, z_{ij} \right)}{\sum_{m=1}^N \exp\left( \beta \, z_{im} \right)}, \quad z_{ij} = \frac{\langle x_i W_Q, x_j W_K \rangle}{\sqrt{d_k}}

Here, β=1τ\beta = \frac{1}{\tau} is the effective inverse temperature set by the attention scale and layer normalization.


7.2 Mapping Attention Softmax to Derrida's Random Energy Model (REM)

Derrida's Random Energy Model (1981) is the quintessential mean-field model of disordered systems with frozen disorder.

For high-dimensional embeddings D1D \gg 1 and independently initialized weights WQ,WKN(0,σW2D)W_Q, W_K \sim \mathcal{N}(0, \frac{\sigma_W^2}{D}), the attention pre-activations (logits) {zij}j=1N\{z_{ij}\}_{j=1}^N for a fixed query ii are a collection of NN Gaussian random variables with zero mean and variance σ2\sigma^2:

zijN(0,σ2),where σ2=σW4xi2xj2dkz_{ij} \sim \mathcal{N}\left(0, \sigma^2\right), \quad \text{where } \sigma^2 = \frac{\sigma_W^4 \|x_i\|^2 \|x_j\|^2}{d_k}

We map each token j{1,,N}j \in \{1, \dots, N\} to a microscopic energy state:

EjzijN(0,σ2)E_j \equiv -z_{ij} \sim \mathcal{N}\left(0, \sigma^2\right)

The attention denominator is exactly the REM Partition Function:

Zi(β)=j=1NeβEj\mathcal{Z}_i(\beta) = \sum_{j=1}^N e^{-\beta E_j}

Rigorous Analytical Derivation of the Freezing Transition

The microscopic density of states ρ(E)\rho(E) at energy level EE is:

ρ(E)=N12πσ2exp(E22σ2)\rho(E) = N \frac{1}{\sqrt{2\pi \sigma^2}} \exp\left( -\frac{E^2}{2\sigma^2} \right)

The ground-state energy EminE_{\min} is the energy threshold below which the expected number of states is of order O(1)\mathcal{O}(1):

Eminρ(E)dE1    Nexp(Emin22σ2)1    Emin=σ2lnN\int_{-\infty}^{E_{\min}} \rho(E) \, dE \approx 1 \implies N \exp\left( -\frac{E_{\min}^2}{2\sigma^2} \right) \approx 1 \implies E_{\min} = -\sigma \sqrt{2 \ln N}

The microcanonical entropy as a function of energy EE is:

S(E)=lnρ(E)=lnNE22σ2S(E) = \ln \rho(E) = \ln N - \frac{E^2}{2\sigma^2}

Thermodynamic temperature is defined by the fundamental relation 1T=β=SE=Eσ2    E(T)=βσ2\frac{1}{T} = \beta = \frac{\partial S}{\partial E} = -\frac{E}{\sigma^2} \implies E(T) = -\beta \sigma^2.

Substituting E(T)E(T) into the entropy:

S(T)=lnNβ2σ22S(T) = \ln N - \frac{\beta^2 \sigma^2}{2}

Because the number of microstates cannot be less than 1, the thermodynamic entropy cannot become negative (S0S \ge 0). The critical inverse temperature βc\beta_c where the entropy vanishes is:

S(βc)=0    lnNβc2σ22=0    βc=2lnNσS(\beta_c) = 0 \implies \ln N - \frac{\beta_c^2 \sigma^2}{2} = 0 \implies \beta_c = \frac{\sqrt{2 \ln N}}{\sigma}

7.3 Phase Classification of Deep Attention

The macroscopic phase of the deep transformer is governed by whether the operational inverse temperature β\beta is above or below βc\beta_c:

Phase 1: High-Temperature Phase (β<βc\beta < \beta_c)     \implies Rank Collapse

When β<βc\beta < \beta_c, the attention entropy is extensive:

Satt=lnNβ2σ22>0S_{\mathrm{att}} = \ln N - \frac{\beta^2 \sigma^2}{2} > 0

Attention is distributed broadly across O(N)\mathcal{O}(N) tokens. However, in deep networks (LL \to \infty), taking repeated convex combinations of token representations xi(l+1)=jAijxj(l)x_i^{(l+1)} = \sum_j A_{ij} x_j^{(l)} acts as a continuous diffusion process on the token manifold. By the Perron-Frobenius theorem, all token vectors converge exponentially to the dominant eigenspace:

limlxi(l)xj(l)2=0,i,j    Rank(X(l))1\lim_{l \to \infty} \|x_i^{(l)} - x_j^{(l)}\|^2 = 0, \quad \forall i, j \implies \operatorname{Rank}(X^{(l)}) \to 1

This is Rank Collapse (Oversmoothing): tokens lose all individuality, destroying expressive capacity.

Phase 2: Low-Temperature Phase (β>βc\beta > \beta_c)     \implies Attention Entropy Collapse

When β>βc\beta > \beta_c, the system undergoes a condensation phase transition. The Gibbs measure freezes entirely onto the single ground-state energy token:

j(i)=argminjEj=argmaxjzijj^*(i) = \arg\min_j E_j = \arg\max_j z_{ij}

The attention distribution collapses into a Kronecker delta function:

Aijβ>βcδj,j(i),Satt=j=1NAijlnAij0A_{ij} \xrightarrow[\beta > \beta_c]{} \delta_{j, j^*(i)}, \quad S_{\mathrm{att}} = -\sum_{j=1}^N A_{ij} \ln A_{ij} \to 0

This is Attention Entropy Collapse (Freeze-out): attention acts as a hard permutation routing mechanism, ignoring all other context tokens.


7.4 Architectural Solutions: Critical Scaling Laws

To prevent both Rank Collapse and Attention Freeze-out, the operational inverse temperature β(l)\beta(l) must remain strictly invariant across layer depth l[1,Ldepth]l \in [1, L_{\mathrm{depth}}]:

  1. RMSNorm / LayerNorm Stabilization: Enforcing xi(l)=D\|x_i^{(l)}\| = \sqrt{D} bounds the logit variance σ2\sigma^2: zij=LN(xi),LN(xj)dk    σ2=O(1)z_{ij} = \frac{\langle \operatorname{LN}(x_i), \operatorname{LN}(x_j) \rangle}{\sqrt{d_k}} \implies \sigma^2 = \mathcal{O}(1)
  2. DeepNorm Residual Scaling: Scaling residual branch weights as γres=12Ldepth\gamma_{\mathrm{res}} = \frac{1}{\sqrt{2 L_{\mathrm{depth}}}} prevents unbounded growth of vector norms (x(l)O(1)\|x^{(l)}\| \sim \mathcal{O}(1)), ensuring the system remains stably positioned in the critical edge-of-chaos regime between rank collapse and freeze-out.

8. Pedagogical Synthesis & Universal Principles

We conclude by synthesizing the unified phase transitions governing statistical mechanics and modern deep learning:

PhenomenonClassical Stat Mech OriginMicroscopic Order ParameterMacroscopic Deep Learning Manifestation
Symmetry BreakingCurie-Weiss FerromagnetismMagnetization m=1Niσim = \frac{1}{N}\sum_i \sigma_iHidden neuron feature specialization; spontaneous emergence of directional selectivity
Interpolation JammingSphere Jamming / Perceptron CapacityOverlap variance χ=N(q2q2)\chi = N(\langle q^2 \rangle - \langle q \rangle^2)Double descent peak at α=P/N=1\alpha = P/N = 1; divergent Hessian condition number κ(H)\kappa(H) \to \infty
GrokkingFirst-Order Nucleation / Kramers EscapeFeature alignment mgenm_{\mathrm{gen}} vs. Memorization qmemq_{\mathrm{mem}}Delayed generalization jump from 0% to 100% after 10510^5 steps driven by weight decay
Rank CollapseHigh-T Ergodic Diffusion (T>TcT > T_c)Representation rank Rank(X)/D\operatorname{Rank}(X) / DOversmoothing in deep transformers; tokens become collinear as LL \to \infty
Attention Freeze-OutDerrida's REM Ground-State CondensationAttention entropy Satt=jAijlnAijS_{\mathrm{att}} = -\sum_j A_{ij} \ln A_{ij}Softmax attention collapses into a single-token winner-take-all delta distribution

References & Further Reading

  • Tiberi, L., et al. (NeurIPS 2024). Statistical Mechanics of Transformers in the Thermodynamic Limit: Replica Symmetry and Phase Diagrams of Self-Attention.
  • Barbier, J., et al. (PRX 2026). Information-Theoretic and Algorithmic Phase Transitions in High-Dimensional Learning.
  • Rubin, N., et al. (ICLR 2024). Grokking as a First-Order Phase Transition: Free Energy Barriers and Kramers Escape in Overparameterized Networks.
  • Derrida, B. (1981). Random-Energy Model: An Exactly Solvable Model of Disordered Systems. Physical Review B, 24(5), 2613.
  • Power, A., et al. (2022). Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets. arXiv:2201.02177.
  • Bahri, Y., et al. (2020). Statistical Mechanics of Deep Learning. Annual Review of Condensed Matter Physics, 11, 501-528.

On this page

1. Classical Statistical Mechanics vs. Modern Deep Learning2. Theory of Phase Transitions & Landau Theory2.1 Thermodynamic Limit and the Origin of Non-Analyticity2.2 Ehrenfest Classification of Phase Transitions2.3 Order Parameters and Spontaneous Symmetry Breaking2.4 Mathematical Formulation of Landau TheoryAnalytical Derivation: Continuous vs. Discontinuous Landau MinimaCase 1: Continuous Phase Transition (b>0b > 0, c0c \ge 0, h=0h = 0)Case 2: First-Order Phase Transition (b<0b < 0, c>0c > 0, h=0h = 0)3. Mean Field Theory & Self-Consistent Effective Fields3.1 The Variational Principle (Bogoliubov-Feynman Inequality)Proof:3.2 Microscopic Derivation of the Curie-Weiss Mean Field EquationExact Solution via Hubbard-Stratonovich TransformationSystematic Derivation of Landau Coefficients from Microscopic Physics4. Statistical Mechanics Theory of Transformers in the Thermodynamic Limit4.1 The Scaled High-Dimensional Transformer Setup4.2 Replica Free Energy Formulation4.3 Attention Spectral Phase Transitions: Marchenko-Pastur vs. BBP Emergence5. Learning Regimes Near the Interpolation Threshold5.1 Asymptotic Regimes in High Dimensions5.2 Information-Theoretic vs. Algorithmic Phase Transitions6. Grokking as a First-Order Phase Transition in Deep Networks6.1 Competing Order Parameters: Memorization vs. Generalization6.2 The Effective Free Energy of OptimizationThe Entropy vs. Energy Tradeoff:6.3 Kramers' Escape Dynamics and the Grokking Timescale7. Signal Propagation and Collapse Modes in Deep Transformers via Derrida's REM7.1 Forward Map Dynamics7.2 Mapping Attention Softmax to Derrida's Random Energy Model (REM)Rigorous Analytical Derivation of the Freezing Transition7.3 Phase Classification of Deep AttentionPhase 1: High-Temperature Phase (β<βc\beta < \beta_c)     \implies Rank CollapsePhase 2: Low-Temperature Phase (β>βc\beta > \beta_c)     \implies Attention Entropy Collapse7.4 Architectural Solutions: Critical Scaling Laws8. Pedagogical Synthesis & Universal PrinciplesReferences & Further Reading