Marginal

Physics of Deep Learning

Tools from statistical physics for understanding neural networks: learning as statistical mechanics and partition functions, the Ising perceptron and storage capacity, wide networks as Gaussian processes, signal propagation and the edge of chaos, the constant neural tangent kernel, mean-field scaling and feature learning, μP, grokking, dynamical mean-field theory, empirical and theoretical scaling laws, and the replica method.

26 lessons in 3 units · free with an account

Start your free trialThis course stays free after the trial.
What you'll learn

26 lessons, one small step at a time

Each lesson states its goal, then works up to it in short steps with practice after each. A placement test at the start skips what you already know.

Statistical Mechanics of Learning

10 lessons
  1. Learning as physicsRead a Bayesian posterior as a Boltzmann distribution, and match each loss to the noise model and temperature it implies.
  2. A science of learningState the learning-mechanics view of deep learning, sort its evidence into five strands, and say what would refute its discretization hypothesis.
  3. Partition functions & cumulantsCompute average energies and their fluctuations from ln Z, apply equipartition with the learning coefficient, and read a peak in heat capacity as a transition.
  4. Phase transitions at finite sizePredict how a susceptibility peak scales with system size, tell first-order from second-order transitions, and explain metastability.
  5. Cover's counting theoremCount the labelings a perceptron can separate with Cover's theorem, and find the sharp threshold at twice the dimension.
  6. Perceptron capacityCompute how many random patterns a perceptron can store with continuous or binary weights and with a margin, and explain Gardner's volume method.
  7. Quenched vs. annealedCompute the quenched and annealed averages of a random free energy, and explain why learning theory needs the quenched one.
  8. The replica methodCompute a quenched average with the replica trick, explain how order parameters reduce the problem, and judge the method's status.
  9. Teacher–student learningCompute a student perceptron's generalization error from its overlap with the teacher, and read the learning curves that result.
  10. Jumping to perfect generalizationExplain why a binary student perceptron jumps to perfect generalization at a critical load, and map the problem onto a magnet.

Wide Networks

10 lessons
  1. Wide networks as GPsExplain why an infinitely wide random network is a Gaussian process, propagate variance through its layers, and say what the limit leaves out.
  2. The edge of chaosLocate the edge of chaos between the ordered and chaotic phases, compute how gradients grow or vanish with depth, and choose initializations that keep networks trainable.
  3. Depth versus widthExplain why the ratio of depth to width controls a network's departure from the Gaussian-process picture, and sort networks into its three regimes.
  4. The NTK at infinite widthExplain why the tangent kernel becomes deterministic and fixed at infinite width, build it layer by layer, and compute what the trained network predicts.
  5. Learning with a frozen kernelCompute the timescale on which a frozen kernel learns each mode of a target, and explain why Bayesian kernel regression reaches the same answer.
  6. Mean-field scalingTell NTK scaling from mean-field scaling by how the output is scaled, compute how far weights move under each, and explain why only mean-field scaling learns features.
  7. Neurons as particlesPicture a wide network as a cloud of interacting neurons, describe the equation the cloud obeys, and place the lazy limit and μP on a dial of scalings.
  8. Maximal update parameterizationExplain why the best settings drift with width under standard practice, and scale learning rates with μP so that they transfer.
  9. GrokkingDescribe grokking, match its explanations to their ingredients, and design an experiment that separates the two main accounts.
  10. Dynamical mean-field theoryExplain the self-consistency at the heart of dynamical mean-field theory, match its tools to what they do, and say what it predicts about training.

Scaling

6 lessons
  1. Power-law scalingCompute how a power law shrinks the loss as models grow, read its exponent off a log–log plot, and judge the risks of extrapolating it.
  2. Compute-optimal scalingCompute training compute from model and data size, find the compute-optimal model with the Chinchilla rule, and judge whether a model is under- or over-trained.
  3. Data & inference limitsCompute how the supply of data and the cost of inference limit compute-optimal scaling, and name the responses to both.
  4. Scaling-law bookkeepingDerive why training compute is about 6Pn, compute the compute exponent from the parameter and data exponents, and name what sets the exponents.
  5. Where scaling laws come fromDerive a loss exponent from Zipf-distributed skills and from the spectrum of the data, and explain how sudden skills average into smooth curves.
  6. Where exponents come fromCompute the parameter and data exponents of the quantization model, infer an intrinsic dimension from the data-manifold argument, and name what current theories still assume.
Sample lesson

Learning as physics

Goal: Read a Bayesian posterior as a Boltzmann distribution, and match each loss to the noise model and temperature it implies.

Statistical mechanics studies systems with huge numbers of interacting parts, which describes the parameters of a neural network well. The bridge is that a Bayesian posterior over parameters has exactly the form of a Boltzmann distribution.

We will treat loss as energy, read losses as likelihoods, and finish with choosing a loss as choosing a noise model.

Step 1: Loss as energy

A Gibbs posterior weights each parameter setting by its loss:

p(w) ∝ φ(w) e−βnL(w)

This is a Boltzmann distribution with energy nL(w) and inverse temperature β. Temperature controls how strongly the loss matters. As β → 0 (high temperature) the loss stops mattering and the posterior becomes the prior; as β → ∞ (low temperature) it concentrates on the minimizers of the loss, recovering ordinary training. β = 1 is ordinary Bayesian inference.

Step 2: Losses are likelihoods

Most training losses are negative log-likelihoods of some noise model. If y = f(x) + noise with Gaussian noise of variance σ², then −ln p(y | x) = (y − f)² ÷ (2σ²) + constant. So training with squared loss (y − f)² at inverse temperature β is exactly Bayesian inference when β = 1 ÷ (2σ²): β = 0.5 corresponds to noise variance 1. Choosing β is implicitly choosing how noisy you believe the data are.

Step 3: Choosing a loss, choosing a noise model

The same correspondence works for other losses. Absolute error |y − f| is the negative log-likelihood of Laplace noise, which has heavier tails, so it is less disturbed by outliers. Cross-entropy is −ln of the probability a categorical model assigns to the correct class. And the normalizer Z of the Gibbs posterior gives the free energy −ln Z, the negative log marginal likelihood, so the machinery of statistical mechanics (free energies, phase transitions, fluctuations) applies directly to learning.

In the app, each step ends with practice questions, new ones every time, and the lesson comes back later in spaced reviews.

Start Physics of Deep Learning

Lessons that need something you haven't learned yet bring it in first, from any course.

Start your free trialThis course stays free after the trial.