Deep Learning & Approximation Theory Notes
Deep Learning & Approximation Theory Notes
Nadav Dym
Preface
These are lecture notes from the course ‘Deep Learning and Approximation Theory’ which I taught in the
Technion in the spring of 2023. The course is intended for graduate and advanced undergraduate students.
Its goal is to introduce students to modern research which focuses on understanding the approximation power
of neural networks. The course is divided into two main chapters: the first chapter deals with approximation
results pertaining to fully connected neural networks. The second chapter discusses approximation results
for neural network architectures which are invariant to permutations or other group actions.
I am making these notes public with the hope that they will be of interest to people outside the Technion.
However, note that wile I did some minimal proof reading of these notes, they have not undergone very serious
editing and will tend to contain more errors than, say, a textbook. Use at your own risk... Please do let me
know via email of any errors which you find.
Chapter 0
Lesson 1
The first goal of this lesson is to show some fundamental facts about approximation: basically that poly-
nomials are dense in the space of continuous functions, while polynomials of finite degrees are not. The
secondary goal is to clarify some of the math background necessary for this course, and help close the gaps
to those who need to. For additional reading see [Simmons, 1963].
We also say that (X, ∥ · ∥) is a normed space. Later today we will use the reverse triangle inequality:
|∥x∥ − ∥y∥| ≤ ∥x − y∥
Definition 0.3. Let X be a non-empty set. A metric d is a function d : X × X → R which satisfies the
following conditions
3
4 CHAPTER 0. SOME MATH PRELIMINARIES
Example 0.4. 1. For any non-empty set X, we can define the ‘discrete metric’ d(x, x) = 0 and d(x, y) = 1
if x ̸= y.
Problem 0.6. The discrete metric on R is not induced from a norm. Explain why.
Definition 0.7 (Convergence). Let (X, d) be a metric space. We say that a sequence xn , n = 1, 2, . . . of
elements in X converges to x if
d(xn , x) → 0
Definition 0.8 (Cauchy sequences). Let (X, d) be a metric space. We say that a sequence xn , n = 1, 2, . . . of
elements in X is Cauchy if for every ϵ > 0 there exists N such that for all n, m ≥ N we have d(xn , xm ) < ϵ.
A converging sequence is always a Cauchy sequence: If xn → x then for all ϵ > 0 there exists N such
that for all n > N we have d(xn , x) < ϵ/2, and so for n, m > N we use the triangle inequality to obtain
A metric space is complete if ever Cauchy sequence has a limit. For example Rd and closed subsets of Rd
are complete, while [0, 1) or the rational numbers are not complete.
Definition 0.9. Let (X, d) be a metric space. For x0 ∈ X and r > 0, the open ball Br (x0 ) is the set
Definition 0.10 (Open sets). Let (X, d) be a metric space. We say that U ⊆ X is an open set if for all
x ∈ U there exists some r > 0 such that Br (x) ⊆ U .
Definition 0.12 (Closed sets). Let (X, d) be a metric space. We say that a set C ⊆ X is closed if for every
sequence xn ∈ C which converges to a point x ∈ X, we have that x ∈ C.
Problem 0.13. Show that a set C ⊆ X is closed if and only if its complement is open.
Definition 0.14 (Compactness). Let (X, d) be a metric space. We say that a set K ⊆ X is compact if
every sequence xn ⊆ K has a subsequence which converges to a limit in K.
Example 0.15. The set (0, 1] is not a compact subset of R because the sequence 1/n, and all its subsequences,
converge to a point which is not in the set. The set [0, 1] is compact. In general in Rn any closed and bounded
set is compact.
Definition 0.16 (Continuity). Let (X, dX ) and (Y, dY ) be metric spaces. We say that a function f : X → Y
is continuous if for every sequence xn → x in X, we have that f (xn ) → f (x) in Y .
Proposition 0.17. Let (X, dX ) and (Y, dY ) be metric spaces. If f : X → Y is continuous and K ⊆ X is
compact, then f (K) is compact.
5
Proof. We need to show that f (K) is compact. Let yn be a sequence in f (K). There exist xn ∈ K such that
f (xn ) = yn . By compactness of K, the sequence xn has a subsequence xnk which converges to some x ∈ K.
By continuity
ynk = f (xnk ) → f (x) ∈ f (K)
and so we showed that yn has a converging subsequence, and thus f (K) is compact.
Corollary 0.18. Let (X, d) be a metric space. K ⊆ X compact, and f : X → R a continuous function.
Then f obtains a maximum and minimum of K.
Proof. By the previous proposition f (K) is a compact subset of R and so it is bounded: there exists some
M > 0 such that |f (x)| < M . It follows that S = supx∈K f (x) is finite. There exists a sequence xn ⊆ K
such that f (xn ) → S. By compactness xn has a subsequence which converges to x ∈ K and by continuity
f (x) = S so x is a maximum. The same argument can be used to show the existence of a minimum.
Let V be a vector space over the reals and K ⊆ V be a subset. Denote
C(K) = {f : K → R| f is continuous}.
∥f ∥ = max |f (x)|
x∈K
by the previous corollary this is well defined. We can verify that this is indeed a norm. Positivity and
homogeneity are rather obvious. As for the triangle inequality: For f, g ∈ C(K) and for all x ∈ K
and since this inequality is true for all x it is also true for the x which maximize |f (x) + g(x)|.
Problem 0.19. Give an example of f, g for which (i) the inequality is strict and (ii) the inequality is not
strict.
The norm on C(K) induces the metric ∥f − g∥ = maxx∈K |f (x) − g(x)| on functions. This metric space
will be central in this course. We will consider questions such as: given a subset of function P ⊆ C(K), can
any function f ∈ C(K) be approximated by functions in P ? That is, can we, for every given ϵ > 0 find some
p ∈ P such that
∥f − p∥ = max |f (x) − p(x)| < ϵ
x∈K
or equivalently, can we find a sequence pn ⊆ P such that ∥pn − f ∥ → 0? When this happens we say that pn
uniformly converges to f , and we say that P is dense in C(K).
We state Weierstrass’s theorem
Theorem 0.20 (Weierstrass). Every continuous function f : [a, b] → R can be approximated uniformly by
polynomials.
we will later discuss this theorem’s generalization, the Stone-Weierstrass theorem. For now, we want to
show that we cannot approximate a continuous function by polynomials of degree ≤ D. Denote
This is a vector space of dimension D + 1, with the norm ∥f ∥C[a,b]] = maxx∈[a,b] |f (x)|. We will show that
all finite dimensional normed spaces are ‘topologically equivalent’ and through this show that they cannot
approximate all functions. In contrast, note that the space of all polynomials R[x] is infinite dimensional.
Definition 0.21. Let (X, ∥ · ∥X ) and (Y, ∥ · ∥Y ) be normed spaces over R. We say that a map T : X → Y
is an isomorphism of normed spaces if T is linear, onto, and there exists 0 < m < M such that
Problem 0.22. Show that the identity map Ix = x is a isomorphism between (Rn , ∥ · ∥∞ ) and (Rn , ∥ · ∥1 ).
What are the constants? Can you do the same when ∞ is replaced with 2?
Solution. We have that
n
X
∥x∥1 = |xi | ≥ max |xi | = ∥x∥∞ ,
i
i=1
and on the other hand
n
X n
X
∥x∥1 = |xi | ≤ |x|∞ = n|x|∞ ,
i=1 i=1
and so we obtained
m∥x∥∞ ≤ ∥x∥1 ≤ M ∥x∥∞ .
with m = 1 and M = n. Note that these constants aren’t unique: we can make M larger of m smaller. They
are however the optimal constants one can choose, as can be seen by taking
x = [1, 0, 0, . . . , 0] and x = [1, 1, . . . , 1]
We say that (X, ∥ · ∥X ) and (Y, ∥ · ∥Y ) are isomorphic if there exists an isomorphism between them.
As it turns out, there is always an isomorphism between normed spaces of the same finite dimension.
Theorem 0.23. Let (V, ∥ · ∥) be a vector space over R of dimension n. Then there is a isomorphism between
V and (Rn , ∥ · ∥2 ).
Proof. Let v1 , . . . , vn be a basis for V , and e1 , . . . , en denote the standard basis for Rn . We define a linear
map T : Rn → V by
Xn
T (x) = x i vi .
i=1
The map T is linear and onto. It is also one-to-one, for T (x) = 0 implies that all xi are zero. It remains to
show that the norm ∥T x∥ can be bounded from above and below by ∥x∥ up to some constant. Define
v
u n
uX
M =t ∥vi ∥2
i=1
this gives us the first inequality we need. We can also use it to get the other direction: the inequality we
just proved shows that the map
N : Rn → R, N (x) = ∥T x∥
is continuous. For if xn → x then, using the reverse triangle inequality:
|N (xn ) − N (x)| = |∥T xn ∥ − ∥T x∥| ≤ ∥T (xn − x)∥ ≤ M ∥xn − x∥2 → 0
The continuous function N obtains a minimum on the compact set S1 = {x ∈ Rn | ∥x∥2 = 1}. This minimum
is clearly non-negative. Moreover, we saw that N is injective and so doesn’t assume zero values on S1 , which
then implies that since ∥ · ∥ is a norm, N (x) = ∥T x∥ is never zero on S1 , and so there is a positive minimum
m > 0. It follows that for all x ∈ S1
∥T x∥ ≥ m = m∥x∥2
this inequality holds for all x. If x = 0 then both sides are zero. Otherwise we have
x
∥T x∥ = ∥x∥2 · ∥T ∥ ≥ ∥x∥2 · m
∥x∥2
7
sketch of proof. Let (V, ·) be a real normed space of dimension n and let T : V → Rn be an isomorphism.
One can verify that vn ⊆ V converges to v ∈ V if and only if T vn converges to T v, and similarly vn is a
Cauchy sequence if and only if T vn is a Cauchy sequence. Since vn is Cauchy, so is T vn , and since Rn is
complete, T vn has a limit x, and so vn has a limit T −1 x.
Corollary 0.25. Let (V, ∥ · ∥) be a real normed vector space, and P ⊆ V is a finite dimensional subspace,
and assume that pn ⊆ P converges to some limit f ∈ V . Then f ∈ P .
Proof. Since pn → f the sequence pn is a Cauchy sequence in P and so it has a limit in P . Thus f is in
P.
As mentioned above, this corollary shows in particular that polynomials of degree ≤ D cannot approxi-
mate any continuous functions which are not polynomials of degree ≤ D.
x = (x1 , . . . , xn ) 7→ xα α2 αn
1 · x2 . . . · xn
1
where α = (α1 , . . . , αn ) ∈ Nn0 (here N0 = N ∪ {0}). We use the shortened notation xα to described this
function. The degree of a monomial is the sum of all indices of α which is denoted by |α| = ∥α∥1 . A
polynomial function p : Rn → R is a finite linear combination of monomials. The degree of a polynomials is
the maximal degree of a monomial in the linear combination which has a non-zero coefficient.
The Stone-Weierstrass theorem shows that multi-variate polynomials are dense in C(K) for compact
K ⊆ Rn . In fact, it applies to a wider family of functions called sub-algebras:
Definition 0.26. Let X be a metric space. We say that a subset A ⊆ C(X) is a subalgebra of C(X) if for
all f, g ∈ A and c ∈ R
1. f + g ∈ A
2. cf ∈ A
3. f · g ∈ A
4. The trigonometric polynomials: functions which are finite linear combinations of the constant function
1, and the functions cos(nx) and sin(mx) for n, m ∈ N, are a sub-algebra. This can be seen using the
trigonometric identities
fw (x) = e⟨w,x⟩
are a subalgebra.
Definition 0.28. An algebra A ⊆ C(K) separates points in K, if for any points x, y ∈ K with x ̸= y there
exists some f ∈ A such that f (x) ̸= f (y).
Theorem 0.29 (Stone-Weierstrass). Let K be a compact metric space, and let A be an algebra which
contains a non-zero constant function and separate points, then A is dense in C(K).
We will not prove this theorem, but we will practice using it.
Problem 0.30. Using the Stone-Weierstrass Theorem, answer the following questions:
1. Show that the univariate polynomials are dense on every closed interval [a, b] (that is, that Weierstrass
follows from Stone Weirstrass)?
2. Are the univariate polynomials dense on all of R?
Lesson 2
1.1 Introduction
1.1.1 Supervised Learning
The motivation for most questions discussed in this course come from a supervised learning problem: Let
K ⊆ Rd be a compact set, and f : K → Rℓ a continuous function. We have ‘no access’ to f , except via its
samples f (xi ), i = 1, . . . , N at some points xi , i = 1, . . . , N in K. Our aim is to find a good approximation
for f , by choosing an appropriate hypothesis class of parametric functions
H = {h(x; θ) : K × Rp → Rℓ }
and searching for the best approximation of f by h in terms of the given data, by solving an optimization
problem such as
N
X 2
minp L(θ) = [hθ (xi ) − f (xi )] .
θ∈R
i=1
Typically L(θ) is differentiable (at least at ‘most’ points), and the methods used for searching for the
minimizer of L(θ) are variations of the ‘gradient descent’ method. In its simple form, in gradient descent we
are given an initial guess θ0 for the minimum of L, and we iteratively update our guess for θ by going in the
direction in which L is reduced most:
θt+1 = θt − ∇L(θt ).
Once this procedure is terminated and some final θ∗ is reached, we choose hθ∗ as our approximation of f .
There are several theoretical (and practical) issues that can arise:
1. Optimization Can gradient descent (or a different algorithm) find a solution θ∗ which is a good
approximation of the true minimum?
2. Generalization Will a good approximation of f on the data xi give a good approximation for other
points in K?
3. Approximation Does our hypothesis class H contain a good approximation for f ?
In this course we focus only on the question of approximation. We would like to show that the hypothesis
classes we construct can approximate any continuous function. This property is called ‘universality’. In the
previous chapter we saw some examples of parametric function classes which can approximate all continuous
functions, at the limit where the number of parameters goes to infinity. In practice, we will focus mostly on
hypothesis classes called neural networks, which are popular in modern applications. Our first goal will be
to show that they too, like polynomials, can approximate all continuous functions. But before we do this,
we will start by defining these hypothesis classes:
9
10 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
Fixing some activation function σ, and natural numbers w0 , . . . , wL , wL+1 , a Neural Network Function (NNF)
with widths w0 , . . . , wL , wL+1 is defined to be a function h : Rw0 → RwL+1 of the form
Choices of activation function Possibly the most popular choice of activation function today is
A very popular choices of activation function in the past was the analytic sigmoid function
1
sigmoid(x) = .
1 + e−x
A smooth version of the ReLU can be obtained by considering
x
SiLU (x) = x · sigmoid(x) = .
1 + e−x
Another common option is the hyperbolic tangent
ex − e−x
tanh(x) =
ex + e−x
In the literature discontinuous functions like
1 if x > 0
sign(x) =
−1 if x ≤ 0
are also discussed though they are difficult to work with using gradient descent.
1. Fully connected neural networks Let X = Rw0 be our domain. Let σ : R → R be some function,
which we will call an activation function. Let
The number L is called the depth of the network, and each number wℓ is called the width of the ℓ-th
layer. We usually think of the vector w ⃗ (and the activation function σ ) as hyper-parameters: once
they are fixed, we can use gradient descent to find the parameters which define the affine functions hi .
1.1. INTRODUCTION 11
(a) (b)
Figure 1.1: (a) The directed graph corresponding to the architecture FC(3, 2; 2, 1, σ). (b) The ‘trapezoid
function’ ha,b,c,d .
2. Fully connected neural networks with fixed width When studying the approximation power of
fully connected neural networks we will usually simplify things by assuming that all hidden layer have
the same width. The width vector w ⃗ is then described by four hyper-parameters
w
⃗ (W, L, win , wout ) = (w0 = win , w1 = W, w2 = W, . . . , wL = W, wL+1 = wout )
3. Convolutional Neural Networks are another example (which we will not discuss in this course) of
functions which are compositions of affine and activation functions. The affine functions are convolu-
tions rather than general linear transformations.
Each vertex is called a neuron, and the collection of all vertices with superindex ℓ are called the ℓ-th layer.
The 0-th layer is called the input layer, the last layer is called the output layer, and the intermediate layers
are called ‘hidden layers’.
For a given vertex=neuron vjℓ , the incoming edges in the graph connect the neuron to all neurons in the
previous layer
(ℓ−1)
vi , i = 1 . . . wℓ−1
while the outgoing edges connect vjℓ to all neurons in the next layer
(ℓ+1)
vi , i = 1 . . . wℓ+1
12 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
when ℓ = 0 there are no incoming edges and when ℓ = L is maximal there are no outcoming edges. In
Figure 1.1(a) we visualize the directed graph associated with the architecture FC(W = 3, L = 2; win =
2, wout = 1, σ).
The function in (1.1) can be rewritten as a composition of functions, where we denote the input x ∈ Rw0
by x(0) and then recursively define
x(ℓ) = σ hℓ (x(ℓ−1) = σ A(ℓ) x(ℓ−1) + b(ℓ) . (1.2)
The final vector we obtain by this process x(L) is the output of the neural network function defined in (1.1).
Looking at the j-th coordinate of x(ℓ) in (1.2) we obtain
wℓ−1
!
(ℓ)
X (ℓ) (ℓ−1) (ℓ)
xj = σ Ajk xk + bk
k=1
(ℓ) (ℓ)
That is, the neuron vj aggregates the signals it obtains from its neighbors according to weights Ajk (which
are defined per edges) and bℓk (which is defined per vertex), and then decides whether to fire. In this context
the sigmoid and sign activation functions seem more natural. When using the sign function, the neuron
decides to fire (or activate) if the signal it obtained from its neighbors is above a certain threshold. with
sigmoid a smoother approach is taken, where the amount of activation varies continuously with the input.
Of course, in practice we are interested in which functions perform best in terms of learning, irrespective to
how well they resemble our understanding of ‘natural neural networks’.
with activation function σ(x) = ReLU (x). These networks are called shallow neural networks.
4. The function class [
FC (W, L = 1; win = d, wout = 1, σ)
W ∈N
Solution: The first is not dense as it contains only linear functions. The last is not dense as it contains
only degree two polynomials. The second and third function classes are dense as we will now discuss.
As it turns out, for ReLU activation functions, a single hidden layer is sufficient to obtain universal-
ity(=denseness), as the width is taken to infinity. Which other activation functions have this property?
Clearly this cannot occur for polynomial activation functions of some degree D because then FC (W, L = 1; win , wout , σ)
only contains polynomials p : Rwin → Rwout of degree ≤ D. The space of such polynomials is finite dimen-
sional, and by Corollary 0.25 functions from this space cannot approximate any functions from outside that
space.
Remarkably, this is the only restriction on the activation function. The well known universality theorem
for neural networks (perhaps the most well known result in neural network theory...) states
Theorem 1.2 ([Pinkus, 1999]). Let K ⊆ Rd be a compact set, and σ : R → R be a continuous function
which is not a polynomial. Then
[
FC (W, L = 1; win = d, wout = 1, σ)
W ∈N
is dense in C(K).
Due to this theorem, neural networks are often called ‘universal approximators’. That is: for any given
unknown continuous f , there is hope to approximate it using a neural network hypothesis class, as such
hypothesis classes can approximate any continuous function.
A standard reference for the theorem and it historical development, is in the review article by Allan Pinkus
[Pinkus, 1999], (who by the way is a retired professor from our very own Technion Math department). In
this course we will not present the full proof, but we will use parts of his proof to prove Theorem 1.2 for
anlaytic non-polynomial activations. Later on, we will present a different proof for ReLU activations, where
we will allow the depth of the network to grow and not only the width.
We conclude
Lemma 1.3. Let K ⊆ Rd be a compact set, and σ : R → R be some function, if
span{σ (⟨a, x⟩ + b) | a ∈ Rd , b ∈ R} (1.3)
is dense in C(K), then [
FC (W, L = 1; win = d, wout = 1, σ)
W ∈N
is dense in C(K).
14 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
Closure Next, recall that if C is a normed space and P ⊆ C is a subspace, then the closure of P is denoted
by P̄ , and defined as the set
Note that saying that P is dense in C is equivalent to saying that C = P̄ . One can verify that
1. P̄ contains P , is closed, and is the smallest set having these two properties.
2. P̄ is a subspace of C.
Lemma 1.5. If σ : R → R is analytic and non-polynomial, then there exists a point b ∈ R such that none
of the derivatives of σ at b vanish, that is
Proof. For analytic functions, if there is a sequence tn which converges to some t, for which σ(tn ) = 0 for
all n, then σ(t) = 0 for all t ∈ R. It follows that if σ is not zero, then in the interval [0, 1] it can have a
finite number of zeros (otherwise, we can find a sequence tn on which σ is zero, and then take a converging
subsequence which would imply that σ = 0). We deduce that for all k = 0, 1, . . . the set
is finite and therefore the set ∪k∈{0}∪N Zk is countable, and so there exists some b ∈ [0, 1] which is not in this
set, and for this b we have (1.4).
We are now ready to prove Theorem 1.2 for the case d = 1. The general case d ≥ 1 will then follow
relatively easily.
Lemma 1.6 (Shallow universality for d = 1). Let K ⊆ R be a compact set, and σ : R → R be an analytic
function which is not a polynomial. Then
[
FC (W, L = 1; win = 1, wout = 1, σ)
W ∈N
is dense in C(K).
P = span{σ(at + b)| a, b ∈ R}
is dense, that is that P̄ = C(K). Let us fix some b for which σ and all its derivatives do not vanish as in
(1.4). We claim by induction that for every a ∈ R and every k = 0, 1, . . . the function
dk
fa(k) (t) = σ(at + b) = tk σ (k) (at + b)
dak
(k+1)
they converge uniformly on K to fa (t) and therefore since P̄ is closed this function is also in P̄ . Indeed
we have for every t ∈ K that there exists some â ∈ [a − 1, a + 1] such that
1 (k) 1 (k)
| fa+h (t) − fa(k) (t) − fa(k+1) (t)| = | fa+h (t) − fa(k) (t) − hfa(k+1) (t) |
h h
1 1 2 (k+2)
=| h fâ (t)|
h2
|h| (k+2)
≤ max |f (t)|,
2 (â,t)∈[a−1,a+1]×K â
where the existence of the maximum follows from the fact thatall derivatives of
σ exists and are continuous,
(k) (k)
and the set [a − 1, a + 1] × K is compact. It follows that h1 fa+h (t) − fa (t) converges unifomly on K
(k+1) (k+1)
to fa (t) as required, and so fa ∈ P̄ for all a ∈ R and all k. In particular, this holds for a = 0, in
which case we see that for all k the function tk σ (k) (b) is in P̄ . Since σ (k) (b) ̸= 0 for all k we see that every
polynomial can be obtained as a linear combination of these functions, and since P̄ is a subspace of C(K) it
follows that all polynomials are contained in P̄ . From the denseness of polynomials it follows that P̄ = C(K)
and so we are done.
We can now conclude the proof of the theorem for general d ≥ 1.
Proof of Theorem 1.2. By Lemma 1.3 it is sufficient to show that the closure of
P = span{σ (⟨a, x⟩ + b) | a ∈ Rd , b ∈ R}
is equal to C(K). In Problem 0.30 we used Stone-Weierstrass to show that linear combinations of functions
of the form
Ea (x) = exp (⟨a, x⟩)
are dense in C(K). It is thus sufficient to show that all such functions are in P̄ . By the previous lemma,
For fixed a, and every ϵ > 0 we can approximate the continuousPexponential function on the compact set
N
Ka = {⟨a, x⟩|x ∈ K} to ϵ accuracy by an expression of the form n=1 cn σ(an t + bn ), and so for all x ∈ K
N
X
∥ exp(⟨a, x⟩) − cn σ(an ⟨a, x⟩ + bn )∥ ≤ ϵ
n=1
The full proof of Theorem 1.2 We proved Theorem 1.2 for the special case where the activation func-
tion is analytic and non-polynomial. The same proof works for C ∞ (R) non-polynomial functions, the only
difference being that proving that there exists a point on which all derivative do not vanish is more challeng-
ing. This can then be extended to all continuous non-polynomial functions, essentially by approximating the
smooth activations by continuous activations. The details can be found in [Pinkus, 1999].
16 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
Lesson Three
1.3 Universality of (deep) ReLU Neural Networks
Recall that for a fixed activation function σ : R → R and integer vector
We also said that we will often focus on the case where all hidden layers have the same width. The width
vector w
⃗ is then described by four hyper-parameters
w
⃗ (W, L, win , wout ) = (w0 = win , w1 = W, w2 = W, . . . , wL = W, wL+1 = wout )
From now on we will focus mostly on the case where σ = ReLU . For short, we will denote ρ := ReLU ,
and when referring to the architectures above with ReLU activation we will drop the activation from the
notation, so that our architectures will just be denoted by FC (w)
⃗ and FC (W, L, win , wout ).
In this section we will prove the universality of neural networks with ReLU activations. What we will
do now is discuss in general some basic properties of ReLU activation neural networks functions. Once we
establish these, proving universality will be rather straightforward. The properties we will discuss will be
useful not only for this theorem but for our understanding of ReLU networks and various other results we
will see later on.
1. Going wider can’t hurt Given w ⃗ = (w0 , . . . , wL+1 ) ∈ NL+2 , every NNF which is in FC(w)
⃗ is also in
FC([w0 , w1 , . . . , wj + n, wj+1 , . . . , wL+1 ]), for every 1 ≤ j ≤ L and every n ∈ N. Let
⃗ To see our claim is true, it is sufficient to show that there exist h̃j+1 : Rwj +n →
be a function in FC(w).
wj+1 wj−1
R and h̃j : R → Rwj +n such that
⃗ ′ ∈ NL+2 and w
We can deduce that if the first and last coordinates of w ⃗ ∈ NL+2 are the same, and
′
⃗ are larger, then FC(w)
all other coordinates of w ⃗ is contained in FC(w⃗ ′ ). In particular, for a given
⃗ ∈ NL+2 , we always have that FC(w)
w ⃗ ⊆ FC(W, L, w0 , wL+1 ) where W = max1≤i≤L wi .
1.3. UNIVERSALITY OF (DEEP) RELU NEURAL NETWORKS 17
so max ∈ FC(W = 3, L = 1, nin = 2, nout = 1). In homework you will show this can be extended to finding
the maximum of a d dimensional vector:
Lemma 1.8. The function h : Rd → R defined by h(x) = max(x) is expressible as a neural network in
FC(W, L, nin = d, nout = 1) with width W = 3d and depth L = ⌈log2 (d)⌉.
We note that we can also express the minimum function with a network of the same size. This follows
from the fact that
min(x) = − max(−x), ∀x ∈ Rd .
We now discuss how to create the trapezoid function (note there is more than one way to do this).
Lemma 1.9. For any a < b < c < d the trapezoid function ha,b,c,d illustrated in Figure 1.1(b) can be
expressed as a neural network in FC(W, L, nin = w, nout = 1) with depth L = 1 and width W = 4.
Proof. Let us relabel a, b, c, d as a1 , . . . , a4 , and choose some a5 > a4 . We guess that there exist α1 , . . . , α4
such that
X4
hα (x) = αi ρ(x − ai )
i=1
is the trapezoid function. Note that for any choice of α1 , . . . , α4 the obtained function is linear on the
intervals
(−∞, a1 ], [a4 , ∞) and [ai , ai+1 ], i = 1, . . . , 3,
Accordingly is is sufficient to find on each such interval two points on which the expected value is obtained.
Note that by construction the function hα is zero on (−∞, α1 ]. It is thus sufficent to find α1 , . . . , α4 such
that
hα (a2 ) = 1
hα (a3 ) = 1
hα (a4 ) = 0
hα (a5 ) = 0
The matrix on the left hand side is non-singular, as its determinant is just the product of the non-zero
diagonal elements. Thus this equation has a unique solution and the hα obtained by using the vector α
solving the equation is the NNF we wanted.
1.3. UNIVERSALITY OF (DEEP) RELU NEURAL NETWORKS 19
We’d like to think of the trapezoid function we just constructed as an approximation of an indicator
function for the unit interval [b, c] by a continuous function (think of the case a = b − ϵ, d = c + ϵ). We can
now use this and the maximum function we constructed, to construct approximations of a indicator for a
high-dimensional cube:
Lemma 1.10. Let â, a, b̂, b ∈ Rk be such that âi < ai < bi < b̂i for all i = 1, . . . , k, then there exists a neural
network function h in FC(W = 4k, L = 1 + ⌈log2 (k)⌉, nin = k, nout = 1) such that
1. 0 ≤ h(x) ≤ 1 for all x ∈ Rk .
Qk
2. h(x) = 1 for all x in the cube C = i=1 [ai , bi ].
Qk
3. h(x) = 0 for all x outside the cube Ĉ = i=1 [âi , b̂i ].
which satisfies the conditions of the lemma. By Lemma 1.8 the minimum function is in FC(W, L, nin =
k, nout = 1) with width W = 3k and depth L = ⌈log2 (k)⌉ while each of the hi can be realized with width
four and depth 1 by Lemma 1.9. Using the concatenation and composition rules we see that the function
x1 h1 (x1 )
x2 h2 (x2 )
.. 7→ .. 7→ min{h1 (x1 ), h2 (x2 ), . . . , hk (xk )}
. .
xk hk (xk )
Universality We now want to prove universality of ReLU networks, using the fact that they can approx-
imate cube indicators and minimum and maximum functions. For any set C ⊆ Rd we define its indicator
function to be
1 if x ∈ C
1C (x) = .
0 if x ̸∈ C
For practice, let us prove the following theorem
Theorem (Universality of real indicator functions). Let f : [0, 1]d → R be a continuous, non-negative
function. For every ϵ > 0 there exist n = n(ϵ) cubes C1 , . . . , Cn and numbers c1 , . . . , cn such that
√ d
dℓ
Moreover, if f is ℓ Lipschitz then we can choose n(ϵ) ≤ 2ϵ +1 .
Proof. Let ϵ > 0. Since f is continuous on a compact set, it is uniformly continuous, and so there exists
some δ > 0 such that
∀x, y ∈ [0, 1]d if |x − y| ≤ δ then |f (x) − f (y)| ≤ ϵ.
Moreover, if f is ℓ Lipschitz then we can take δ = ϵ/ℓ, because this implies that if |x − y| < δ then
Now, For every N we define a partition of [0, 1] into N intervals of the from Ik = [ k−1 k
N , N ] where
d d
k = 1, . . . , N . This partition induces a partition of all of [0, 1] into N cubes of the general form
Curse of Dimensionality Our proof achieved ϵ accuracy with approximately (1/ϵ)d cubes. This type
of phenomena where the complexity depends exponentially on the dimensionality is called the ‘curse of
dimensionality’.
We now prove universality for ReLU networks. The idea is to imitate the proof of the previous theorem,
based on the fact that we can express the maximum function and approximate the cube indicator function
used in the previous theorem.
Theorem 1.11 (Universality for ReLU networks). Let f : [0, 1]d → R be a continuous function. For every
ϵ > 0 there exist a neural network function h : Rd → R such that
Since f is continuous on a compact set it is bounded from below, so we can find some b ≥ 0 such that the
function f˜(x) = f (x) + b is non-negative. We will find a NNF h̃ for which
which implies that h(x) = h̃(x) − b satisfies (1.5). Note that h will be a NNF with the same width and depth
as h̃.
Since f˜ is continuous on a compact set it is uniformly continuous and so there exists some δ > 0 such
that
∀x, y ∈ [0, 1]d if |x − y| ≤ δ then |f (x) − f (y)| ≤ ϵ.
Moreover, if f is ℓ Lipschitz then f˜ will be ℓ Lipschitz as well, and we can take δ = ϵ/ℓ as we saw before.
Again as before, for every N we define a partition of [0, 1] into N intervals of the form Ik = [ k−1 k
N , N]
d d
where k = 1, . . . , N . This partition induces a partition of all of [0, 1] into N cubes of the general form
Let xk denote the center of Ck , and denote ck = f (xk ). Let ϕk be a quasi-indicator of Ck supported in
Ĉk , where Ĉk is chosen so that its center is also xk , it contains Ck , and is close enough to Ck such that the
distance of any point in Ĉk from xk is still smaller than δ. We deduce that if ϕk (x) > 0 then x is in Ĉk and
so |x − xk | < δ which implies that |f (x) − ck | = |f (x) − f (xk )| < ϵ. It follows that for every x ∈ [0, 1]d the
maximum of ck ϕk (x) over all k will be obtained by some k∗ = k∗ (x) for which ϕk (x) > 0, and we have that
On the other hand, since the cubes cover all the domain, there exists some k∗∗ for which x ∈ Ck∗∗ , and thus
and so the function x 7→ maxk (ck ϕk (x)) is an ϵ approximation of f . This function can be realized as a neural
network through the construction
x1 c1 ϕ1 (x1 )
x2 c2 ϕ2 (x2 )
.. 7→ 7→ max{c1 ϕ1 (x1 ), c2 ϕ2 (x2 ), . . . , cn ϕn (xn )}
..
. .
xn cn ϕn (xn )
where n = N d denotes the number of cubes. By Lemma 1.10 the width of each ϕk is 4d and the depth is
⌈log2 (d)⌉, and so overall the width of the function we constructed would be 4nd and the depth would be
√ d
⌈log2 (d)⌉ + ⌈log2 (n)⌉. As in our previous claim, when f is ℓ-Lipschitz we can take n(ϵ) ≤ 2ϵdℓ + 1 and
so we can obtain ϵ approximation with width and depth bounded by
√ !d √ !
dℓ dℓ
W ≤ 4d +1 , L ≤ ⌈log2 (d)⌉ + ⌈d · log2 +1 ⌉
2ϵ 2ϵ
To conclude, we showed that ReLU networks can ‘imitate’ approximation by piecewise constant func-
tions. The original piecewise constant construction, as well as the ReLU imitation, suffer from the curse of
dimensionality. Later on in the course we will see that smoothness of f enables neural networks to ‘overcome’
the curse of dimensionality.
As there name suggests, closed convex polytopes are always closed and convex (verify this). Examples
include
1. The whole space P = Rd (with m = 0 constraints, or with the constraint ⟨0, x⟩ + 1 ≥ 0).
2. The empty set is a polytope defined by the constraint ⟨0, x⟩ − 1 ≥ 0.
22 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
.
5. The plane
P = {(x1 , x2 , x3 )| x3 = 0}
which can be rewritten as in (1.6)
P = {x ∈ R3 | x3 ≥ 0 and − x3 ≥ 0}.
In general, using this same trick we see that closed convex polytopes can be defined by affine equalities
as well as affine inequalities.
Remark 1.13. From now on we will use the term polytope to denote a closed convex polytope.
Problem 1.14. Show that all bounded polytopes in R are points or closed intervals.
Definition 1.15. A polytope covering P of Rd is a finite collection of polytopes P = {P1 , . . . , PR } such
SR
that r=1 Pr = Rd
Problem 1.16. Which of the following is not a polytope covering of R2
1. The collection of polytopes
P1 = {(x, y)|x ≥ 0}, P2 = {(x, y)|x ≤ 0}, P3 = {(x, y)|y ≥ 0}, P4 = {(x, y)|y ≤ 0}
P1 = {(x, y)|x ≥ 0}, P2 = {(x, y)|x ≤ 0}, P3 = {(x, y)|y ≥ 0}, P4 = {(x, y)|y < 0}
P1 = {(x, y)|x ≥ 0}, P2 = {(x, y)|x ≤ 0}, P3 = {(x, y)|y ≥ 0}, P4 = {(x, y)|y ≤ 0}, P5 = {(1, 1)}
P1 = {(x, y)|x ≥ −1}, P2 = {(x, y)|x ≤ 1}, P3 = {(x, y)|y ≥ 0}, P4 = {(x, y)|y ≤ 0}
Let us see some examples for CPwL functions. Perhaps the two most important examples for us are affine
functions, which are CPwL with respect to the trivial partition P = {Rd }, and the ReLU function. The
ReLU function is a linear function on each of the 2d quadrants of Rd . Formally, for every vector s ∈ {−1, 1}d
we can define the polytope
Qs = {x ∈ Rd | si xi ≥ 0, ∀i = 1, . . . , d}
The collection of all such polytopes form a polytope partition, and
1 + s1 0 0 ... 0 x1
0 1 + s2 0 . . . 0 x2
1
ReLU (x) = 0 0 1 + s3 . . . 0 x3 , ∀x ∈ Qs . (1.7)
2 .. .
0 ..
0 0 0 .
0 0 0 0 1 + sd xd
As we saw that affine functions and ReLU functions are both CPwL, we can now deduce that every NNF
is a CPwL function by showing that the composition of CPwL functions are also CPwL.
Proposition 1.20. If f : Rd → Rn and g : Rn → Rm are CPwL functions then g ◦ f is a CPwL functions.
Proof. By assumption f is subordinate to some polytope covering P = {P1 , . . . , PR } and g is subordinate
to some polytope covering Q = {Q1 , . . . , QS }. The restriction of f to each Pr is an affine function fr ,
and the restriction of g to each Qs is an affine function gs . We can now define a new polytope covering
{Tr,s }1≤r≤R,1≤s≤S by
Tr,s = {x ∈ Pr and fr (x) ∈ Qs }
We note that these sets do indeed cover all of Rd , that g ◦ f is continuous and its restriction to Tr,s is the
affine function gs ◦ fr , and finally that each Tr,s is a polytope, for if
and
Qs = {y ∈ Rn |⟨cj , y⟩ + dj ≥ 0, j = 1, . . . , ℓ}
then
Lesson 4
1.4.2 From coverings to partitions
We saw that any ReLU network is a CPwL subordinate to some polytope covering. This covering is not
unique. For example, the function f (x) = |x| is subordinate to the covering P = {(∞, 0], [0, 1], {1/2}, [1/2, ∞)}
but also to the covering P ′ = {(∞, 0], [0, ∞)}. Clearly, the second covering is more natural as it is minimal,
and forms a ‘partition’ of the space. We will now define the notion of a partition:
Definition 1.21. Let P ⊆ Rd . The interior of P , denoted by int(P ), are all points p ∈ P such that there
exists some open ball B with p ∈ B ⊆ P .
For example, the interior of [0, 1] ∈ R is (0, 1). More generally
Problem 1.22. Let P = {x ∈ Rd |⟨ai , x⟩ + bi ≥ 0, i = 1, . . . , m} be a polytope. Show that its interior is the
set
P = {x ∈ Rd |⟨ai , x⟩ + bi > 0, i = 1, . . . , m}
Definition 1.23. Let P = {P1 , . . . , PN } be a finite collection of polytopes in Rd . we say that P is a partition
of Rd if
1. i Pi = Rd .
S
Pi = {x ∈ Rd |⟨ai , x⟩ + bi ≥ 0, i = 1, . . . , m}
and
Pj = {x ∈ Rd |⟨cj , x⟩ + dj ≥ 0, j = 1, . . . , ℓ}.
We will show how to defined a new finite collection of polytopes whose union is exactly Pi ∪ Pj and who do
not intersect.
The intersection Pi ∩ Pj is a polytope
The set Pi \ (Pi ∩ Pj ) is not necessarily a polytope, but it can be written as a finite union of the polytopes
𝑓𝑓 𝑥𝑥, 𝑦𝑦 = 0
𝑓𝑓 𝑥𝑥, 𝑦𝑦 = 0
𝑓𝑓 𝑥𝑥, 𝑦𝑦 = 𝑦𝑦
𝑓𝑓 𝑥𝑥, 𝑦𝑦 = 𝑥𝑥
Figure 1.2: In our definition f has four (convex) linear region, though it has three non-convex linear regions.
We can do the same thing to Pj and write it as a union of polytopes Ptj where t ∈ {−1, 1}m and Pi ∩ Pj
is the polytope corresponding to t = (1, . . . , 1), and such the interior of the Ptj do not intersect. Finally we
consider this new collection of polytopes of all Ptj and Psi and we find that their interiors do not intersect.
Thus, we have showed how we can reduce the number of intersections between polytopes by one, and by
repeating this process recursively we can transform a covering into a partition.
Definition 1.25. The number of linear regions of a CPwL function f is the smallest m such that f is
subordinate to a partition P = {P1 , . . . , Pm }.
Example 1.26. The function f (x) = |x| is subordinate to the partition P = {(∞, 0], [0, 1], [1, ∞)} but also
to the smaller partition P ′ = {(∞, 0], [0, ∞)} and therefore the number of linear regions is ≤ 2. Clearly the
number of linear regions cannot be 1 since f is not linear, and so the number of linear regions is two.
Example 1.27. The function in Figure 1.2 has four linear regions, though if we would have allowed non-
polytope partitions the number of regions would have been reduced to three.
Free knot splines For fixed n, let Σn be the set of CPwL functions determined by 2n + 2 parameters: n
knots 0 < k1 < . . . < kn < 1, n assigned values yi to each of the knots, and values y0 and yn+1 assigned to 0
and 1. These values then uniquely define a CPwL function on [0, 1] which attains these values and is affine
in the intervals defined by the knots. We refer to this function spaces as the space of free knot splines with
n knots. Note that a function in Σn can have a breakpoint (a non-differentiable point) only at a knot, but
a knot does not necessarily have to be a breakpoint. In fact Σn is exactly the set of all CPwL functions on
[0, 1] with n or less breakpoints, and in particular Σn ⊆ Σn+1 .
Counting parameters in Υ(W, L) We will compare function spaces Σn and Υ(W, L) in terms of the
number of their parameters on the one hand, and their expressive power on the other hand. Recall that Σn
is defined by 2n + 2 parameters. Let’s now count the number of parameters in Υ(W, L):
For fixed W, L the number of parameters which determine functions in Υ(W, L) is
n(W, L) = 2W + (L − 1)(W 2 + W ) + W + 1
= 3W + 1 + (L − 1)(W 2 + W )
ΣW −1 ⊆ Υ(W, L = 1) ⊆ ΣW
Recall that n(W, L = 1) = 3W + 1 while functions in Σn are determined by 2n parameters. Thus this
theorem says that the number of parameters needed to express a CPwL functions via shallow neural networks
or via free knot splines is roughly the same.
Proof. Let us first show that Υ(W, L = 1) ⊆ ΣW . Recall that a function f in Υ(W, L = 1) is of the form
f (x) = h2 ◦ ReLU ◦ h1
so
W
X
f (x) = d + cj ρ(aj x − bj ) (1.8)
j=1
the breakpoints of f are exactly the points xj which solve the equation aj x − bj and so there are at most W
such solutions in (0, 1). Thus f ∈ ΣW .
1.4. RELU NETWORKS, CPWL FUNCTIONS AND DEPTH SEPARATION 27
In the other direction: Let g ∈ ΣW −1 . The function g has W − 1 knots 0 < k1 < k2 < . . . < kW −1 < 1.
There exist some c, d ∈ R such that g(x) = cx + d for all x ≤ k1 . We claim that there exist c1 , . . . , cW −1
such that
WX−1
g(x) = cρ(x) + d + ci ρ(x − ki )
i=1
and thus g is in Υ(W, 1). Thus, we need to show that we can select c1 , . . . , cW −1 such that
W
X −1
g̃(x) := g(x) − cρ(x) − d = ci ρ(x − ki ), ∀x ∈ [0, 1]
i=1
Note that for all selection of the ci , the functions g̃ and the function on the right hand side both have
knots at k1 , . . . , kW −1 , and are zero on [0, k1 ]. At this point we essentially repeat the argument we used in
Lemma 1.9: it is sufficient to show that for an appropriate choice of the ci , the two functions are equal on
the points k2 < k3 < . . . < kW −1 < 1. This gives us W − 1 linear equations in the ci :
k2 − k1 c1 g̃(k2 )
k3 − k1 k3 − k2 c2 g̃(k3 )
k4 − k1 k4 − k2 k4 − k3 c3 g̃(k4 )
=
.. .. . . .. ..
. . . . .
1 − k1 1 − k2 1 − k3 · · · 1 − kW −1 cW −1 g̃(1)
This equation has a unique solution since it is a lower diagonal matrix and all diagonal elements are non-
zero.
Problem 1.29. Give an example of a univariate CPwL function with W breakpoints that is not in Υ(W, 1).
NNF with exponentially many knots Interestingly, for deep networks, it is possible to express some
functions with n ≫ n(W, L) breakpoints as we will now see. The following question is in the homework:
Problem 1.31. Consider the function
2x if 0 ≤ x ≤ 1/2
H(x) = .
2 − 2x if 1/2 ≤ x ≤ 1
28 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
1. Show that H ∈ Υ(2, 1) and that the function H ◦s (the composition of H with itself s times) is in
Υ(2, L = s).
1 2
k0 = 0, k1 = s
, k2 = s . . . , k2s = 1.
2 2
Show that H ◦s (x) is the unique CPwL function which is affine on each interval [kj−1 , kj ], j = 1, . . . , 2s
and satisfies
◦s 0 if j is even
H (kj ) =
1 if j is odd
We call the function H the ‘hat function’. The composition of H with itself s times is called the sawtooth
function(s), or sometimes Telgarsky’s function. These are illustrated in figure 1.3. The function H ◦s are
in Υ(2, s), so the number of parameters needed to express it grows linearly in s. However it has 2s − 1
breakpoints!!!
Here is a helpful way to see how many breakpoints H has easily:
Problem 1.32. say f : [0, 1] → R is CPwL and is affine in the intervals [kj−1 , kj ] defined by the points
0 < k1 < k2 < . . . < kn < 1. Show that f ◦ H is affine in the intervals defined by the points
k1 kn 1 kn k1
0< < ... < < <1− < ... < 1 − < 1.
2 2 2 2 2
Using this argument we can compute the knots of H ◦s . The calculation of H ◦s is then reduced to finding
the value of H ◦s at these knots.
Bounding the number of breakpoints We saw that deep networks can have exponentially many break-
points. The following gives an upper bound to the number of breakpoints
Note that this bound is not completely optimal. For example in [Raghu et al., 2017] it is shown that
every f ∈ Υ(W, L) has no more than W L breakpoints. Recall that H ◦s is in Υ(W = 2, L = s) and has
2s − 1 = W L − 1 breakpoints, so this bound is very close to optimal.
g = ρ ◦ hL ◦ ρ ◦ . . . ◦ ρ ◦ h1 (1.9)
the breakpoints of this function are the solutions of the equations ai x + bi = 0, and so m(1) ≤ W < W + 1.
1.4. RELU NETWORKS, CPWL FUNCTIONS AND DEPTH SEPARATION 29
Now let us assume that we know for some given L that m(L) < (W + 1)L . Let g be some function in
Υ̃(W, L + 1) so g = ρ ◦ hL+1 ◦ gL where gL is in Υ̃(W, L). We get
ρ(⟨a1 , gL (x)⟩ + b1 )
ρ(⟨a2 , gL (x)⟩ + b2 )
g(x) =
..
.
ρ(⟨aW , gL (x)⟩ + bW )
A function the the form ρ(⟨ai , gL (x)⟩ + bi ) could have a breakpoint in every one of the original breakpoints
of gL . It could also have a ‘new’ breakpoint between every pair of consecutive breakpoints (if gL (ki ) > 0 and
gL (ki+1 ) < 0 or vice versa), or between 0 and the first breakpoint, or between 1 and the last breakpoint.
All in all each one of the ρ(ai gL (x) + bi ) can have up to m(L) + 1 new breakpoints, and so altogether these
functions could have up to W (m(L) + 1) new breakpoints, as well as the original m(L) breakpoints of gL .
Altogether we will have no more than W (m(L) + 1) + m(L) breakpoints. Since m(L) is an integer which is
strictly smaller than (W + 1)L we have that
Summary To summarize our discussion of univariate ReLU networks: we saw that shallow neural networks
are more or less the same as free knot linear splines (Proposition 1.28). Deep networks can also express all
free knot splines with n(W, L) parameter (Theorem 1.30), however, they can also express some functions,
such as ‘sawtooth functions’, with a number of breakpoints which is exponential in L (but not all such
functions, see proof in [Dym et al., 2020] ). In general, univariate networks with width W and depth L will
have less that (W + 1)L breakpoints.
The attractiveness of the latter results as that they point to an expressive advantage of deep neural
networks over a ‘standard function base’-free knot linear splines. It also points to an advantage over shallow
neural networks- a network with depth one, or with fixed depth, would need its width to grow exponentially
with s to express the function H ◦s , rather than the linear growth we have observed. This type of results are
sometimes called ‘depth separation’ results. There are many similar arguments in various papers, see e.g.,
[Telgarsky, 2016, Eldan and Shamir, 2016].
Possible criticisms of these arguments are that the functions for which deep neural networks have an
advantage over shallow ones don’t necessarily seem to be the functions we are interested in learning. Another
argument which has been made is that highly oscillating functions such as the sawtooth function are difficult
to learn using gradient descent (see e.g., [Malach and Shalev-Shwartz, 2019, Hanin and Rolnick, 2019]). One
could also wonder to what extent the univariate case discussed here is representative of the multivariate case.
We will discuss this next.
30 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
Example 1.34. Recall that the function x 7→ ReLU (x) which is in FC(W = d, L = 1, nin = d, nout = d),
has 2d linear regions.
The ReLU function is a linear function on each of the 2d quadrants of Rd . Formally, for every vector
s ∈ {−1, 1}d we can define the polytope
Qs = {x ∈ Rd | si xi ≥ 0, ∀i = 1, . . . , d}
In the homework we saw that, if the restriction of a CPwL function f to each partition element is
a different affine function, then there is no smaller polytope partition which f is subordinate to. In our
context, since the restriction to each of the 2d polytopes Qs is a different affine function, the number of
linear regions of ReLU is exactly 2d .
The number of linear regions of shallow univariate networks is strongly related to the hyperplane ar-
rangement problem. Let us describe this problem:
H = {x ∈ Rd |⟨a, x⟩ − b = 0}
We’d like to ask the following question: how many connected components does U have? Note that U is a
union of a finite number of convex open sets Us with empty intersection: For every s ∈ {−1, 1}m define
all in all there are 2m possible choices of s, but some of the sets Us may be empty. The number of linear
regions is the number of Us which are not empty.
Example When d = 1, consider the hyperplanes Hi = {x ∈ R|x = i} for i = 1, 2, 3, 4. The set U has 5
connected components. In general we see that given m hyperplanes in R, the complement will have m + 1
connected component, unless some of the hyperplanes are equal in which case we will have less hyperplanes.
Problem 1.35. How many connected components does the complement of a hyper-plane arrangement with
m hyperplanes in Rd have when
1.4. RELU NETWORKS, CPWL FUNCTIONS AND DEPTH SEPARATION 31
1. d = 2 and m = 2.
2. d = 2 and m = 3.
Answer Could always be as little as two if all hyperplanes are taken to be the same. When d = 2, m = 2
the maximal number is four, while when m = 3 the maximal number is seven, as we shall soon see.
In general, the number of connected components in a hyperplane arrangement are given by the following
theorem (which we will not prove):
Theorem 1.36 ([Zaslavsky, 1975]). A hyperplane arrangement with m hyperplanes in Rd has at most
d
X m
ν(d, m) := (1.11)
j=0
j
linear regions. Additionally, there are m hyperplanes in Rd with exactly ν(d, m) linear regions (in fact, this
happens for Lebesgue almost every (ai , bi ), i = 1, . . . , m. )
Remark 1.37. When d > m, the summation in (1.11) includes expressions m
j with j > m. This number
is zero by definition.
Let us consider some examples: when d = 1 we saw previously that m hyperplanes will have
m m
ν(1, m) = + =m+1
0 1
connected components, unless some hyperplanes are identical in which case there will be less connected
components. When d = 2 and m = 3, the maximal number of connected components will be
m m m
ν(2, m = 3) = + + = 1 + 3 + 3 = 7,
0 1 2
while when m = 2, d = 2 there will be only four. Finally, when m = d, there can be at most
d d
X m X d
ν(d, m = d) = = = 2d
j=0
j j=0
j
connected components. For example, the d hyperplanes {x ∈ Rd |xi = 0} divide Rd into 2d connected
components.
The relationship between the number of linear regions in a hyperplane arrangement and the number of
linear regions of a shallow ReLU network are given by the following proposition:
Proposition 1.38. If f ∈ FC(W, L = 1, nin = d, nout ), then f has at most
d
X W
ν(d, W ) =
j=0
j
linear regions.
Note that the number of linear regions does not depend on nout at all.
Proof. We can write f = h2 ◦ ρ ◦ h1 . Denoting h1 (x) = Ax + b, and denoting the rows of A by a1 , . . . , aW ,
we have that
⟨a1 , x⟩ + b1
h2 ◦ ρ(Ax + b) = h2 ◦ ρ
..
.
⟨aW , x⟩ + bW
Denoting d = nin , we can define a polytope covering of R , indexed by s ∈ {−1, 1}W by
d
Ps = {x ∈ Rd |si (⟨ai , x⟩ + bi ) ≥ 0, i = 1, . . . , W }
32 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
and the restriction of f to each Ps is a linear function. We can remove from the partition {Ps }s∈{−1,1}W all
polytopes Ps whose interior is empty, and still remain with a partition. The number of linear regions in this
partition is exactly the number of connected components of Rd \ ∪i {x ∈ Rd | ⟨ai , x⟩ + bi = 0}. The result
then follows from Theorem 1.36.
We’ve seen that for shallow networks, the number of linear regions can grow exponentially with the
input dimension. However, it is still true that you can get much more linear regions with deep networks.
For example, while Proposition 1.38 implies that f ∈ FC(W, L, nin , nout ) will have no more than W nin + 1
linear regions when L = 1 (you will verify this for homework), when we allow L > 1 there exist f ∈
h i(L−1)nin
FC(W, L, nin , nout ) with ∼ nWin W nin linear regions (see [Montufar et al., 2014] for more details).
1.5. APPROXIMATING POLYNOMIALS AND SMOOTH FUNCTIONS 33
1 1 0.07
0.9 0.9
0.06
0.8 0.8
0.6 0.6
0.04
0.5 0.5
0.03
0.4 0.4
0.2 0.2
0.01
0.1 0.1
0 0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Figure 1.4: (a) Swift convergence of the approximations fm (x) of x2 (b) the functions f1 and f2 and (c) the function
f1 − f2 is a scaling of the sawtooth function H ◦ H.
1.5.1 Approximating x2
Let us consider the problem of approximating x2 with a ReLU network. In Theorem 1.11 we showed that
we can approximate a function f : [0, 1]d → R which is ℓ-Lipschitz to ϵ accuracy (uniformly on [0, 1]d ) by a
function in FC(W, L, d, 1) where
√ !d √ !
dℓ dℓ
W ≤ 4d + 1 , L ≤ ⌈log2 (d)⌉ + ⌈d · log2 ( + 1 )⌉
2ϵ 2ϵ
In particular, if we want to approximate x2 on [0, 1], we note that x2 is Lipschitz with Lipschitz constant
ℓ = 2, and we can obtain an ϵ approximation with ∼ 1/ϵ width and ∼ log(1/ϵ) depth. We now will see that
we can do much better than this. As a first step, let us consider approximations with shallow networks, or
equivalently, with functions in ΣN .
Proposition 1.39. Let gN be the unique CPwL function which satisfies gN (k/N ) = (k/N )2 for all k =
0, . . . , N , and is affine on the intervals [ k−1 k
N , N ], k = 1, . . . N . Then
2
2 1
max |x − gN (x)| ≤
x∈[0,1] 2N
Proof. We will use the following lemma
Lemma 1.40. Let g(x) = g(x|a, b) be the linear interpolation of x2 at a, b, that is
1
(b − x)a2 + (x − a)b2
g(x) =
b−a
then 2 2
a+b a+b b−a
max |g(x) − x2 | = g − =
x∈[a,b] 2 2 2
34 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
Proof of the Lemma. The continuous function q(x) = g(x) − x2 = g(x) − x2 is maximized and minimize at
a or b or at a point x ∈ (a, b) with q ′ (x) = 0. We have that q(a) = 0 = q(b). Solving the equation
b2 − a 2
0 = q ′ (x) = − 2x
b−a
a+b
we obtain that the derivative is zero at the midpoint 2 . At this point we have
2
a2 + b2
a+b a+b 1 1
q = − = 2a2 + 2b2 − a2 − b2 − 2ab = (b − a)2
2 2 2 4 4
So the minimum of q is obtained at a and b, and the minimal value of q is zero, while the maximum is
obtained at the center and the maximal values is 41 (b − a)2 . This concludes the proof of the lemma.
This is a great approximation rate but of course the function fm have 2m knots and so expensive to compute
using free knot splines or shallow networks. However, this can be done much more efficiently with deep
networks, using the sawtooth function we studied earlier:
Lemma 1.41. Let fm denote the Piecewise linear interpolation of x2 at the points k2−m , k = 0, . . . , 2m as
defined above, and let H denote the sawtooth function, then
H ◦m (x)
fm−1 (x) − fm (x) = , ∀x ∈ [0, 1]
22m
Proof. Let us consider the difference fm−1 (x) − fm (x). This function has knots at the points 2km . The knots
2
where k is even are also knots of fm−1 and therefore at these knots fm−1 ( 2km ) = 2km = fm ( 2km ), and the
difference between the functions is zero at these points. When k is odd, we can repeat the computation we
did in Lemma 1.40: Let us denote a = k−1 k+1 k 1
2m and b = 2m , then 2m = 2 (a + b) and
2
k k 1 2 1 1 1
fm−1 − fm = (a + b2 ) − (a + b) = (b − a)2 = 2m
2m 2m 2 2 4 2
1.5. APPROXIMATING POLYNOMIALS AND SMOOTH FUNCTIONS 35
H ◦m (x)
fm−1 (x) − fm (x) = . (1.12)
22m
An illustration of this result is shown in Figure 1.4.
Applying (1.12) recursively, we obtain (note that f0 (x) = x)
m
X H ◦s (x)
fm (x) = f0 (x) + (f1 (x) − f0 (x)) + . . . + (fm (x) − fm−1 (x)) = x −
s=1
22s
Remark Recall that a network with width W and depth L has ∼ W 2 L parameters, so the total number
of parameters is linear in log(1/ϵ).
1
Proof. We saw that fm (x) approximate x2 with an error rate of 22m+2 , and we can reorder (1.12) to obtain
H ◦s
fs = fs−1 − 22s , and so we can recursively define
which shows that fm can be constructed with a neural network with fixed width W0 and depth mL0 . To
obtain ϵ accuracy we need to have
2−2m−2 < ϵ
or equivalently
1
m > 1/2 log2 −1
ϵ
so we can choose m = 1/2 log2 (1/ϵ) to get width and depth as required by the theorem.
36 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
New Lesson
1.5.2 Approximating multiplication
An important consequence of the previous result is that the product function (x, y) 7→ xy can also be
approximated by neural networks with exponential accuracy: in general, this can be done by noting
1
(x + y)2 − x2 − y 2
xy =
2
and then using our approximation of the squaring function. Recall that our approximation of x2 was obtained
on [0, 1]. We will want to obtain approximation for xy on [−M, M ]2 . To do this note that we can rewrite
the previous equation as
2 2 2 !
M2
|x + y| |x| |y|
xy = − − . (1.13)
8 2M 2M 2M
The advantage of this is that we are now applying the squaring function to inputs in the interval [0, 1].
Proposition 1.43. There exists (W1 , L1 ) ∈ N2 , such that for all M > 0 and ϵ > 0, there is an NNF
N N× : R2 → R satisfying
1. for all x, y with |x|, |y| < M we have |N N× (x, y) − xy| < ϵ.
2. if x = 0 or y = 0 then N N× (x, y) = 0.
Proof. Choose some ϵ > 0 and M > 0. Recall that there exists (W0 , L0 ) ∈ N2 such that for all ϵ̃ > 0 there
exists s ∈ FC(W0 , L0 log(1/ϵ̃), 1, 1) such that |s(x) − x2 | < ϵ̃ for all x ∈ [0, 1]. Now set
8ϵ
ϵ̃ = .
3M 2
and let s be the function in FC(W0 , L0 log(1/ϵ̃), 1, 1) such that |s(x) − x2 | < ϵ̃. We replace the squares in
(1.13) with s to obtain the function
M2
|x + y| |x| |y|
N N× (x, y) := s −s −s
8 2M 2M 2M
We can verify directly that this function satisfied (1) due to (1.13), satisfies (2) since s(0) = 0, and satisfies
(3) as N N× is in FC(W1 , L1 (1 + log(1/ϵ) + log(M )), 2, 1) and
We can think of this result as follows: up to now we knew that if f, g were NNFs then we can take linear
combinations of them and get another NNF. We can also concatenate or take compositions and get an NNF.
This result means that the same is almost true for the product f · g. While we cannot exactly express f · g
as an NNF, we can approximate it extremely well.
We now prove a similar lemma for the multi-dimensional product function
Proposition 1.44. For every s ∈ N there exist W2 = W2 (s), L2 = L2 (s) such that for every 1 > ϵ > 0,
there exists a function m ∈ FC(W2 , L2 (1 + log(1/ϵ)), din = s, 1) with
Proof. For given ϵ > 0, let N N× be the function promised by Proposition 1.13 with respect to the parameters
ϵ̃ = ϵ/(s − 1) and M = 2. Define recursively the functions
m1 (x) = x1 , m2 (x) = N N× (m1 (x), x2 ), p3 (x) = N N× (m2 (x), x3 ) ..., ms (x) = N N× (ms−1 (x), xs ).
We can think of each mk as an approximation of the product of the first k entries of x and m := ms is the
final approximation we need. Note that we can apply Proposition 1.43 recursively to see that:
Since for all x ∈ [0, 1]s we have that |m2 (x) − x2 · m1 (x)| < ϵ̃ and both x2 and m1 (x) = x1 are in [0, 1],
we deduce that |m2 (x)| < 1 + ϵ̃ < 1 + 1/(s − 1) < 2.
Since |m2 (x)| < 2 we know that for all x ∈ [0, 1]s we have |m3 (x) − x3 (x)m2 (x)| < ϵ̃, and therefore
|m3 (x)| < 1 + 2/(s − 1) < 2
continuing recursively with this process we see that for all j = 1, . . . , s − 1,
Using this we can see that the error of the approximation m = ms is bounded for all x ∈ [0, 1]s by
|x1 · . . . · xs − ms (x) ≤ |ms (x) − xs ms−1 (x)| + |xs ms−1 (x) − xs xs−1 ms−2 (x)| + . . .
+ |xs xs−1 . . . x3 m2 (x) − xs xs−1 . . . x2 m1 (x)|
s−1
X
≤ |mi+1 (x) − xi+1 mi (x)|
i=1
≤ (s − 1)ϵ̃ = ϵ
The width of this construction does not depend on ϵ and the depth is proportional to s log(1/ϵ̃) = s log(s −
1) + s log(1/ϵ).
Theorem 1.45. Let n ∈ N. There exist W = W (n), L = L(n) such that for every ϵ ∈ (0, 1) and every
f ∈ Fn , there exists f˜ ∈ FC(W, L(1 + (1/ϵ)1/n log(1/ϵ)), din = 1, dout = 1) with
Remark 1.46. Note that this result can be used, in a sense, for any n times continuously differentiable f :
since the derivatives are continuous they are bounded on a bounded interval, and so there will be some M
for which
|f (k) (x)| ≤ M, ∀k = 0, . . . , n and x ∈ [0, 1].
We then have that M 1
f is in Fn . If we use the theorem to obtain a neural network f˜ which approximates
1 ϵ ˜
M f to within an error of M , then M f will approximate f to within an error of ϵ.
38 CHAPTER 1. FULLY CONNECTED NEURAL NETWORKS
The idea of this proof is as following: we first consider approximation of f by a function space of ‘piecewise
polynomials’, and then use what we showed so far to efficiently approximate these piecewise polynomials.
Let us first define our piecewise polynomials. Assume that for some given N , we are given an N -partition
of unity: this term we will use to mean a collection of functions ϕ0 , . . . , ϕN : [0, 1] → R which are non-negative
and satisfy
XN
ϕj (x) = 1, ∀x ∈ [0, 1] and ϕj (x) = 0 if |x − j/N | < 1/N
j=0
One example of such a partition which is useful for us are the CPwL functions ϕj defined by the require-
ment that they are linear on the intervals [k/N, (k + 1)/N ] for all k = 0, . . . , N − 1, and satisfy
1 if k = j
ϕj (k/N ) =
0 ̸ j
if k =
PN
clearly these functions are non-negative, are zero where they should be, and since j=0 ϕj (x) = 1 for
x = 0, 1/N/2/N, . . . , 1, and is affine between these points, we see that this equality holds for all x ∈ [0, 1].
Proposition 1.47. For any n ∈ N, there exists some C = C(n) such that for every ϵ > 0 and every f ∈ Fn
there exists N ≤ 1 + C(n)ϵ−1/n polynomials p0 , p1 , . . . , pN of degree ≤ n such that
N
X
|f (x) − ϕj (x)pj (x)| < ϵ, ∀x ∈ [0, 1]
j=0
Proof. Assume we are given n, given f ∈ Fn and given ϵ > 0. Assume we pick some N . For given
j = 0, . . . , N , we define pj to be the Taylor expansion of order n − 1 of f around j/N . Then we know that
for all x ∈ [0, 1] with |x − j/N | ≤ 1/N , there exists some c ∈ [0, 1] such that
1 1
|f (x) − pj (x)| ≤ (x − j/N )n f (n) (c) ≤ (1/N )n
n! n!
We want the expression on the right hand side to be smaller than ϵ, which equivalently means
1/n
1
N≥ .
ϵn!
N
X N
X
|f (x) − ϕj (x)pj (x)| = | ϕj (x)(f (x) − pj (x))|
j=0 j=0
N
X
≤ ϕj (x)|f (x) − pj (x)| ≤ ϵ
j=0
We see that functions in Fn can be approximated to ϵ accuracy with N ∼ (1/ϵ)1/n polynomials of degree
≤ n − 1. All in all this function space is spanned by nN ∼ C(n)(1/ϵ)1/n parameters.
We now turn to prove Theorem 1.45, where we see that we can do almost as well with neural networks.
The idea behind this claim is as follows: the construction we just saw is based on products of functions we can
easily build with neural networks: they are a product of hat functions with polynomials, which themselves
are linear combinations of products of linear functions. Since we known how to swiftly approximate products,
we can successfully ‘imitate’ the approximation we just saw with neural networks.
1.5. APPROXIMATING POLYNOMIALS AND SMOOTH FUNCTIONS 39
Proof of Theorem 1.45. For given ϵ > 0, let N < C21/n (1/ϵ)1/n be such that the piecewise polynomials
PN
P (x) := j=0 ϕj (x)pj (x) defined in Proposition 1.47 are an ϵ/2 approximation of f . We can rewrite P as
N n−1
X X
P (x) = aj,k ϕj (x)(x − j/N )k
j=0 k=0
| {z }
Pj,k (x)
and note that since we took pj to be the Taylor expansion of f at j/N and the derivatives of f are bounded
by 1, we have that |aj,k | ≤ 1. We will show that we can approximate each Pj,k with a neural network
hj,k up to accuracy of ϵ̃ = 2n(Nϵ +1) . For fixed j, k, we know from Proposition 1.44 that there is some
mk+1 ∈ FC(W2 , L2 (1+log(1/ϵ̃)+log(k+1)), din = k+1, 1) which can approximate the function x1 x2 . . . xk+1
to accuracy of ϵ̃. We thus have that
j j j
|Pj,k (x) − mk+1 ϕj (x), x − , x − , . . . , x − | ≤ ϵ̃
N N N
| {z }
hj,k
which is a neural network with width independent of ϵ̃ and depth logarithmic in 1/ϵ̃ and hence in 1/ϵ. We
PN Pn−1
can the approximate f by h = j=0 k=0 aj,k hj,k (x) with error
N n−1
X X
|f (x) − h(x)| ≤ |f (x) − P (x)| + |P (x) − h(x)| ≤ ϵ/2 + |aj,k ||Pj,k (x) − hj,k (x)|
j=0 k=0
N n−1
X X
≤ ϵ/2 + ϵ̃ = ϵ.
j=0 k=0
The network h is a sum of (N + 1)n ∼ (1/ϵ)1/n networks hj,k with fixed width W and depth proportional to
log(1/ϵ). In the homework you will show that this addition can be done with fixed width and depth which
grows like (N + 1)n. This concludes the claim.
d
dimensional cube [0, 1]d with s derivatives can be obtained with ∼ (1/ϵ) 2s (up to logarithmic factors). We
stress that unlike the previous results where neural networks achieved slightly worse rates than piecewise
polynomials, these rates are actually better than what piecewise polynomials and other standard function
bases can do...
Chapter 2
2.0.1 Preliminaries
Definition 2.1 (Group). A pair (G, ·), where G is a set and · : G × G → G is called a group if
1. Associativity For all a, b, c ∈ G,
(a · b) · c = a · (b · c)
.
a · e = a = e · a, ∀a ∈ G.
3. Inverse element For every a ∈ G there exists some element b ∈ G such that
a · b = e = b · a.
We denote b by a−1 .
Examples: The pair (Rn×n , +) is a group whose identity element is the zero matrix. The pair (Rn×n , ·)
is not a group (where · denotes matrix multiplication). The pair (GL(n)), ·) is a group whose identity element
is the identity matrix In , where
GL(n) = {A ∈ Rn×n | det(A) ̸= 0}
A subgroup of (G, ·) is a group (H·) with the same operation ·, and where H is a subset of G. Subgroups of
GL(n) include
The set of bijections from [n] := {1, . . . , n} to [n] is denoted by Sn . The bijections are called permutations.
They are a group with respect to composition.
41
42 CHAPTER 2. INVARIANT LEARNING AND APPROXIMATION THEORY
New Lesson
Remark 2.2. In the following we will use the convention that a vector v ∈ Rn is actually a degenerate matrix
v ∈ Rn×1 (a ‘column vector’). This allows expressing all vector operations in terms of matrix multiplication.
For example the inner product of two vectors v, u ∈ Rn is given by
⟨v, u⟩ = v T u.
[σ.x]i = xσ(i) , σ ∈ Sn , x ∈ Rn , i = 1, . . . , n.
However as it turns out this is not a group action in our definition because
Note that
[σ.(τ.x)]i = [τ.x]σ−1] (i) = xτ −1 ◦σ−1 (i) = x(σ◦τ )−1 (i) = [(σ ◦ τ ).x]i
Example Similarly, we can define an action of Sn on Rd×n by
Definition 2.5. Let G be a group acting on a set S. The orbit of s ∈ S is denoted by [s] and is defined as
the set of all element in S related to s by a group transformation, that is
We denote s ∼ s′ if [s] = [s′ ]. One can verify that this is an equivalence relation. The collection of all orbits
is denoted by S/G.
43
Example 2.6. The group G = {−1, 1} acts on R by multiplication. We have that [x] = [y] if and only if
|x| = |y|, so we can identify R/G with [0, ∞).
Example 2.7. The group of permutations G = Sn acts on Rd×n as described above. We have that
X = (x1 , . . . , xn ) ∼ Y = (y1 , . . . , yn )
if and only if
(x1 , . . . , xn ) = (yσ(1) , . . . , yσ(n) ). (2.1)
This means that we have equality as sets:
The converse is not completely true. For example, in the case d = 1 if we choose
x1 = 1, x2 = 1, x3 = 2 and y1 = 1, y2 = 2, y3 = 2
Then we will have equality in (2.2) but not in (2.1). This can be remedied by introducing the concept
of ‘multisets’, where order does not matter (like with sets) but repetitions are allowed (unlike sets). For
multisets (denoted by double curly brackets) we will have that
and in general we will have that (2.1) if and only if we have the corresponding multiset equality
Definition 2.8. Let G be a group acting on a real vector space V . We say that the action σ : G × V → V
is linear if for all g ∈ G the map V ∋ v 7→ g.v ∈ V is linear
Example 2.9. The group Rd acts on Rd×n via
The group O(d) acts on Rd×n via matrix multiplication R. X = RX. Clearly this action is linear.
Example 2.10 (Multisets). The action of Sn on Rn is linear: for every σ ∈ Sn and x, y ∈ Rn and λ ∈ R we
have
(σ. (λx))j = (λx)σ−1 (j) = λ(x)σ−1 (j) = λ(σ. (x))j
and
(σ. (x + y))j = (x + y)σ−1 (j) = xσ−1 (j) + yσ−1 (j) = (σ. x)j + (σ. y)j
Matrix notation Since the action of σ ∈ Sn on vectors in Rn is linear, there is some matrix Pσ ∈ Rn×n
satisfying
σ(x) = Pσ x, ∀x ∈ Rn .
We can find P = Pσ explicitly by noting that for all i and j
1 if j = σ −1 (i)
1 if σ(j) = i
Pij = [P ej ]i = (σ(ej ))i = (ej )σ (i) =
−1 =
̸ σ −1 (i)
0 if j = 0 ̸ i
if σ(j) =
P 1n = 1n and 1Tn P = 1Tn . We also see that the columns of P form an orthonormal basis, and therefore P is
a unitary matrix.
Since the action of permutations is a well-defined group action we deduce that Pτ ◦σ = Pτ Pσ because
X1∗ PσT
σ. (X1∗ )
σ. (X2∗ ) X2∗ PσT
σ. (X) = = .. = XPσT
..
. .
σ. (Xd∗ ) Xd∗ PσT
Definition 2.11 (Invariant). Let (G, ·) be a group, let S, T be sets, and ρ : G × S → S a group action . We
say that f : S → T is invariant if
f (ρ(g, s)) = f (s), ∀g ∈ G, s ∈ S
Example: P The function ∥x∥ is invariant with respect to the action of both O(n) and Sn on Rn . The
functions x 7→ i xi is Sn invariant but not O(n) invariant.
Problem 2.12. Is there a function f : Rd×n → R which is SO(d) invariant but not O(d) invariant? Is there
a function which is O(d) invariant and not SO(d) invariant?
Definition 2.13 (Intertwining). Let (G, ·) be a group, let S be a set, and ρ : G × S → S a group action .
We say that f : S → S is intertwining if
The following proposition is very useful for the construction of equivariant neural networks, since it means
that we can construct equivariant networks by compositions of equivariant functions.
Proposition 2.15. Let (G, ·) be a group acting on S1 , S2 , S3 through group actions ρ1 , ρ2 , ρ3 respectively. If
f1 : S1 → S2 and f2 : S2 → S3 are equivariant then f2 ◦ f1 is equivariant.
hL+1 ◦ ρ . . . h2 ◦ ρ ◦ h1 (2.3)
where ρ could be ReLU or any other elementwise activation function, and the hi are affine functions. The
point net architecture has the same structure, where
hi : Rci−1 ×n → Rci ×n
where A = Ai is a matrix in Rci ×ci−1 and b ∈ Rci . Clearly each hi are equivariant with respect to the action
of the permutation group: if P is a permutation matrix then using the fact that P T is also a permutation
matrix and that 1Tn P = 1Tn for every permutation matrix, we obtain
The activation function ρ could be any function ρ : R → R which is extended to a mapping ρ : Rci ×n →
ci ×n
R by elementwise application (ρ(X))ij = ρ(Xij ). This map is clearly equivariant=intertwining because
for every permutation τ we have that
(τ ◦ ρ(X))ij = ρ(X)iτ −1 (j) = ρ(Xiτ −1 (j) ) and (ρ ◦ τ (X))ij = ρ(τ X)ij = ρ(Xiτ −1 (j) )
Thus by Proposition 2.15 functions obtained by composition of these pointwise applied functions as in
(2.3) are permutation equivariant functions from Rc0 ×n to RcL+1 ×n .
To obtain a permutation invariant function PointNet uses the permutation invariant ‘max pooling’: a
permutation invariant function on Rd×n (in our case d = cL+1 ) is given by applying the maximum function
row-wise (we call this function maxrow )
X11 X12 . . . X1n max[X11 , X12 , . . . , X1n ]
X21 X22 . . . X2n max[X21 , X22 , . . . , X2n ]
maxrow . = .
.. ..
.. . .
Xd1 Xd2 ... Xdn max[Xd1 , Xd2 , . . . , Xdn ]
A popular permutation invariant alternative is ‘sum pooling’ where the maximum over each row is replaced
by summation over each row. After pooling was applied and an invariant function was achieved, the function
is composed with a standard fully connected network. To summarize, the PointNet architecture includes
functions of the form
Hpointnet = {f (maxrow (h(x1 ), h(x2 ), . . . , h(xn )))|h : Rd → Rm , and f : Rm → Rnout are neural networks}
(2.4)
Specifying the hyper-parameters d, n, m, nout determines a function space Hpointnet . In implementation we
take f and h to be neural networks with prescribed width and depth.
46 CHAPTER 2. INVARIANT LEARNING AND APPROXIMATION THEORY
Deep sets and characterization of linear equivariant functions In Deep Sets [Zaheer et al., 2017]
the authors suggested that, since we are looking for expressions of the form (??), where the hi are linear
(actually affine) equivariant functions, we might as well look for all possible linear equivariant functions.
We now turn to characterize all linear permutation equivariant functions, first from Rn → Rn and then
′
eventually from Rc×n to Rc ×n .
Problem 2.16. Find linear mappings L : Rn → Rn which are intertwining with respect to the action of Sn .
L = {A ∈ Rn×n | APσ = Pσ A ∀σ ∈ Sn }
is a linear subspace of Rn×n . It follows that linear combinations of In and S = 1n×n are intertwining. We
will now see that these are the only linear intertwining maps.
Proposition 2.17. L : Rn → Rn is a linear mapping which is intertwining with respect to the action of Sn ,
if and only if it is of the form
L = αIn + β1n×n
Proof. In our previous discussion we saw that any linear combination of In and 1n×n is intertwining. We
now prove the reverse:
Assume L is linear and intertwining, we need to show that Lii = L11 and Lij = L12 for all 1 ≤ i ≤ n, 1 ≤
j ≤ n with i ̸= j.
For given j, let σ be the transposition of j and 1 (the permutation that swaps between j and 1 and fixes
all other indices) and let P = Pσ . So P ej = e1 and P e1 = ej . Then
Ljj = ⟨ej , Lej ⟩ = ⟨ej , LP e1 ⟩ = ⟨ej , P Le1 ⟩ = ⟨P T ej , Le1 ⟩ = ⟨P T P e1 , Le1 ⟩ = ⟨e1 , Le1 ⟩ = L11 .
Moreover, if a ̸= b we can define σ with σ(1) = a, σ(2) = b. Let P denote the corresponding permutation
matrix. Then
P (ea ) = e1 , P (eb ) = e2
and we get
L1,2 = ⟨e1 , Le2 ⟩ = ⟨e1 , LP eb ⟩ = ⟨e1 , P Leb ⟩ = ⟨P T e1 , Leb ⟩ = ⟨P T P ea , Leb ⟩ = ⟨ea , Leb ⟩ = La,b
Now that we characterized all linear equivariant functions from Rn to Rn , we discuss how to handle
several copies of Rn :
47
Proposition 2.18. A function L : Ra×n → Rn is linear and equivariant with respect to the action of Sn , in
and only if it is of the form
X a
L(X) = L(i) (Xi,∗ ) (2.5)
i=1
(i) n n
where each L : R → R is linear and intertwining.
Remark: Note that for convenience of notation we allow L to be applied to row vectors instead of
column vectors.
Remark: Equivalently, linear equivariant mappings L : Ra×n → Rn are of the form
Xa a
X Xn
L(X) = αi (Xi∗ )T + βi Xij 1n
i=1 i=1 j=1
Proof. First assume that L is of the form (2.5). We need to show that for all X ∈ Ra×n and permutation σ
L(σ. X) = σ. (LX)
Indeed
a a a a
!
X X X X
(i) (i) (i) (i)
L(σ. X) = L ((σ. X)i,∗ ) = L (σ. (Xi,∗ )) = σ. L (Xi,∗ ) = σ. L (Xi,∗ ) = σ. L(X)
i=1 i=1 i=1 i=1
where we used the fact that permutation of L is equivalent to permuting each of the rows.
In the other direction, Assume L : Ra×n → Rn is linear and equivariant. The linearity implies that L
can be decomposed as
Xa
L(X) = L(i) (Xi,∗ )
i=1
where each L(i) is linear. We need to show that each L(i) is also equivariant. Due to the equivariance of L,
we have for all permutations σ, for all x ∈ Rn and for every X whose j-th row is xT and all other rows are
zero
σ. (L(j) xT ) = σ. (LX) = L(σ. (X)) = L(j) (σ. (xT ))
and so each L(j) is equivariant and we are done.
New Lesson
Finally we have
Proposition 2.19. L : Ra×n → Rb×n is a linear mapping which is equivariant with respect to the action of
Sn , if and only if it is of the form
L(1)
L(2)
L= .
..
L(b)
a×n n
where L(i) : R → R is linear and equivariant.
Remark: Piecing all of this together, linear equivariant mappings L : Ra×n → Rb×n are of the form
P
a (1) Pa (1) Pn T
α Xi∗ + β j=1 ij 1n
X
i=1 i i=1 i
L(X) =
..
P .
a (b) Pa (b) Pn T
i=1 αi Xi∗ + i=1 βi j=1 Xij 1n
We denote the space of all such mappings by L(n, a, b). Note that this space is determined by 2a · b
parameters. In contrast, Pointnet considers only functions of the form X = (x1 , . . . , xn ) 7→ (Ax1 , . . . , Axn )
(j)
where A ∈ Rb×a . This functions space has a · b parameters which correspond to choosing all βi = 0.
The deep set architecture, like the point net architecture, consist of functions of the form
hL+1 ◦ ρ . . . h2 ◦ ρ ◦ h1 (2.6)
where the linear part of hi : Rdi−1 ×n → Rdi ×n is in L(n, di−1 , di ). This ensures that all such functions are
permutation equivariant.
α(v) = α(w).
We will sometimes say that the functions α1 , . . . , αm are invariant and separating, instead of saying that
α is invariant and separating.
49
Example 2.21. Consider the action of O(1) = {−1, 1} on R. The mapping α(x) = x2 is invariant and
separating .
Similarly for the action of O(d) on Rd the mapping α(x) = ∥x∥ is invariant and separating (see that you
know why). Can you think of any other invariants for this group action?
invariant and separating ? What about the mapping α(X) = X ?(the first is not separating, the second is
not invariant).
If α is invariant then F ◦ α is invariant as well. The next theorem show that when α is separating these
are in fact all possible invariants
Proposition 2.22. Let G be a group acting on a set V and let α : V → Rm be a separating invariant
mapping. A function f : V → R is G-invariant if and only if there exists some F : Rm → R such that
Proof. The invariance of α means that we can define a function α̃[v] = α(v) on the quotient space V /G
and this definition does not depend on the choice of the representative in the orbit [v]. Similarly, since f is
invariant there exists f˜ : V /G → R with
f˜([v]) = f (v).
The fact that α is separating implies that α̃ is injective, so for all v ∈ V
Note that f ◦ α̃−1 is defined on α(V ) and we think of F is some extension of this function to all of Rm .
Typically our invariant functions f and α are continuous, and we would like to say that the function F
in Proposition 2.22 is also continuous. This is indeed the case once we add some minor assumptions:
Proposition 2.23 (Without proof). Let G be a group acting on a metric space V , and let α : V → Rm be a
continuous separating invariant mapping. For every continuous G-invariant function f : V → R and every
compact K ⊆ V , there exists some continuous F = FK : Rm → R such that
Sketch of proof. The proof is simple but relies on some facts from topology which are not in the course’s
prerequisites, and can be found in [Munkres, 2000]. The general idea is that under the standard definition
of the quotient topology for V /G, the maps α̃, f˜ defined as in the previous theorem will be continuous, as is
the quotient map q(v) = [v]. We need to have the map α̃−1 continuous as well. The map α̃ is continuous
and a bijection. In general this does not imply continuity of the inverse but it does in our case where the
domain q(K) is compact. Thus the functions in (2.8) are continuous, and F is a continuous extension of
f˜ ◦ α̃−1 from its compact domain to all of Rm .
Proposition 2.23 can be used to construct universal invariant hypothesis classes. In particular functions
classes of the form
Hinv = {h ◦ α(x)|h is fully connected. }
will be universal. We can also construction universal invariant function classes of the form
Hinv = {h ◦ hinv (x)|h is fully connected. hinv comes from a family of invariant functions }
where the collection of possible hinv includes α or at least can approximate α. This is based on the following
lemma:
50 CHAPTER 2. INVARIANT LEARNING AND APPROXIMATION THEORY
Lemma 2.24. [Don’t need proof for exam] Let G be a group acting on a metric space V , and let α : V → Rm
be a continuous separating invariant mapping. Let K ⊆ V be a compact set and assume that αn : V → Rm
are continuous invariant functions which converge uniformly to α in C(K, Rm ). Then for every continuous
invariant f : V → R there exists neural network functions Fn : Rm → R such that Fn ◦ αn converges to f
uniformly on C(K).
Proof. Since α(K) is compact it is contained in some closed ball B̄R ⊆ Rm . Since ∥αn − α∥C(K,Rm ) → 0
there exists some r > 0 such that ∥αn − α∥ ≤ r for all n. It follows that αn (K) ⊆ B̄R+r for all n. Let
F : Rm → R be the function satisfying (2.9) as promised in Proposition 2.23. Let Fn : Rm → R be neural
network functions which approximate F uniformly on B̄R+r .
Choose some ϵ > 0, we need to show that there exists some N such that for all n > N
2. Since F is continuous it is uniformly continuous on B̄R+r . We choose some δ > 0 such that F (y1 ) −
F (y2 )| < ϵ/2 whenever ∥y1 −y2 ∥ ≤ δ and then choose N large enough so that maxx∈K |∥αn (x)−α(x)∥ <
δ. This implies that |(F ◦ αn )(x) − (F ◦ α)(x)| ≤ ϵ/2 for all x ∈ K.
Due to (2.10) this concludes our argument.
We will now consider separating invariants for the action of permutations on multisets and then use them
to show universality of point-net/deep sets/ other models.
Continuous Separating Invariants for the action of Sn on Rn We consider three different types of
separating invariants for the action of Sn on Rn :
1. Sorting The sorting mapping sort(x) sorts a vector x ∈ Rn by size, e.g.,
This mapping is clearly permutation invariant and separating. It is also continuous piecewise linear
(you will see in homework).
2. Elementary symmetric polynomials The elementary symmetric polynomials are defined as
n
X X
e0 (x) = 1, e1 (x) = xi , e2 (x) = xi xj ,
i=1 1≤i<j≤n
X
e3 (x) = xi xj xk , . . . en (x) = x1 · x2 · . . . · xn
1≤i<j<k≤n
Clearly these polynomials are continuous and invariant to permutations. We prove that they are
separating using the proof in [Zaheer et al., 2017]
Theorem 2.25. The mapping e : Rn → Rn defined by
Proof. Given x, y ∈ Rn , we need to show that if e(x) = e(y) then [x] = [y].
We use x, y to define two polynomials
n
Y n
Y
Px (t) = (t − xi ) and Py (t) = (t − yi )
i=1 i=1
the roots of Px (respectively Py ) are exactly the entries of x (or y) and they are equal as polynomials
if and only if x and y are equal up to permutation. We can rewrite
Px (t) = a0 + a1 t + . . . + an tn
Py (t) = b0 + b1 t + . . . + bn tn
ak = (−1)n−k ek (x), k = 0, 1, . . . , n
n−k
bk = (−1) ek (y), k = 0, 1, . . . , n
It follows that if e(x) = e(y) then ak = bk , k = 0, 1, . . . , n and therefore Px = Py which implies that x
and y are equal up to permutation.
3. Power sum polynomials The symmetric power sum polynomials are defined as
n
X n
X n
X n
X
p0 (x) = 1, p1 (x) = xi , p2 (x) = x2i , p3 (x) = x3i , . . . pn (x) = xni .
i=1 i=1 i=1 i=1
It turns out that these polynomials hold the same information as the elementary symmetric polyno-
mials. Indeed, note that
p0 = e0 and p1 = e1 .
Moreover
n
!2 n
X X X
2
p1 (x) = xi = x2i + 2 xi xj = p2 (x) + 2e2 (x)
i=1 i=1 1≤i<j≤n
so
2s2 (x) = p1 (x)2 − p2 (x).
k
X
kek (x) = (−1)k−i ek−i (x)pi (x).
i=1
In particular if pk (x) = pk (y) for all k = 1, . . . , n then ek (x) = ek (y) for all k = 1, . . . , n which means
that x and y are equivalent up to permutation according to the previous theorem. Thus we see that
the power sum polynomials are also continuous separating invariants.
Remark 2.26. A related but stronger result which we will not need here is that the algebra generated by the
elementary symmetric polynomials (equivalently, the algebra generated by the power sum polynomials) is in
fact equal to the algebra of all Sn invariant polynomials. In other words, for every polynomial p : Rn → R
which is Sn invariant there is some polynomial q : Rn+1 → R such that
Universal hypothesis classes for the action of Sn on Rn It follows immediately from our discussion
above that taking α : Rn → Rm to be a continuous separating invariant mapping such as the (i) sorting, (ii)
elementary polynomials or (iii) power sum polynomials defined above, that functions in
m(x) = (x, x2 , . . . , xn ).
Pnm : R →
which is continuous invariant and separating. Note that universality of neural networks implies that
Rn can be approximated on compact sets by a neural network h : R P → Rn , and as a result p(x) = i=1 m(xi )
n
can be approximated on compact sets by expression of the form i=1 h(xi ). The claim now follows from
Lemma 2.24:
Continuous Separating Invariants for the action of Sn on Rd×n We now turn to consider separating
invariants (and universality) for the action of Sn on Rd×n where now d > 1. A natural approach to generalize
the one-dimensional sort function is by using lexicographical sorting, where e.g., we sort according to the
first coordinate from small to large, and break equalities by sorting according to the second coordinate from
small to large, e.g.
1 5 5 8 7 7 1 5 5 7 7 8
lexsort = .
6 5 4 1 2 3 6 4 5 2 3 1
This type of mapping is indeed both permutation invariant and separating but it is not continuous. In
contrast, we can get polynomial invariants which are continuous separating invariants.
We consider Sn polynomial invariants for Rd×n which are obtained from polynomial invariants of Rn by
a process called polarization. For given k = 0, . . . , n and w ∈ Rd we define
n
X
T
q(X; w, k) = pk (w X) where pk (t1 , . . . , tn ) = tki .
i=1
n
these are indeed invariant as for all permutation matrices P , since pk : R → R are permutation invariant:
Note that for each k, w, the function q(X; w, k) is a multivariate polynomial from Rd×n of degree k ≤ n. We
claim that this infinite family of polynomial is separating in the following sense:
Lemma 2.28. If X, Y ∈ Rd×n and
Si = {w ∈ Rd | A(i) w = 0}
Proof of Lemma 2.29. This can be done using measure considerations, by showing that each Si has Lebesgue
measure zero and therefore so does there union.
Alternatively, we can do this inductively. Denote T0 = Rd and
Ti = Ti−1 \ Si , i = 1, . . . , m.
Note that Tm is the complement of ∪m i=1 Si . We want to show Tm isn’t empty. To do this we will recursively
show that each Ti is open and not empty. For T0 this is clear. Now assuming that Ti−1 is open and non-empty
we see that Ti is also open since it is the intersection of two open sets: Ti−1 and the complement of Si . Now
let us show that Ti is not empty: if Ti = Ti−1 we are done. Otherwise, there exists some w ∈ Ti−1 ∩ Si .
Since A(i) ̸= 0, there exists some row of A(i) which we denote by aTj which is not zero. It follows that for
every ϵ > 0,
aTj (w + ϵaj ) = ϵ∥aj ∥2 ̸= 0 and therefore A(w + ϵaj ) ̸= 0,
and so w + ϵaj will not be in Si . Since Ti−1 is open, for small enough ϵ the vector w + ϵaj will be in Ti−1
and so will be in Ti = Ti−1 \ Si which concludes the proof.
Proof of Lemma 2.28. We assume that X, Y are such that X ̸= σ. Y for all σ ∈ Sn and we will prove that
there exist k, w such that pk (wT X) ̸= pk (wT Y ). Indeed for fixed σ let us consider the set
Note that by assumption for each σ we have that X − σ. Y ̸= 0 and so by Lemma 2.29 there exists w̄ which
is not in ∪σ∈Sn Bσ . Since the power-sum polynomials are separating on Rn and w̄T X ̸∼ w̄T Y , it follows that
there exists some k such that pk (w̄T X) ̸= pk (w̄T Y ).
The next step is to find a finite number of separating invariants using this lemma. Recall that P(d, n),
the space of multivariate polynomials b : Rd → R of degree ≤ n is a linear space of dimension m = m(n, d) =
n+d
d . We will consider some basis b1 , . . . , bm for this space. They induce permutation invariant polynomials
defined on Rd×n by
Xn
Bk (X) = bk (xi ).
i=1
We prove
Theorem 2.30. Let b1 , . . . , bm : Rd → R be polynomials which span the space of polynomials, then the
polynomial mappings
n
X
Bℓ (X) = bℓ (xi ), ℓ = 1, . . . , m (2.11)
i=1
Proof. Invariance is clear. To show separation, let X, Y ∈ Rd×n be such that Bℓ (X) = Bℓ (Y ), ℓ = 1, . . . , m.
We will show that this implies that pk (wX) = pk (wY ) for all k and w, which in turn implies that X = σ. Y
for some σ ∈ Sn , according to the previous lemma.
We note that for every w ∈ Rd and k = 0, . . . , n the polynomial
k
x 7→ wT x
54 CHAPTER 2. INVARIANT LEARNING AND APPROXIMATION THEORY
(k,w)
is a polynomial on Rd of degree k ≤ n, and therefore there exist coefficients cℓ , ℓ = 1, . . . , m such that
m
k X (k,w)
wT x = cℓ bℓ (x), ∀x ∈ Rd
ℓ=1
It follows that
n n X
m m
X k X (k,w)
X (k,w)
pk (wT X) = w T xi = cℓ bℓ (xi ) = cℓ Bℓ (X)
i=1 i=1 ℓ=1 ℓ=1
and
m
(k,w)
X
pk (wT Y ) = cℓ Bℓ (Y ).
ℓ=1
Since by assumption Bℓ (X) = Bℓ (Y ) for all ℓ it follows that pk (wT X) = pk (wT Y ) for all k, w and therefore
X = σ. Y for some σ ∈ Sn as required.
Remark 2.31. It is possible to obtain m̃ = n(2nd + 1) << m(n, d) continuous separating invariants by
taking random w(1) , . . . , w(2nd+1) , and defining the invariants to be
T
X 7→ qk (w(j) X), k = 1, . . . , n, j = 1, . . . , 2nd + 1.
For more details see [Dym and Gortler, 2022]. In this construction we can also replace the power sum
polynomials with the sorting function.
55
New Lesson
An immediate consequence of Theorem 2.30 is the universality of point-net with sum-pooling for the case
d > 1:
Theorem 2.32. For every d, n, and every compact K ⊆ Rd×n , every f : Rd×n → R which is continuous
and Sn invariant can be approximated uniformly on K by functions in
n
!
X
Hpointnet−sum = {F h(xi ) |h : Rd → Rm , and F : Rm → R are neural networks}
i=1
Sketch of proof.
PnThe proof is the same of the proof of Theorem 2.27: we use the fact that thempolynomi-
als Bℓ (X) = i=1 bℓ (xi ) in (2.11) are separating, and the fact that the function x 7→ (bℓ (x))ℓ=1 can be
approximated by neural networks of the form h : Rd → Rm due to universality of neural networks.
and then the fact that (2.12) holds for j = 1, . . . , m implies that x1 , . . . , xn′ and y1 , . . . , yn′ are related by a
permutation and so the multisets containing these points are equal.
Remark 2.34 (Dimension optimality). In general, for any continuous injective function B : Sn (Rd ) → Rm
or B : S≤n (Rd ) → Rm the dimension m must satisfy m ≥ nd (see [Wagstaff et al., 2022] for the d = 1 case
and [Joshi et al., 2023, Amir et al., 2023] for the general case). When the set elements are assumed to come
from a finite or countable set (we can think of this as d = 0) then we can actually get m = 1 as discussed in
[Zaheer et al., 2017, Xu et al., 2018, Amir et al., 2023].
56 CHAPTER 2. INVARIANT LEARNING AND APPROXIMATION THEORY
Equivariant operations on graphs To construct hypothesis classes which consist only of graph-equivariant
functions, we need to identify equivariant operations we can use. One simple example: we can extend any
ρ : R → R to an elementwise function on X and A and this will be permutation equivariant.
Here is a more interesting example: the function h : Rn×n ⊕ Rn×d → Rn×d defined by
is permutation equivariant because for every permutation τ and corresponding permutation matrix P = Pτ .
When A represents an adjacent matrix, the operation (A, X) 7→ Y = XA can be understood as a ‘message
passing’ procedure, where Yv is the sum of all features in X belonging to its neighbors. The set of neigbors
of a node v is defined as
N (v) = {u ∈ V |(u, v) ∈ E} = {u ∈ V |Au,v = 1}.
Note that
n
X X
(XA)i,v = Xiu Auv = Xiu = S({{Xiu | u ∈ N (v)}})
u=1 u∈N (v)
where S denotes the summation function which is well defined on multisets (it does not depend on the order
of the elements).
This ‘message passing’ interpretation can be generalized: let us denote the spaces of n × n adjacency
matrices by
An = {A ∈ {0, 1}n×n , Aii = 0 and Aij = Aji ∀1 ≤ i < j ≤ n}
This is a subset of Rn×n and for every A ∈ An and permutation τ ∈ Sn we have that τ. A ∈ An so that the
action of the permutation group on this subset is well defined. We then have
Proposition 2.36. Let (A, X) ∈ An ⊕ Rd×n and let m be a function which maps finite multisets with
elements in Rd into Rc . Then the function h : (A, X) ∈ An ⊕ Rd×n → Rc×n defined by
is permutation equivariant.
Proposition 2.36 gives us a general method to construct graph-equivariant functions using functions on
multisets. We can take the function m to be the summation function as above, or take m to be more
complicated multiset valued functions such as the injective multiset functions we discussed previously. Note
that since different nodes generally have neighborhoods of different sizes, we will typically require functions
which are will defined on multisets of different cardinalities.
Message Passing Neural Networks Message passing neural networks are a family of (arguably, the
most) popular equivariant graph neural networks. They iteratively use the graph structure to redefine node
labels. A message passing neural network is initialized via
Xv(0) = Xv
58 CHAPTER 2. INVARIANT LEARNING AND APPROXIMATION THEORY
(k) (k−1)
and then we recursively define Xv from Xv via
a(k)
v = AGGREGAT E (k)
{
{Xu
(k−1)
, u ∈ Nv }
}
Xv(k) = COM BIN E (k) Xv(k−1) , a(k)
v . (2.15)
We can apply this procedure recursively K times, which ultimately gives us a permutation equivariant
function
f (A, X) = (A, X (K) ).
If our final goal is to achieve a permutation invariant function we add an additional readout function
F (A, X) = READOU T {{Xv(K) | v ∈ V }}
where W is some given matrix (which is learned in practice). This is a well defined multiset function, as the
same function
yu = ReLU (W Xu(k−1) )
is applied to all neighbors of v, and the maximum, which is applied row-wise to the matrix whose columns
are yu , u ∈ N (v) is a permutation invariant operation.
The COMBINE function in GraphSAGE is taken to be
Xv(k) = ReLU B · CON CAT Xv(k−1) , a(k)
v ,
𝐺𝐺 𝐺𝐺’
Figure 2.1: Two graphs which are not isomorphic (are not related by a permutation) but cannot be separated
by any message passing neural network
2.1. GRAPH NEURAL NETWORKS AND GRAPH ISOMORPHISM TEST 59
Approximation Power It would be natural to inquire what the expressive power of message passing
neural networks (MPNN) is, and to hope that like pointnet architecture for point clouds, it will be universal
in the sense that it can approximate any continuous permutation invariant function on graphs. As we saw,
this question is very strongly linked to the question of finding separating invariants for the group action (in
our case, permutation and graphs). Thus one could inquire whether MPNN can separate any graphs up to
permutation equivalence.
To be more precise, can we define F (A, X) via a message passing procedure with some specified itera-
tion number K, and some multiset valued functions AGGREGAT E (k) , COM BIN E (k) , k = 1, . . . , K and
READOU T , such that F (A, X) = F (A′ , X ′ ) if and only if A′ = P AP T , X ′ = XP T for some appropriate
permutation matrix P ?
It turns out that the answer to this question is negative. In general, since F is permutation invariant by
construction we always have that if A′ = P AP T , X ′ = XP T then F (A, X) = F (A′ , X ′ ). The converse is
not true: Figure 2.1 shows an example of two graphs G, G′ which are not isomorphic. Here we can take A
and A′ to be the adjacency matrices of the two graphs and X and X ′ to just be a all one vector. We note
that for every node v or v ′ in either graph we have the same initial coloring Xv = 1 or Xv′ = 1, and the
neighborhoods of all nodes contain exactly two nodes, so that the multisets encountered in the first step of
the message passing procedure are just {{1, 1}}. We can see that the message passing procedure gets ‘stuck’,
where no matter what we do all nodes in both graphs will assume the same value.
The fact that separation of graphs fails is not surprising. The problem of telling whether two graphs are
related by a permutation is known as the Graph Isomorphism Problem (GI). There is no known polynomial
time algorithm to solve this problem, though it is also not known to be NP-hard. It is one of the examples
of a problem which may be NP-intermediate.
In general, the separation power of MPNNs is strongly related to the Weisfeiler-Lehman (WL) graph
isomorphism tests which we did not have time to define this year. In general, MPNNs separation power is
bounded from above by the WL tests: they cannot separate graphs which the WL test cannot separate. An
MPNN which uses injective multiset functions, and injective COMBINE functions, will be equivalent to the
WL test in terms of graph separation abilities. For more on this see [Morris et al., 2019, Xu et al., 2018].
60 CHAPTER 2. INVARIANT LEARNING AND APPROXIMATION THEORY
Bibliography
[Amir et al., 2023] Amir, T., Gortler, S. J., Avni, I., Ravina, R., and Dym, N. (2023). Neural injective
functions for multisets, measures and graphs via a finite witness theorem.
[Daubechies et al., 2021] Daubechies, I., DeVore, R., Foucart, S., Hanin, B., and Petrova, G. (2021). Non-
linear approximation and (deep) relu networks. Constructive Approximation, pages 1–46.
[DeVore et al., 2021] DeVore, R., Hanin, B., and Petrova, G. (2021). Neural network approximation. Acta
Numerica, 30:327–444.
[Dym and Gortler, 2022] Dym, N. and Gortler, S. J. (2022). Low dimensional invariant embeddings for
universal geometric learning. arXiv preprint arXiv:2205.02956.
[Dym et al., 2020] Dym, N., Sober, B., and Daubechies, I. (2020). Expression of fractals through neural
network functions. IEEE Journal on Selected Areas in Information Theory, 1(1):57–66.
[Eldan and Shamir, 2016] Eldan, R. and Shamir, O. (2016). The power of depth for feedforward neural
networks. In Conference on learning theory, pages 907–940. PMLR.
[Hamilton et al., 2017] Hamilton, W., Ying, Z., and Leskovec, J. (2017). Inductive representation learning
on large graphs. Advances in neural information processing systems, 30.
[Hanin and Rolnick, 2019] Hanin, B. and Rolnick, D. (2019). Deep relu networks have surprisingly few
activation patterns. Advances in neural information processing systems, 32.
[Joshi et al., 2023] Joshi, C. K., Bodnar, C., Mathis, S. V., Cohen, T., and Liò, P. (2023). On the expressive
power of geometric graph neural networks. arXiv preprint arXiv:2301.09308.
[Lu et al., 2021] Lu, J., Shen, Z., Yang, H., and Zhang, S. (2021). Deep network approximation for smooth
functions. SIAM Journal on Mathematical Analysis, 53(5):5465–5506.
[Malach and Shalev-Shwartz, 2019] Malach, E. and Shalev-Shwartz, S. (2019). Is deeper better only when
shallow is good? Advances in Neural Information Processing Systems, 32.
[Montufar et al., 2014] Montufar, G. F., Pascanu, R., Cho, K., and Bengio, Y. (2014). On the number of
linear regions of deep neural networks. Advances in neural information processing systems, 27.
[Morris et al., 2019] Morris, C., Ritzert, M., Fey, M., Hamilton, W. L., Lenssen, J. E., Rattan, G., and
Grohe, M. (2019). Weisfeiler and leman go neural: Higher-order graph neural networks. In Proceedings of
the AAAI conference on artificial intelligence, volume 33, pages 4602–4609.
[Munkres, 2000] Munkres, J. R. (2000). Topology, volume 2. Prentice Hall Upper Saddle River.
[Pinkus, 1999] Pinkus, A. (1999). Approximation theory of the mlp model in neural networks. Acta numerica,
8:143–195.
[Qi et al., 2017] Qi, C. R., Su, H., Mo, K., and Guibas, L. J. (2017). Pointnet: Deep learning on point sets
for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and
pattern recognition, pages 652–660.
61
62 BIBLIOGRAPHY
[Raghu et al., 2017] Raghu, M., Poole, B., Kleinberg, J., Ganguli, S., and Sohl-Dickstein, J. (2017). On
the expressive power of deep neural networks. In international conference on machine learning, pages
2847–2854. PMLR.
[Reiser et al., 2022] Reiser, P., Neubert, M., Eberhard, A., Torresi, L., Zhou, C., Shao, C., Metni, H., van
Hoesel, C., Schopmans, H., Sommer, T., et al. (2022). Graph neural networks for materials science and
chemistry. Communications Materials, 3(1):93.
[Simmons, 1963] Simmons, G. F. (1963). Introduction to topology and modern analysis, volume 44. Tokyo.
[Telgarsky, 2016] Telgarsky, M. (2016). Benefits of depth in neural networks. In Conference on learning
theory, pages 1517–1539. PMLR.
[Wagstaff et al., 2022] Wagstaff, E., Fuchs, F. B., Engelcke, M., Osborne, M. A., and Posner, I. (2022).
Universal approximation of functions on sets. Journal of Machine Learning Research, 23(151):1–56.
[Xu et al., 2018] Xu, K., Hu, W., Leskovec, J., and Jegelka, S. (2018). How powerful are graph neural
networks? In International Conference on Learning Representations.
[Yarotsky, 2017] Yarotsky, D. (2017). Error bounds for approximations with deep relu networks. Neural
Networks, 94:103–114.
[Zaheer et al., 2017] Zaheer, M., Kottur, S., Ravanbakhsh, S., Poczos, B., Salakhutdinov, R. R., and Smola,
A. J. (2017). Deep sets. Advances in neural information processing systems, 30.
[Zaslavsky, 1975] Zaslavsky, T. (1975). Facing up to arrangements: Face-count formulas for partitions of
space by hyperplanes: Face-count formulas for partitions of space by hyperplanes, volume 154. American
Mathematical Soc.