Chapter 15Optimization basics
15.1 Objective functions
Consider a function , for example evaluating the error or “loss” achieved by a model with parameters , where . To find the best possible model parameterization, we seek to minimize , that is, to compute approximately assuming that the infimum exists (i.e., is lower bounded). We will denote a solution, if it exists, by In general, an analytical solution is not available and computing such a minimum approximately requires an optimization algorithm. An optimization algorithm is an iterative procedure, which, starting from an initial point , outputs after iterations a point that approximates the minimum of up to some accuracy , i.e.,
15.2 Oracles
To produce iterates that converge to a minimum, the algorithm naturally needs to have access to information about . For example, the algorithm needs a priori to be able to evaluate to know if it decreased its value or not. Such information about the function is formalized by the notion of oracles (Nemirovski and Yudin, 1983). Formally, oracles are procedures that an algorithm can call to access information about the objective at any given point . We usually mainly consider the following three oracles.
Zero-order oracle: evaluating the function .
First-order oracle: evaluating the gradient for differentiable.
Second-order oracle: evaluating the Hessian matrix , or evaluating the Hessian-vector product (HVP) , for twice differentiable and any vector .
Given an oracle for a function , we can formally define an optimization algorithm as a procedure which computes the next iterate as a function of all past and current information. Formally, an algorithm builds a sequence from a starting point as where encapsulates some hyperparameters of the algorithm, such as the stepsize. Oftentimes, algorithms build the next iterate simply from the information collected at the current iterate, without using all past iterates. That is, they take the form . A classical example is the gradient descent algorithm, which uses a first-order oracle to compute iterates of the form where the stepsize is a hyperparameter of the algorithm. The notion of oracle therefore delineates different classes of algorithms. For instance, we may consider zero-order algorithms or first-order algorithms.
15.3 Variational perspective of optimization algorithms
One of the most basic optimization algorithms is the proximal point method, which produces from by In words, the next iterate is produced by solving a trade-off between minimizing the function and staying close to . Unfortunately, the optimization problem involved in performing this parameter update is as difficult as the original optimization problem, making the proximal point method impractical.
As we shall see in Chapter 16 and Chapter 17, many optimization algorithms can be seen as an approximation of the proximal point method, in the sense that they solve or more generally where is an approximation of around and is some form of distance between and . Different choices of and lead to different optimization algorithms, and to different trade-offs.
15.4 Classes of functions
When studying algorithms theoretically, stronger results can often be stated by restricting to certain classes of functions. We already covered continuous and differentiable functions in Chapter 2. We review a few important other classes in this section.
15.4.1 Lipschitz functions
Lipschitz continuity is a stronger form of continuity. Intuitively, a Lipschitz continuous function is limited in how fast it can change.
Definition 15.1 (Lipschitz-continuous functions)
A function is -Lipschitz continuous if for all
Note that the definition is valid even for vector-valued functions.
With respect to arbitrary norms
Thanks to dual norms reviewed in Section 18.1, we can state a more general definition of Lipschitz continuity based on arbitrary norms, instead of the -norm. Moreover, we may consider Lipschitz-continuity over a subset of the input domain.
Definition 15.2 (Lipschitz continuous functions w.r.t. a norm)
A function is said to be -Lipschitz w.r.t. a norm over a set if for all
When , we recover Definition 15.1, since the -norm is dual to itself.
15.4.2 Smooth functions
A differentiable function is said to be -smooth if its gradients are -Lipschitz continuous. Setting in Definition 15.1, we obtain the following definition.
Definition 15.3 (Smooth functions)
A differentiable function
is -smooth for if for all
Smoothness ensures that the information provided by the gradient at some is meaningful in a neighborhood of , since its variations are upper-bounded. If the variations were not bounded, the gradient at arbitrarily close to could drastically change, rendering the information provided by a first-order oracle potentially useless.
Smoothness of a function can be interpreted as having a quadratic upper bound on the function as formalized below.
Proposition 15.1 (Smooth functions)
If a differentiable function is -smooth then for all , In particular, we have
Proof
This is shown by bounding using the integral representation of the objective along , i.e., , where the last inequality follows from the smoothness assumption and standard integration. ◻
In other words, is upper-bounded and lower-bounded around by a quadratic function of . We will see in Section 16.1 that this characterization gives rise to a variational perspective on gradient descent.
With respect to arbitrary norms
We can generalize the definition of smoothness in Definition 15.3 to arbitrary norms.
Definition 15.4 (Smooth functions w.r.t. a norm)
A function is -smooth w.r.t. a norm over a set if for all
An equivalent characterization, generalizing Proposition 15.1 to arbitrary norms, is given below (see, e.g. Beck (2017, Theorem 5.8)).
Proposition 15.2 (Smooth functions w.r.t. a norm)
If a differentiable function is -smooth w.r.t. a norm over a set , then for all where is the Bregman divergence generated by (Definition 18.2).
15.4.3 Convex functions
A convex function is a function such that its value on the average of two or more points is smaller than the average of the values of the functions at these points. This is illustrated in Figure 15.2 and formalized below.
Definition 15.5 (Convex functions)
A function is said to be convex if for all and The function is strictly convex if the above inequality is strict for all .
The above characterization can easily be generalized to multiple points. Namely, for and such that (that is, defines a probability distribution over , we have if is convex that The point is called a convex combination. This can be seen as comparing the function at the average point to the average of the values at these points and can further be generalized to any random variable.
Proposition 15.3 (Jensen’s inequality)
A function is convex if it satisfies Jensen’s inequality, that is, for any random variable on , provided that the expectations are well-defined.
If the function considered is differentiable, an alternative characterization of convexity is to observe how linear approximations of the function lower bound the function. This is illustrated in Figure 15.2 and formalized below.
Definition 15.6 (Convex differentiable functions)
A differentiable function is convex if and only if for all The function is strictly convex if and only if the above inequality is strict for any .
The above characterization pinpoints the relevance of convex functions in optimization: if we can find a point with null gradient, then we know that we have found the minimum as we have This means that by having access to the gradient of the function or an approximation thereof, we have access to a sufficient criterion to know whether we found a global minimum. In the case of a gradient descent on a smooth function, convexity ensures convergence to a minimum at a sublinear rate as detailed below.
Finally, if the function is twice differentiable, convexity of a function can be characterized in terms of the Hessian of the function.
Proposition 15.4 (Convex twice differentiable functions)
A twice differentiable function is convex if and only if its Hessian is positive semi-definite, The function is strictly convex if and only if the Hessian is positive-definite, , i.e., , .
15.4.4 Strongly-convex functions
Convexity can also be strengthened by considering -strongly convex functions.
Definition 15.7 (Strongly-convex functions)
A function is -strongly convex for if for all and A differentiable function is -strongly convex if and only if for all A twice differentiable function is -strongly convex if and only if its Hessian satisfies
The characterization of strong convexity for differentiable functions states that is lower-bounded by a quadratic. This enables the design of linearly convergent algorithms as explained later. We naturally have the implications
With respect to arbitrary norms
A function can be strongly convex w.r.t. an arbitrary norm, simply by replacing the -norm in Definition 15.7 with that norm. For differentiable strongly convex functions, we have the following alternative characterization, generalizing Definition 15.7 to arbitrary norms.
Proposition 15.5 (Differentiable strongly-convex functions)
If a differentiable function is -strongly convex w.r.t. a norm over a set , then for all
Obviously, if a function is -strongly convex, then, is -strongly convex. Because all norms are equivalent, if a function is strongly convex w.r.t. a norm, it is also strongly-convex w.r.t. another norm. However, stating the norm w.r.t. which strong convexity holds can lead to better constant (the higher, the better in terms of convergence rates of, e.g., a gradient descent). We also emphasize that it is important to mention over which set strong convexity holds. We give examples below.
Example 15.1 (Strongly convex functions)
The function is -strongly convex w.r.t. over .
The function is -strongly convex w.r.t. over . Applying Proposition 15.5, we obtain for all which is known as Pinsker’s inequality. We empirically verify the inequality in Fig. 15.1.
More generally, is -strongly convex w.r.t. over any bounded set such that (Blondel, 2019). However, it is not strongly convex over , as it is not bounded.

Figure 15.1: Graphical verification of Pinsker’s inequality, , with and .
15.4.5 Nonconvex functions
In general, the minimum of a function necessarily has a null gradient, that is, To see this, consider the function . If , then . Therefore, there exists a small such that , i.e., is not the minimum. However, if the function is not convex, the converse is a priori not true: finding a point that has a null gradient does not ensure that we have found a global minimum as illustrated in Figure 15.3.
For non-convex functions, a point with null gradient is called a stationary point. A stationary point may define a local maximum or a local minimum. Formally, is a local minimum if A local maximum is defined similarly, except that in a neighborhood of . For non-convex functions, convergence rates are therefore generally expressed in terms of convergence of the norm of the gradient towards . Such theoretical results do not ensure convergence to the global minimum but rather convergence to a point where no further progress may a priori be possible with just gradient information.

Figure 15.2: Convex function: any secant is above the function, any tangent is below the function, a point with zero gradient is a minimum.

Figure 15.3: Non-convex function: a point with zero gradient is not necessarily the global minimum.
15.5 Performance guarantees
For a given class of functions, we can define the performance of an algorithm as the number of iterations the algorithm would need to find an -accurate solution as in Eq. (15.1). This is called the computational complexity of the algorithm, denoted Alternatively, the performance of an algorithm can be stated in terms of convergence rate, i.e., the accuracy that the algorithm reaches after iterations, where is a decreasing positive function vanishing as . Usually, incorporates properties of the function minimized, such as its smoothness constant and information on the initial point, such as its function value. The corresponding computational complexity is then given as the minimum number of iterations such that ,
Convergence rates can generally be classified by considering the progress ratio on iteration , defined by The asymptotic convergence rate is then defined by We can classify the rates as follows.
Sublinear convergence rates, : the longer the algorithm runs, the slower it makes progress. That is, the relative progress eventually tends to stall as . Examples of in this category include or more generally for some . This is equivalent to .
Linear convergence rates, : the algorithm eventually reaches a state of constant relative progress at each iteration, leading to an overall rate for depending on the properties of the objective. This corresponds to .
Superlinear convergence rates, : the relative progress is better at each new iteration. This can happen for, e.g., , leading to , or , which is specifically called a quadratic rate, leading to .
This is illustrated in Fig. 15.4.
Note that the term “linear” may be misleading as the rates are in fact exponential. They are called “linear” because of their behavior in log scale.

Figure 15.4: Left: convergence rates. Right: progress ratios. An algorithm with sublinear convergence rates eventually stops making progress. An algorithm with linear convergence rate eventually reaches a state of constant progress. An algorithm with superlinear convergence rate makes faster progress after each iteration.
Upper and lower bounds
The best performance of a class of algorithms equipped with a given oracle (e.g. first-order oracle) can be upper-bounded or lower-bounded. This allows to show that an algorithm with access limited to a certain type of oracle cannot theoretically do better than a certain number. For example, the computational complexity to minimize -smooth functions restricted on with first-order oracles is lower bounded by (Nemirovski and Yudin, 1983, p. 1.1.7). For example, with and , this gives iterations. Note that these results are pessimistic by construction. The actual performance of an algorithm on a specific instance of this function class may be much better than this worst-case scenario, as it is the case with popular algorithms such as quasi-Newton methods. Better computational complexities can be achieved by further restricting the class of functions to the set of convex functions, which play a central role in optimization and many other fields.
Zero-order vs. first-order
For the class of smooth strongly convex functions, the computational complexity of the best first-order algorithm is (up to constant and logarithmic factors) times better than that of the best zero-order algorithm (Nesterov, 2018; Nesterov and Spokoiny, 2017). This theoretical comparison shows that, while zero-order optimization algorithms may perform on par with first-order optimization algorithms for problems with a low dimension , they can be much slower for high dimensional problems, i.e., .
In different settings, for example with stochastic oracles (Duchi et al., 2015) or for different classes of functions, slightly different comparisons may be achieved, such as a factor instead of . However, the same conclusion holds in the current frameworks considered: first-order optimization algorithms can provide fast rates that are dimension independent while the rates of zero-order optimization algorithms generally depend on the dimension of the problem, making them unfit for high-dimensional problems.
This explains the immense success of first-order algorithms for training neural networks. Fortunately, using reverse-mode autodiff, as studied in Chapter 8, it can be shown that computing a gradient has roughly the same complexity as evaluating the function itself Section 8.3.3.
15.6 Summary
The information available to us on a function can be formalized by the notion of oracle. Zero-order oracles can only evaluate the function; first-order oracles can also compute the gradient; second-order oracles can also compute the Hessian or the Hessian-vector product (HVP).
Most optimization algorithms reviewed in this book can be viewed from a variational perspective, in which the next iteration is produced by optimizing a trade-off between an approximation of the function and a proximity term. Different approximations and different proximity terms lead to different algorithms.
We also reviewed different classes of functions, and performance guarantees.