MVA · Course notes

Theoretical Foundations of Deep Learning

M2 MVA · Semester 1 · Learning · 5 ECTS

Contents

Introduction and overview

Module Theoretical Foundations of Deep Learning
Official title Fondements Théoriques du deep learning
Instructors S. GERCHINOVITZ, F. MALGOUYRES, E. PAUWELS, G. FRANCHI, N. THOME (master-mva.com, 2026–2027)
Period Semester 1 · period 1 (28/09/2026 – 08/01/2027)
Credits and volume 5 ECTS · 30 h (lectures 25 h, labs 5 h) per the Université Paris-Saclay programme table
Label Learning · domains on master-mva.com: Deep Learning, Theory
Language French, without distance teaching (Université Paris-Saclay course detail, “Langue d’enseignement”); not displayed on master-mva.com
Assessment master-mva.com (“Mode de validation”): labs (TP) 30 %, exam 70 %. Université Paris-Saclay course detail: one final exam (90 % of the grade) and one take-home assignment with an algorithm implementation (10 % of the grade); for the resit, an exam whose grade replaces the previous grades; nature of the assessment “Evaluation Continue non Intégrale”. The two official sources give different weights.
Prerequisites Basic notions of analysis, statistics and machine learning, and Python programming (both sources); the Université Paris-Saclay detail adds a Master 1 in mathematics and the basics of optimisation and statistical learning

Audience: a student with a good M1 in mathematics, computer science or physics who has already trained a network in PyTorch and wants to know which of its behaviours are theorems, which are open problems and which are folklore.

Empirical first: the same two-layer network reaches 100 % training accuracy on the scikit-learn digits whether the labels are the true ones or a random permutation of them (ch. 9). Test accuracy is 97.8 % in the first case and 8.1 % in the second. Classical capacity bounds cannot tell the two runs apart; this course builds the tools to say what can.

The course is a mathematical reading of deep learning for classification and regression. It follows a network from its definition to its training, its approximation power, its generalisation and its reliability. Each step pairs a theorem with a small experiment. The optimisation chapters extend Convex Optimization and Applications in Machine Learning; the generalisation chapters extend Introduction to Statistical Learning; the practice of networks is in Deep Learning.

What you will be able to do

Official objectives and syllabus (2026–2027)

The course description on master-mva.com states that the main objective is to present the mathematical formulation of deep neural networks used for classification and regression. It announces the problems raised by these models and representative results of current research on parameter optimisation, the properties of networks, their expressivity, their complexity, and phenomena that are still unexplained, such as double descent and implicit regularisation.

It then links these results to the practice of the algorithms, with a view to robustness (uncertainty, stability). Practical sessions (TP) help students understand some properties of deep networks intuitively, implement learning algorithms on concrete problems and place the mathematical properties in their applied context.

The teaching team listed on master-mva.com is Sébastien Gerchinovitz (researcher, IRT Saint-Exupéry), François Malgouyres (professor, Institut de Mathématiques de Toulouse), Édouard Pauwels (maître de conférences, IRIT), Nicolas Thome (professor, Sorbonne Université, ISIR) and Gianni Franchi (teacher-researcher in trustworthy AI, ENSTA Paris). The Université Paris-Saclay detail states the objective as presenting representative research results on the mathematical justification of deep learning algorithms, then linking them to practice.

The table matches every official item — the “Thèmes abordés” of master-mva.com, each bullet of its ten announced sessions, and each item of the Université Paris-Saclay “Programme / plan / contenus” — with the section of these notes that teaches it.

Official topic Course section
Thèmes: formalise several network models and describe the back-propagation algorithms used to minimise them ch. 1 (1.4–1.5), ch. 2 (2.3)
Thèmes: modelling neural networks and first properties ch. 1 (Definitions 1.6–1.7, Propositions 1.10–1.11), ch. 2 (2.1–2.2)
Thèmes: back-propagation ch. 2 (Algorithm 2.6, Theorem 2.7, section 2.4)
Thèmes: risk estimation ch. 1 (Definition 1.1, Proposition 1.3), ch. 9 (Theorem 9.3)
Thèmes: non-convex optimisation ch. 4
Thèmes: properties of the landscape of the objective function ch. 3
Thèmes: expressivity ch. 8
Thèmes: control of the generalisation error ch. 9, ch. 10
Thèmes: uncertainty quantification ch. 5 (5.4), ch. 6, ch. 7
Thèmes: robustness ch. 5 (5.1–5.2), ch. 7 (7.3–7.5)
Session 1: generalities on classification and regression ch. 1 (Definition 1.1, Proposition 1.2)
Session 1: generalisation, approximation and optimisation errors; implicit regularisation and double descent ch. 1 (Proposition 1.5, note on the modern regime); implicit regularisation in Proposition 3.4; double descent in ch. 10
Session 1: feed-forward and convolutional networks; overview of the zoo (transformers, RNN, GAN, FairGAN, representation learning) ch. 1 (Definitions 1.6–1.7, section 1.5, Proposition 1.9)
Session 1: a piecewise-affine prediction as a function of X ch. 1 (Propositions 1.10–1.11, code)
Session 2: a piecewise-polynomial prediction as a function of θ ch. 2 (Proposition 2.1)
Session 2: basics of the properties of the cost function (non-convexity, non-coercivity) ch. 2 (Proposition 2.3, Example 2.4, Corollary 2.5)
Session 2: back-propagation; exploding and vanishing gradients ch. 2 (Algorithm 2.6, Propositions 2.8–2.9, code)
Session 3: landscape properties and their impact on optimisation (Lee et al.) ch. 3 (Definition 3.1, note), ch. 4 (Theorem 4.3)
Session 3: landscape in the linear case, implicit regularisation (Baldi and Hornik) ch. 3 (Theorem 3.2, Propositions 3.4–3.5)
Session 3: non-linear case, good properties of the loss of wide deep networks (Nguyen and Hein) ch. 3 (Theorems 3.7–3.8)
Session 4: gradient descent and convergence to local minima for Morse functions ch. 4 (Definition 4.2, Theorem 4.3)
Session 4: algebraic and geometric properties of the loss functions of deep learning ch. 4 (Definition 4.5, Proposition 4.6)
Session 4: gradient methods under the KL assumption (Bolte, Sabach and Teboulle) ch. 4 (Theorem 4.7)
Session 4: application to global convergence, stochastic gradient, least squares under a surjectivity assumption ch. 4 (Theorems 4.8–4.9 and the paragraph on tame functions)
Session 5: context of decision robustness; theoretical and applied stakes for critical systems (healthcare, autonomous driving) ch. 5 (5.1)
Session 5: stability (scattering, group invariance and deformations, influence functions) ch. 5 (Proposition 5.2, Definition 5.4, Theorem 5.5)
Session 5: decision uncertainty: typology, Bayesian models (posterior and predictive distribution) ch. 5 (Definitions 5.6–5.7)
Session 5: Bayesian linear regression, extension to non-linear regression with explicit embeddings ch. 5 (Theorem 5.8, code)
Session 5 lab: Bayesian linear regression on simulated data ch. 5 (code of 5.4), Exercise 5
Session 6: logistic regression, Laplace approximation ch. 6 (Definition 6.1, Propositions 6.2–6.3, code)
Session 6: Bayesian neural networks, variational approximations (Blundell et al.) ch. 6 (Theorem 6.4, Definition 6.5)
Session 6: Monte Carlo dropout, link between regularisation and variational inference (Gal and Ghahramani) ch. 6 (Proposition 6.6, Theorem 6.7)
Session 6 lab: Laplace approximation for classification, a LinearVariational layer in PyTorch, linear models and multilayer perceptrons, comparison with MC dropout ch. 6 (two code blocks), Exercise 12
Session 7: uncertainty metrics for regression ch. 7 (Definition 7.1, Proposition 7.2)
Session 7: ensembling, evidential models ch. 7 (Proposition 7.3, note on evidential models)
Session 7: calibration (Guo et al.) ch. 7 (Definition 7.4, Proposition 7.5)
Session 7: failure prediction (ConfidNet) ch. 7 (Definition 7.6, Proposition 7.7)
Session 7: out-of-distribution detection (ODIN) ch. 7 (Definition 7.8, Proposition 7.9)
Session 7 lab: uncertainty of a convolutional classifier on MNIST, failure detection (ConfidNet), OOD detection (ODIN) ch. 7 (code: a multilayer perceptron on the scikit-learn digits, bundled with the library, instead of a CNN on MNIST, so that it runs without download); ConfidNet in Exercise 14
Session 8: a universal approximation theorem (Cybenko) ch. 8 (Theorems 8.1–8.2)
Session 8: a founding quantitative result in L2 norm (Barron) ch. 8 (Lemma 8.4, Theorem 8.5)
Session 8: depth separation (Eldan and Shamir) ch. 8 (Propositions 8.6–8.7, Theorem 8.8, code)
Session 8: super-approximation by deep networks (Yarotsky) ch. 8 (Proposition 8.9, Theorem 8.10)
Session 9: statistical reminders for binary classification: risk bounds, VC dimension, Rademacher complexity ch. 9 (Theorems 9.1, 9.3, Definition 9.5, Corollary 9.7)
Session 9: VC dimension of feed-forward networks (Bartlett et al.); Rademacher complexity of feed-forward networks (Golowich et al.) ch. 9 (Theorems 9.8–9.9)
Session 10: a quick tour of questions and research leads (Kawaguchi et al.) ch. 10 (10.1), ch. 11
Session 10: the double-descent phenomenon (Belkin et al.; Hastie et al.) ch. 10 (Theorem 10.2, Corollary 10.3, code)
Paris-Saclay: formalise network models and describe back-propagation ch. 1, ch. 2
Paris-Saclay: non-convex optimisation ch. 4
Paris-Saclay: properties of the landscape of the objective function ch. 3
Paris-Saclay: stability of minimisers, notably for structured linear networks ch. 3 (Proposition 3.6 and the Malgouyres–Landsberg statement)
Paris-Saclay: interpretability of networks ch. 5 (Theorem 5.5, influence functions); ch. 3 (3.3, stable and interpretable layers); gradient attributions in ch. 11
Paris-Saclay: expressivity of networks, their Rademacher complexity, regularisation with dropout ch. 8; ch. 9 (Theorem 9.9); ch. 6 (Proposition 6.6)
Paris-Saclay: properties of generative adversarial networks (GANs) ch. 1 (Proposition 1.9); ch. 11 (generalisation of GANs)
Paris-Saclay: decision robustness of deep networks (uncertainty, stability) ch. 5, ch. 6, ch. 7
Paris-Saclay: less mathematical presentation of architectures and properties used in practice ch. 1 (1.4–1.5), ch. 2 (remedies in 2.4), ch. 7

Every official item is taught on this page. The extensions of these notes beyond the syllabus are the Polyak–Łojasiewicz analysis of over-parameterised least squares (Theorem 4.8), the influence-function experiment (5.3), and the research chapter (ch. 11, self-study), which adds the implicit bias of gradient descent on separable data (Theorem 11.1) and conformal prediction (Proposition 11.2).

Where this course fits in the programme

Official prerequisites: basic notions of analysis, statistics, machine learning and Python programming; the Université Paris-Saclay detail adds a Master 1 in mathematics with the basics of optimisation and statistical learning.

Course outline

Session plan

30 h in class = 10 sessions of 3 h. The volume is the official one of the Université Paris-Saclay programme table (25 h of lectures and 5 h of labs), and master-mva.com announces the same organisation, 10 sessions of 3 h, with the labs at the end of sessions 5–7 (“cours puis TP”). The plan below follows the published order session by session; the split of each session into material and exercises is a proposal.

Level 1 = foundations, 2 = core results and algorithms, 3 = advanced and research-level results; the level never goes down.

Session Hours Level Content Practice
1 3 h 1 ch. 0 Review (chain rule, descent lemma, concentration, Gaussians, pseudo-inverse); ch. 1 Learning problem, risk estimation, three errors, networks, zoo and GANs, piecewise-affine predictions Ex. 1, 2
2 3 h 1 ch. 2 Piecewise-polynomial dependence on θ, symmetries, non-convexity, non-coercivity, back-propagation, exploding and vanishing gradients Ex. 3, 4
3 3 h 2 ch. 3 Critical points, Baldi–Hornik, implicit regularisation, balancedness, stability of factors, wide networks Ex. 9
4 3 h 2 ch. 4 Gradient descent, strict saddles and Morse functions, KL property, PL and least squares under surjectivity, stochastic gradient Ex. 7, 10
5 3 h 2 ch. 5 Robustness, Lipschitz and deformation stability, influence functions, Bayesian linear regression (lecture, then lab) Ex. 5; lab: Bayesian regression
6 3 h 2 ch. 6 Laplace approximation, Bayes by Backprop, dropout as ridge, MC dropout (lecture, then lab) Ex. 11, 12; lab: LinearVariational
7 3 h 2 ch. 7 Regression metrics, ensembles, evidential models, calibration, failure prediction, OOD detection (lecture, then lab) Ex. 6, 13, 14; lab: digits
8 3 h 3 ch. 8 Universal approximation, Barron, depth separation, Yarotsky Ex. 8, 15
9 3 h 3 ch. 9 Risk bounds, Rademacher complexity, VC dimension, bounds for networks Ex. 16
10 3 h 3 ch. 10 Open questions, guarantees from a validation set, exact risk of minimum-norm least squares, double descent Ex. 17

Self-study, outside the 30 h (about 4 h in total): ch. 11 Research directions and open problems (≈ 4 h, with Ex. 18).

How to study this module

Independent notes These notes reconstruct the official programme for self-study. They are not the instructors’ material, and the proposals for projects and the exam are suggestions in the spirit of the official assessment.

0. Review: calculus, probability and optimisation from M1

The proofs of this course use five M1 tools again and again. This chapter states them once, with the short proofs, so that later chapters can cite them by number.

Definition 0.1 — Jacobian and chain rule For a differentiable map F : \mathbb{R}^n \to \mathbb{R}^m, the Jacobian J_F(x) \in \mathbb{R}^{m \times n} collects the partial derivatives \partial F_i / \partial x_j. For a composition, J_{G \circ F}(x) = J_G(F(x))\, J_F(x).

For a scalar function \ell : \mathbb{R}^m \to \mathbb{R}, the gradient of \ell \circ F is obtained by applying the transposed Jacobian to the gradient of \ell: \nabla (\ell \circ F)(x) = J_F(x)^\top\, \nabla \ell(F(x)).

Back-propagation (ch. 2) is this identity applied layer after layer, from the output back to the input.

Proposition 0.2 — Descent lemma Let f : \mathbb{R}^p \to \mathbb{R} be differentiable with an L-Lipschitz gradient. For all x, y: f(y) \le f(x) + \langle \nabla f(x), y - x \rangle + \frac{L}{2} \|y - x\|^2 .

In particular, one gradient step x^+ = x - \nabla f(x)/L decreases f by at least \|\nabla f(x)\|^2 / (2L).

Proof. Write f(y) - f(x) - \langle \nabla f(x), y - x\rangle as the integral over t \in [0, 1] of \langle \nabla f(x + t(y - x)) - \nabla f(x), y - x \rangle.

By Cauchy–Schwarz and the Lipschitz property, the integrand is at most L t \|y - x\|^2, whose integral is L\|y - x\|^2/2.

For the second claim, put y = x^+: the right-hand side becomes f(x) - \|\nabla f(x)\|^2/L + \|\nabla f(x)\|^2/(2L). ∎

Theorem 0.3 — Hoeffding and McDiarmid inequalities Let Z_1, \dots, Z_n be independent random variables.

  • Hoeffding. If Z_i \in [a_i, b_i] almost surely, then for every t > 0 \mathbb{P}\Big(\sum_{i=1}^n (Z_i - \mathbb{E} Z_i) \ge t\Big) \le \exp\Big(-\frac{2t^2}{\sum_i (b_i - a_i)^2}\Big).
  • McDiarmid. If changing the i-th argument of g changes its value by at most c_i, then \mathbb{P}\big(g(Z_1, \dots, Z_n) - \mathbb{E}\, g \ge t\big) \le \exp\Big(-\frac{2t^2}{\sum_i c_i^2}\Big).

Key step of the proof: Hoeffding’s lemma bounds the moment generating function of a centred variable in [a, b] by e^{\lambda^2 (b - a)^2 / 8}; Markov’s inequality applied to e^{\lambda S} and an optimisation in \lambda conclude. McDiarmid applies the same lemma to the martingale differences of g (Boucheron, Lugosi and Massart, 2013, ch. 2 and 6).

Proposition 0.4 — Gaussian conditioning Let w \sim \mathcal{N}(m_0, S_0) and, given w, let y \sim \mathcal{N}(\Phi w, \beta^{-1} I). Then the conditional law of w given y is Gaussian, \mathcal{N}(m, S), with S^{-1} = S_0^{-1} + \beta\, \Phi^\top \Phi, \qquad m = S\,\big(S_0^{-1} m_0 + \beta\, \Phi^\top y\big).

Proof. Up to terms that do not depend on w, the log-density of w given y is -\tfrac12 (w - m_0)^\top S_0^{-1} (w - m_0) - \tfrac{\beta}{2} \|y - \Phi w\|^2 .

Its quadratic part in w is -\tfrac12 w^\top S^{-1} w and its linear part is w^\top (S_0^{-1} m_0 + \beta \Phi^\top y).

Completing the square identifies a Gaussian with precision S^{-1} and mean m. ∎

Proposition 0.5 — Pseudo-inverse and minimum-norm solutions Let X \in \mathbb{R}^{n \times p} have the singular value decomposition X = U \Sigma V^\top. Its pseudo-inverse is X^+ = V \Sigma^+ U^\top, where \Sigma^+ inverts the non-zero singular values.

If the system Xw = y has a solution, then w^+ = X^+ y is its unique solution of minimal Euclidean norm, and the unique solution lying in the row space \mathrm{Im}(X^\top).

Proof. Every solution writes w^+ + v with v \in \ker X. The vector w^+ lies in \mathrm{Im}(V\Sigma^+) \subset \mathrm{Im}(X^\top), which is orthogonal to \ker X.

By Pythagoras, \|w^+ + v\|^2 = \|w^+\|^2 + \|v\|^2, minimal exactly when v = 0. ∎

Key takeaways — chapter 0

  • Gradients of compositions are transposed Jacobians applied to a gradient: back-propagation.
  • With an L-Lipschitz gradient, a step 1/L decreases f by at least \|\nabla f\|^2 / (2L).
  • Bounded independent sums concentrate at rate 1/\sqrt{n}; Gaussian prior and likelihood give a Gaussian posterior.
  • The pseudo-inverse picks the minimum-norm solution, which lies in the row space.

1. The learning problem and neural network models

This chapter fixes the objects of the course: the risk a network must minimise, how to estimate it, and what a network computes.

1.1 Classification and regression

Definition 1.1 — Risk, empirical risk, Bayes risk Data are pairs (X, Y) drawn from an unknown distribution P on \mathcal{X} \times \mathcal{Y}. A loss \ell(\hat y, y) \ge 0 measures the cost of predicting \hat y when the truth is y.

The risk of a predictor f and its empirical counterpart on a sample (x_i, y_i)_{i \le n} are R(f) = \mathbb{E}\big[\ell(f(X), Y)\big], \qquad \widehat R_n(f) = \frac1n \sum_{i=1}^n \ell(f(x_i), y_i).

The Bayes risk R^\ast is the infimum of R over all measurable predictors.

  • Regression: \mathcal{Y} = \mathbb{R} and the square loss \ell(\hat y, y) = (\hat y - y)^2.
  • Classification with K classes: the 0–1 loss \mathbb{1}[\hat y \ne y] for evaluation, and the cross-entropy -\log p_y of a vector of class probabilities p for training.

Proposition 1.2 — Bayes predictors For the square loss, the Bayes predictor is the regression function f^\ast(x) = \mathbb{E}[Y \mid X = x], and for every f R(f) - R(f^\ast) = \mathbb{E}\big[(f(X) - f^\ast(X))^2\big].

For the 0–1 loss, the Bayes classifier predicts \arg\max_k \mathbb{P}(Y = k \mid X = x).

Proof. Expand the square around f^\ast(X): (f(X) - Y)^2 = (f(X) - f^\ast(X))^2 + 2 (f(X) - f^\ast(X))(f^\ast(X) - Y) + (f^\ast(X) - Y)^2 .

Conditionally on X, the cross term has zero mean because \mathbb{E}[Y \mid X] = f^\ast(X); taking expectations gives the identity, whose right-hand side is non-negative.

For the 0–1 loss, the conditional risk of predicting k at x is 1 - \mathbb{P}(Y = k \mid X = x), minimal at the most probable class. ∎

1.2 Risk estimation

The risk is never observed. The cleanest estimate uses data that played no role in training.

Proposition 1.3 — Risk estimation on a test set Let f be fixed independently of a test sample of size m, and let the loss take values in [0, 1]. With probability at least 1 - \delta, \big|\widehat R_{\mathrm{test}}(f) - R(f)\big| \le \sqrt{\frac{\log(2/\delta)}{2m}} .

Proof. The m test losses are independent, in [0, 1], with mean R(f). Apply Hoeffding’s inequality (Theorem 0.3) to the sum and to its opposite with t = m\varepsilon, and take a union bound over the two sides. ∎

Example 1.4 — How precise is a test accuracy? With m = 10\,000 test images and \delta = 0.05, the half-width is \sqrt{\log(40)/20\,000}, that is \varepsilon \approx 0.0136 .

A gain of 0.5 % between two models is not certified by this bound. Choosing among k models on the same test set replaces \log(2/\delta) by \log(2k/\delta).

1.3 Approximation, estimation and optimisation errors

A trained network is limited by its architecture, its finite sample and its training algorithm. Each limitation has a cost.

Proposition 1.5 — Decomposition of the excess risk Let \mathcal{F} be the class of functions realised by an architecture, f_{\mathcal F} a minimiser of the risk over \mathcal{F}, \hat f_n a minimiser of the empirical risk over \mathcal{F}, and \tilde f the output of the training algorithm. Then R(\tilde f) - R^\ast = \underbrace{R(f_{\mathcal F}) - R^\ast}_{\text{approximation}} + \underbrace{R(\hat f_n) - R(f_{\mathcal F})}_{\text{estimation}} + \underbrace{R(\tilde f) - R(\hat f_n)}_{\text{optimisation}} .

Moreover, the estimation error is at most 2 \sup_{f \in \mathcal F} |R(f) - \widehat R_n(f)|.

Proof. The identity is a telescoping sum. For the bound, write R(\hat f_n) - R(f_{\mathcal F}) as the sum of three differences: R(\hat f_n) - \widehat R_n(\hat f_n), then \widehat R_n(\hat f_n) - \widehat R_n(f_{\mathcal F}), then \widehat R_n(f_{\mathcal F}) - R(f_{\mathcal F}).

The middle difference is non-positive because \hat f_n minimises \widehat R_n; each of the two others is at most the supremum. ∎

Approximation is studied in ch. 8, estimation in ch. 9, optimisation in ch. 3 and ch. 4. Classically, enlarging \mathcal{F} lowers the first term and raises the second: the test error is U-shaped in the model size.

The modern regime: implicit regularisation and double descent Deep networks are trained far past interpolation of the training set, and their test error often keeps decreasing. Belkin, Hsu, Ma and Mandal (2019) called the curve double descent: a U-shape, a peak at the interpolation threshold, then a second descent.

Explaining it needs two ingredients: which interpolant the algorithm selects (implicit regularisation, Proposition 3.4), and the risk of that interpolant (Theorem 10.2).

1.4 Feed-forward and convolutional networks

Definition 1.6 — Feed-forward network Fix widths n_0 = d, n_1, \dots, n_L and an activation \sigma : \mathbb{R} \to \mathbb{R} applied entrywise, typically the ReLU \sigma(t) = \max(t, 0). The parameters are \theta = (W_\ell, b_\ell)_{\ell \le L} with W_\ell \in \mathbb{R}^{n_\ell \times n_{\ell - 1}}. The network computes a_0 = x and z_\ell = W_\ell\, a_{\ell - 1} + b_\ell, \qquad a_\ell = \sigma(z_\ell) \quad (\ell < L), \qquad f_\theta(x) = z_L .

The depth is L, the width is \max_\ell n_\ell, and the number of parameters is W = \sum_\ell n_\ell (n_{\ell - 1} + 1). For classification, f_\theta(x) \in \mathbb{R}^K is a vector of logits, turned into probabilities by the softmax.

Definition 1.7 — Convolutional layer For a signal x \in \mathbb{R}^{\mathbb{Z}} (or an image on \mathbb{Z}^2) and a filter w supported on \{-k, \dots, k\}, the convolutional layer computes (w \ast x)(u) = \sum_{|v| \le k} w(v)\, x(u - v), followed by a bias, an activation and often a subsampling (stride or pooling). With C input channels and C' output channels, the layer is a sum of such convolutions, with C C' (2k + 1) weights whatever the size of the signal: the weights are shared across positions.

Proposition 1.8 — Translation equivariance Let (T_s x)(u) = x(u - s). A convolution commutes with translations: w \ast (T_s x) = T_s (w \ast x).

So does every entrywise activation; without subsampling, a stack of such layers is translation-equivariant, and a final global average makes it invariant.

Proof: \sum_v w(v)\, x(u - v - s) is the value of w \ast x at u - s.

1.5 A tour of the zoo

The theorems below concern feed-forward networks; the same questions arise for the architectures used in practice.

Proposition 1.9 — Optimal discriminator of a GAN (Goodfellow et al., 2014) Let p be the data density and q the density of G(z), and consider V(D, G) = \mathbb{E}_{x \sim p}[\log D(x)] + \mathbb{E}_{x \sim q}[\log(1 - D(x))].

For fixed G, the maximiser over all functions D with values in (0, 1) is D^\ast = p / (p + q), and \max_D V(D, G) = 2\, \mathrm{JS}(p, q) - \log 4, where \mathrm{JS} is the Jensen–Shannon divergence. The generator therefore minimises a divergence, uniquely at q = p.

Proof. The value is the integral of p(x) \log D(x) + q(x) \log(1 - D(x)). For fixed a, b > 0, the function t \mapsto a \log t + b \log(1 - t) is maximal at t = a/(a + b), so the maximiser is pointwise.

Substituting D^\ast gives \mathrm{KL}(p \,\|\, m) + \mathrm{KL}(q \,\|\, m) - \log 4 with m = (p + q)/2, which is 2\,\mathrm{JS}(p, q) - \log 4.

The JS divergence is non-negative and vanishes only when p = q. ∎

For disjoint supports, \mathrm{JS}(p, q) = \log 2 whatever their distance, and the generator gets no gradient: hence the Wasserstein GAN (Arjovsky, Chintala and Bottou, 2017; see Optimal Transport for Machine Learning).

1.6 A piecewise-affine prediction as a function of the input

Proposition 1.10 — ReLU networks are piecewise affine Let f_\theta be a ReLU network (Definition 1.6). For every input x, call activation pattern the vector of signs \mathbb{1}[z_\ell(x) > 0] of all hidden units. On the set of inputs sharing a given pattern, f_\theta coincides with an affine map. Hence f_\theta is continuous and piecewise affine, with at most one affine piece per realised pattern.

Proof. Let D_\ell(x) be the diagonal matrix of the pattern of layer \ell, so that a_\ell = D_\ell(x) z_\ell.

On a set where all the matrices D_\ell are constant, an induction on the layers shows that z_\ell is affine in x.

Indeed z_1 is affine, and if z_\ell is affine then so is z_{\ell + 1} = W_{\ell+1} D_\ell z_\ell + b_{\ell + 1}.

Continuity holds because ReLU is continuous. ∎

Proposition 1.11 — One hidden layer on the line A ReLU network with one hidden layer of m units and a scalar input is piecewise affine with at most m + 1 pieces. Conversely, every continuous piecewise-affine function on \mathbb{R} with m + 1 pieces is realised by such a network with m hidden units, plus an affine term.

Proof. Each unit \sigma(w_j x + b_j) with w_j \neq 0 has one kink, at x = -b_j/w_j; a sum of such functions can only change slope at these m points.

Conversely, if g has kinks at t_1 < \dots < t_m with slope jumps c_j, then g(x) - \sum_j c_j \sigma(x - t_j) has no kink, so it is affine. ∎

Depth can multiply the number of pieces (ch. 8), but random networks use little of this capacity.

import numpy as np

rng = np.random.default_rng(0)

def random_layers(widths):
    """He-initialised weights and small biases for a ReLU network."""
    return [(rng.normal(0, np.sqrt(2 / m), (m, k)), rng.normal(0, 0.5, k))
            for m, k in zip(widths[:-1], widths[1:])]

def activation_patterns(x, layers):
    """Sign pattern of every hidden unit, for each input point of a 1-D grid."""
    h, pats = x[:, None], []
    for W, b in layers[:-1]:
        z = h @ W + b
        pats.append(z > 0)
        h = np.maximum(z, 0.0)
    return np.hstack(pats)

x = np.linspace(-4, 4, 40_001)
for widths in [(1, 16, 1), (1, 8, 8, 1), (1, 4, 4, 4, 4, 1)]:
    counts = []
    for trial in range(10):
        P = activation_patterns(x, random_layers(widths))
        changes = np.any(P[1:] != P[:-1], axis=1).sum()
        counts.append(changes + 1)          # affine pieces of x -> f(x)
    print(f"widths {widths}: {sum(widths[1:-1])} units, "
          f"mean pieces {np.mean(counts):.1f}, max {max(counts)}")

With 16 hidden units in each case, the mean number of pieces on [-4, 4] is 16.1 for one layer, 15.9 for two and 13.6 for four: it grows with the number of units, not exponentially with depth, as Hanin and Rolnick (2019) prove in expectation at initialisation.

Key takeaways — chapter 1

  • A held-out test set estimates the risk to within \sqrt{\log(2/\delta)/(2m)}.
  • The excess risk splits into approximation, estimation and optimisation errors.
  • With an optimal discriminator, a GAN generator minimises a Jensen–Shannon divergence.
  • A ReLU network is continuous and piecewise affine in its input, one piece per activation pattern.

2. The prediction as a function of the parameters; back-propagation

Training sees f_\theta as a function of \theta. This chapter describes its regularity and symmetries, and computes its gradient.

2.1 A piecewise-polynomial prediction in θ

Proposition 2.1 — Piecewise-polynomial dependence on the parameters Fix an input x and a ReLU network of depth L. The map \theta \mapsto f_\theta(x) is continuous and piecewise polynomial. On each set of parameters that share the same activation pattern at x, it is a polynomial of degree at most L, affine in each pair (W_\ell, b_\ell) separately.

The sets of constant pattern are defined by polynomial inequalities in \theta: they are semi-algebraic, a fact used in ch. 4.

Proof. With the pattern matrices D_\ell fixed, unroll Definition 1.6: f_\theta(x) = W_L D_{L-1}\big(W_{L-1} D_{L-2}(\cdots D_1 (W_1 x + b_1) \cdots) + b_{L-1}\big) + b_L .

Expanding the products, each monomial contains at most one entry of (W_\ell, b_\ell) for each layer \ell, hence the degree bound and the multi-affine structure.

The pattern is constant where the signs of the z_\ell(x) are fixed, and each z_\ell(x) is itself a polynomial in \theta on such a set. ∎

For the square loss, the empirical risk is therefore piecewise polynomial of degree at most 2L in \theta: a smooth function on each piece, with kinks on the boundaries.

2.2 Basic properties of the cost function

Definition 2.2 — Training objective Given data (x_i, y_i)_{i \le n} and a loss \ell, the training objective is the empirical risk as a function of the parameters, possibly with weight decay \lambda \ge 0: F(\theta) = \frac1n \sum_{i=1}^n \ell\big(f_\theta(x_i), y_i\big) + \frac{\lambda}{2}\, \|\theta\|^2 .

Proposition 2.3 — Symmetries of ReLU networks The following transformations of \theta leave the function f_\theta unchanged, hence leave F unchanged when \lambda = 0.

  • Permutation. Permute the units of a hidden layer \ell: the rows of (W_\ell, b_\ell) and the columns of W_{\ell + 1} by the same permutation.
  • Rescaling. For c > 0, replace (W_\ell, b_\ell, W_{\ell + 1}) by (c W_\ell, c\, b_\ell, W_{\ell + 1}/c).

Proof. A permutation of the units only reorders the terms of the sum computed by layer \ell + 1.

For the rescaling, ReLU is positively homogeneous, \sigma(ct) = c\,\sigma(t) for c > 0; the factor c multiplying z_\ell goes through \sigma and is cancelled by W_{\ell + 1}/c. ∎

Example 2.4 — The smallest deep network Take one scalar weight per layer, two layers, one data point x = y = 1 and no activation: F(a, b) = (ab - 1)^2 .

  • The global minima form the hyperbola ab = 1: unbounded and not isolated, the rescaling orbit of Proposition 2.3.
  • The origin is a critical point. The Hessian there is the matrix with 0 on the diagonal and -2 off it, with eigenvalues \pm 2: a strict saddle.
  • F is not convex: F(1, 1) = F(-1, -1) = 0, but F equals 1 at their midpoint (0, 0).

Corollary 2.5 — Non-convexity and non-coercivity Let F be the objective of a ReLU network with \lambda = 0.

  • Non-convexity. Suppose that F has a minimiser, that a hidden layer has two units, and that no minimiser of F gives these two units identical incoming and outgoing weights. Then F is not convex.
  • Non-coercivity. If some layer is not identically zero at a minimiser, F has unbounded level sets and no isolated minimiser; it is not strongly convex near any minimiser.

With weight decay \lambda > 0, F becomes coercive and has a minimiser, but the permutation symmetry, hence the non-convexity, remain.

Proof. If F were convex, its set of minimisers would be convex. Let \theta^\ast be a minimiser and \pi\theta^\ast its image under the swap of the two units; both are minimisers.

Their midpoint is then a minimiser, and it is invariant under the swap: the two units have identical weights, a contradiction.

For coercivity, the rescaling orbit of \theta^\ast is an unbounded curve on which F is constant. ∎

2.3 Back-propagation

Algorithm 2.6 — Back-propagation For one example (x, y) and the network of Definition 1.6:

  1. Forward pass. Compute and store z_\ell and a_\ell for \ell = 1, \dots, L.
  2. Output. Set \delta_L = \nabla_{z_L}\, \ell(z_L, y).
  3. Backward pass. For \ell = L - 1, \dots, 1, set \delta_\ell = \sigma'(z_\ell) \odot \big(W_{\ell + 1}^\top \delta_{\ell + 1}\big).
  4. Gradients. For every layer, \frac{\partial \ell}{\partial W_\ell} = \delta_\ell\, a_{\ell - 1}^\top, \qquad \frac{\partial \ell}{\partial b_\ell} = \delta_\ell .

For a mini-batch, the gradients of the examples are averaged.

Theorem 2.7 — Correctness and cost of back-propagation At every point where \sigma is differentiable at all the z_\ell, the vector \delta_\ell equals \partial \ell / \partial z_\ell, and the formulas of step 4 give the gradient. The backward pass costs at most twice the multiplications of the forward pass, whatever the number W of parameters.

By contrast, finite differences need W + 1 forward passes.

Proof. Induction from \ell = L down. The map z_\ell \mapsto z_{\ell+1}, given by z_{\ell+1} = W_{\ell+1}\sigma(z_\ell) + b_{\ell+1}, has Jacobian W_{\ell+1}\,\mathrm{diag}(\sigma'(z_\ell)).

By the chain rule (Definition 0.1), \partial \ell / \partial z_\ell is the transpose of this Jacobian applied to \delta_{\ell + 1}, which is step 3.

Since z_\ell = W_\ell a_{\ell-1} + b_\ell depends on W_\ell linearly, the derivative with respect to the entry (i, j) of W_\ell is \delta_{\ell, i}\, a_{\ell - 1, j}.

For the cost, layer \ell costs n_\ell n_{\ell - 1} multiplications forward; backward it needs one product by W_\ell^\top and one outer product, each of the same size. ∎

Back-propagation is reverse-mode automatic differentiation; its price is the memory needed to store every z_\ell. At a ReLU kink, PyTorch sets \sigma'(0) = 0, and the output need not be a gradient (ch. 11).

import numpy as np
import torch

rng = np.random.default_rng(0)
d, m, n = 3, 5, 4
X = rng.normal(size=(n, d)); y = rng.normal(size=n)
W1, W2, w3 = rng.normal(size=(m, d)), rng.normal(size=(m, m)), rng.normal(size=m)

z1 = X @ W1.T; a1 = np.maximum(z1, 0)          # forward pass, storing z_l and a_l
z2 = a1 @ W2.T; a2 = np.maximum(z2, 0)
f = a2 @ w3

g_f = (f - y) / n                               # backward pass, loss = mean of (f - y)^2 / 2
g_w3 = a2.T @ g_f
d2 = np.outer(g_f, w3) * (z2 > 0)               # delta_2 = sigma'(z_2) * (w3 delta_3)
g_W2 = d2.T @ a1
d1 = (d2 @ W2) * (z1 > 0)                       # delta_1 = sigma'(z_1) * (W2^T delta_2)
g_W1 = d1.T @ X

T = lambda A: torch.tensor(A, requires_grad=True)
tW1, tW2, tw3 = T(W1), T(W2), T(w3)
tf = torch.relu(torch.relu(torch.tensor(X) @ tW1.T) @ tW2.T) @ tw3
(0.5 * ((tf - torch.tensor(y)) ** 2).mean()).backward()
err = max(np.abs(g - t.grad.numpy()).max() for g, t in [(g_W1, tW1), (g_W2, tW2), (g_w3, tw3)])
print(f"max |hand-made gradient - autograd| = {err:.1e}")

The hand-made gradient agrees with PyTorch’s autograd to machine precision (2.2 \times 10^{-16}).

2.4 Exploding and vanishing gradients

Proposition 2.8 — Gradients are products of matrices With D_\ell = \mathrm{diag}(\sigma'(z_\ell)), the Jacobian of a network with respect to its input is J_{f_\theta}(x) = W_L D_{L-1} W_{L-1} \cdots D_1 W_1 .

For ReLU, \|D_\ell\|_2 \le 1, so \|J_{f_\theta}(x)\|_2 \le \prod_\ell \|W_\ell\|_2. Likewise, \delta_\ell is a product of L - \ell such factors applied to \delta_L.

Proof. Apply the chain rule of Definition 0.1 to the composition of the maps a_{\ell-1} \mapsto a_\ell, whose Jacobians are D_\ell W_\ell, and use the sub-multiplicativity of the operator norm. ∎

A product of L random matrices typically grows or decays geometrically in L. The initialisation decides which.

Proposition 2.9 — Variance propagation and He initialisation Let the weights of layer \ell + 1 be independent \mathcal{N}(0, s^2/n_\ell), the biases zero, and \sigma the ReLU. Let q_\ell be the second moment of one coordinate of z_\ell. Then

Key result — variance propagation through ReLU layers q_{\ell + 1} = \frac{s^2}{2}\, q_\ell .

With s^2 = 2 (He et al., 2015) the second moment is preserved across layers. With s^2 = 2g^2 it is multiplied by g^{2L} over L layers. The back-propagated \delta_\ell obey the same law under the usual approximation that treats the backward weights as independent of the forward activations.

Proof. Coordinate i of z_{\ell+1} is \sum_j W_{ij} a_{\ell, j} with W independent of a_\ell, so its second moment is (s^2/n_\ell)\, \mathbb{E}\|a_\ell\|^2.

Given the previous layer, z_\ell is a centred Gaussian vector, hence symmetric, so \mathbb{E}\big[\sigma(z_{\ell, j})^2\big] = \tfrac12\, \mathbb{E}\big[z_{\ell, j}^2\big].

Summing over the n_\ell units gives \mathbb{E}\|a_\ell\|^2 = n_\ell q_\ell / 2. The backward pass is the same computation with W^\top. ∎

import numpy as np

rng = np.random.default_rng(0)
width, L = 200, 50
for gain in [0.8, 1.0, 1.2]:
    x = rng.normal(size=width)
    Ws, h = [], x
    for _ in range(L):                                    # forward pass, He scale times gain
        W = rng.normal(0, gain * np.sqrt(2 / width), (width, width))
        Ws.append((W, W @ h > 0)); h = np.maximum(W @ h, 0)
    g = rng.normal(size=width); g /= np.linalg.norm(g)    # backward: g <- W^T (mask * g)
    for W, mask in reversed(Ws):
        g = W.T @ (mask * g)
    print(f"gain {gain}: ||grad wrt input|| after {L} layers = {np.linalg.norm(g):.2e}"
          f"  (gain^L = {gain ** L:.2e})")

After 50 layers of width 200, the back-propagated norm is 1.8 \times 10^{-5} for a gain of 0.8, 1.3 for the He scale, and 1.2 \times 10^{4} for a gain of 1.2, in line with g^{L}.

The standard remedies follow from Proposition 2.8.

Key takeaways — chapter 2

  • For a fixed input, a ReLU network is piecewise polynomial of degree at most L in its parameters.
  • Permutation and rescaling symmetries make the objective non-convex and non-coercive.
  • Back-propagation computes the whole gradient for at most about three times the cost of a forward pass, whatever the number of parameters.
  • Gradients scale like g^{L}; initialisation, residual connections and normalisation keep them at scale.

3. Landscape of the objective function

Whether a gradient method finds a good minimum depends on the critical points of the objective. This chapter describes them for linear networks and for wide non-linear networks.

3.1 Critical points and why they matter

Definition 3.1 — Critical points Let F be twice differentiable. A point \theta with \nabla F(\theta) = 0 is critical. A local minimum that is not global is spurious.

A critical point that is neither a local minimum nor a local maximum is a saddle. Following Lee et al. (2016), a critical point is a strict saddle if the Hessian has a direction of negative curvature: \lambda_{\min}\big(\nabla^2 F(\theta)\big) < 0 .

Such a point is never a local minimum; local maxima with a negative eigenvalue are included. F has the strict saddle property if each of its critical points is a local minimum or a strict saddle.

What the landscape buys for optimisation From a random initialisation, gradient descent almost surely avoids strict saddles (Lee, Simchowitz, Jordan and Recht, 2016; Theorem 4.3). If all local minima are global, the strict saddle property holds and the iterates converge, then the limit is a global minimum for almost every initialisation.

Degenerate saddles break the argument: for the depth-3 scalar network (abc - 1)^2, the Hessian vanishes at the origin.

3.2 Linear networks: no spurious minima, implicit regularisation

Theorem 3.2 — Baldi and Hornik (1989) Let A \in \mathbb{R}^{m \times k} and B \in \mathbb{R}^{k \times d} with k \le \min(m, d), and minimise F(A, B) = \sum_{i=1}^n \|y_i - A B x_i\|^2 .

Assume that \Sigma_{XX} = \sum_i x_i x_i^\top is invertible and that the matrix \Sigma = \Sigma_{YX} \Sigma_{XX}^{-1} \Sigma_{XY} has full rank and distinct eigenvalues \lambda_1 > \dots > \lambda_m, with orthonormal eigenvectors u_1, \dots, u_m. Then:

  • every local minimum of F is global;
  • at a global minimum, AB = U_k U_k^\top \Sigma_{YX} \Sigma_{XX}^{-1}, with U_k = [u_1, \dots, u_k]: the least-squares regressor, projected on the top-k eigenvectors;
  • every other critical point with A of full rank is a saddle, associated with another set of k eigenvectors.

Proof sketch. At a critical point with A of full rank, the condition in B gives AB = P_A \Sigma_{YX} \Sigma_{XX}^{-1}, where P_A is the orthogonal projector on the range of A.

The condition in A then forces P_A \Sigma = \Sigma P_A. Hence the range of A is spanned by k eigenvectors, indexed by a set I.

The loss equals \mathrm{tr}(\Sigma_{YY}) - \sum_{i \in I} \lambda_i. If I is not the top-k set, rotating one eigenvector of I towards a better unused one decreases the loss, so the point is a saddle. When Y = X, this recovers principal component analysis.

Example 3.3 — Example 2.4 again For F(a, b) = (ab - 1)^2, the gradient is 2(ab - 1)(b, a). It vanishes on the hyperbola ab = 1 (global minima) and at the origin (a strict saddle). There is no spurious local minimum, as Theorem 3.2 predicts.

Linear models also show how the algorithm selects one minimiser among many.

Proposition 3.4 — Implicit regularisation of gradient descent Let X \in \mathbb{R}^{n \times p} have rank n < p, and run gradient descent on \tfrac12 \|Xw - y\|^2 with a step 0 < \eta < 2/\|X\|_2^2: w_{k + 1} = w_k - \eta\, X^\top (X w_k - y).

Let P = X^+ X be the orthogonal projector on the row space. Then w_k \xrightarrow[k \to \infty]{} X^+ y + (I - P)\, w_0 .

From w_0 = 0, gradient descent converges to the minimum-norm interpolant (Proposition 0.5), although nothing in the objective asks for a small norm.

Proof. Every update lies in \mathrm{Im}(X^\top), so the component (I - P)w_k never changes.

Let w^+ = X^+ y, which satisfies X^\top X w^+ = X^\top y. Then P w_{k+1} - w^+ = (I - \eta X^\top X)(P w_k - w^+).

On the row space, X^\top X has eigenvalues s_i^2 \in (0, \|X\|_2^2], so this map is a contraction of ratio \max_i |1 - \eta s_i^2| < 1, and P w_k \to w^+. ∎

import numpy as np

rng = np.random.default_rng(1)
n, p = 20, 100
X, y = rng.normal(size=(n, p)), rng.normal(size=n)
step = 1 / np.linalg.norm(X, 2) ** 2
w_min_norm = np.linalg.pinv(X) @ y
P_row = np.linalg.pinv(X) @ X                           # projector on the row space of X
for name, w in [("zero init", np.zeros(p)), ("random init", rng.normal(size=p))]:
    w0 = w.copy()
    for _ in range(5000):
        w -= step * X.T @ (X @ w - y)
    print(f"{name}: residual {np.linalg.norm(X @ w - y):.1e}, "
          f"||w - w_min_norm|| = {np.linalg.norm(w - w_min_norm):.2f}, "
          f"||w - (w_min_norm + (I-P) w0)|| = {np.linalg.norm(w - w_min_norm - w0 + P_row @ w0):.1e}")

Both runs interpolate the data. From zero, the limit is the minimum-norm solution; from a random start, it is off by 8.93 in norm, exactly the component (I - P)w_0 predicted by Proposition 3.4.

For deeper linear networks the bias is subtler, and it is governed by a conserved quantity.

Proposition 3.5 — Balancedness is conserved Let G(A, B) = \mathcal{L}(AB) with \mathcal{L} differentiable, and let (A(t), B(t)) follow the gradient flow of G. Then the matrix A^\top A - B B^\top is constant in time.

Proof. Write \nabla = \nabla \mathcal{L}(AB). The flow is \dot A = -\nabla B^\top and \dot B = -A^\top \nabla.

Hence the two derivatives are \frac{d}{dt}(A^\top A) = -B \nabla^\top A - A^\top \nabla B^\top, \qquad \frac{d}{dt}(B B^\top) = -A^\top \nabla B^\top - B \nabla^\top A, and they are equal. ∎

From a small balanced initialisation, the product follows a preconditioned flow that favours low rank (Arora, Cohen and Hazan, 2018; Gunasekar et al., 2017). Du, Hu and Lee (2018) prove the analogous conservation, unit by unit, for ReLU networks.

3.3 Stability of minimisers in structured linear networks

Minimisers are never isolated (Corollary 2.5), so stability must be measured modulo the symmetries: two sets of factors are close if they are close after rescaling. In the rank-one case this is a statement about directions.

Proposition 3.6 — Stability of rank-one factors Let u, u' \in \mathbb{R}^m and v, v' \in \mathbb{R}^n be non-zero, X = u v^\top and X' = u' v'^\top. Then the angle between the factors satisfies \sin \angle(u, u') \le \frac{\|X - X'\|_F}{\|X\|_F}, and the same bound holds for v and v'.

Proof. Let Q be the orthogonal projector on the orthogonal complement of u', so that Q X' = 0.

Then, using \|u\|\,\|v\| = \|X\|_F, \|Q(X - X')\|_F = \|Q u\|\, \|v\| = \sin \angle(u, u')\, \|X\|_F .

Since Q is a contraction, \|Q(X - X')\|_F \le \|X - X'\|_F. ∎

The constant 1/\|X\|_F blows up near the origin, the saddle of Example 2.4. Malgouyres and Landsberg (official reference 7) treat products of any number of structured factors, for instance convolutional ones. Through a tensorial lifting based on the Segre embedding, they characterise when the factors are identifiable up to rescaling.

A deep analogue of the null-space property of compressed sensing then makes the error on the factors linear in the error on the product: successful training yields stable, hence interpretable, layers.

import numpy as np

rng = np.random.default_rng(1)
u, v = rng.normal(size=8), rng.normal(size=6)
for scale in [1.0, 0.1]:
    Xs = scale * np.outer(u, v)
    noisy = Xs + 0.01 * rng.normal(size=Xs.shape)
    U, s, Vt = np.linalg.svd(noisy)
    X_hat = s[0] * np.outer(U[:, 0], Vt[0])            # best rank-one approximation
    sin_u = np.sqrt(max(0.0, 1 - (U[:, 0] @ u / np.linalg.norm(u)) ** 2))
    bound = np.linalg.norm(X_hat - Xs) / np.linalg.norm(Xs)
    print(f"||X||_F = {np.linalg.norm(Xs):5.2f}: sin(angle(u_hat, u)) = {sin_u:.4f} <= bound {bound:.4f}")

With the same noise, the factor direction is recovered to \sin\angle = 0.017 when \|X\|_F = 2.15, but only to 0.125 when \|X\|_F = 0.21, each time below the bound of Proposition 3.6.

3.4 Non-linear networks: the benefit of width

Theorem 3.7 — A wide last hidden layer has no bad critical points Write f_\theta(x) = V^\top \phi_\psi(x), where \phi_\psi(x) \in \mathbb{R}^m gathers the last hidden layer (parameters \psi) and V \in \mathbb{R}^{m \times c} the output weights. Let \Phi_\psi \in \mathbb{R}^{N \times m} stack the features of the N training points, and F(\psi, V) = \tfrac12 \|\Phi_\psi V - Y\|_F^2 .

If (\psi, V) is critical and \Phi_\psi has rank N (which requires m \ge N), then F(\psi, V) = 0: the point is a global minimum.

Proof. The gradient in V is \Phi_\psi^\top (\Phi_\psi V - Y), and it vanishes at a critical point.

Since \Phi_\psi has rank N, the map r \mapsto \Phi_\psi^\top r is injective on \mathbb{R}^N, so the residual \Phi_\psi V - Y is zero. ∎

Bad critical points can therefore only occur where the features lose rank. Nguyen and Hein turn this mechanism into a statement about almost all parameters.

Theorem 3.8 — Nguyen and Hein (2017), statement Consider a fully connected network with the square loss and an analytic activation, such as the sigmoid or the softplus. Suppose one hidden layer has more units than there are training points, and the widths do not increase from that layer to the output (a pyramidal structure).

Then, under mild conditions on the data and the activation, almost all local minima are global. The proof shows that the feature matrix of the wide layer has rank N for almost every choice of the lower weights, and extends the argument of Theorem 3.7 through the upper layers.

Venturi, Bandeira and Bruna (official reference 5) show that wide enough networks of finite intrinsic dimension have no spurious valleys; Safran and Shamir (official reference 6) that over-specified networks often start in a good basin. Width is not sufficient in general: Safran and Shamir (2018) exhibit spurious local minima in two-layer ReLU networks of moderate width.

Key takeaways — chapter 3

  • Two-layer linear networks have no spurious local minima; their other critical points are saddles.
  • From zero, gradient descent on under-determined least squares converges to the minimum-norm interpolant.
  • Factors of a product are stable only modulo rescaling, and not near the zero product.
  • A hidden layer wider than the data set removes bad critical points where its features have full rank.

4. Non-convex optimisation

Chapter 3 described the landscape. This chapter follows the iterates of gradient methods through it: which critical points they avoid, whether they converge, and how fast.

4.1 Gradient descent on smooth functions

Theorem 4.1 — Stationarity at rate 1/√K Let F have an L-Lipschitz gradient and be bounded below by F^\ast. Gradient descent with step 1/L satisfies \min_{k < K} \|\nabla F(x_k)\|^2 \le \frac{2L\, (F(x_0) - F^\ast)}{K} .

Proof. By the descent lemma (Proposition 0.2), each step decreases F by at least \|\nabla F(x_k)\|^2/(2L). Summing over k < K, the total decrease, at most F(x_0) - F^\ast, bounds K/(2L) times the minimum. ∎

The theorem says nothing about which critical point is approached, nor whether the iterates converge at all. The next two sections answer these questions.

4.2 Morse functions and strict saddles

Definition 4.2 — Morse function A twice differentiable function is Morse if the Hessian is invertible at every critical point. Its critical points are then isolated, and each one is a local minimum, a local maximum or a strict saddle.

Training objectives are never Morse, since their minimisers come in continuous families (Corollary 2.5). Lee and coauthors treat one strict saddle at a time. Panageas and Piliouras (official reference 2) cover non-isolated critical points, which gives the first statement below.

Theorem 4.3 — Gradient descent only converges to minimisers (Lee, Simchowitz, Jordan and Recht, 2016; Panageas and Piliouras, 2017) Let F be twice continuously differentiable with an L-Lipschitz gradient, and run gradient descent with a step 0 < \eta < 1/L. The set of initial points from which the iterates converge to a strict saddle has Lebesgue measure zero.

For a Morse function, if the iterates converge, then for almost every initialisation the limit is a local minimum.

Proof sketch.

  1. The map g(x) = x - \eta \nabla F(x) is a diffeomorphism: its Jacobian I - \eta \nabla^2 F is invertible because \eta \|\nabla^2 F\| < 1.
  2. At a strict saddle x^\ast, the Jacobian of g has an eigenvalue 1 - \eta \lambda_{\min} > 1. The centre-stable manifold theorem puts all points whose orbit stays near x^\ast on a manifold of dimension less than p, a null set.
  3. The points that converge to x^\ast are preimages of this null set under the iterates of g. The inverse of g is C^1 and maps null sets to null sets, so this countable union is null.
  4. Cover the strict saddles by countably many such neighbourhoods (Lindelöf’s lemma) to conclude.

Example 4.4 — Avoiding a saddle Let F(x, y) = x^4/4 - x^2/2 + y^2/2. Its critical points are the minima (\pm 1, 0) and the strict saddle (0, 0), with Hessian \mathrm{diag}(-1, 1). The iterates converge to the saddle only from its stable manifold, the line x = 0.

import numpy as np

rng = np.random.default_rng(0)
grad = lambda z: np.stack([z[:, 0] ** 3 - z[:, 0], z[:, 1]], axis=1)
Z = rng.uniform(-2, 2, size=(10_000, 2))           # 10 000 random initialisations
for _ in range(500):
    Z = Z - 0.1 * grad(Z)
print("limits reached:", np.unique(np.round(Z, 6) + 0.0, axis=0).tolist())
z = np.array([[0.0, 1.5]])                          # start on the stable manifold {x = 0}
for _ in range(500):
    z = z - 0.1 * grad(z)
print("start (0, 1.5) ->", np.round(z, 6).tolist())

All 10 000 random starts end at (-1, 0) or (1, 0); the start (0, 1.5), on the stable manifold, ends at the saddle.

4.3 The Kurdyka–Łojasiewicz property

Bounded gradient iterates may still fail to converge: on some smooth functions they circle forever around a ring of minimisers (Absil, Mahony and Andrews, 2005). The Kurdyka–Łojasiewicz property rules this out.

Definition 4.5 — Kurdyka–Łojasiewicz (KL) property A differentiable F has the KL property at \bar x if there are \eta > 0, a neighbourhood U of \bar x and a desingularising function \varphi, such that the inequality below holds.

Here \varphi : [0, \eta) \to [0, \infty) is concave and continuous, \varphi(0) = 0, and \varphi is C^1 and increasing on (0, \eta). The inequality is \varphi'\big(F(x) - F(\bar x)\big)\, \|\nabla F(x)\| \ge 1 for every x \in U with F(\bar x) < F(x) < F(\bar x) + \eta.

With \varphi(s) = c\, s^{1 - \vartheta} this is the Łojasiewicz inequality, with exponent \vartheta \in [0, 1): |F(x) - F(\bar x)|^{\vartheta} \le C\, \|\nabla F(x)\| .

Proposition 4.6 — Algebraic and geometric properties of deep learning losses

  • Real-analytic functions satisfy the Łojasiewicz inequality (Łojasiewicz, 1963).
  • Functions definable in an o-minimal structure satisfy the KL property at every point: Kurdyka (1998) in the smooth case, Bolte, Daniilidis, Lewis and Shiota (2007) for non-smooth functions and Clarke subgradients.
  • Semi-algebraic functions are definable. By Proposition 2.1, the empirical risk of a ReLU network with the square, absolute or hinge loss is semi-algebraic.
  • With sigmoids, softmax and cross-entropy, the objective is definable in the structure generated by the exponential, which is o-minimal (Wilkie, 1996).

The usual training objectives therefore have the KL property everywhere. The proofs belong to o-minimal (tame) geometry (van den Dries, 1998).

Theorem 4.7 — Convergence of gradient descent under KL Let F have an L-Lipschitz gradient and the KL property at every point, and run gradient descent with step \eta \le 1/L. If the iterates are bounded, they have finite length and converge to a critical point: \sum_{k} \|x_{k+1} - x_k\| < \infty .

Proof. Let \Delta_k = x_{k+1} - x_k = -\eta \nabla F(x_k), let \bar x be a cluster point, and let r_k = F(x_k) - F(\bar x), which decreases to 0.

Sufficient decrease. The descent lemma with \eta \le 1/L gives r_k - r_{k+1} \ge \|\Delta_k\|^2 / (2\eta).

KL step. For k large, x_k \in U, and the KL inequality reads \varphi'(r_k) \ge \eta / \|\Delta_k\|. By concavity, \varphi(r_k) - \varphi(r_{k+1}) \ge \varphi'(r_k)\,(r_k - r_{k+1}) \ge \tfrac12 \|\Delta_k\| .

Conclusion. Summing telescopes into \sum_k \|\Delta_k\| \le 2\varphi(r_{k_0}). Finite length makes (x_k) a Cauchy sequence; its limit is critical because \nabla F(x_k) = -\Delta_k/\eta \to 0.

That the iterates stay in U after some k_0 follows from the same estimate by induction (Attouch and Bolte, 2009). ∎

The exponent gives the rate: \vartheta = 1/2 yields linear convergence, and \vartheta \in (1/2, 1) a polynomial rate. Bolte, Sabach and Teboulle (official reference 1) isolate the three ingredients of this proof — sufficient decrease, a relative error bound, KL — and apply them to proximal alternating minimisation over blocks of variables, such as the layers of a network or the factors of a matrix factorisation.

4.4 Global convergence: least squares under surjectivity, stochastic gradient

When the Jacobian of the outputs stays surjective along training, which requires over-parameterisation, the KL inequality holds globally with exponent 1/2, and gradient descent reaches a global minimum.

Theorem 4.8 — Least squares under a surjectivity assumption Let G : \mathbb{R}^p \to \mathbb{R}^N map the parameters to the outputs on the N training points, J(\theta) its Jacobian and F(\theta) = \tfrac12 \|G(\theta) - y\|^2. Assume that, on a set containing the iterates, \nabla F is \beta-Lipschitz and \lambda_{\min}\big(J(\theta) J(\theta)^\top\big) \ge \mu > 0 .

Then gradient descent with step \eta \le 1/\beta satisfies

Key result — linear convergence under the PL inequality F(\theta_k) \le (1 - \eta \mu)^k\, F(\theta_0) .

Proof. With r = G(\theta) - y, the gradient is J^\top r. Hence \|\nabla F\|^2 = r^\top J J^\top r \ge \mu \|r\|^2 = 2\mu F: this is the Polyak–Łojasiewicz inequality.

The descent lemma then gives F(\theta_{k+1}) \le F(\theta_k) - \tfrac{\eta}{2}\|\nabla F(\theta_k)\|^2 \le (1 - \eta\mu)\, F(\theta_k).

∎

Surjectivity of J needs at least as many parameters as data points (p \ge N). For a wide two-layer network, \mu is bounded below at initialisation and the Jacobian barely moves during training, the lazy regime of ch. 11.

import torch

torch.set_num_threads(1)                            # tiny model: one thread is fastest
torch.manual_seed(0)
N, d, m = 20, 20, 2000
X = torch.randn(N, d); X = X / X.norm(dim=1, keepdim=True)
y = torch.randn(N)

def outputs(theta):                                 # f(x) = a^T relu(W x) / sqrt(m)
    W, a = theta[: m * d].view(m, d), theta[m * d:]
    return torch.relu(X @ W.T) @ a / m ** 0.5

def spectrum(theta):                                # extreme eigenvalues of J J^T
    J = torch.autograd.functional.jacobian(outputs, theta.detach())
    e = torch.linalg.eigvalsh(J @ J.T)
    return e[0].item(), e[-1].item()

theta = torch.randn(m * d + m, requires_grad=True)
mu, lam = spectrum(theta)
lr = 0.2                                            # below 1 / lambda_max
opt, losses = torch.optim.SGD([theta], lr=lr), []
for t in range(201):
    loss = 0.5 * ((outputs(theta) - y) ** 2).sum()
    losses.append(loss.item())
    opt.zero_grad(); loss.backward(); opt.step()
print(f"at init: mu = {mu:.3f}, lambda_max = {lam:.2f}; after training: mu = {spectrum(theta)[0]:.3f}")
print("loss at steps 0, 50, 100, 200:", [f"{losses[k]:.1e}" for k in (0, 50, 100, 200)])
print(f"guaranteed rate 1 - lr*mu = {1 - lr * mu:.3f}; "
      f"observed rate per step = {(losses[200] / losses[100]) ** 0.01:.3f}")

With 2 000 hidden units and 20 data points, \mu = 0.274 at initialisation and 0.271 after training. The loss falls from 15 to 3.9 \times 10^{-10} in 200 steps, at an observed rate of 0.900 per step, faster than the guaranteed 0.945.

Theorem 4.9 — Stochastic gradient on a smooth non-convex function (Ghadimi and Lan, 2013) Let F have an L-Lipschitz gradient and be bounded below by F^\ast, and run x_{k+1} = x_k - \eta g_k.

Here g_k is an unbiased estimate of \nabla F(x_k), with variance at most \sigma^2. If \eta \le 1/L, then \frac1K \sum_{k < K} \mathbb{E}\|\nabla F(x_k)\|^2 \le \frac{2\,(F(x_0) - F^\ast)}{\eta K} + L \eta \sigma^2 .

The choice \eta \propto 1/\sqrt{K} gives the rate O(1/\sqrt{K}).

Proof. The second moment of g_k is \|\nabla F(x_k)\|^2 plus the variance. The descent lemma in conditional expectation then gives \mathbb{E} F(x_{k+1}) \le \mathbb{E} F(x_k) - \frac{\eta}{2}\, \mathbb{E}\|\nabla F(x_k)\|^2 + \frac{L\eta^2\sigma^2}{2} .

Sum over k < K and divide by \eta K/2. ∎

ReLU networks are not smooth, but they are definable. For such locally Lipschitz functions, Davis, Drusvyatskiy, Kakade and Lee (official reference 24) prove that the stochastic subgradient method with decreasing steps has, almost surely, only Clarke-critical limit points, under a boundedness assumption.

Key takeaways — chapter 4

  • Gradient descent finds an \varepsilon-stationary point in O(1/\varepsilon^2) steps and almost surely avoids strict saddles.
  • Deep learning objectives are definable, hence KL: bounded iterates converge.
  • A surjective Jacobian gives the PL inequality and linear convergence to a global minimum.
  • Stochastic gradient reaches stationarity at rate O(1/\sqrt{K}).

5. Robust deep learning I: stability, interpretability, Bayesian uncertainty

A network deployed in a hospital or a car must be accurate, but also predictable. A small change of the input should not flip the decision, and the network should signal when it does not know. This chapter introduces both sides of decision robustness: stability and uncertainty.

5.1 Decision robustness for critical systems

In medical diagnosis or autonomous driving, errors have asymmetric and sometimes irreversible costs. A deployed model must then answer three questions besides “what is the prediction?”.

Definition 5.1 — Lipschitz stability and certified margin A map f is L-Lipschitz if \|f(x) - f(x')\| \le L \|x - x'\| for all inputs. For a classifier with logits f and predicted class y, the margin is m(x) = f_y(x) - \max_{k \ne y} f_k(x).

If f is L-Lipschitz in the Euclidean norm, each difference f_y - f_k is \sqrt2 L-Lipschitz. The decision is therefore unchanged on the ball \|\delta\| < \frac{m(x)}{\sqrt2\, L} .

Proposition 5.2 — A Lipschitz bound for networks If every activation is 1-Lipschitz (ReLU and tanh are; the sigmoid is even 1/4-Lipschitz), then \mathrm{Lip}(f_\theta) \le \prod_{\ell = 1}^L \|W_\ell\|_2 .

Proof: each layer a \mapsto \sigma(W_\ell a + b_\ell) is \|W_\ell\|_2-Lipschitz; compose, as in Proposition 2.8. The bound is often very pessimistic, but it is what spectral normalisation controls.

Example 5.3 — Why high dimension makes linear models fragile For a linear score w^\top x, the perturbation \delta = \varepsilon\, \mathrm{sign}(w), of max-norm \varepsilon, changes the score by \varepsilon \|w\|_1.

Take 3072 inputs (a 32 × 32 colour image), weights of size 0.1 and \varepsilon = 1/255, an invisible change. The score moves by \varepsilon \|w\|_1 = 3072 \times 0.1 / 255 \approx 1.2 .

The effect grows linearly with the dimension. This is the explanation of adversarial examples given by Goodfellow, Shlens and Szegedy (2015), whose attack takes \delta = \varepsilon\, \mathrm{sign}(\nabla_x \ell).

5.2 Stability to deformations

Images of the same object differ by small deformations more than by additive noise.

Definition 5.4 — Stability to deformations Let \tau : \mathbb{R}^d \to \mathbb{R}^d be a smooth displacement field and (L_\tau x)(u) = x(u - \tau(u)) the deformed signal. A representation \Phi is stable to deformations if, for some constant C, \|\Phi(L_\tau x) - \Phi(x)\| \le C\, \|x\|\, \big(\|\nabla \tau\|_\infty + \text{higher-order terms in } \tau\big).

Invariance to translations alone is not enough: the modulus of the Fourier transform is translation-invariant, but a small dilation moves its high frequencies far away.

5.3 Influence functions: which training points drive a prediction?

Theorem 5.5 — Influence of a training point (Koh and Liang, 2017) Let \hat\theta minimise \widehat R(\theta) = \frac1n \sum_i \ell(z_i, \theta), twice differentiable with invertible Hessian H at \hat\theta.

Up-weight a point z by \varepsilon, and let \hat\theta_\varepsilon minimise \widehat R(\theta) + \varepsilon\, \ell(z, \theta). Then \frac{d \hat\theta_\varepsilon}{d\varepsilon}\Big|_{\varepsilon = 0} = -H^{-1} \nabla_\theta \ell(z, \hat\theta).

For a test point, the loss changes at the rate \frac{d}{d\varepsilon}\, \ell(z_{\mathrm{test}}, \hat\theta_\varepsilon)\Big|_{\varepsilon = 0} = -\nabla_\theta \ell(z_{\mathrm{test}}, \hat\theta)^\top H^{-1} \nabla_\theta \ell(z, \hat\theta).

Removing z from the training set corresponds to \varepsilon = -1/n.

Proof. The optimality condition defines \hat\theta_\varepsilon implicitly: \nabla \widehat R(\hat\theta_\varepsilon) + \varepsilon\, \nabla \ell(z, \hat\theta_\varepsilon) = 0 .

The implicit function theorem applies since H is invertible. Differentiating at \varepsilon = 0 gives H\, \dot\theta + \nabla \ell(z, \hat\theta) = 0, where \dot\theta is the derivative of \hat\theta_\varepsilon. The test-loss formula is the chain rule. ∎

This classical tool of robust statistics (Cook and Weisberg, 1982) explains a prediction by the training points that support it. It also finds mislabelled examples and crafts training-set attacks. For networks, H is not invertible, and Koh and Liang use a damping term and Hessian-vector products.

import numpy as np

rng = np.random.default_rng(0)
n, d, lam = 200, 5, 1e-2
X = rng.normal(size=(n, d)); w_true = rng.normal(size=d)
y = (rng.uniform(size=n) < 1 / (1 + np.exp(-X @ w_true))).astype(float)
x_test, y_test = rng.normal(size=d), 1.0

def fit(X, y, iters=30):                     # Newton's method on the L2-regularised log-loss
    w = np.zeros(d)
    for _ in range(iters):
        p = 1 / (1 + np.exp(-X @ w))
        g = X.T @ (p - y) / len(y) + lam * w
        H = (X.T * (p * (1 - p))) @ X / len(y) + lam * np.eye(d)
        w -= np.linalg.solve(H, g)
    return w, H

def test_loss(w):
    p = 1 / (1 + np.exp(-x_test @ w))
    return -np.log(p if y_test == 1 else 1 - p)

w_hat, H = fit(X, y)
p_t = 1 / (1 + np.exp(-x_test @ w_hat))
g_test = (p_t - y_test) * x_test
predicted, actual = [], []
for i in range(n):
    p_i = 1 / (1 + np.exp(-X[i] @ w_hat))
    g_i = (p_i - y[i]) * X[i] + lam * w_hat          # gradient of the i-th summand
    predicted.append(g_test @ np.linalg.solve(H, g_i) / n)   # removing z_i: eps = -1/n
    w_loo, _ = fit(np.delete(X, i, 0), np.delete(y, i))
    actual.append(test_loss(w_loo) - test_loss(w_hat))
predicted, actual = np.array(predicted), np.array(actual)
print(f"correlation(influence prediction, leave-one-out) = {np.corrcoef(predicted, actual)[0, 1]:.4f}")
top = np.argsort(-np.abs(actual))[:3]
print("three most influential points (predicted, actual):",
      [(int(i), round(float(predicted[i]), 4), round(float(actual[i]), 4)) for i in top])

On this L2-regularised logistic regression, the influence formula and 200 refits by leave-one-out agree with correlation 0.9998. For the most influential point, it predicts a test-loss change of 0.161, against 0.169 measured.

5.4 Decision uncertainty and Bayesian models

Definition 5.6 — Typology of uncertainty

  • Aleatoric uncertainty is the randomness of Y given X: overlapping classes, sensor noise. It does not decrease with more data.
  • Epistemic uncertainty is the lack of knowledge of the model: it is large far from the training data and decreases as data accumulate.
  • Distribution shift occurs when test inputs come from another distribution than the training inputs; it is treated in ch. 7.

Definition 5.7 — Bayesian model, posterior and predictive distribution A prior p(\theta) and a likelihood, the product of the terms p(y_i \mid x_i, \theta), define the posterior and the predictive distribution: p(\theta \mid \mathcal{D}) \propto p(\mathcal{D} \mid \theta)\, p(\theta), \qquad p(y \mid x, \mathcal{D}) = \int p(y \mid x, \theta)\, p(\theta \mid \mathcal{D})\, d\theta .

The spread of the posterior, pushed through the predictions, is the epistemic uncertainty.

Theorem 5.8 — Bayesian linear regression Let y = w^\top \phi(x) + \varepsilon with noise \varepsilon \sim \mathcal{N}(0, \beta^{-1}), an explicit embedding \phi(x) \in \mathbb{R}^D, and the prior w \sim \mathcal{N}(0, \alpha^{-1} I). With \Phi the design matrix, the posterior is \mathcal{N}(m_N, S_N) with S_N^{-1} = \alpha I + \beta\, \Phi^\top \Phi, \qquad m_N = \beta\, S_N \Phi^\top y .

The predictive distribution at x is Gaussian, with mean m_N^\top \phi(x) and variance

Key result — the predictive variance splits in two \sigma_N^2(x) = \underbrace{\beta^{-1}}_{\text{aleatoric}} + \underbrace{\phi(x)^\top S_N\, \phi(x)}_{\text{epistemic}} .

Proof. The posterior is Proposition 0.4 with m_0 = 0 and S_0 = \alpha^{-1} I. Under the posterior, y = w^\top \phi(x) + \varepsilon is a sum of two independent Gaussian variables; means and variances add. ∎

The model is linear in w but not in x: with polynomial features, Gaussian bumps or random features, it performs non-linear regression. The first lab fits it on simulated data with a gap.

import numpy as np

rng = np.random.default_rng(0)
x = np.concatenate([rng.uniform(-2, 0, 30), rng.uniform(1, 2, 15)])   # gap on (0, 1)
beta = 25.0                                          # noise precision (sigma = 0.2)
y = np.sin(2 * x) + rng.normal(0, beta ** -0.5, x.size)

centres = np.linspace(-3, 3, 25)                     # explicit embedding: Gaussian bumps
phi = lambda t: np.exp(-(np.subtract.outer(t, centres) ** 2) / (2 * 0.4 ** 2))

alpha = 1.0                                          # prior w ~ N(0, alpha^{-1} I)
Phi = phi(x)
S_N = np.linalg.inv(alpha * np.eye(centres.size) + beta * Phi.T @ Phi)
m_N = beta * S_N @ Phi.T @ y

for t in [-1.0, 0.5, 1.5, 3.0]:
    f = phi(np.array([t]))[0]
    mean, var = f @ m_N, 1 / beta + f @ S_N @ f      # predictive mean and variance
    print(f"x = {t:4.1f}: mean {mean:+.2f} (truth {np.sin(2 * t):+.2f}), "
          f"predictive std {np.sqrt(var):.2f} (noise std {beta ** -0.5:.2f})")

Where data are dense (x = -1 and x = 1.5), the predictive standard deviation is 0.22 and 0.21, barely above the noise level 0.20. It rises to 0.59 in the gap and to 1.31 outside the data, at x = 3: the epistemic term does its job.

Key takeaways — chapter 5

  • A Lipschitz constant and a margin certify a decision on a ball.
  • Scattering and convolutional kernel representations are stable to small deformations.
  • Influence functions predict, through one Hessian solve, the effect of a training point.
  • Bayesian linear regression adds an epistemic term that grows away from the data.

6. Robust deep learning II: Bayesian neural networks

For a network, the posterior is neither Gaussian nor computable. This chapter presents the three approximations used in practice — Laplace, variational and Monte Carlo dropout — first on logistic regression, where they can be checked.

6.1 The Laplace approximation

Definition 6.1 — Laplace approximation Let \theta_{\mathrm{MAP}} maximise the log-posterior and H be the Hessian of the negative log-posterior there. The Laplace approximation is the Gaussian q(\theta) = \mathcal{N}\big(\theta_{\mathrm{MAP}}, H^{-1}\big), obtained from the second-order Taylor expansion of the log-posterior at its maximum.

Proposition 6.2 — Logistic regression Let p(y = 1 \mid x, w) = s(w^\top \phi(x)) with the logistic function s, and the prior \mathcal{N}(0, \alpha^{-1} I). With s_i = s(w^\top \phi_i), the Hessian of the negative log-posterior is H(w) = \alpha I + \sum_i s_i (1 - s_i)\, \phi_i \phi_i^\top .

It is positive definite, so the MAP is unique and Newton’s method finds it. Proof: the gradient is \alpha w + \sum_i (s_i - y_i)\phi_i, and s' = s(1 - s).

Proposition 6.3 — Predictive probability: the probit approximation (MacKay, 1992) Under q, the activation a = w^\top \phi(x) is Gaussian, with mean \mu_a = \theta_{\mathrm{MAP}}^\top \phi(x) and variance s_a^2 = \phi(x)^\top H^{-1} \phi(x). Then p(y = 1 \mid x, \mathcal{D}) \approx s\big(\kappa(s_a^2)\, \mu_a\big), \qquad \kappa(s^2) = \big(1 + \pi s^2/8\big)^{-1/2} .

Proof. Replace s(a) by the probit \Phi(\lambda a), where \Phi is the standard Gaussian distribution function and \lambda^2 = \pi/8, which has the same slope at 0. A Gaussian average of a probit is a probit: \int \Phi(\lambda a)\, \mathcal{N}(a; \mu, s^2)\, da = \Phi\big(\lambda \mu / \sqrt{1 + \lambda^2 s^2}\big).

Converting back to the logistic function gives the formula. ∎

The approximation pulls the probability towards 1/2 where s_a^2 is large, without changing the predicted class.

import numpy as np

rng = np.random.default_rng(0)
n = 100                                               # two Gaussian classes in the plane
X = np.vstack([rng.normal([-1, 0], 0.7, (n, 2)), rng.normal([1, 0], 0.7, (n, 2))])
y = np.r_[np.zeros(n), np.ones(n)]
Phi = np.c_[np.ones(2 * n), X]                        # features (1, x1, x2)
alpha = 1.0                                           # prior w ~ N(0, alpha^{-1} I)
sigmoid = lambda a: 1 / (1 + np.exp(-a))

w = np.zeros(3)                                       # MAP by Newton's method
for _ in range(25):
    p = sigmoid(Phi @ w)
    H = (Phi.T * (p * (1 - p))) @ Phi + alpha * np.eye(3)
    w -= np.linalg.solve(H, Phi.T @ (p - y) + alpha * w)
S = np.linalg.inv(H)                                  # Laplace: q(w) = N(w_MAP, H^{-1})

for x in [np.array([0.5, 0.0]), np.array([0.5, 8.0]), np.array([6.0, 8.0])]:
    f = np.r_[1.0, x]
    mu_a, s2_a = f @ w, f @ S @ f
    probit = sigmoid(mu_a / np.sqrt(1 + np.pi * s2_a / 8))
    mc = sigmoid(rng.multivariate_normal(w, S, 20_000) @ f).mean()
    print(f"x = ({x[0]:.1f}, {x[1]:.1f}): MAP {sigmoid(mu_a):.3f} | Laplace, probit {probit:.3f} | "
          f"Laplace, Monte Carlo {mc:.3f} | var(a) = {s2_a:.2f}")

Near the data, at the point (0.5, 0), the MAP gives 0.869 and the Laplace predictive 0.864. Far along the uninformative direction, at (0.5, 8), the activation variance is 6.8, and the Laplace predictive moves from 0.345 to 0.417, towards 1/2. The probit formula and a Monte Carlo average over q agree within 0.004.

For networks, Laplace is applied to the last layer or with Kronecker-factored Hessians (Ritter, Botev and Barber, 2018; Daxberger et al., 2021).

6.2 Variational inference and Bayes by Backprop

Theorem 6.4 — Evidence lower bound For every density q on the parameters, \log p(\mathcal{D}) = \underbrace{\mathbb{E}_{q}\big[\log p(\mathcal{D} \mid \theta)\big] - \mathrm{KL}\big(q \,\|\, p(\theta)\big)}_{\mathrm{ELBO}(q)} + \mathrm{KL}\big(q \,\|\, p(\theta \mid \mathcal{D})\big).

Maximising the ELBO over a family of distributions is therefore minimising the KL divergence to the posterior.

Proof. For every \theta, Bayes’ rule gives \log p(\mathcal{D}) = \log p(\mathcal{D} \mid \theta) + \log p(\theta) - \log p(\theta \mid \mathcal{D}).

Take the expectation under q, then add and subtract \mathbb{E}_q[\log q(\theta)]. ∎

Definition 6.5 — Bayes by Backprop (Blundell et al., 2015) Take a mean-field Gaussian family, q(\theta) = \prod_j \mathcal{N}(\mu_j, \sigma_j^2) with \sigma_j = \log(1 + e^{\rho_j}), and write \theta = \mu + \sigma \odot \varepsilon with \varepsilon \sim \mathcal{N}(0, I).

This reparameterisation (Kingma and Welling, 2014) turns the expectation of the ELBO into an expectation over \varepsilon, which no longer depends on (\mu, \rho). One draw of \varepsilon then gives an unbiased gradient by back-propagation.

With a standard normal prior, the KL term is explicit: \mathrm{KL}(q \,\|\, p) = \sum_j \Big(\frac{\sigma_j^2 + \mu_j^2 - 1}{2} - \log \sigma_j\Big).

6.3 Dropout: a regulariser and a variational approximation

Dropout (Srivastava et al., 2014) multiplies each unit by an independent Bernoulli mask \delta \sim \mathcal{B}(q), divided by the keep probability q, during training. On a linear model, its effect is an explicit penalty.

Proposition 6.6 — Dropout is a data-dependent ridge In linear regression, replace each input x_{ij} by x_{ij} \delta_{ij}/q with independent \delta_{ij} \sim \mathcal{B}(q). The expected training loss is \mathbb{E}_\delta \sum_i \big(y_i - \tilde x_i^\top w\big)^2 = \sum_i \big(y_i - x_i^\top w\big)^2 + \frac{1 - q}{q} \sum_j w_j^2 \sum_i x_{ij}^2 .

Proof. For each i, the random variable \tilde x_i^\top w has mean x_i^\top w and variance \sum_j x_{ij}^2 w_j^2 (1 - q)/q, since \mathrm{Var}(\delta/q) = (1 - q)/q. Conclude with the bias–variance identity \mathbb{E}(y - Z)^2 = (y - \mathbb{E}Z)^2 + \mathrm{Var}\, Z .

∎

Dropout is thus a ridge penalty weighted by the energy of each feature; Wager, Wang and Liang (2013) extend this reading to generalised linear models. Its Bayesian reading is due to Gal and Ghahramani.

Theorem 6.7 — Monte Carlo dropout (Gal and Ghahramani, 2016), statement Consider a network with dropout before every weight layer, trained with weight decay. Its training objective coincides, up to constants and an approximation of the KL term, with the negative ELBO of a variational family in which each weight matrix is M\, \mathrm{diag}(\delta), with Bernoulli \delta and learned M, against a Gaussian prior.

Keeping dropout active at test time and averaging T stochastic passes therefore estimates the predictive mean, and the spread of the passes estimates the epistemic variance. The key step approximates the KL divergence between the variational distribution and the prior by a weight-decay penalty on M.

The second lab implements a LinearVariational layer and compares it with MC dropout on a one-dimensional regression with a gap.

import torch
import torch.nn as nn

torch.set_num_threads(1)                              # tiny model: one thread is fastest
torch.manual_seed(0)
x = torch.cat([torch.empty(40).uniform_(-3, -1), torch.empty(40).uniform_(1, 3)])[:, None]
y = torch.sin(x) + 0.1 * torch.randn_like(x)          # gap in the data around 0

class LinearVariational(nn.Module):
    """Mean-field Gaussian q(W) = N(mu, softplus(rho)^2), prior N(0, 1) (Bayes by Backprop)."""
    def __init__(self, n_in, n_out):
        super().__init__()
        self.mu = nn.Parameter(0.3 * torch.randn(n_out, n_in + 1))
        self.rho = nn.Parameter(torch.full((n_out, n_in + 1), -4.0))
    def forward(self, h):
        sigma = nn.functional.softplus(self.rho)
        W = self.mu + sigma * torch.randn_like(sigma)          # reparameterisation trick
        self.kl = (0.5 * (sigma ** 2 + self.mu ** 2 - 1) - torch.log(sigma)).sum()
        return nn.functional.linear(h, W[:, :-1], W[:, -1])

def train(model, loss_fn, steps=1000):
    opt = torch.optim.Adam(model.parameters(), lr=1e-2)
    for _ in range(steps):
        opt.zero_grad(); loss_fn(model).backward(); opt.step()

bnn = nn.Sequential(LinearVariational(1, 32), nn.Tanh(), LinearVariational(32, 1))
def neg_elbo(model, noise_sd=0.1):                    # -ELBO = expected NLL + KL
    nll = ((model(x) - y) ** 2).sum() / (2 * noise_sd ** 2)
    return nll + sum(layer.kl for layer in model if isinstance(layer, LinearVariational))
train(bnn, neg_elbo)

mcd = nn.Sequential(nn.Linear(1, 32), nn.Tanh(), nn.Dropout(0.1), nn.Linear(32, 1))
opt_loss = lambda model: ((model(x) - y) ** 2).mean() + 1e-4 * sum((p ** 2).sum() for p in model.parameters())
train(mcd, opt_loss)                                  # dropout + weight decay

grid = torch.tensor([[-2.0], [0.0], [2.0], [5.0]])
with torch.no_grad():
    mcd.train()                                       # keep dropout active at test time
    for name, model in [("Bayes by Backprop", bnn), ("MC dropout", mcd)]:
        draws = torch.stack([model(grid) for _ in range(500)]).squeeze(-1)
        err = (draws.mean(0) - torch.sin(grid.squeeze())).abs()
        print(f"{name:17s} |error| / std at x = -2, 0, 2, 5:",
              "  ".join(f"{e:.2f}/{s:.2f}" for e, s in zip(err.tolist(), draws.std(0).tolist())))

Inside the data, both methods are honest: at x = -2 and x = 2, the error is at most the standard deviation. At x = 5, far outside, the error reaches 0.62 (Bayes by Backprop) and 1.20 (MC dropout), against standard deviations of 0.12 and 0.15. Both approximations under-estimate epistemic uncertainty away from the data; Exercise 12 studies the role of the prior and of the noise level.

Key takeaways — chapter 6

  • Laplace fits a Gaussian at the MAP; the probit formula gives the predictive of logistic regression.
  • Variational inference maximises the ELBO; Bayes by Backprop learns a mean and a scale per weight.
  • Dropout is a feature-weighted ridge, and approximately a variational posterior.
  • Away from the data, these approximations can be badly overconfident.

7. Robust deep learning III: uncertainty in practice

Uncertainties must be checked against data. This chapter gives the metrics and the practical tools.

7.1 Metrics for regression

Definition 7.1 — Uncertainty metrics for regression Let a model predict a Gaussian with mean \mu(x) and standard deviation s(x).

  • Negative log-likelihood (NLL), averaged over test points: \mathrm{NLL} = \frac12 \log\big(2\pi s(x)^2\big) + \frac{(y - \mu(x))^2}{2 s(x)^2} .
  • Coverage: the fraction of test points inside the central interval of level 1 - a; it should be close to 1 - a.
  • Sharpness: the mean width of these intervals, to be small at a given coverage. The RMSE of \mu measures accuracy alone.

Proposition 7.2 — The NLL is a strictly proper scoring rule If Y has density p, then for every density q \mathbb{E}_{Y \sim p}\big[-\log q(Y)\big] - \mathbb{E}_{Y \sim p}\big[-\log p(Y)\big] = \mathrm{KL}(p \,\|\, q) \ge 0, with equality only when q = p.

Proof. The difference is \mathbb{E}_p[\log(p/q)], the KL divergence, which is non-negative by Jensen’s inequality and vanishes only when q = p. ∎

A network with two outputs (\mu, s), trained on the NLL, therefore learns the aleatoric variance (Gneiting and Raftery, 2007, for the theory of proper scores). Calibrating the intervals afterwards is studied by Kuleshov, Fenner and Ermon (2018).

7.2 Ensembles and evidential models

Proposition 7.3 — Uncertainty of an ensemble Let M members predict Gaussians \mathcal{N}(\mu_m, s_m^2), and let the ensemble predict their uniform mixture, with mean \bar\mu. Its variance is \sigma^2 = \underbrace{\frac1M \sum_m s_m^2}_{\text{aleatoric}} + \underbrace{\frac1M \sum_m (\mu_m - \bar\mu)^2}_{\text{epistemic}} .

Proof. Apply the law of total variance, conditioning on the index m of the member drawn uniformly. ∎

Deep ensembles (Lakshminarayanan, Pritzel and Blundell, 2017) train M networks from different random initialisations, independently. The disagreement between members is a strong epistemic signal, and ensembles are among the most reliable methods under distribution shift (Ovadia et al., 2019).

Evidential models An evidential network outputs, in one pass, a distribution over predictive distributions.

  • In classification (Sensoy, Kaplan and Kandemir, 2018), non-negative evidences e_k give Dirichlet parameters \alpha_k = e_k + 1. With S = \sum_k \alpha_k, the class probabilities are \alpha_k / S and the uncertainty mass K/S is high when evidence is low.
  • In regression (Amini et al., 2020), it outputs a Normal-Inverse-Gamma distribution over the mean and the variance.

7.3 Calibration

Definition 7.4 — Calibration and expected calibration error A classifier predicts \hat y(x) with confidence \hat p(x) = \max_k p_k(x). It is perfectly calibrated if, for every level c, \mathbb{P}\big(Y = \hat y(X) \mid \hat p(X) = c\big) = c .

Group the test points into confidence bins B_b. The expected calibration error (Naeini, Cooper and Hauskrecht, 2015) is the weighted gap between accuracy and confidence: \mathrm{ECE} = \sum_b \frac{|B_b|}{n}\, \big|\mathrm{acc}(B_b) - \mathrm{conf}(B_b)\big| .

The reliability diagram plots accuracy against confidence, bin by bin.

Guo, Pleiss, Sun and Weinberger (official reference 19) observe that modern deep networks are overconfident. Their temperature scaling divides the logits by a single scalar T, fitted by minimising the NLL on a validation set.

Proposition 7.5 — Temperature scaling keeps the decisions For every T > 0, the softmax of f/T has the same arg max as the softmax of f, so the accuracy is unchanged. As T \to \infty the probabilities tend to the uniform distribution, and as T \to 0 to the indicator of the arg max.

Proof: the exponential is increasing, so the order of the entries of f/T is that of f.

7.4 Failure prediction

Definition 7.6 — Confidence criteria The maximum class probability is \mathrm{MCP}(x) = \max_k p_k(x); it is the baseline of Hendrycks and Gimpel (2017). The true class probability is \mathrm{TCP}(x) = p_y(x), which requires the label. A criterion is judged by how well it separates errors from successes, for instance by the area under the ROC curve (AUROC).

Proposition 7.7 — The true class probability separates errors If \mathrm{TCP}(x) > 1/2, the prediction is correct; if \mathrm{TCP}(x) < 1/K, it is wrong. No such thresholds exist for the MCP, which is always at least 1/K, even on errors.

Proof: if p_y > 1/2, the other probabilities sum to less than 1/2, so each is below p_y. If p_y < 1/K, the largest probability is at least 1/K, hence larger than p_y.

ConfidNet (Corbière et al., official reference 20) exploits this: an auxiliary network, fed with the features of the classifier, is trained to regress the TCP on the training set. At test time its output ranks the predictions by reliability, and it detects failures better than the MCP.

7.5 Out-of-distribution detection

Definition 7.8 — Out-of-distribution detection Given a score S(x), OOD detection tests whether x comes from the training distribution (large S) or from another one (small S). It is evaluated by the AUROC and by the false-positive rate at 95 % true-positive rate.

ODIN (Liang, Li and Srikant, official reference 21) takes the maximum softmax probability at a high temperature T, typically 1000, on an input moved by a small signed-gradient step that increases the score — more so for in-distribution inputs. The temperature has a first-order explanation.

Proposition 7.9 — Softmax score at high temperature Let f be the logits, \hat y the predicted class and S(x; T) the maximum softmax probability at temperature T. Then S(x; T) = \frac{1}{\sum_k e^{-(f_{\hat y} - f_k)/T}} = \frac{1}{K - \frac1T \sum_k \big(f_{\hat y}(x) - f_k(x)\big) + O(T^{-2})} .

At high temperature, the score ranks inputs by the mean gap between the top logit and all the others, instead of being driven by the top two logits.

Proof: expand e^{-u} = 1 - u + O(u^2) for each term.

The third lab runs these tools on the scikit-learn digits: a network is trained on the digits 0–4, and the digits 5–9 play the role of out-of-distribution inputs.

import numpy as np
import torch
import torch.nn as nn
from sklearn.datasets import load_digits
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import train_test_split

torch.set_num_threads(1)                              # tiny model: one thread is fastest
torch.manual_seed(0)
X, y = load_digits(return_X_y=True)
X = torch.tensor(X / 16.0, dtype=torch.float32); y = torch.tensor(y)
inn = y < 5                                           # in-distribution: digits 0-4
X_ood = X[~inn]                                       # out-of-distribution: digits 5-9
X_tr, X_te, y_tr, y_te = train_test_split(X[inn], y[inn], test_size=0.5, random_state=0)
X_val, y_val, X_te, y_te = X_te[:200], y_te[:200], X_te[200:], y_te[200:]

def make_net():
    net = nn.Sequential(nn.Linear(64, 128), nn.ReLU(), nn.Linear(128, 5))
    opt = torch.optim.Adam(net.parameters(), lr=1e-2)
    for _ in range(300):                              # full-batch training, deliberately long
        opt.zero_grad(); nn.functional.cross_entropy(net(X_tr), y_tr).backward(); opt.step()
    return net

def ece(probs, labels, bins=10):
    conf, pred = probs.max(1)
    edges, total = torch.linspace(0, 1, bins + 1), 0.0
    for lo, hi in zip(edges[:-1], edges[1:]):
        b = (conf > lo) & (conf <= hi)
        if b.any():
            total += b.float().mean() * abs((pred[b] == labels[b]).float().mean() - conf[b].mean())
    return float(total)

net = make_net()
with torch.no_grad():
    logits_val, logits_te = net(X_val), net(X_te)
T = torch.ones(1, requires_grad=True)                 # temperature scaling on the validation set
opt = torch.optim.LBFGS([T], lr=0.1, max_iter=200)
def closure():
    opt.zero_grad(); l = nn.functional.cross_entropy(logits_val / T, y_val); l.backward(); return l
opt.step(closure)
p1, pT = logits_te.softmax(1), (logits_te / T.detach()).softmax(1)
acc = (p1.argmax(1) == y_te).float().mean()
print(f"accuracy {acc:.3f}; ECE {ece(p1, y_te):.3f} -> {ece(pT, y_te):.3f} after T = {T.item():.2f}")

wrong = (p1.argmax(1) != y_te).numpy()
print(f"failure prediction AUROC with MSP: {roc_auc_score(wrong, -p1.max(1).values.numpy()):.3f}")

def odin_score(x, temp=1000.0, eps=0.002):          # ODIN: temperature + input perturbation
    x = x.clone().requires_grad_(True)
    out = net(x) / temp
    nn.functional.cross_entropy(out, out.argmax(1)).backward()
    with torch.no_grad():
        return (net(x - eps * x.grad.sign()) / temp).softmax(1).max(1).values

labels = np.r_[np.zeros(len(X_te)), np.ones(len(X_ood))]    # 1 = out-of-distribution
with torch.no_grad():
    msp = torch.cat([net(X_te), net(X_ood)]).softmax(1).max(1).values
odin = torch.cat([odin_score(X_te), odin_score(X_ood)])
ens = torch.stack([m(torch.cat([X_te, X_ood])).softmax(1) for m in [net] + [make_net() for _ in range(4)]]).mean(0)
for name, s in [("MSP", msp), ("ODIN", odin), ("ensemble of 5", ens.detach().max(1).values)]:
    print(f"OOD detection AUROC, {name:13s}: {roc_auc_score(labels, -s.numpy()):.3f}")

The network reaches 99.2 % test accuracy. Temperature scaling finds T = 1.53, a sign of overconfidence, and lowers the ECE from 0.007 to 0.004. The MCP ranks errors with an AUROC of 0.994, a fragile figure since the 251 test digits contain only two errors. For OOD detection, the AUROC is 0.945 with the maximum softmax probability, 0.959 with ODIN and 0.947 with an ensemble of five networks. Exercise 14 adds a ConfidNet head.

Key takeaways — chapter 7

  • The NLL is strictly proper; coverage and sharpness check intervals.
  • Ensemble variance = mean member variance + member disagreement.
  • Temperature scaling fixes overconfidence without changing decisions.
  • The true class probability (ConfidNet) and high-temperature scores (ODIN) detect failures and OOD inputs.

8. Expressivity of feed-forward networks

Which functions can a network represent, and at what size? Shallow networks are universal; size and depth decide the cost.

8.1 Universal approximation

Theorem 8.1 — Cybenko (1989) Let \sigma be continuous and sigmoidal, with limits 1 at +\infty and 0 at -\infty. The finite sums \sum_j \alpha_j\, \sigma(w_j^\top x + b_j) are dense in C([0, 1]^d) for the uniform norm.

Key step. Otherwise, Hahn–Banach and Riesz give a non-zero signed measure \mu integrating every \sigma(w^\top x + b) to zero. Rescaled sigmoids tend to indicators of half-spaces, so \mu vanishes on half-spaces, and a Fourier argument gives \mu = 0. Leshno, Lin, Pinkus and Schocken (1993) extend density to every continuous non-polynomial activation.

For ReLU, a complete proof only uses tools from ch. 0 and ch. 1.

Theorem 8.2 — Universality of one-hidden-layer ReLU networks For every continuous g on a compact set K \subset \mathbb{R}^d and every \varepsilon > 0, there is a ReLU network f with one hidden layer such that \sup_{x \in K} |f(x) - g(x)| \le \varepsilon .

Proof.

  1. Ridge functions. The span of the functions \cos(w^\top x) and \sin(w^\top x) is an algebra that contains the constants and separates points. By Stone–Weierstrass, a finite sum T = \sum_k c_k h_k(w_k^\top x) of such ridge functions is within \varepsilon/2 of g on K.
  2. One dimension. Each h_k is uniformly continuous on the compact interval spanned by w_k^\top x for x \in K. Its piecewise-affine interpolant on a fine grid is within \varepsilon / (2\sum_k |c_k|) of it, and it is a one-hidden-layer ReLU network of t (Proposition 1.11). The affine part is also one: t = \sigma(t) - \sigma(-t).
  3. Back to the input space. Substituting t = w_k^\top x keeps one hidden layer. Summing over k gives a network within \varepsilon/2 of T, hence within \varepsilon of g. ∎

Universality says nothing about size, which may grow exponentially with the dimension; Barron exhibits a class where it does not.

8.2 A quantitative result in L2: Barron’s theorem

Definition 8.3 — Barron constant Let f(x) = \int e^{i \omega^\top x} \hat f(\omega)\, d\omega on \mathbb{R}^d. Its Barron constant is C_f = \int_{\mathbb{R}^d} \|\omega\|\, |\hat f(\omega)|\, d\omega .

Lemma 8.4 — Maurey’s sampling lemma In a Hilbert space, let f be a convex combination of elements of a set G with \|g\| \le b for all g \in G. For every n \ge 1, there are g_1, \dots, g_n \in G such that \Big\|f - \frac1n \sum_{k=1}^n g_k\Big\|^2 \le \frac{b^2 - \|f\|^2}{n} .

The same bound, with any constant larger than b^2 - \|f\|^2, holds for f in the closure of the convex hull.

Proof. Write f = \sum_j \lambda_j g_j and draw G_1, \dots, G_n independently with \mathbb{P}(G = g_j) = \lambda_j, so that \mathbb{E}\, G = f. The variance of an average of n independent copies is \mathbb{E}\Big\|f - \frac1n \sum_k G_k\Big\|^2 = \frac1n\, \mathbb{E}\|G - f\|^2 = \frac{\mathbb{E}\|G\|^2 - \|f\|^2}{n} .

Some realisation does at least as well as the mean. ∎

Theorem 8.5 — Barron (official reference 8) Let C_f < \infty, let \mu be a probability measure on the ball B_r of radius r, and let the activation be sigmoidal. For every number n of hidden units, some network f_n satisfies \int_{B_r} \big(f(x) - f_n(x)\big)^2 \mu(dx) \le \frac{(2 r C_f)^2}{n} .

Proof sketch. The Fourier representation writes f - f(0) as an average, against the probability proportional to \|\omega\|\,|\hat f(\omega)|, of ridge functions of \omega^\top x with slope at most C_f.

On B_r, each of them is a limit of convex combinations of steps \pm 2rC_f\, \mathbb{1}[\omega^\top x \ge s], and steps are limits of sigmoids. Lemma 8.4 with b = 2rC_f concludes.

The dimension enters only through C_f. Barron also shows that n fixed basis functions cannot beat order (1/n)^{2/d} uniformly over the class: adapting the units to f defeats the curse of dimensionality.

8.3 Depth separation

Proposition 8.6 — The sawtooth The tent map g(t) = 2\sigma(t) - 4\sigma(t - 1/2) rises from 0 to 1 on [0, 1/2] and falls back on [1/2, 1]. Its k-fold composition h = g^{k} is computed by a ReLU network of depth k and width 2.

On [0, 1], h is the sawtooth with 2^k affine pieces that takes the value j \bmod 2 at j/2^k.

Proof: by induction, since g maps each half of the unit interval affinely onto the whole interval.

Proposition 8.7 — Counting pieces A ReLU network on \mathbb{R} with L hidden layers of width at most w is piecewise affine with at most (2w)^L pieces; with one hidden layer of m units, at most m + 1 (Proposition 1.11).

Proof sketch: if the inputs of a unit have at most N pieces each, their weighted sum has at most wN pieces, and the ReLU at most doubles this count, since each affine piece crosses zero at most once. Induct on the layers.

Theorem 8.8 — Depth separation on the line Let k \ge 2 and h = g^k. Every continuous piecewise-affine f with p \le 2^{k-2} - 1 pieces satisfies \int_0^1 |f(t) - h(t)|\, dt \ge \frac{1}{16} .

To approximate h, which depth k and width 2 compute exactly, with an L^1 error below 1/16, a one-hidden-layer network needs at least 2^{k-2} - 1 units.

Proof. Let N = 2^k and I_j = [(j - \frac12)/N, (j + \frac12)/N] for 1 \le j \le N - 1. The sawtooth is above 1/2 on the intervals of odd index, below on the others, and \int_{I_j} |h - 1/2| = \frac{1}{4N} .

Each affine piece of f crosses the level 1/2 at most once, so f - 1/2 changes sign at most p times.

Form the N/2 - 1 pairs (I_{2i-1}, I_{2i}), which have disjoint interiors. In a pair without sign change, f stays on one side of 1/2 while h visits both.

So on one interval of the pair, |f - h| \ge |h - 1/2|, which contributes at least 1/(4N).

At least N/2 - 1 - p pairs contribute, so the error is at least \frac18 - \frac{p + 1}{4N}, which is at least \frac1{16} when p + 1 \le N/4. ∎

The construction is due to Telgarsky (2016). Eldan and Shamir (official reference 9) prove a high-dimensional analogue: a radial function on \mathbb{R}^d is computed by a network with two hidden layers of width polynomial in d, but no network with one hidden layer approximates it to better than a constant unless its width is exponential in d.

import numpy as np

relu = lambda t: np.maximum(t, 0.0)
tent = lambda t: 2 * relu(t) - 4 * relu(t - 0.5)      # g: one hidden layer of width 2

x = np.linspace(0, 1, 2 ** 12 + 1)
k = 8
h = x.copy()
for _ in range(k):                                    # depth-k, width-2 network: g o ... o g
    h = tent(h)

# Best continuous piecewise-affine fit with p uniform pieces (least squares on hat functions).
for p in [16, 63, 255, 256]:
    knots = np.linspace(0, 1, p + 1)
    hats = np.array([np.interp(x, knots, np.eye(p + 1)[j]) for j in range(p + 1)]).T
    f = hats @ np.linalg.lstsq(hats, h, rcond=None)[0]
    print(f"p = {p:3d} pieces: L1 error {np.trapezoid(np.abs(f - h), x):.4f}"
          f"  (Theorem 8.8 guarantees >= 1/16 = 0.0625 when p <= {2 ** (k - 2) - 1})")

# Yarotsky's approximation of x^2: f_m(x) = x - sum_s g_s(x) / 4^s.
for m in [1, 2, 4, 6]:
    g, f_m = x.copy(), x.copy()
    for s in range(1, m + 1):
        g = tent(g)
        f_m -= g / 4 ** s
    print(f"m = {m}: sup |f_m(x) - x^2| = {np.abs(f_m - x ** 2).max():.2e}"
          f"  (bound 2^(-2m-2) = {2.0 ** (-2 * m - 2):.2e})")

For k = 8, least-squares fits with 16 or 63 uniform pieces do no better than the constant 1/2, with an L^1 error of 0.25; 255 pieces still leave 0.171, and only 256 pieces fit exactly.

8.4 Super-approximation by deep networks

Proposition 8.9 — Squaring with a deep network (Yarotsky) Let f_m(x) = x - \sum_{s=1}^m g^{s}(x)/4^s, computed by a ReLU network of depth O(m) and constant width. Then \sup_{x \in [0, 1]} |f_m(x) - x^2| = 2^{-2m - 2} .

Proof. By induction, f_m is the piecewise-affine interpolant of x^2 on the grid of step 2^{-m}. Indeed, g^m vanishes on the coarser grid and equals 1 at its midpoints, where the coarse interpolant exceeds x^2 by exactly 4^{-m}.

On an interval of length \delta, the interpolant of x^2 exceeds it by (x - a)(a + \delta - x) \le \delta^2/4. With \delta = 2^{-m} this is the claim. ∎

The code confirms the bound for m = 1, 2, 4, 6. Since xy = ((x + y)^2 - x^2 - y^2)/2, products, polynomials and local Taylor expansions follow at a logarithmic extra cost.

Theorem 8.10 — Optimal approximation by very deep networks (Yarotsky, official reference 27), statement Let f be continuous on [0, 1]^d with modulus of continuity \omega_f, and let W count the weights. Fully connected ReLU networks of constant width and depth proportional to W achieve the uniform error O\big(\omega_f(O(W^{-2/d}))\big), and this rate is optimal and cannot be achieved by less deep networks. Constant-depth networks with weights depending continuously on f only reach O(\omega_f(O(W^{-1/d}))).

The faster “super-approximation” phase needs depth growing as a power of W and weights that depend discontinuously on f. Its optimality rests on the VC-dimension bounds of ch. 9.

Key takeaways — chapter 8

  • One hidden layer is universal, possibly with very many units.
  • Barron: dimension-free rate (2rC_f)^2/n for a finite first Fourier moment.
  • Depth k and width 2 compute 2^k pieces that shallow networks cannot approximate cheaply.
  • Very deep networks reach the optimal rate \omega_f(W^{-2/d}).

9. Generalisation error of feed-forward networks

The estimation error of Proposition 1.5 is controlled by the uniform deviation between risk and empirical risk over the class. This chapter bounds it for binary classification, in general and then for networks. The loss takes values in [0, 1].

9.1 Risk bounds and Rademacher complexity

Theorem 9.1 — Finite classes If \mathcal{F} is finite, then with probability at least 1 - \delta, simultaneously for all f \in \mathcal{F}, \big|R(f) - \widehat R_n(f)\big| \le \sqrt{\frac{\log(2|\mathcal{F}|/\delta)}{2n}} .

Proof. Apply Proposition 1.3 to each f with confidence \delta / |\mathcal{F}| and take a union bound. ∎

Definition 9.2 — Rademacher complexity Let \varepsilon_1, \dots, \varepsilon_n be independent uniform signs. The empirical Rademacher complexity of a class \mathcal{G} of functions on a sample z_1, \dots, z_n is \widehat{\mathfrak{R}}_n(\mathcal{G}) = \mathbb{E}_\varepsilon \sup_{g \in \mathcal{G}} \frac1n \sum_{i=1}^n \varepsilon_i\, g(z_i), and its expectation over the sample is the Rademacher complexity \mathfrak{R}_n(\mathcal{G}): the ability of the class to correlate with random noise.

Theorem 9.3 — Rademacher bound Let \mathcal{G} be the class of the losses z \mapsto \ell(f(x), y) for f \in \mathcal{F}. With probability at least 1 - \delta, for all f \in \mathcal{F},

Key result — the Rademacher bound R(f) \le \widehat R_n(f) + 2\, \mathfrak{R}_n(\mathcal{G}) + \sqrt{\frac{\log(1/\delta)}{2n}} .

Proof. Let \Phi be the supremum over \mathcal{G} of the gap between \mathbb{E}\,g and the sample mean of g. Changing one point changes \Phi by at most 1/n.

McDiarmid’s inequality (Theorem 0.3) then bounds \Phi by \mathbb{E}\Phi + \sqrt{\log(1/\delta)/(2n)}.

Symmetrisation. Introduce an independent ghost sample z'_i. Then \mathbb{E}\Phi is at most the expected supremum of the mean of g(z'_i) - g(z_i).

Each difference is symmetric, so multiplying it by \varepsilon_i does not change the law. Splitting the supremum bounds the result by 2\mathfrak{R}_n(\mathcal{G}). ∎

Proposition 9.4 — Linear classes Let \mathcal{F}_M be the class of linear functions x \mapsto \langle w, x\rangle with \|w\| \le M, and let \|x_i\| \le B. Then \widehat{\mathfrak{R}}_n(\mathcal{F}_M) \le \frac{M B}{\sqrt n} .

Proof. The supremum over w of \langle w, \sum_i \varepsilon_i x_i \rangle is M \|\sum_i \varepsilon_i x_i\|. By Jensen’s inequality and the independence of the signs, \mathbb{E}\Big\|\sum_i \varepsilon_i x_i\Big\| \le \Big(\sum_i \|x_i\|^2\Big)^{1/2} \le B\sqrt n .

∎

Talagrand’s contraction lemma transfers such bounds to losses: if \phi is \rho-Lipschitz, composing a class with \phi multiplies its Rademacher complexity by at most \rho.

9.2 VC dimension

Definition 9.5 — Growth function and VC dimension For a class \mathcal{F} of \{-1, +1\}-valued functions, the growth function \Pi_{\mathcal F}(n) is the largest number of sign vectors that \mathcal{F} realises on n points.

The VC dimension D is the largest n with \Pi_{\mathcal F}(n) = 2^n. Half-spaces of \mathbb{R}^d have VC dimension d + 1.

Lemma 9.6 — Sauer–Shelah and Massart

  • If n \ge D, then \Pi_{\mathcal F}(n) \le (en/D)^D.
  • For a finite set A \subset \mathbb{R}^n of vectors of norm at most r, the expected maximum over A of \frac1n \sum_i \varepsilon_i a_i is at most r\sqrt{2\log|A|}/n.

Proofs: Shalev-Shwartz and Ben-David (2014), ch. 6 and 26.

Corollary 9.7 — VC bound For the 0–1 loss and a class of VC dimension D, with probability at least 1 - \delta, for all f \in \mathcal{F}, R(f) \le \widehat R_n(f) + 2\sqrt{\frac{2 D \log(en/D)}{n}} + \sqrt{\frac{\log(1/\delta)}{2n}} .

Proof: on the sample, the loss vectors take at most \Pi_{\mathcal F}(n) values, of norm at most \sqrt n. Apply Massart, then Sauer–Shelah, then Theorem 9.3.

9.3 Complexity of feed-forward networks

Theorem 9.8 — VC dimension of ReLU networks (Bartlett, Harvey, Liaw and Mehrabian, official reference 28) For piecewise-linear networks with W parameters and L layers, the VC dimension of the sign of the output is O(W L \log W), and some networks reach \Omega(W L \log(W/L)). The upper bound counts the sign patterns of the piecewise polynomials of Proposition 2.1, layer by layer.

For a network with W = 10^6 weights and L = 10 layers, WL\log W \approx 1.4 \times 10^8, against n = 5 \times 10^4 training images: Corollary 9.7 is vacuous. Norm-based bounds do not count parameters.

Theorem 9.9 — Size-independent Rademacher bound (Golowich, Rakhlin and Shamir, official reference 10), statement Consider real-valued networks of depth L with a 1-Lipschitz, positively homogeneous activation such as ReLU, weight matrices with \|W_j\|_F \le M_j, and inputs of norm at most B. Then \widehat{\mathfrak{R}}_n \le \frac{B\, \big(\sqrt{2 \log(2)\, L} + 1\big) \prod_{j=1}^L M_j}{\sqrt n} .

The bound does not depend on the width. Its proof bounds an exponential moment and peels one layer at a time, at a total cost \sqrt L, where earlier peeling arguments (Neyshabur, Tomioka and Srebro, 2015) paid 2^L.

With a margin loss and the contraction lemma, such bounds become margin bounds: the test error is bounded by the fraction of training points of margin below \gamma, plus a complexity term divided by \gamma\sqrt{n} (Bartlett, Foster and Telgarsky, 2017, with spectral norms).

import numpy as np
import torch
import torch.nn as nn
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split

rng = np.random.default_rng(0)

# 1) Empirical Rademacher complexity of {x -> <w, x> : ||w|| <= M}: closed form vs bound.
n, d, M = 200, 50, 1.0
X = rng.normal(size=(n, d)) / np.sqrt(d)                      # ||x_i|| close to 1
sigma = rng.choice([-1.0, 1.0], size=(5000, n))
rad = M * np.linalg.norm(sigma @ X, axis=1).mean() / n         # sup_w <w, sum sigma_i x_i> / n
B = np.linalg.norm(X, axis=1).max()
print(f"empirical Rademacher complexity {rad:.4f} <= M B / sqrt(n) = {M * B / np.sqrt(n):.4f}")

# 2) Same network, true labels vs random labels (Zhang et al., 2017, on a small scale).
torch.set_num_threads(1)                                      # tiny model: one thread is fastest
Xd, yd = load_digits(return_X_y=True)
Xd = torch.tensor(Xd / 16.0, dtype=torch.float32)
for name, labels in [("true labels", yd), ("random labels", rng.permutation(yd))]:
    torch.manual_seed(0)
    X_tr, X_te, y_tr, y_te = train_test_split(Xd, torch.tensor(labels), test_size=0.3, random_state=0)
    net = nn.Sequential(nn.Linear(64, 256), nn.ReLU(), nn.Linear(256, 10))
    opt = torch.optim.Adam(net.parameters(), lr=1e-2)
    for _ in range(400):                                       # full batch, no regularisation
        opt.zero_grad(); nn.functional.cross_entropy(net(X_tr), y_tr).backward(); opt.step()
    acc = lambda A, b: (net(A).argmax(1) == b).float().mean().item()
    print(f"{name:13s}: train accuracy {acc(X_tr, y_tr):.3f}, test accuracy {acc(X_te, y_te):.3f}")

The Monte Carlo complexity, 0.070, sits below the bound 0.088 of Proposition 9.4. The same network and algorithm fit true and random labels perfectly, with test accuracies of 97.8 % and 8.1 %. A bound that depends only on the class must hold for both runs, so it cannot be smaller than the random-label gap; norms, margins and the algorithm must enter (Exercise 16).

Key takeaways — chapter 9

  • Uniform deviations are bounded by twice the Rademacher complexity plus a McDiarmid term.
  • VC bounds for ReLU networks scale like WL\log W and are vacuous in practice.
  • Norm-based bounds do not depend on the width; random labels show that class capacity alone cannot explain generalisation.

10. Open questions on generalisation; double descent

Chapter 9 ends on a paradox. This chapter surveys what is known about it, then computes exactly the risk of the simplest interpolating model, which already displays double descent.

10.1 A tour of open questions

Kawaguchi, Kaelbling and Bengio (official reference 11) organise the debate around a few points.

Proposition 10.1 — A guarantee from a validation set Choose a model among k candidates, all trained without the validation set, and let \hat f be the one with the smallest validation risk on m points. With probability at least 1 - \delta, R(\hat f) \le \widehat R_{\mathrm{val}}(\hat f) + \sqrt{\frac{\log(k/\delta)}{2m}} .

Proof: Hoeffding’s inequality (Theorem 0.3), one-sided, for each candidate with confidence \delta/k, and a union bound.

10.2 Double descent

Belkin, Hsu, Ma and Mandal (official reference 29) observed, on random features and on networks, that the test risk plotted against the number p of parameters is U-shaped for p < n, peaks near the interpolation threshold p = n, then decreases again. Nakkiran et al. (2020) report the same curve for deep networks. Linear regression already shows it.

Let x \sim \mathcal{N}(0, I_p) and y = x^\top \beta + \varepsilon, with noise \varepsilon \sim \mathcal{N}(0, \sigma^2) and \|\beta\| = r. From n samples, let \hat\beta = X^+ y.

This is least squares when p < n, and the minimum-norm interpolant reached by gradient descent from zero when p > n (Proposition 3.4). The excess risk is \|\hat\beta - \beta\|^2.

Theorem 10.2 — Exact risk of minimum-norm least squares Let X have independent standard Gaussian entries, and \beta be uniform on the sphere of radius r, independent of X. Then \mathbb{E}\|\hat\beta - \beta\|^2 = \begin{cases} \sigma^2\, \dfrac{p}{n - p - 1} & \text{if } p < n - 1, \\[2mm] r^2 \Big(1 - \dfrac{n}{p}\Big) + \sigma^2\, \dfrac{n}{p - n - 1} & \text{if } p > n + 1. \end{cases}

Proof. Case p < n. Here \hat\beta - \beta = (X^\top X)^{-1} X^\top \varepsilon, whose expected squared norm given X is \sigma^2 \mathrm{tr}((X^\top X)^{-1}).

The matrix X^\top X is Wishart with n degrees of freedom, and the mean of its inverse is I_p/(n - p - 1).

Case p > n. Let P = X^+ X be the projector on the row space, of rank n. Then \hat\beta - \beta = -(I - P)\beta + X^+ \varepsilon, a sum of two orthogonal terms.

The bias term has mean r^2(1 - n/p), because a uniform direction keeps a fraction n/p of its squared norm on a fixed n-dimensional subspace. The variance term is \sigma^2 \mathrm{tr}((XX^\top)^{-1}), with mean \sigma^2 n/(p - n - 1) by the same Wishart identity. ∎

Corollary 10.3 — The asymptotic curve (Hastie, Montanari, Rosset and Tibshirani, official reference 30) When n, p \to \infty with p/n \to \gamma, the risk tends to \sigma^2\, \frac{\gamma}{1 - \gamma} \quad (\gamma < 1), \qquad r^2 \Big(1 - \frac1\gamma\Big) + \frac{\sigma^2}{\gamma - 1} \quad (\gamma > 1).

It explodes at \gamma = 1, where X has singular values close to zero that amplify the noise.

For \gamma > 1 and a signal stronger than the noise (r > \sigma), it decreases to a minimum at \gamma^\ast = \frac{r}{r - \sigma}, then increases towards r^2, the risk of the null predictor. When r \le \sigma, it decreases towards r^2 without a minimum.

In misspecified models, where the features capture only part of the signal, the global minimum can lie in the over-parameterised regime.

import numpy as np

rng = np.random.default_rng(0)
n, sigma, r = 100, 0.5, 1.0                       # samples, noise level, signal norm ||beta||

def exact_risk(p):                                # Gaussian design, min-norm least squares
    if p < n - 1:
        return sigma ** 2 * p / (n - p - 1)
    if p > n + 1:
        return r ** 2 * (1 - n / p) + sigma ** 2 * n / (p - n - 1)
    return np.inf

for p in [10, 50, 90, 98, 102, 110, 200, 400, 1000]:
    risks = []
    for _ in range(200):
        beta = rng.normal(size=p); beta *= r / np.linalg.norm(beta)
        X = rng.normal(size=(n, p))
        y = X @ beta + sigma * rng.normal(size=n)
        beta_hat = np.linalg.pinv(X) @ y          # min-norm interpolator when p > n
        risks.append(np.sum((beta_hat - beta) ** 2))   # excess risk for isotropic x
    print(f"p/n = {p / n:5.2f}: simulated excess risk {np.mean(risks):6.3f}, "
          f"formula {exact_risk(p):6.3f}")

With 100 samples, noise level 0.5 and signal norm 1, simulation and formula agree away from the threshold: 0.255 at p/n = 0.5, 0.753 at p/n = 2, 0.928 at p/n = 10. The minimum over p > n is at p = 2n, as Corollary 10.3 predicts for a signal twice as strong as the noise.

Near p = n both explode: the formula gives 24.5 and 25.0 at p = 98 and p = 102, and the simulated mean, about 20, is noisy because the risk has heavy tails. The link with random-matrix spectra is developed in Large Random Matrices and Applications to Machine Learning.

Key takeaways — chapter 10

  • Validation sets give non-vacuous guarantees without explaining generalisation.
  • The risk of minimum-norm least squares explodes at p = n and decreases beyond: double descent.

11. Research directions and open problems

This chapter is for self-study. It surveys directions in which the questions of the course are still open, with entry points into the literature. It uses ch. 3, 4, 9 and 10, and Exercise 18 goes with it.

11.1 Implicit bias in classification

Proposition 3.4 showed that gradient descent selects the minimum-norm interpolant in least squares. In classification, the selected solution is a maximum-margin one.

Theorem 11.1 — Gradient descent maximises the margin (Soudry, Hoffer, Nacson, Gunasekar and Srebro, 2018), statement On linearly separable data, gradient descent on the logistic loss with a small enough constant step satisfies \|w_k\| \to \infty, and its direction converges to the hard-margin SVM solution \hat w: \frac{w_k}{\|w_k\|} \longrightarrow \frac{\hat w}{\|\hat w\|} .

The convergence of the direction is only logarithmic in the number of steps.

Training long after the training error reaches zero thus keeps increasing the margin, which the margin bounds of ch. 9 reward. Lyu and Li (2020) extend the picture to homogeneous networks, such as ReLU networks without biases: gradient flow converges in direction to a KKT point of a margin-maximisation problem. Whether this point generalises, and how the architecture shapes the implicit norm, are open questions.

11.2 Infinite-width limits: lazy training and mean field

Two scalings of wide networks lead to two different theories.

Open problems include quantitative rates for the mean-field dynamics, extensions to deep networks, and a theory of the intermediate regimes in which practical networks operate.

11.3 Benign overfitting

Theorem 10.2 shows interpolation with a bounded risk, but not consistency. Bartlett, Long, Lugosi and Tsigler (2020) characterise the covariances of Gaussian features for which the minimum-norm interpolant is consistent. The noise must be absorbed by many directions of small variance, a condition expressed through two effective ranks of the covariance. Extending such characterisations beyond linear and kernel models is open.

11.4 The edge of stability

The descent lemma (Proposition 0.2) needs a step below 2/L. Cohen, Kaur, Li, Kolter and Talwalkar (2021) observe that full-batch gradient descent on networks behaves otherwise. The largest eigenvalue of the Hessian rises until it reaches 2/\eta, then hovers there, while the loss keeps decreasing non-monotonically. Explaining this self-stabilisation, and its effect on the solutions found, is an active topic.

11.5 Non-smooth automatic differentiation

At the kinks of ReLU, back-propagation applies the chain rule to objects that are not derivatives. Work by Bolte and Pauwels (2021) shows that its output is an element of a conservative set-valued field. For definable functions (Proposition 4.6), conservative fields coincide with the gradient almost everywhere. Stochastic gradient methods driven by them converge to points that are critical for the field, which justifies the practice of training ReLU networks with automatic differentiation.

11.6 Non-vacuous bounds and the role of the algorithm

Dziugaite and Roy (2017) optimise a PAC-Bayes bound for a stochastic network trained on MNIST and obtain a non-vacuous guarantee. Arora, Ge, Neyshabur and Zhang (2018) derive bounds from the compressibility of trained networks. Hardt, Recht and Singer (2016) bound the generalisation error of stochastic gradient descent through its algorithmic stability. No bound is yet known to predict reliably which of two practical architectures generalises better.

11.7 Uncertainty with guarantees

The approximate posteriors of ch. 6 come without guarantees. Conformal prediction provides a guarantee that holds for any model, at the price of exchangeability (Vovk, Gammerman and Shafer, 2005; Angelopoulos and Bates, 2023).

Proposition 11.2 — Split conformal prediction Fit any model \hat f on one part of the data. On n other calibration points, compute the scores s_i = |y_i - \hat f(x_i)|, and let \hat q be the \lceil (n + 1)(1 - \alpha) \rceil-th smallest of them, assuming this rank is at most n. If the calibration points and a new point are exchangeable, \mathbb{P}\big(|Y_{n+1} - \hat f(X_{n+1})| \le \hat q\big) \ge 1 - \alpha .

Proof. By exchangeability, the rank of the new score among the n + 1 scores is uniform on \{1, \dots, n + 1\}, ties broken at random.

The new point is covered as soon as its rank is at most \lceil (n+1)(1 - \alpha) \rceil, an event of probability at least 1 - \alpha. ∎

import numpy as np
from sklearn.datasets import load_diabetes
from sklearn.linear_model import Ridge

rng = np.random.default_rng(0)
X, y = load_diabetes(return_X_y=True)                 # 442 patients, bundled with scikit-learn
alpha, covered, widths = 0.1, [], []
for trial in range(1000):                             # random splits: train / calibration / test
    idx = rng.permutation(len(y))
    tr, cal, te = idx[:200], idx[200:321], idx[321:]
    model = Ridge(alpha=1.0).fit(X[tr], y[tr])
    scores = np.abs(y[cal] - model.predict(X[cal]))   # conformity scores on the calibration set
    n = len(cal)
    q = np.sort(scores)[int(np.ceil((n + 1) * (1 - alpha))) - 1]
    pred = model.predict(X[te])
    covered.append(np.mean(np.abs(y[te] - pred) <= q))
    widths.append(2 * q)
print(f"target coverage {1 - alpha:.2f}; empirical coverage {np.mean(covered):.3f} "
      f"(sd over splits {np.std(covered):.3f}); mean interval width {np.mean(widths):.0f}")

Over 1000 random splits of the diabetes data, the empirical coverage is 0.901 for a target of 0.90. The guarantee is marginal, averaged over the data. Foygel Barber, Candès, Ramdas and Tibshirani (2021) show that exact conditional coverage, given X = x, is impossible without further assumptions; approximate conditional guarantees and conformal methods under distribution shift are active topics.

For adversarial robustness, randomised smoothing gives certificates. Cohen, Rosenfeld and Kolter (2019) classify x by the most likely output of a base classifier under Gaussian noise \mathcal{N}(0, \sigma^2 I), and certify the decision in a Euclidean ball whose radius is proportional to \sigma.

11.8 Theory of generative adversarial networks

Proposition 1.9 assumes an optimal discriminator over all functions. With discriminators restricted to a class of networks, Arora, Ge, Liang, Ma and Zhang (2017) show that the training objective can be small while the generator has a support far too small to represent the data. Generalisation of generative models, and the equilibria of the GAN game, remain only partly understood. The diffusion models that replaced GANs in many applications are treated in Stochastic Calculus in Machine Learning and Generative Models for Images.

11.9 Explaining predictions by input attributions

Influence functions (Theorem 5.5) explain a prediction by training points. Saliency maps explain it by input coordinates, through the gradient of the class score with respect to the input (Simonyan, Vedaldi and Zisserman, 2014), or its integral along a path from a baseline, integrated gradients (Sundararajan, Taly and Yan, 2017). Whether such attributions are faithful to the computation of the network is debated; these methods are developed in Multimodal Explainable AI.

11.10 A short list of open problems

  1. Explain why stochastic gradient descent on over-parameterised networks finds solutions that generalise, outside the lazy and linear regimes.
  2. Give quantitative global convergence results for deep networks of realistic width, from standard initialisations.
  3. Find generalisation bounds that are non-vacuous and predict the ranking of architectures and training choices.
  4. Obtain uncertainty estimates for deep networks that remain calibrated, conditionally on the input, under distribution shift.
  5. Decide whether gradient methods can find the efficient deep approximants of ch. 8, which are typically not found from random initialisations.

Key takeaways — chapter 11

  • Gradient descent selects maximum-margin solutions in classification, as it selects minimum-norm ones in regression.
  • Wide networks have kernel (lazy) and mean-field limits; practical networks lie between them.
  • Large steps, non-smooth derivatives and non-vacuous bounds are active research fronts.
  • Conformal prediction and randomised smoothing give model-agnostic guarantees, marginal and certified respectively.

Exercises

  1. ★ Size of a test set. How many test examples guarantee, with probability 95 %, that the test error of a fixed classifier is within 1 % of its risk (Proposition 1.3)? Within 0.1 %?

    Solution: we need \sqrt{\log(2/\delta)/(2m)} \le \varepsilon, that is m \ge \log(40)/(2\varepsilon^2). For 1 %, this gives m \ge 3.689 / (2 \times 10^{-4}) \approx 18\,445 .

    For 0.1 %, multiply by 100: about 1.84 million examples.

  2. ★ Pieces of a small network. Let f(x) = \sigma(x) - 2\sigma(x - 1) + \sigma(x - 2) with the ReLU \sigma. Draw f, count its affine pieces and compare with Proposition 1.11.

    Solution: the kinks are at 0, 1 and 2, with slope jumps +1, -2, +1, so the slopes are 0, 1, -1, 0. The function is a hat supported on [0, 2], with peak 1 at x = 1. It has 4 pieces, the maximum m + 1 for m = 3 units.

  3. ★ Back-propagation by hand. Let f(x) = w_2\, \sigma(w_1 x + b_1) with w_1 = 2, b_1 = -1, w_2 = 3, one example (x, y) = (1, 1) and the loss \frac12 (f - y)^2. Run Algorithm 2.6 and check one derivative by finite differences.

    Solution: forward, z_1 = 1, a_1 = 1, f = 3. Backward, \delta_2 = f - y = 2, so \partial/\partial w_2 = \delta_2 a_1 = 2.

    Then \delta_1 = \sigma'(z_1)\, w_2\, \delta_2 = 6, so \partial/\partial w_1 = \delta_1 x = 6 and \partial/\partial b_1 = 6. Check: replacing w_1 by 2 + h gives the loss \frac12 (2 + 3h)^2, whose derivative at 0 is 6.

  4. ★ Initialisation for leaky ReLU. Let \sigma(t) = \max(t, at) with 0 \le a < 1. For a symmetric z, show that the second moment of \sigma(z) is (1 + a^2)/2 times that of the input, and find the weight variance s^2/n that preserves the second moment (Proposition 2.9).

    Solution: split according to the sign of z. The positive part contributes \mathbb{E}[z^2 \mathbb{1}_{z > 0}], the negative part a^2 times the same quantity by symmetry, and each is half of \mathbb{E}[z^2]. The recursion becomes q_{\ell+1} = s^2 (1 + a^2) q_\ell / 2, so s^2 = \frac{2}{1 + a^2} .

  5. ★ Bayesian linear regression in one dimension. Model y = wx + \varepsilon with \beta = 4 (noise standard deviation 0.5), prior w \sim \mathcal{N}(0, 1), and data x = (1, 2), y = (1, 3). Compute the posterior and the predictive distribution at x = 3, and split its variance (Theorem 5.8).

    Solution: S_N^{-1} = 1 + 4 \times (1 + 4) = 21 and m_N = 4 \times (1 + 6)/21 = 4/3. At x = 3, the predictive mean is 4 and the variance is \frac14 + \frac{9}{21} \approx 0.25 + 0.43 = 0.68 .

    The epistemic part already exceeds the aleatoric one at x = 3, outside the data.

  6. ★ Calibration by hand. Six predictions have confidences 0.95, 0.9, 0.9, 0.6, 0.55, 0.5 and are correct, respectively, yes, yes, no, yes, no, no. Compute the ECE with the bins [0.5, 0.75] and (0.75, 1], and say what temperature scaling with T > 1 changes.

    Solution: the high bin has mean confidence 0.917 and accuracy 0.667; the low bin, 0.55 and 0.333. Hence \mathrm{ECE} = \tfrac12 \times 0.25 + \tfrac12 \times 0.217 \approx 0.208 .

    The model is overconfident in both bins. A temperature T > 1 lowers all confidences; the accuracy, 3/6, is unchanged (Proposition 7.5).

  7. ★★ The scalar network, again. For F(a, b) = (ab - 1)^2, compute the Hessian at (1, 1) and show that it is singular; explain the singular direction; is F a Morse function? For G(a, b, c) = (abc - 1)^2, show that the Hessian vanishes at the origin.

    Solution: the Hessian is 2\begin{pmatrix} b^2 & 2ab - 1 \\ 2ab - 1 & a^2 \end{pmatrix}, equal at (1, 1) to twice the all-ones matrix, with eigenvalues 4 and 0. The null direction (1, -1) is tangent to the rescaling orbit (c, 1/c) at c = 1.

    The critical points are degenerate, so F is not Morse. For G, write G = 1 - 2abc + (abc)^2: its lowest-order non-constant term is cubic, so all second derivatives vanish at 0 — a degenerate saddle, outside the scope of Theorem 4.3.

  8. ★★ Counting pieces. Prove Proposition 8.7 in detail. Deduce that a one-hidden-layer ReLU network computing the sawtooth g^k exactly needs at least 2^k - 1 units, and that a network of depth L and width w computing it needs (2w)^L \ge 2^k.

    Hints and expected result: if two piecewise-affine functions have N_1 and N_2 pieces, their sum has at most N_1 + N_2 - 1 pieces (union of breakpoints). The ReLU of a function with N pieces has at most 2N pieces. Induct on the layers. The sawtooth has 2^k pieces with distinct slopes on adjacent pieces, so no fewer pieces can represent it.

  9. ★★ Balancedness in depth. For W = W_L \cdots W_1 and the gradient flow of \mathcal{L}(W) in the factors, show that W_{j+1}^\top W_{j+1} - W_j W_j^\top is conserved for every j (generalising Proposition 3.5).

    Solution: let A_j = W_L \cdots W_{j+1} and B_j = W_{j-1} \cdots W_1, so that the flow is \dot W_j = -A_j^\top \nabla B_j^\top. Using A_j = A_{j+1} W_{j+1} and B_{j+1} = W_j B_j, both derivatives equal -A_j^\top \nabla B_{j+1}^\top - B_{j+1} \nabla^\top A_j .

  10. ★★ A Polyak–Łojasiewicz region. For F(a, b) = \frac12 (ab - 1)^2, show that \|\nabla F\|^2 = 2F\,(a^2 + b^2). Deduce linear convergence of gradient descent on any region a^2 + b^2 \ge c that contains the iterates, and discuss a start near the saddle.

    Solution: \nabla F = (ab - 1)(b, a), hence the identity, and the PL inequality with constant c on the region. Theorem 4.8 gives a rate 1 - \eta c.

    From a small balanced start a_0 = b_0 = t_0, the iterates stay balanced and t grows like t_0 (1 + \eta)^k. Leaving the saddle region takes about \log(1/t_0)/\eta steps: the PL constant degenerates near the saddle.

  11. ★★ The dropout penalty. Two features take the values (1, 1, 1, 1) and (1, 0, 0, 0) on four examples, and the keep probability is q = 0.5. Write the penalty of Proposition 6.6 and compare it with ridge. What happens with standardised features?

    Solution: the penalty is \frac{1 - q}{q}(4 w_1^2 + w_2^2) = 4w_1^2 + w_2^2: the rare feature is penalised four times less per unit weight than with an isotropic ridge of the same strength on w_1. If every feature satisfies \sum_i x_{ij}^2 = n, dropout is exactly ridge with \lambda = n(1 - q)/q.

  12. ★★ Bayes by Backprop against MC dropout (Python). In the second code block of ch. 6, use a prior \mathcal{N}(0, s_0^2) with s_0 \in \{0.1, 1, 3\}, then dropout rates 0.1 and 0.5. Report the ratio error/standard deviation at x = 0 and x = 5.

    Hints and expected result: the KL term becomes \sum_j \Big(\log\frac{s_0}{\sigma_j} + \frac{\sigma_j^2 + \mu_j^2}{2 s_0^2} - \frac12\Big).

    In our runs, the ratio at x = 5 stays between 5 and 9 for every prior and both dropout rates: neither approximation is calibrated far from the data.

    Widening the prior from 0.1 to 1 roughly doubles the spread of Bayes by Backprop in the gap (x = 0), but leaves it unchanged at x = 5. A dropout rate of 0.5 raises the spread at x = 5 only from 0.15 to 0.19. One reason is that the tanh units saturate far from the data, so the spread there comes from the output layer alone.

  13. ★★ The ODIN perturbation. Prove Proposition 7.9. Then let u = \nabla_x \log S(x; T) and show that the ODIN step \tilde x = x + \varepsilon\, \mathrm{sign}(u) increases \log S, at first order, by \varepsilon \|u\|_1.

    Solution: the first part is the expansion e^{-v} = 1 - v + O(v^2) in each term of the denominator. For the second, a first-order Taylor expansion gives \log S(\tilde x) \approx \log S(x) + \varepsilon \langle u, \mathrm{sign}(u)\rangle = \log S(x) + \varepsilon \|u\|_1 .

    Liang et al. observe larger gradient norms on in-distribution inputs, which therefore gain more.

  14. ★★ A ConfidNet head on the digits (Python). In the lab of ch. 7, freeze the classifier and train a small network on its hidden features to regress the true class probability, with the square loss. Compare its failure-prediction AUROC with that of the maximum class probability.

    Hints and expected result: training errors are almost absent, so the TCP targets are close to 1 on the training set; train the head on the validation half instead. The lab’s test set holds only two errors among 251 digits, so the AUROC of both criteria is close to 1 and the comparison is meaningless. A harder task separates them, for instance with 20 % of the training labels flipped, or with the classifier trained for only a few steps. Report bootstrap intervals.

  15. ★★★ The Barron constant of a Gaussian. For f(x) = \exp(-\|x\|^2/2) on \mathbb{R}^d, compute C_f (Definition 8.3). Deduce how many units Theorem 8.5 needs for an L^2 error \varepsilon on the unit ball, and compare with a grid of piecewise-affine interpolation. Which functions have an infinite Barron constant?

    Hints and expected result: \hat f is the standard Gaussian density, so C_f = \mathbb{E}\|G\| for G \sim \mathcal{N}(0, I_d), close to \sqrt d. Theorem 8.5 then needs about 4d/\varepsilon^2 units.

    A grid with error of order h^2 needs about \varepsilon^{-d/2} cells. Functions with kinks, such as |x_1|, have no integrable first Fourier moment.

  16. ★★★ Is the random-label network more complex? (Python). In the experiment of ch. 9, compute for both trained networks the product of the Frobenius norms of the weight matrices, the minimum normalised margin on the training set, and the bound of Theorem 9.9 combined with a margin loss.

    Hints and expected result: the network trained on random labels has larger norms and smaller margins, so its norm-based bound is larger. In our runs, the product of Frobenius norms is about 9 times larger, and the bound 30 to 70 times larger, depending on the margin level used. Both bounds may still exceed 1: discuss what this says about the tightness of Theorem 9.9.

  17. ★★★ Double descent with random ReLU features (Python). Draw n = 100 inputs x \sim \mathcal{N}(0, I_{10}), a unit vector \beta, and responses y = \sigma(\beta^\top x) + 0.2\,\varepsilon.

    Fit them by minimum-norm least squares on p random features \sigma(w_j^\top x)/\sqrt p, with w_j \sim \mathcal{N}(0, I_{10}/10), for p from 10 to 3000.

    Plot the test error against p, as a median over 20 draws of the features, then add a small ridge penalty. Finally, repeat with a scalar input x \in [0, 1].

    Hints and expected result: in our runs over three seeds, the test error has a first minimum between p = 25 and p = 50 (0.12 to 0.15). It peaks at p = n = 100 (10 to 45), then decreases again for p \gg n, to 0.06–0.13 at p = 3000, below the first minimum, as in Belkin et al. (2019).

    A ridge penalty equal to 10^{-2} times the squared norm of the coefficients removes the peak, as the formulas of Hastie et al. (2022) predict. With a scalar input there is no second descent: the limiting kernel is smooth, and its interpolant of noisy points oscillates more and more as p grows.

  18. ★★★ Lazy training (Python, self-study). Rerun the second code block of ch. 4 with widths m \in \{100, 1000, 10\,000\}. Measure the relative distance \|\theta_K - \theta_0\| / \|\theta_0\| and the change of \lambda_{\min}(JJ^\top), then repeat with the mean-field scaling 1/m and a step multiplied by m.

    Hints and expected result: in the 1/\sqrt m scaling, the relative distance decreases like m^{-1/2} and \lambda_{\min} barely moves: the network behaves like its linearisation (section 11.2). In the mean-field scaling, the neurons move by a quantity of order one, and features are learned.

Projects and assessment

The official assessment differs between the two sources. On master-mva.com it is labs (TP) 30 % and an exam 70 %. In the Université Paris-Saclay detail it is a final exam (90 %) and a take-home assignment with an algorithm implementation (10 %), with a resit exam whose grade replaces the previous ones. The solo subjects below are sized like an extended lab report or take-home implementation; the group subjects are for students who want to go further; the exam proposal matches the final exam.

Solo projects

  1. [Solo · ≈ 20 h] Paper study: temperature scaling (Guo, Pleiss, Sun and Weinberger, 2017). Question: does miscalibration grow with capacity, and does one temperature fix it? Train multilayer perceptrons and a small CNN of increasing width and depth, with and without weight decay, on the scikit-learn digits and on Fashion-MNIST (public, via torchvision).
    • Deliverables: code, a 4–6 page report with reliability diagrams, a 10-minute talk.
    • Success criterion: reproduce the trend “ECE grows with capacity”, and a lower ECE after temperature scaling at unchanged accuracy.
    • Chapters used: ch. 6, 7. Evaluated with the rubric below.
  2. [Solo · ≈ 20 h] Depth separation in practice. Question: can gradient descent find the efficient deep representation of the sawtooth? Train shallow and deep ReLU networks with Adam to fit g^k for k = 4, \dots, 8, and record the parameters needed to reach an L^1 error of 1/16.
    • Deliverables: code, a 4–6 page report with a figure “parameters against k” for both families, a 10-minute talk.
    • Success criterion: the figure, compared with Theorem 8.8 and Proposition 8.7, and a discussion of what random initialisations find.
    • Chapters used: ch. 1, 2, 8. Evaluated with the rubric below.
  3. [Solo · ≈ 20 h] Implicit regularisation in matrix factorisation (Gunasekar et al., 2017). Question: does gradient descent on W = UU^\top from a small initialisation find low-rank solutions of matrix sensing? Use synthetic low-rank matrices and random Gaussian measurements; compare with nuclear-norm minimisation by proximal gradient.
    • Deliverables: code, a 4–6 page report, a 10-minute talk.
    • Success criterion: recovery error and effective rank as functions of the initialisation scale, with Proposition 3.5 used to explain the trend.
    • Chapters used: ch. 3, 4. Evaluated with the rubric below.

Group projects

  1. [Group of 2–3 · ≈ 30 h each] Paper study: double descent (Belkin, Hsu, Ma and Mandal, 2019). Question: when does the test risk peak at the interpolation threshold, and what removes the peak?
    • Member A: theory — Theorem 10.2, the asymptotics of Hastie et al. (2022) with ridge and in a misspecified model, checked by simulation.
    • Member B: random Fourier features on a 10 000-image subset of MNIST (public, via torchvision), reproducing the curve of the paper.
    • Member C: width sweep of a two-layer network with label noise, after Nakkiran et al. (2020).
    • Deliverables: one repository, a 6–8 page report, a 15-minute talk. Success: a peak at the threshold, and agreement with theory in the linear case within Monte Carlo error. Chapters 3, 9, 10.
  2. [Group of 2–3 · ≈ 30 h each] An uncertainty benchmark. Question: which approximation of ch. 6–ch. 7 gives the most reliable uncertainties, and at what cost?
    • Methods, one or two per member: last-layer Laplace, Bayes by Backprop, MC dropout, deep ensembles, an evidential classifier; one shared evaluation harness.
    • Data: digits 0–4 against 5–9 and Fashion-MNIST against MNIST for OOD detection; the scikit-learn diabetes data for regression.
    • Metrics: NLL, ECE, failure and OOD AUROC, coverage and sharpness, all over 5 seeds.
    • Deliverables: code, a 6–8 page report with one summary table, a 15-minute talk. Success: complete table with error bars and a check of Proposition 7.3. Chapters 5–7.
  3. [Group of 2–3 · ≈ 30 h each] Landscape and convergence of small networks. Question: do the assumptions of Theorems 3.7, 4.3, 4.7 and 4.8 hold along real training runs?
    • Member A: fraction of runs reaching zero loss on N random points, as a function of width, with \lambda_{\min}(JJ^\top) tracked along training.
    • Member B: finite length of the iterates and an estimate of the Łojasiewicz exponent near the limits.
    • Member C: failure cases — narrow ReLU networks, dead units, degenerate saddles.
    • Deliverables: code, a 6–8 page report, a 15-minute talk. Success: each figure tied to a theorem whose assumptions are checked numerically. Chapters 3, 4.

Written exam (proposal)

Two hours, one handwritten A4 sheet allowed, four exercises (a proposal, not the official exam).

  1. Question (4 points). State the decomposition of the excess risk into approximation, estimation and optimisation errors, and prove the bound on the estimation error. Explain in a few lines why double descent contradicts the classical picture, using Proposition 3.4 and Theorem 10.2.

    Expected: Proposition 1.5 with its three-term proof (2 points); interpolation and the selection of the minimum-norm interpolant, the explosion at p = n and the second descent (2 points).

  2. Question (5 points). Bayesian linear regression with y = wx + \varepsilon, noise precision 1 and the prior w \sim \mathcal{N}(0, 1), on the data x = (1, -1, 2), y = (2, -1, 3). Compute the posterior, then the predictive mean and variance at the inputs 0 and 3, and split each variance into aleatoric and epistemic parts.

    Expected: S_N^{-1} = 7 and m_N = 9/7 (2 points). At x = 0, mean 0 and variance 1, all aleatoric; at x = 3, mean 27/7 \approx 3.86 and variance 1 + 9/7 \approx 2.29 (2 points). Interpretation (1 point).

  3. Question (5 points). Let F(\theta) = \frac12\|G(\theta) - y\|^2 with \lambda_{\min}(JJ^\top) \ge \mu and a \beta-Lipschitz gradient. Prove that gradient descent with step 1/\beta converges linearly to zero loss, and explain why the assumption needs at least as many parameters as data points.

    Expected: the PL inequality from \nabla F = J^\top r (2 points); the descent lemma and the rate 1 - \mu/\beta (2 points); the rank of J is at most p (1 point).

  4. Question (6 points). Expressivity on the line. (a) Show that a one-hidden-layer ReLU network with m units has at most m + 1 affine pieces. (b) Show that the tent map composed with itself is a sawtooth with 4 pieces. (c) Prove that every continuous piecewise-affine function with at most 2^{k-2} - 1 pieces is at L^1 distance at least 1/16 from g^k.

    Expected: kinks of each unit (2 points); composition on each half-interval (1 point); the pairing argument of Theorem 8.8 (3 points).

Grading rubric (proposal)

Criterion Weight What earns the marks
Mathematical correctness 30 % Precise statements, assumptions checked, proofs or proof sketches without gaps
Experimental rigour 25 % Fixed seeds, baselines, error bars over several runs, ablations that isolate one factor
Link between theory and experiment 20 % Each figure answers a question raised by a theorem, and discrepancies are explained
Clarity of the report and of the talk 15 % A clear question, a readable structure, figures with labelled axes, the time limit respected
Code quality and reproducibility 10 % One command reproduces the main figure; dependencies and data sources are stated

References

Official references (master-mva.com course page, numbered as there; the text calls them “official reference N”):

  1. J. Bolte, S. Sabach, M. Teboulle. Proximal alternating linearized minimization for nonconvex and nonsmooth problems. Mathematical Programming, 146(1–2), 2014 (pages listed as “59-594” on the official page).
  2. I. Panageas, G. Piliouras. Gradient descent only converges to minimizers: non-isolated critical points and invariant regions. ITCS, 2017.
  3. J. D. Lee, M. Simchowitz, M. I. Jordan, B. Recht. Gradient descent only converges to minimizers. COLT, 2016.
  4. P. Baldi, K. Hornik. Neural networks and principal component analysis: learning from examples without local minima. Neural Networks, 2(1):53–58, 1989.
  5. L. Venturi, A. S. Bandeira, J. Bruna. Neural networks with finite intrinsic dimension have no spurious valleys. arXiv, February 2018.
  6. I. Safran, O. Shamir. On the quality of the initial basin in overspecified neural networks. ICML, pages 774–782, 2016.
  7. F. Malgouyres, J. Landsberg. Multilinear compressed sensing: application to deep linear networks. arXiv, 2017.
  8. A. R. Barron. Universal approximation bounds for superpositions of a sigmoidal function. IEEE Transactions on Information Theory, 39(3):930–945 (dated 1994 on the official page; volume 39 is the 1993 volume).
  9. R. Eldan, O. Shamir. The power of depth for feedforward neural networks. 29th Annual Conference on Learning Theory, PMLR 49:907–940, 2016.
  10. N. Golowich, A. Rakhlin, O. Shamir. Size-independent sample complexity of neural networks. Proceedings of COLT 2018, 297–299, 2018.
  11. K. Kawaguchi, L. P. Kaelbling, Y. Bengio. Generalization in deep learning. In Mathematical Aspects of Deep Learning, pages 112–148, Cambridge University Press, 2022.
  12. J. Bruna, S. Mallat. Invariant scattering convolution networks. IEEE TPAMI, 35(8):1872–1886, 2013.
  13. A. Bietti, J. Mairal. Group invariance and stability to deformations of deep convolutional representations. NIPS, 2017.
  14. P. W. Koh, P. Liang. Understanding black-box predictions via influence functions. ICML, 2017.
  15. C. M. Bishop. Pattern Recognition and Machine Learning. Springer, 2006.
  16. K. P. Murphy. Machine Learning: A Probabilistic Perspective. The MIT Press, 2012.
  17. C. Blundell, J. Cornebise, K. Kavukcuoglu, D. Wierstra. Weight uncertainty in neural networks. ICML, 2015.
  18. Y. Gal, Z. Ghahramani. Dropout as a Bayesian approximation: representing model uncertainty in deep learning. ICML, 2016.
  19. C. Guo, G. Pleiss, Y. Sun, K. Q. Weinberger. On calibration of modern neural networks. ICML, 2017.
  20. C. Corbière, N. Thome, A. Saporta, T.-H. Vu, M. Cord, P. Pérez. Confidence estimation via auxiliary models. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
  21. S. Liang, Y. Li, R. Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. ICLR, 2018.
  22. K. Kurdyka. On gradients of functions definable in o-minimal structures. Annales de l’Institut Fourier, 48(3):769–783, 1998.
  23. J. Bolte, A. Daniilidis, A. Lewis, M. Shiota. Clarke subgradients of stratifiable functions. SIAM Journal on Optimization, 18(2):556–572, 2007.
  24. D. Davis, D. Drusvyatskiy, S. Kakade, J. D. Lee. Stochastic subgradient method converges on tame functions. arXiv:1804.07795, 2018.
  25. Q. Nguyen, M. Hein. The loss surface of deep and wide neural networks. arXiv:1704.08045, 2017.
  26. G. Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of Control, Signals and Systems, 2:303–314, 1989.
  27. D. Yarotsky. Optimal approximation of continuous functions by very deep ReLU networks. Proceedings of COLT 2018, 639–649, 2018.
  28. P. L. Bartlett, N. Harvey, C. Liaw, A. Mehrabian. Nearly-tight VC-dimension and pseudodimension bounds for piecewise linear neural networks. Journal of Machine Learning Research, 20(63):1–17, 2019.
  29. M. Belkin, D. Hsu, S. Ma, S. Mandal. Reconciling modern machine-learning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116(32):15849–15854, 2019.
  30. T. Hastie, A. Montanari, S. Rosset, R. J. Tibshirani. Surprises in high-dimensional ridgeless least squares interpolation. The Annals of Statistics, 50:949–986, 2022.

Textbooks

Networks, optimisation and landscape

Approximation, generalisation and infinite width

Robustness, uncertainty and generative models