We haven’t yet really talked in this course about any optimization algorithms to actually implement our learning algorithms ERM or SRM.
Recall our usual decomposition (1.5)
and that we’ve often done as in (1.6) that
What about if we try to get the ERM, but we don’t exactly achieve it,
instead getting
Today we’ll study this optimization error a bit.
By far the most common optimization algorithm used in machine learning is (stochastic) gradient descent and its variants. We’ll cover the foundational ideas, but there is a lot more in this area, and generally, learning theory and optimization are becoming much more integrated. For much much more about optimization, some good resources are graduate courses by Michael Friedlander (CPSC 536M) and Mark Schmidt (CPSC “5XX”, to eventually be offered as an actual class), the books of [BV04, NW06, BUB15], and the survey of [GG23]. Chapter 14 of [SB14] also gives an approachable account of projected stochastic subgradient descent, which generalizes what we’re talking about here.
Gradient descent tries to find
We start at some initial point
the scalar
One way to motivate this is to say that we should only “trust” the gradient direction locally,
and then should re-check it regularly.
Another way is to notice that this update actually minimizes the local quadratic approximation given by
111If instead of
This approximation is useful in that
if
We repeat this until we decide to stop, after
We’ll usually assume for now that
A common assumption in optimization is that the target function is
We say a function
If
When
where
Now suppose that
Choosing
For the other direction, suppose that each
thus
taking the limit as
Suppose
its deviation from its tangent planes is upper-bounded by a quadratic.
By the Lagrange form of Taylor’s theorem, we have that
for some
Let
Thus if
So, this means that gradient descent with a small-enough learning rate is a “descent method”:
each step decreases the objective,
unless
Suppose
For convex functions, any stationary point – one with
For convex functions in particular (with a slightly smaller learning rate), we can turn the descent lemma into a proof of gradient descent convergence.
Let
We’re going to want to bound the improvement in each step of gradient descent:
To see what that right-hand side is, we’ll use
and rearrange into
Now we can use the descent lemma to deal with that last term:
since
We’ve therefore obtained
which we can simplify to
or equivalently
This holds for each
Notice that by the descent lemma,
But by Jensen’s inequality (theorem C.8),
since
Much faster rates are available if
The analysis above can be pretty-easily extended to SGD; see e.g. Chapter 14 of [SB14] or the recent survey of [GG23]. It can be generalized further, though more complicatedly, to show that even SGD eventually reaches a stationary point, even for non-convex functions:
Let
for some
That is, the best iterate achieves
Is
Consider the very simple network
where
and we have
|
|
|||
The Jacobian with
Notice that the descent lemma doesn’t actually need a global upper bound on the smoothness,
just along the path from
So, if we’re optimizing a deep network with a fixed learning rate
One model we can look at is deep linear nets,
To see that they’re nonconvex:
consider just a depth two model on scalars,
But this is not a convex set: it’s a line in
It turns out that for deep linear nets:
Unfortunately, stationary points can also be saddle points – including potentially “bad” saddles with
Fortunately, in general, gradient descent almost surely converges to local minimizers, not saddles (or local maxes) ([LSJ+16]).
Unfortunately, doing so can take exponential time ([DJL+17]).
Fortunately, this doesn’t happen for deep linear networks, under some conditions ([ACG+19a]).
Unfortunately, there are bad local minima in nonlinear networks.
For a very simple example, consider the network
Any negative input is a (non-strict) local min
(since
But, do bad local minima exist for realistic networks, with realistic data?
Even if they do, does SGD find them?
Moreover, even if I find a good local min of