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” () 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:
Why don’t heavily over-parameterised neural networks overfit?
What is the effective number of parameters?
Why doesn’t gradient descent get stuck in poor local minima?
When should one stop training?
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 with inputs and labels . The goal is to learn a mapping that generalises to unseen data.
① Data. The training set . In the statistical physics approach, data are random samples from some distribution , which enables disorder averaging (see below). Concrete benchmarks: MNIST ( greyscale images, 70 k examples), CIFAR-10 ( RGB, 60 k), ImageNet (14 M images, 20 k categories), LAION-5B (5.8 B image–text pairs).
② Architecture. The function class , mapping inputs to predictions .
The perceptron (McCulloch–Pitts 1943; Rosenblatt 1958) is the simplest case: a single artificial neuron
where is a weight vector, is a bias, and is a nonlinearity. With it defines a linear classifier: the decision boundary is the hyperplane in input space, partitioning 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:
Each layer applies an affine map followed by a pointwise nonlinearity (e.g.\ ReLU, , erf). The weight matrices 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:
where (queries), (keys), (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:
For deep networks, requires backpropagation Rumelhart et al. (1986) — the chain rule applied layer-by-layer. With , , , , the backward pass computes error signals layer-by-layer:
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:
The generalisation error is unknown in practice (we do not have access to , only to a finite sample from it). The statistical physics approach circumvents this: by working with an explicit generative model, it allows 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 :
A student network with learnable is trained to recover . 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 and are often vacuous for modern large models.
The statistical physics approach instead asks: what happens for a typical dataset drawn from ? In the large- limit, the distribution of 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 with 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 does gradient descent converge to, and what is its ? ② Dynamics: how does the trajectory evolve, and can we describe it with ODEs?
Supervised Learning: Bayesian Formulation¶
Given , Bayes’ theorem gives the posterior distribution over weights:
Here is the prior and is the normalisation constant (partition function in physics language).
Identifying and gives a Gibbs distribution at inverse temperature :
The fundamental analogy: loss energy, inverse temperature, spin configuration, quenched disorder (frozen random couplings). The partition function plays the role of the normalising constant for a Boltzmann distribution.
ERM limit (): the Gibbs measure concentrates on the loss minimiser; this is what gradient descent implements.
Bayes-optimal setting: if and exactly match the true generative process, the posterior mean achieves the minimum possible among all algorithms (the MMSE estimator).
Free Energy Density and Self-Averaging¶
The free energy density encodes all macroscopic information about the system:
Self-averaging is the key property that makes this tractable: in the limit ,
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 for a specific, random ) with the easier problem (compute ). Once is known, all macroscopic observables follow by differentiation — exactly as in thermodynamics.
Quenched vs annealed. Self-averaging tells us we want (the quenched average, where is fixed before taking the log). The annealed average 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:
The two classes form isotropic Gaussian clouds of radius centred at ; the signal-to-noise ratio is . The student uses a perceptron with threshold :
The pre-activation is a scalar summary of the input: it is the projection of onto the weight vector, normalised to .
The limiting case (pure noise labels) is the Gardner capacity problem: random labels can be shattered by a linear classifier in if and only if Gardner (1988). This is a sharp phase transition — entirely analogous to a subcritical/supercritical bifurcation in PDEs.
The Replica Method¶
We need . The replica trick Mézard et al. (1987)Nishimori (2001)Engel & Broeck (2001) is an elegant algebraic device:
For integer , is the partition function of independent copies (replicas) of the system, all coupled through the same quenched disorder . One averages over first (this couples the replicas to each other), then analytically continues to .
Step 1: Gaussian integration over data. The local fields are jointly Gaussian. Averaging the replicated partition function over the i.i.d. samples couples replicas through two macroscopic order parameters:
These are scalar summaries: measures how well replica has recovered the teacher direction, and measures how similar two replica weight vectors are.
Step 2: Saddle-point. In large the integral over and conjugate variables is dominated by a saddle point, giving an effective free energy:
The data term involves a one-dimensional Gaussian integral over a single effective field — all the -dimensional complexity has been collapsed to a scalar problem.
Step 3: Analytic continuation. Extremise over and continue to .
Replica-Symmetric Ansatz¶
The simplest consistent ansatz is replica symmetry (RS): all replicas are equivalent, so and . This reduces to three scalar order parameters:
| Symbol | Meaning |
|---|---|
| Mean squared norm of the weight vector | |
| , | Overlap between two independent posterior samples |
| Teacher–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 (). 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 — three equations in three unknowns.
ERM limit (). The posterior concentrates on the minimiser; but the susceptibility remains finite (it measures the linear response of the order parameters to perturbations).
Generalisation Error¶
Once 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:
so the generalisation error (fraction of test points misclassified, with bias ) is:
where is the standard Gaussian CDF.
For the balanced (), unbiased () case: , which depends only on the signal-to-noise ratio of the student’s pre-activation. As (more data), and . The full phase diagram as a function of is in Mignacco et al. (2020).
Key insight. The entire -dimensional learning problem has been reduced to a three-parameter scalar system whose solution gives exact predictions for . This is the power of the thermodynamic limit combined with the RS ansatz.
- Mignacco, F., Krzakala, F., Lu, Y. M., & Zdeborová, L. (2020). The Role of Regularization in Classification of High-Dimensional Noisy Gaussian Mixture. ICML 2020.
- 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.
- Mézard, M., Parisi, G., & Virasoro, M. A. (1987). Spin Glass Theory and Beyond. World Scientific.
- 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.
- LeCun, Y., Bengio, Y., & Hinton, G. (2015). Deep Learning. Nature, 521, 436–444.
- 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.
- Rumelhart, D. E., Hinton, G. E., & Williams, R. J. (1986). Learning Representations by Back-Propagating Errors. Nature, 323, 533–536.
- Zdeborová, L. (2020). Understanding Deep Learning is Also a Job for Physicists. Nature Physics, 16, 602–604.
- Engel, A., & Van den Broeck, C. (2001). Statistical Mechanics of Learning. Cambridge University Press.
- Gardner, E. (1987). Maximum Storage Capacity in Neural Networks. Europhysics Letters, 4(4), 481–485.
- Gardner, E. (1988). The Space of Interactions in Neural Network Models. Journal of Physics A, 21(1), 257–270.
- Nishimori, H. (2001). Statistical Physics of Spin Glasses and Information Processing. Oxford University Press.