Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lecture Notes
ICTP-INdAM-SLMath Summer Graduate School for Machine Learning, Trieste, 15–19 June 2026

Statistical Physics Approaches to High-Dimensional Learning

ICTP Summer School on Machine Learning — Lecture 1

These notes cover the first lecture. The central idea is that a trained neural network is a high-dimensional interacting system and the tools statistical physicists developed — disorder averaging, free energies, saddle-point methods, and the replica trick — give exact, quantitative predictions about learning and generalization. The analysis of the binary Gaussian mixture classification model follows Mignacco et al. (2020).

A note on perspective. Readers with a PDE background will find many familiar structures here, but with a probabilistic flavour. The “order parameters” that characterise the stationary states of the learning problem are analogous to macroscopic quantities (density, temperature) that collapse a high-dimensional PDE system to a low-dimensional description. The “thermodynamic limit” (NN \to \infty) plays the role of a continuum limit. The replica method is a device for computing disorder-averaged logarithms, analogous in spirit to the method of characteristics but for a very different class of equations.

Motivation: Why Physics Methods for Machine Learning?

Modern ML systems achieve striking results: large language models, protein structure prediction (AlphaFold, 2024 Nobel Prize in Chemistry), image generation, mathematical reasoning. Training-compute has grown exponentially, from ADALINE (1950s) to GPT-class models (1025 FLOPs). Yet theoretical foundations remain poorly understood. Leo Breiman’s 1995 essay “Reflections after refereeing papers for NIPS” listed open questions that remain largely unresolved:

The first two concern the statics of learning (what the trained model looks like); the last two concern the dynamics (how it gets there). These two goals organise the entire course.

The Hopfield model Hopfield (1982) is the founding example of the physics–ML connection. It is an associative memory: each stored pattern is an energy minimum of a disordered spin system, and retrieval is simply gradient descent relaxing into the nearest basin. Hopfield and Hinton shared the 2024 Nobel Prize in Physics; Parisi received the 2021 Nobel Prize for the replica theory that underpins it Mézard et al. (1987). The capacity phase diagram — how many patterns can be stored before retrieval fails — was computed analytically by Amit, Gutfreund, and Sompolinsky Amit et al. (1985) using the replica method.

Three Ingredients of Machine Learning

A supervised learning problem is defined by a dataset D={(xμ,yμ)}μ=1p\mathcal{D} = \{(x^\mu, y^\mu)\}_{\mu=1}^{p} with inputs xμRNx^\mu \in \mathbb{R}^N and labels yμRy^\mu \in \mathbb{R}. The goal is to learn a mapping xyx \mapsto y that generalises to unseen data.

① Data. The training set D\mathcal{D}. In the statistical physics approach, data are random samples from some distribution PXYP_{XY}, which enables disorder averaging (see below). Concrete benchmarks: MNIST (28×2828\times28 greyscale images, 70 k examples), CIFAR-10 (32×3232\times32 RGB, 60 k), ImageNet (14 M images, 20 k categories), LAION-5B (5.8 B image–text pairs).

② Architecture. The function class fwf_\mathbf{w}, mapping inputs xx to predictions y^=fw(x)\hat{y} = f_\mathbf{w}(x).

The perceptron (McCulloch–Pitts 1943; Rosenblatt 1958) is the simplest case: a single artificial neuron

y^=ϕ(wx+b),\hat{y} = \phi(\mathbf{w}^\top x + b),

where wRN\mathbf{w}\in\mathbb{R}^N is a weight vector, bb is a bias, and ϕ\phi is a nonlinearity. With ϕ=sign\phi = \operatorname{sign} it defines a linear classifier: the decision boundary is the hyperplane {wx+b=0}\{\mathbf{w}^\top x + b = 0\} in input space, partitioning RN\mathbb{R}^N into two half-spaces. The perceptron can only solve linearly separable tasks; Minsky & Papert’s 1969 book showed it cannot solve XOR, contributing to the first AI winter.

Deep neural networks LeCun et al. (2015) compose many layers of such transforms:

y^=fW(x)=ϕ(L) ⁣(W(L)ϕ(L1) ⁣(ϕ(1)(W(1)x))).\hat{y} = f_\mathbf{W}(x) = \phi^{(L)}\!\left(W_{(L)}\,\phi^{(L-1)}\!\left(\cdots\phi^{(1)}(W_{(1)} x)\cdots\right)\right).

Each layer applies an affine map followed by a pointwise nonlinearity ϕ\phi (e.g.\ ReLU, tanh\tanh, erf). The weight matrices W()W_{(\ell)} are the parameters to be learned. This is a highly nonlinear composition: viewed as a discrete-time nonlinear map, each layer is one step of a flow.

Transformers Vaswani et al. (2017) process sequential data (language, code, proteins) via the attention mechanism:

Attention(Q,K,V)=softmax ⁣(QKdk)V,\operatorname{Attention}(Q,K,V) = \operatorname{softmax}\!\left(\frac{QK^\top}{\sqrt{d_k}}\right)V,

where QQ (queries), KK (keys), VV (values) are learned linear projections of the input tokens, and the softmax makes the row sums equal 1. Intuitively, each token attends to all others with weights proportional to query–key similarity. The training objective is next-token prediction.

③ Algorithm. Gradient descent on a regularised empirical loss:

L(w;D)=μ=1p(yμ;w,xμ)+λ2w22,wt+1=wtηwL(wt).\mathcal{L}(\mathbf{w};\mathcal{D}) = \sum_{\mu=1}^{p} \ell(y^\mu;\mathbf{w}, x^\mu) + \frac{\lambda}{2}\|\mathbf{w}\|_2^2, \qquad \mathbf{w}^{t+1} = \mathbf{w}^{t} - \eta\,\nabla_{\mathbf{w}}\mathcal{L}(\mathbf{w}^{t}).

For deep networks, wL\nabla_\mathbf{w}\mathcal{L} requires backpropagation Rumelhart et al. (1986) — the chain rule applied layer-by-layer. With a(0)=xa^{(0)} = x, z()=W()a(1)+b()z^{(\ell)} = W^{(\ell)}a^{(\ell-1)} + b^{(\ell)}, a()=ϕ(z())a^{(\ell)} = \phi(z^{(\ell)}), y^=a(L)\hat{y} = a^{(L)}, the backward pass computes error signals layer-by-layer:

δ(L)=z(L)(y,a(L)),δ()=(W(+1)) ⁣δ(+1)ϕ(z()),LW()=δ() ⁣(a(1)).\delta^{(L)} = \nabla_{z^{(L)}}\ell(y, a^{(L)}), \qquad \delta^{(\ell)} = \left(W^{(\ell+1)}\right)^\top\!\delta^{(\ell+1)}\odot\phi'(z^{(\ell)}), \qquad \frac{\partial\mathcal{L}}{\partial W^{(\ell)}} = \delta^{(\ell)}\!\left(a^{(\ell-1)}\right)^\top.

Zdeborová Zdeborová (2020) emphasises that building a theory of deep learning requires understanding the interplay of all three ingredients simultaneously.

The Generalization Problem

A predictor is useful only if it performs well on new data, not just on the training set. The two relevant error measures are:

εtrain(w^)=1pμ=1p ⁣(yμ,fw^(xμ)),εgen(w^)=E(x,y)PXY ⁣[ ⁣(y,fw^(x))].\varepsilon_\text{train}(\hat{\mathbf{w}}) = \frac{1}{p}\sum_{\mu=1}^{p}\ell\!\left(y_\mu, f_{\hat{\mathbf{w}}}(x_\mu)\right), \qquad \varepsilon_\text{gen}(\hat{\mathbf{w}}) = \mathbb{E}_{(x,y)\sim P_{XY}}\!\left[\ell\!\left(y, f_{\hat{\mathbf{w}}}(x)\right)\right].

The generalisation error εgen\varepsilon_\text{gen} is unknown in practice (we do not have access to PXYP_{XY}, only to a finite sample from it). The statistical physics approach circumvents this: by working with an explicit generative model, it allows εgen\varepsilon_\text{gen} to be computed exactly in the thermodynamic limit, giving sharp predictions that can be checked against simulations.

Exactly Solvable Models: The Statistical Physics Programme

The statistical physics approach rests on three pillars.

1. The Teacher–Student Setup

Rather than working with a black-box dataset, assume that labels are generated by a known teacher network with fixed weights w\mathbf{w}^*:

yμ=fw(xμ)+noise,xμN(0,IN).y^\mu = f_{\mathbf{w}^*}(x^\mu) + \text{noise}, \qquad x^\mu \sim \mathcal{N}(0, I_N).

A student network with learnable w\mathbf{w} is trained to recover w\mathbf{w}^*. This is analogous to solving an inverse problem when the forward operator is known. The teacher–student framework and its phase diagrams are described in Zdeborová (2020)Engel & Broeck (2001).

2. Average-Case Rather Than Worst-Case Analysis

Classical learning theory (VC dimension, PAC learning, Rademacher complexity) provides worst-case bounds: guarantees that hold for every possible dataset. These bounds scale as O(N/p)\mathcal{O}(\sqrt{N/p}) and are often vacuous for modern large models.

The statistical physics approach instead asks: what happens for a typical dataset drawn from PXYP_{XY}? In the large-NN limit, the distribution of εgen\varepsilon_\text{gen} over datasets concentrates into a sharp spike (self-averaging; see below), so the typical and mean values coincide. This gives exact predictions rather than inequalities.

3. The Thermodynamic Limit

Take N,pN, p \to\infty with α=p/N=O(1)\alpha = p/N = \mathcal{O}(1) fixed. This is the analogue of a continuum limit in PDE numerics: the discrete, high-dimensional problem converges to a continuous, low-dimensional description in terms of a handful of order parameters — scalar quantities that capture the macroscopic state of the system (analogous to, say, the Reynolds number in fluid mechanics). Gardner’s 1987–88 papers Gardner (1987)Gardner (1988) are the founding works of this approach to learning.

The two goals of the course: ① Statics: which w\mathbf{w} does gradient descent converge to, and what is its εgen\varepsilon_\text{gen}? ② Dynamics: how does the trajectory wt\mathbf{w}^t evolve, and can we describe it with ODEs?

Supervised Learning: Bayesian Formulation

Given (xμ,yμ)iidPXY(w)(x^\mu, y^\mu)\overset{\text{iid}}{\sim}P_{XY}(\cdot\mid\mathbf{w}^*), Bayes’ theorem gives the posterior distribution over weights:

P(wD)=P0(w)μPy(yμw,xμ)Z(D),Z(D)=dw  P0(w)μPy(yμw,xμ).P(\mathbf{w}\mid\mathcal{D}) = \frac{P_0(\mathbf{w})\prod_\mu P_y(y^\mu\mid\mathbf{w},x^\mu)}{\mathcal{Z}(\mathcal{D})}, \qquad \mathcal{Z}(\mathcal{D}) = \int d\mathbf{w}\;P_0(\mathbf{w})\prod_\mu P_y(y^\mu\mid\mathbf{w},x^\mu).

Here P0(w)P_0(\mathbf{w}) is the prior and Z(D)\mathcal{Z}(\mathcal{D}) is the normalisation constant (partition function in physics language).

Identifying logPy-\log P_y \propto \ell and logP0λ2w2-\log P_0 \propto \frac\lambda2\|\mathbf{w}\|^2 gives a Gibbs distribution at inverse temperature β\beta:

P(wD)=eβL(w;D)Z(D).P(\mathbf{w}\mid\mathcal{D}) = \frac{e^{-\beta\,\mathcal{L}(\mathbf{w};\mathcal{D})}}{\mathcal{Z}(\mathcal{D})}.

The fundamental analogy: loss \leftrightarrow energy, β\beta \leftrightarrow inverse temperature, w\mathbf{w} \leftrightarrow spin configuration, D\mathcal{D} \leftrightarrow quenched disorder (frozen random couplings). The partition function Z(D)\mathcal{Z}(\mathcal{D}) plays the role of the normalising constant for a Boltzmann distribution.

Free Energy Density and Self-Averaging

The free energy density encodes all macroscopic information about the system:

fN(β)=1βNlogZ(D).f_N(\beta) = -\frac{1}{\beta N}\log\mathcal{Z}(\mathcal{D}).

Self-averaging is the key property that makes this tractable: in the limit NN\to\infty,

fN(β,D)a.s.f(β)=limNED[fN(β)].f_N(\beta,\mathcal{D}) \xrightarrow{a.s.} f(\beta) = \lim_{N\to\infty}\mathbb{E}_\mathcal{D}[f_N(\beta)].

This is analogous to the law of large numbers, but for a nonlinear functional of the data. Self-averaging allows us to replace the hard problem (compute fNf_N for a specific, random D\mathcal{D}) with the easier problem (compute ED[fN]\mathbb{E}_\mathcal{D}[f_N]). Once f(β)f(\beta) is known, all macroscopic observables follow by differentiation — exactly as in thermodynamics.

Quenched vs annealed. Self-averaging tells us we want ED[logZ]\mathbb{E}_\mathcal{D}[\log\mathcal{Z}] (the quenched average, where D\mathcal{D} is fixed before taking the log). The annealed average logED[Z]\log\mathbb{E}_\mathcal{D}[\mathcal{Z}] is easier (Jensen: just exchange log and expectation) but is only an upper bound. Computing the quenched average exactly requires the replica method.

Binary Gaussian Mixture Classification

We study the simplest nontrivial exactly solvable model Mignacco et al. (2020). Data come from a binary Gaussian mixture:

yμ=±1 with equal probability,xμ=yμwN+Δzμ,zμN(0,IN).y^\mu = \pm1 \text{ with equal probability}, \qquad x^\mu = \frac{y^\mu\,\mathbf{w}^*}{\sqrt{N}} + \sqrt{\Delta}\,z^\mu, \qquad z^\mu\sim\mathcal{N}(0,I_N).

The two classes form isotropic Gaussian clouds of radius Δ\sqrt{\Delta} centred at ±w/N\pm\mathbf{w}^*/\sqrt{N}; the signal-to-noise ratio is w2/(ΔN)\|\mathbf{w}^*\|^2/(\Delta N). The student uses a perceptron with threshold κ\kappa:

y^w(x)=sign(h+κ),h=wxN.\hat{y}_\mathbf{w}(x) = \operatorname{sign}(h+\kappa), \qquad h = \frac{\mathbf{w}\cdot x}{\sqrt{N}}.

The pre-activation hh is a scalar summary of the input: it is the projection of xx onto the weight vector, normalised to O(1)\mathcal{O}(1).

The limiting case w=0\mathbf{w}^*=0 (pure noise labels) is the Gardner capacity problem: pp random ±1\pm1 labels can be shattered by a linear classifier in RN\mathbb{R}^N if and only if α<αc=2\alpha < \alpha_c = 2 Gardner (1988). This is a sharp phase transition — entirely analogous to a subcritical/supercritical bifurcation in PDEs.

The Replica Method

We need ED[logZ(D)]\mathbb{E}_\mathcal{D}[\log\mathcal{Z}(\mathcal{D})]. The replica trick Mézard et al. (1987)Nishimori (2001)Engel & Broeck (2001) is an elegant algebraic device:

logZ=limn0Zn1n=limn0nlogZnE[logZ]=limn0nE[Zn].\log Z = \lim_{n\to 0} \frac{Z^n - 1}{n} = \lim_{n\to 0}\frac{\partial}{\partial n}\log Z^n \qquad \Longrightarrow \qquad \mathbb{E}[\log\mathcal{Z}] = \lim_{n\to 0}\frac{\partial}{\partial n}\mathbb{E}[\mathcal{Z}^n].

For integer nn, Zn\mathcal{Z}^n is the partition function of nn independent copies (replicas) {wa}a=1n\{\mathbf{w}_a\}_{a=1}^n of the system, all coupled through the same quenched disorder D\mathcal{D}. One averages over D\mathcal{D} first (this couples the replicas to each other), then analytically continues to n0n\to 0.

Step 1: Gaussian integration over data. The local fields haμ=waxμ/Nh_a^\mu = \mathbf{w}_a\cdot x^\mu/\sqrt{N} are jointly Gaussian. Averaging the replicated partition function over the pp i.i.d. samples {xμ,yμ}\{x^\mu, y^\mu\} couples replicas through two macroscopic order parameters:

ma=wawN(teacher–student alignment),Qab=wawbN(replica overlap matrix).m_a = \frac{\mathbf{w}_a\cdot\mathbf{w}^*}{N} \quad \text{(teacher–student alignment)}, \qquad Q_{ab} = \frac{\mathbf{w}_a\cdot\mathbf{w}_b}{N} \quad \text{(replica overlap matrix)}.

These are scalar summaries: mam_a measures how well replica aa has recovered the teacher direction, and QabQ_{ab} measures how similar two replica weight vectors are.

Step 2: Saddle-point. In large NN the integral over (Qab,ma)(Q_{ab}, m_a) and conjugate variables is dominated by a saddle point, giving an effective free energy:

S=(weight geometry / prior)entropy termαlogZy(Q,m)data / energy term.S = \underbrace{\text{(weight geometry / prior)}}_{\text{entropy term}} - \underbrace{\alpha\log\mathcal{Z}_y(Q,\mathbf{m})}_{\text{data / energy term}}.

The data term Zy\mathcal{Z}_y involves a one-dimensional Gaussian integral over a single effective field — all the NN-dimensional complexity has been collapsed to a scalar problem.

Step 3: Analytic continuation. Extremise SS over (Qab,ma)(Q_{ab}, m_a) and continue to n0n\to 0.

Replica-Symmetric Ansatz

The simplest consistent ansatz is replica symmetry (RS): all replicas are equivalent, so Qab=rδab+q(1δab)Q_{ab} = r\,\delta_{ab} + q\,(1-\delta_{ab}) and ma=mm_a = m. This reduces to three scalar order parameters:

SymbolMeaning
r=wa2/Nr = |\mathbf{w}_a|^2/NMean squared norm of the weight vector
q=wawb/Nq = \mathbf{w}_a\cdot\mathbf{w}_b/N, aba\neq bOverlap between two independent posterior samples
m=waw/Nm = \mathbf{w}_a\cdot\mathbf{w}^*/NTeacher–student alignment (controls generalisation)

RS is exact for convex losses (ridge regression, logistic regression) because convex losses have a unique global minimum, so all replicas converge to the same point (q=rq=r). For non-convex losses (deep networks), RS may break down — a sign of a more complex loss landscape with many local minima.

Extremising the RS free energy gives three coupled algebraic self-consistency equations in (r,q,m)(r, q, m) — three equations in three unknowns.

ERM limit (β\beta\to\infty). The posterior concentrates on the minimiser; rq0r - q \to 0 but the susceptibility χ=β(rq)=O(1)\chi = \beta(r-q) = \mathcal{O}(1) remains finite (it measures the linear response of the order parameters to perturbations).

Generalisation Error

Once (r,q,m)(r,q,m) are found from the saddle-point equations, the generalisation error follows in closed form. The pre-activation of the student on a test point is Gaussian with mean and variance set by the order parameters:

h~y~N ⁣(y~m,  Δr),\tilde{h}\,|\,\tilde{y} \sim \mathcal{N}\!\left(\tilde{y}\,m,\; \Delta r\right),

so the generalisation error (fraction of test points misclassified, with bias κ\kappa) is:

Egen=ρΦ ⁣(mκΔr)+(1ρ)Φ ⁣(mκΔr),\mathcal{E}_\text{gen} = \rho\,\Phi\!\left(\frac{-m-\kappa}{\sqrt{\Delta r}}\right) + (1-\rho)\,\Phi\!\left(\frac{m-\kappa}{\sqrt{\Delta r}}\right),

where Φ(t)=12πtes2/2ds\Phi(t) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^t e^{-s^2/2}\,ds is the standard Gaussian CDF.

For the balanced (ρ=12\rho=\tfrac12), unbiased (κ=0\kappa=0) case: Egen=Φ(m/Δr)\mathcal{E}_\text{gen} = \Phi(-m/\sqrt{\Delta r}), which depends only on the signal-to-noise ratio m/Δrm/\sqrt{\Delta r} of the student’s pre-activation. As α\alpha\to\infty (more data), m1/Δm\to\sqrt{1/\Delta} and εgen0\varepsilon_\text{gen}\to 0. The full phase diagram as a function of (α,Δ,λ)(\alpha,\Delta,\lambda) is in Mignacco et al. (2020).

Key insight. The entire NN-dimensional learning problem has been reduced to a three-parameter scalar system whose solution gives exact predictions for εgen\varepsilon_\text{gen}. This is the power of the thermodynamic limit combined with the RS ansatz.

References
  1. Mignacco, F., Krzakala, F., Lu, Y. M., & Zdeborová, L. (2020). The Role of Regularization in Classification of High-Dimensional Noisy Gaussian Mixture. ICML 2020.
  2. Hopfield, J. J. (1982). Neural Networks and Physical Systems with Emergent Collective Computational Abilities. Proceedings of the National Academy of Sciences, 79(8), 2554–2558.
  3. Mézard, M., Parisi, G., & Virasoro, M. A. (1987). Spin Glass Theory and Beyond. World Scientific.
  4. Amit, D. J., Gutfreund, H., & Sompolinsky, H. (1985). Storing Infinite Numbers of Patterns in a Spin-Glass Model of Neural Networks. Physical Review Letters, 55(14), 1530–1533.
  5. LeCun, Y., Bengio, Y., & Hinton, G. (2015). Deep Learning. Nature, 521, 436–444.
  6. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., & Polosukhin, I. (2017). Attention Is All You Need. NeurIPS 2017.
  7. Rumelhart, D. E., Hinton, G. E., & Williams, R. J. (1986). Learning Representations by Back-Propagating Errors. Nature, 323, 533–536.
  8. Zdeborová, L. (2020). Understanding Deep Learning is Also a Job for Physicists. Nature Physics, 16, 602–604.
  9. Engel, A., & Van den Broeck, C. (2001). Statistical Mechanics of Learning. Cambridge University Press.
  10. Gardner, E. (1987). Maximum Storage Capacity in Neural Networks. Europhysics Letters, 4(4), 481–485.
  11. Gardner, E. (1988). The Space of Interactions in Neural Network Models. Journal of Physics A, 21(1), 257–270.
  12. Nishimori, H. (2001). Statistical Physics of Spin Glasses and Information Processing. Oxford University Press.