目录优化基础

第 15 章 优化基础Chapter 15 Optimization basics

15.1 目标函数15.1 Objective functions

考虑一个函数 LL,例如它评估带有参数 w∈W{\bm{w}}\in\mathcal{W} 的模型所达到的误差或“损失”L(w)L({\bm{w}}),其中 W=RP\mathcal{W}=\mathbb{R}^{P}。为了找到尽可能好的模型参数化,我们寻求最小化 L(w)L({\bm{w}}),也就是近似计算Consider a function LL, for example evaluating the error or “loss” L(w)L({\bm{w}}) achieved by a model with parameters w∈W{\bm{w}}\in\mathcal{W}, where W=RP\mathcal{W}=\mathbb{R}^{P}. To find the best possible model parameterization, we seek to minimize L(w)L({\bm{w}}), that is, to compute approximately

L⋆:=inf⁡w∈WL(w),L^{\star}\coloneqq\inf_{{\bm{w}}\in\mathcal{W}}L({\bm{w}}),

假设下确界存在(即 L(w)L({\bm{w}}) 有下界)。若解存在,我们将把它记为assuming that the infimum exists (i.e., L(w)L({\bm{w}}) is lower bounded). We will denote a solution, if it exists, by

w⋆∈arg min⁡w∈WL(w):={w∈W:L(w)=min⁡w′∈WL(w′)}.{\bm{w}}^{\star}\in\argmin_{{\bm{w}}\in\mathcal{W}}L({\bm{w}})\coloneqq\left\{{\bm{w}}\in\mathcal{W}:L({\bm{w}})=\min_{{\bm{w}}^{\prime}\in\mathcal{W}}L({\bm{w}}^{\prime})\right\}.

通常情况下,解析解并不存在,因而要近似求出这样的最小值,就需要借助优化算法。优化算法是一种迭代过程:它从初始点 w0{\bm{w}}^{0} 出发,经过 tt 次迭代后,输出一个点 wt{\bm{w}}^{t},该点可在一定精度 ε\varepsilon 内近似 LL 的最小值,即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 w0{\bm{w}}^{0}, outputs after tt iterations a point wt{\bm{w}}^{t} that approximates the minimum of LL up to some accuracy ε\varepsilon, i.e.,

L(wt)−L⋆≤ε.L({\bm{w}}^{t})-L^{\star}\leq\varepsilon. (15.1)

15.2 oracle15.2 Oracles

为了产生收敛到最小值的迭代值 w1,w2,…{\bm{w}}^{1},{\bm{w}}^{2},\dots,算法自然需要获取关于 LL 的信息。例如,算法首先要能对 LL 求值,以判断它是否使函数值下降。这类关于函数的信息由 oracle 的概念加以形式化[143]。形式上,oracle 是算法可以调用的过程,用以在任意给定点 w∈W{\bm{w}}\in\mathcal{W} 处获取关于目标函数 L(w)L({\bm{w}}) 的信息。我们通常主要考虑以下三种 oracle。To produce iterates w1,w2,…{\bm{w}}^{1},{\bm{w}}^{2},\dots that converge to a minimum, the algorithm naturally needs to have access to information about LL. For example, the algorithm needs a priori to be able to evaluate LL to know if it decreased its value or not. Such information about the function is formalized by the notion of oracles [143]. Formally, oracles are procedures that an algorithm can call to access information about the objective L(w)L({\bm{w}}) at any given point w∈W{\bm{w}}\in\mathcal{W}. We usually mainly consider the following three oracles.

  • •

    零阶 oracle:对函数 L(w)∈RL({\bm{w}})\in\mathbb{R} 求值。Zero-order oracle: evaluating the function L(w)∈RL({\bm{w}})\in\mathbb{R}.

  • •

    一阶 oracle:当 LL 可微时,对梯度 ∇L(w)∈W\nabla L({\bm{w}})\in\mathcal{W} 求值。First-order oracle: evaluating the gradient ∇L(w)∈W\nabla L({\bm{w}})\in\mathcal{W} for LL differentiable.

  • •

    二阶 oracle:当 LL 二次可微时,对 Hessian 矩阵 ∇2L(w)\nabla^{2}L({\bm{w}}) 求值,或对任意向量 v∈W{\bm{v}}\in\mathcal{W} 求 Hessian—向量乘积(HVP)∇2L(w)v∈W\nabla^{2}L({\bm{w}}){\bm{v}}\in\mathcal{W}。Second-order oracle: evaluating the Hessian matrix ∇2L(w)\nabla^{2}L({\bm{w}}), or evaluating the Hessian-vector product (HVP) ∇2L(w)v∈W\nabla^{2}L({\bm{w}}){\bm{v}}\in\mathcal{W}, for LL twice differentiable and any vector v∈W{\bm{v}}\in\mathcal{W}.

给定函数 LL 的一个 oracle O\mathcal{O},便可将优化算法形式化地定义为一个过程:它根据此前与当前的全部信息计算下一个迭代值。形式上,算法 A\mathcal{A} 从起点 w0{\bm{w}}^{0} 出发,构造序列 w1,…,wt{\bm{w}}^{1},\ldots,{\bm{w}}^{t} 如下:Given an oracle O\mathcal{O} for a function LL, 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 A\mathcal{A} builds a sequence w1,…,wt{\bm{w}}^{1},\ldots,{\bm{w}}^{t} from a starting point w0{\bm{w}}^{0} as

wt+1:=A(w0,…,wt,O(w0),…,O(wt),λ),{\bm{w}}^{t+1}\coloneqq\mathcal{A}({\bm{w}}^{0},\ldots,{\bm{w}}^{t},\mathcal{O}({\bm{w}}^{0}),\ldots,\mathcal{O}({\bm{w}}^{t}),{\bm{\lambda}}),

其中 λ∈Λ⊆RQ{\bm{\lambda}}\in\Lambda\subseteq\mathbb{R}^{Q} 封装了算法的若干超参数,例如步长。算法往往只依据当前迭代值处收集到的信息来构造下一个迭代值,而不动用全部过去的迭代值,即它们具有 wt+1=A(wt,O(wt),λ){\bm{w}}^{t+1}=\mathcal{A}({\bm{w}}^{t},\mathcal{O}({\bm{w}}^{t}),{\bm{\lambda}}) 的形式。梯度下降算法便是一个经典例子:它借助一阶 oracle,算出如下形式的迭代值:where λ∈Λ⊆RQ{\bm{\lambda}}\in\Lambda\subseteq\mathbb{R}^{Q} 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 wt+1=A(wt,O(wt),λ){\bm{w}}^{t+1}=\mathcal{A}({\bm{w}}^{t},\mathcal{O}({\bm{w}}^{t}),{\bm{\lambda}}). A classical example is the gradient descent algorithm, which uses a first-order oracle to compute iterates of the form

wt+1:=wt−γ∇L(wt),{\bm{w}}^{t+1}\coloneqq{\bm{w}}^{t}-\gamma\nabla L({\bm{w}}^{t}),

其中步长 γ\gamma 是该算法的一个超参数。可见,oracle 的概念划分出了不同的算法类别。例如,我们可以考虑零阶算法或一阶算法。where the stepsize γ\gamma 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 优化算法的变分视角15.3 Variational perspective of optimization algorithms

最基本的优化算法之一是邻近点方法,它由 wt{\bm{w}}^{t} 按下式产生 wt+1{\bm{w}}^{t+1}:One of the most basic optimization algorithms is the proximal point method, which produces wt+1{\bm{w}}^{t+1} from wt{\bm{w}}^{t} by

wt+1:=arg min⁡w∈WL(w)+12γ∥w−wt∥22.{\bm{w}}^{t+1}\coloneqq\argmin_{{\bm{w}}\in\mathcal{W}}L({\bm{w}})+\frac{1}{2\gamma}\|{\bm{w}}-{\bm{w}}^{t}\|_{2}^{2}.

换言之,下一个迭代值来自在最小化函数 LL 与保持接近 wt{\bm{w}}^{t} 之间所做的权衡。遗憾的是,执行这一参数更新所涉及的优化问题,其难度与原优化问题相当,因而邻近点方法并不实用。In words, the next iterate is produced by solving a trade-off between minimizing the function LL and staying close to wt{\bm{w}}^{t}. Unfortunately, the optimization problem involved in performing this parameter update is as difficult as the original optimization problem, making the proximal point method impractical.

正如我们将在第 16 章和第 17 章中看到的那样,许多优化算法都可以看作邻近点方法的一种近似,其含义是:这些算法求解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

wt+1:=arg min⁡w∈WL~(w,wt)+12γ∥w−wt∥22.{\bm{w}}^{t+1}\coloneqq\argmin_{{\bm{w}}\in\mathcal{W}}\tilde{L}({\bm{w}},{\bm{w}}^{t})+\frac{1}{2\gamma}\|{\bm{w}}-{\bm{w}}^{t}\|_{2}^{2}.

或更一般地,求解or more generally

wt+1:=arg min⁡w∈WL~(w,wt)+1γd(w,wt),{\bm{w}}^{t+1}\coloneqq\argmin_{{\bm{w}}\in\mathcal{W}}\tilde{L}({\bm{w}},{\bm{w}}^{t})+\frac{1}{\gamma}d({\bm{w}},{\bm{w}}^{t}),

其中 L~(w,wt)\tilde{L}({\bm{w}},{\bm{w}}^{t}) 是 L(w)L({\bm{w}}) 在 wt{\bm{w}}^{t} 附近的一个近似,而 d(w,w′)d({\bm{w}},{\bm{w}}^{\prime}) 表示 w{\bm{w}} 与 w′{\bm{w}}^{\prime} 之间的某种距离。对 L~\tilde{L} 与 dd 的不同选择,会导出不同的优化算法以及不同的权衡。where L~(w,wt)\tilde{L}({\bm{w}},{\bm{w}}^{t}) is an approximation of L(w)L({\bm{w}}) around wt{\bm{w}}^{t} and d(w,w′)d({\bm{w}},{\bm{w}}^{\prime}) is some form of distance between w{\bm{w}} and w′{\bm{w}}^{\prime}. Different choices of L~\tilde{L} and dd lead to different optimization algorithms, and to different trade-offs.

15.4 函数类15.4 Classes of functions

在理论上研究算法时,往往可以通过限制到某些函数类来陈述更强的结果。我们在第 2 章中已经讨论了连续函数与可微函数。本节再回顾另外几个重要的函数类。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 函数Lipschitz functions

Lipschitz 连续性是连续性的一种更强形式。直观地说,Lipschitz 连续函数的变化速度是受限的。Lipschitz continuity is a stronger form of continuity. Intuitively, a Lipschitz continuous function is limited in how fast it can change.

定义 15.4.1(Lipschitz 连续函数)。Definition 15.4.1 (Lipschitz-continuous functions).
若函数 g ⁣:W→Fg\colon\mathcal{W}\to\mathcal{F} 是 β\beta-Lipschitz 连续的,则对所有 w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W}A function g ⁣:W→Fg\colon\mathcal{W}\to\mathcal{F} is β\beta-Lipschitz continuous if for all w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W} ∥g(w)−g(v)∥2≤β∥w−v∥2.\|g({\bm{w}})-g({\bm{v}})\|_{2}\leq\beta\|{\bm{w}}-{\bm{v}}\|_{2}.

注意,该定义即使对向量值函数也依然有效。Note that the definition is valid even for vector-valued functions.

关于任意范数With respect to arbitrary norms

得益于 18.1 节中回顾的对偶范数,我们可以基于任意范数而非 22-范数,给出 Lipschitz 连续性的一个更一般的定义。此外,我们还可以考虑在输入定义域的子集上的 Lipschitz 连续性。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 22-norm. Moreover, we may consider Lipschitz-continuity over a subset of the input domain.

定义 15.4.2(关于某个范数的 Lipschitz 连续函数)。Definition 15.4.2 (Lipschitz continuous functions w.r.t. a norm).
称函数 g ⁣:W→Fg\colon\mathcal{W}\to\mathcal{F} 在集合 C⊆W\mathcal{C}\subseteq\mathcal{W} 上关于范数 ∥⋅∥\|\cdot\| 是 β\beta-Lipschitz的,若对所有 w,v∈C{\bm{w}},{\bm{v}}\in\mathcal{C}A function g ⁣:W→Fg\colon\mathcal{W}\to\mathcal{F} is said to be β\beta-Lipschitz w.r.t. a norm ∥⋅∥\|\cdot\| over a set C⊆W\mathcal{C}\subseteq\mathcal{W} if for all w,v∈C{\bm{w}},{\bm{v}}\in\mathcal{C} ∥g(w)−g(v)∥∗≤β∥w−v∥.\|g({\bm{w}})-g({\bm{v}})\|_{*}\leq\beta\|{\bm{w}}-{\bm{v}}\|.

当 ∥⋅∥=∥⋅∥2\|\cdot\|=\|\cdot\|_{2} 时,我们便回到定义 15.4.1,因为 22-范数与其自身对偶。When ∥⋅∥=∥⋅∥2\|\cdot\|=\|\cdot\|_{2}, we recover Definition 15.4.1, since the 22-norm is dual to itself.

15.4.2 光滑函数Smooth functions

若可微函数 LL 的梯度是 β\beta-Lipschitz 连续的,则称该函数是 β\beta-光滑的。在定义 15.4.1 中取 g(w)=∇L(w)g({\bm{w}})=\nabla L({\bm{w}}),便得到如下定义。A differentiable function LL is said to be β\beta-smooth if its gradients are β\beta-Lipschitz continuous. Setting g(w)=∇L(w)g({\bm{w}})=\nabla L({\bm{w}}) in Definition 15.4.1, we obtain the following definition.

定义 15.4.3(光滑函数)。Definition 15.4.3 (Smooth functions).
若可微函数 L ⁣:W→RL\colon\mathcal{W}\to\mathbb{R} 关于 β>0\beta>0 是 β\beta-光滑的,则对所有 w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W}A differentiable function
L ⁣:W→RL\colon\mathcal{W}\to\mathbb{R} is β\beta-smooth for β>0\beta>0 if for all w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W}
∥∇L(w)−∇L(v)∥2≤β∥w−v∥2.\|\nabla L({\bm{w}})-\nabla L({\bm{v}})\|_{2}\leq\beta\|{\bm{w}}-{\bm{v}}\|_{2}.

光滑性保证了:在某个 w{\bm{w}} 处由梯度提供的信息,在 w{\bm{w}} 的邻域内是有意义的,因为其变化有上界。若变化没有上界,那么在任意接近 w{\bm{w}} 的 v{\bm{v}} 处,梯度都可能发生剧烈变化,从而使一阶 oracle 提供的信息可能毫无用处。Smoothness ensures that the information provided by the gradient at some w{\bm{w}} is meaningful in a neighborhood of w{\bm{w}}, since its variations are upper-bounded. If the variations were not bounded, the gradient at v{\bm{v}} arbitrarily close to w{\bm{w}} 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.

命题 15.4.4(光滑函数)。Proposition 15.4.4 (Smooth functions).
若可微函数 L:W→RL:\mathcal{W}\to\mathbb{R} 是 β\beta-光滑的,则对所有 w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W},If a differentiable function L:W→RL:\mathcal{W}\to\mathbb{R} is β\beta-smooth then for all w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W}, ∣L(w)−L(v)+⟨∇L(v),w−v⟩∣≤β2∥w−v∥22.|L({\bm{w}})-L({\bm{v}})+\langle\nabla L({\bm{v}}),{\bm{w}}-{\bm{v}}\rangle|\leq\frac{\beta}{2}\|{\bm{w}}-{\bm{v}}\|_{2}^{2}. 特别地,有In particular, we have L(w)≤L(v)+⟨∇L(v),w−v⟩+β2∥w−v∥22.L({\bm{w}})\leq L({\bm{v}})+\langle\nabla L({\bm{v}}),{\bm{w}}-{\bm{v}}\rangle+\frac{\beta}{2}\|{\bm{w}}-{\bm{v}}\|_{2}^{2}.
证明 15.4.5。Proof 15.4.5.

这一结论是通过利用目标函数沿 w−v{\bm{w}}-{\bm{v}} 的积分表示来界定 ∣L(v)−L(w)−⟨∇L(w),v−w⟩∣|L({\bm{v}})-L({\bm{w}})-\langle\nabla L({\bm{w}}),{\bm{v}}-{\bm{w}}\rangle| 而得到的,即 ∣L(v)−L(w)−⟨∇L(w),v−w⟩∣=∣∫01⟨∇L(w+s(v−w)),v−w⟩ds−⟨∇L(w),v−w⟩∣≤∫01∥∇L(w+s(v−w))−∇L(w)∥2ds∥v−w∥2≤β∥w−v∥22/2|L({\bm{v}})-L({\bm{w}})-\langle\nabla L({\bm{w}}),{\bm{v}}-{\bm{w}}\rangle|=|\int_{0}^{1}\langle\nabla L({\bm{w}}+s({\bm{v}}-{\bm{w}})),{\bm{v}}-{\bm{w}}\rangle ds-\langle\nabla L({\bm{w}}),{\bm{v}}-{\bm{w}}\rangle|\leq\int_{0}^{1}\|\nabla L({\bm{w}}+s({\bm{v}}-{\bm{w}}))-\nabla L({\bm{w}})\|_{2}ds\|{\bm{v}}-{\bm{w}}\|_{2}\leq\beta\|{\bm{w}}-{\bm{v}}\|_{2}^{2}/2,其中最后一个不等式来自光滑性假设与标准积分。This is shown by bounding ∣L(v)−L(w)−⟨∇L(w),v−w⟩∣|L({\bm{v}})-L({\bm{w}})-\langle\nabla L({\bm{w}}),{\bm{v}}-{\bm{w}}\rangle| using the integral representation of the objective along w−v{\bm{w}}-{\bm{v}}, i.e., ∣L(v)−L(w)−⟨∇L(w),v−w⟩∣=∣∫01⟨∇L(w+s(v−w)),v−w⟩ds−⟨∇L(w),v−w⟩∣≤∫01∥∇L(w+s(v−w))−∇L(w)∥2ds∥v−w∥2≤β∥w−v∥22/2|L({\bm{v}})-L({\bm{w}})-\langle\nabla L({\bm{w}}),{\bm{v}}-{\bm{w}}\rangle|=|\int_{0}^{1}\langle\nabla L({\bm{w}}+s({\bm{v}}-{\bm{w}})),{\bm{v}}-{\bm{w}}\rangle ds-\langle\nabla L({\bm{w}}),{\bm{v}}-{\bm{w}}\rangle|\leq\int_{0}^{1}\|\nabla L({\bm{w}}+s({\bm{v}}-{\bm{w}}))-\nabla L({\bm{w}})\|_{2}ds\|{\bm{v}}-{\bm{w}}\|_{2}\leq\beta\|{\bm{w}}-{\bm{v}}\|_{2}^{2}/2, where the last inequality follows from the smoothness assumption and standard integration.

换言之,L(w)L({\bm{w}}) 在 v{\bm{v}} 附近被 w{\bm{w}} 的二次函数从上下两侧界定。我们将在 16.1 节中看到,这一刻画引出了关于梯度下降的变分视角。In other words, L(w)L({\bm{w}}) is upper-bounded and lower-bounded around v{\bm{v}} by a quadratic function of w{\bm{w}}. We will see in Section 16.1 that this characterization gives rise to a variational perspective on gradient descent.

关于任意范数With respect to arbitrary norms

我们可以把定义 15.4.3 中光滑性的定义推广到任意范数。We can generalize the definition of smoothness in Definition 15.4.3 to arbitrary norms.

定义 15.4.6(关于范数的光滑函数)。Definition 15.4.6 (Smooth functions w.r.t. a norm).
称函数 L:W→RL:\mathcal{W}\to\mathbb{R} 在集合 C\mathcal{C} 上关于范数 ∥⋅∥\|\cdot\| 是 β\beta-光滑的,若对所有 w,v∈C{\bm{w}},{\bm{v}}\in\mathcal{C}A function L:W→RL:\mathcal{W}\to\mathbb{R} is β\beta-smooth w.r.t. a norm ∥⋅∥\|\cdot\| over a set C\mathcal{C} if for all w,v∈C{\bm{w}},{\bm{v}}\in\mathcal{C} ∥∇L(w)−∇L(v)∥∗≤β2∥w−v∥.\|\nabla L({\bm{w}})-\nabla L({\bm{v}})\|_{*}\leq\frac{\beta}{2}\|{\bm{w}}-{\bm{v}}\|.

下面给出一种等价的刻画,它把命题 15.4.4 推广到任意范数(例如参见 [18, 定理 5.8])。An equivalent characterization, generalizing Proposition 15.4.4 to arbitrary norms, is given below (see, e.g. [18, Theorem 5.8]).

命题 15.4.7(关于范数的光滑函数)。Proposition 15.4.7 (Smooth functions w.r.t. a norm).
若可微函数 L:W→RL:\mathcal{W}\to\mathbb{R} 在集合 C\mathcal{C} 上关于范数 ∥⋅∥\|\cdot\| 是 β\beta-光滑的,则对所有 w,v∈C{\bm{w}},{\bm{v}}\in\mathcal{C},If a differentiable function L:W→RL:\mathcal{W}\to\mathbb{R} is β\beta-smooth w.r.t. a norm ∥⋅∥\|\cdot\| over a set C\mathcal{C}, then for all w,v∈C{\bm{w}},{\bm{v}}\in\mathcal{C} ∣L(w)−L(v)−⟨∇L(v),w−v⟩⏟BL(w,v)∣≤β2∥w−v∥2,|\underbrace{L({\bm{w}})-L({\bm{v}})-\langle\nabla L({\bm{v}}),{\bm{w}}-{\bm{v}}\rangle}_{B_{L}({\bm{w}},{\bm{v}})}|\leq\frac{\beta}{2}\|{\bm{w}}-{\bm{v}}\|^{2}, 其中 BLB_{L} 是由 LL 生成的 Bregman 散度(定义 18.3.1)。where BLB_{L} is the Bregman divergence generated by LL (Definition 18.3.1).

15.4.3 凸函数Convex functions

凸函数是指这样的函数:它在两个或更多点的平均值处的取值,小于这些点处函数值的平均值。图 15.3 对此作了图示,下面给出形式化表述。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.3 and formalized below.

定义 15.4.8(凸函数)。Definition 15.4.8 (Convex functions).
称函数 L:W→RL:\mathcal{W}\rightarrow\mathbb{R} 是凸的,若对所有 w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W} 和 τ∈[0,1]\tau\in[0,1],A function L:W→RL:\mathcal{W}\rightarrow\mathbb{R} is said to be convex if for all w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W} and τ∈[0,1]\tau\in[0,1] L(τw+(1−τ)v)≤τL(w)+(1−τ)L(v).L(\tau{\bm{w}}+(1-\tau){\bm{v}})\leq\tau L({\bm{w}})+(1-\tau)L({\bm{v}}). 若上述不等式对所有 w≠v{\bm{w}}\neq{\bm{v}} 严格成立,则函数 LL 是严格凸的。The function LL is strictly convex if the above inequality is strict for all w≠v{\bm{w}}\neq{\bm{v}}.

上述刻画可以很容易地推广到多个点。具体而言,对 w1,…,wn∈W{\bm{w}}_{1},\ldots,{\bm{w}}_{n}\in\mathcal{W} 与 τ1,…,τn≥0\tau_{1},\ldots,\tau_{n}\geq 0,若 ∑i=1nτi=1\sum_{i=1}^{n}\tau_{i}=1(即 τ1,…,τn\tau_{1},\ldots,\tau_{n} 定义了 [n])[n]) 上的一个概率分布),则当 LL 为凸函数时,有The above characterization can easily be generalized to multiple points. Namely, for w1,…,wn∈W{\bm{w}}_{1},\ldots,{\bm{w}}_{n}\in\mathcal{W} and τ1,…,τn≥0\tau_{1},\ldots,\tau_{n}\geq 0 such that ∑i=1nτi=1\sum_{i=1}^{n}\tau_{i}=1 (that is, τ1,…,τn\tau_{1},\ldots,\tau_{n} defines a probability distribution over [n])[n]), we have if LL is convex that

L(∑i=1nτiwi)≤∑i=1nτiL(wi).L\left(\sum_{i=1}^{n}\tau_{i}{\bm{w}}_{i}\right)\leq\sum_{i=1}^{n}\tau_{i}L({\bm{w}}_{i}).

点 ∑i=1nτiwi\sum_{i=1}^{n}\tau_{i}{\bm{w}}_{i} 称为凸组合。这可以看作是把函数在平均点处的取值与这些点处函数值的平均值进行比较,并且可以进一步推广到任意随机变量。The point ∑i=1nτiwi\sum_{i=1}^{n}\tau_{i}{\bm{w}}_{i} 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.

命题 15.4.9(Jensen 不等式)。Proposition 15.4.9 (Jensen’s inequality).
称函数 L ⁣:W→RL\colon\mathcal{W}\rightarrow\mathbb{R} 是凸的,若它满足 Jensen 不等式,即对 W\mathcal{W} 上的任意随机变量 WW,A function L ⁣:W→RL\colon\mathcal{W}\rightarrow\mathbb{R} is convex if it satisfies Jensen’s inequality, that is, for any random variable WW on W\mathcal{W}, L(E[W])≤E[L(W)],L(\mathbb{E}[W])\leq\mathbb{E}[L(W)], 前提是期望是良定义的。provided that the expectations are well-defined.

若所考虑的函数可微,则凸性还有一种刻画方式:考察该函数的线性近似如何从下方界定该函数。图 15.3 对此作了图示,下面给出形式化表述。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.3 and formalized below.

定义 15.4.10(凸的可微函数)。Definition 15.4.10 (Convex differentiable functions).
可微函数 L:W→RL:\mathcal{W}\rightarrow\mathbb{R} 是凸的,当且仅当对所有 w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W},A differentiable function L:W→RL:\mathcal{W}\rightarrow\mathbb{R} is convex if and only if for all w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W} L(v)≥L(w)+⟨∇L(w),v−w⟩.L({\bm{v}})\geq L({\bm{w}})+\langle\nabla L({\bm{w}}),{\bm{v}}-{\bm{w}}\rangle. 函数 LL 是严格凸的,当且仅当上述不等式对任意 w≠v{\bm{w}}\neq{\bm{v}} 严格成立。The function LL is strictly convex if and only if the above inequality is strict for any w≠v{\bm{w}}\neq{\bm{v}}.

上述刻画点明了凸函数在优化中的重要性:如果我们能找到一个梯度为零的点 w^\hat{\bm{w}},那么我们就知道已经找到了最小值,因为此时有The above characterization pinpoints the relevance of convex functions in optimization: if we can find a point w^\hat{\bm{w}} with null gradient, then we know that we have found the minimum as we have

∇L(w^)=0  ⟹  ∀v∈RP, L(v)≥L(w^)  ⟹  L(w^)=L⋆.\nabla L(\hat{\bm{w}})={\mathbf{0}}\implies\forall{\bm{v}}\in\mathbb{R}^{P},\ L({\bm{v}})\geq L(\hat{\bm{w}})\implies L(\hat{\bm{w}})=L^{\star}.

这意味着,只要能够获得函数的梯度或梯度的近似,我们就有了一个充分判据,用以判断是否找到了全局最小值。在对光滑函数进行梯度下降的情形下,凸性保证以次线性速率收敛到最小值,具体如下所述。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.

最后,若函数二次可微,则函数的凸性可以用该函数的 Hessian 矩阵来刻画。Finally, if the function is twice differentiable, convexity of a function can be characterized in terms of the Hessian of the function.

命题 15.4.11(凸的二次可微函数)。Proposition 15.4.11 (Convex twice differentiable functions).
二次可微函数 L:W→RL:\mathcal{W}\rightarrow\mathbb{R} 是凸的,当且仅当其 Hessian 矩阵是半正定的,A twice differentiable function L:W→RL:\mathcal{W}\rightarrow\mathbb{R} is convex if and only if its Hessian is positive semi-definite, ∀w∈W, ∇2L(w)⪰0, i.e., ∀w,v∈W, ⟨v,∇2L(w)v⟩≥0.\forall{\bm{w}}\in\mathcal{W},\ \nabla^{2}L({\bm{w}})\succeq 0,\ \text{i.e.},\ \forall{\bm{w}},{\bm{v}}\in\mathcal{W},\ \langle{\bm{v}},\nabla^{2}L({\bm{w}}){\bm{v}}\rangle\geq 0. 函数 LL 是严格凸的,当且仅当其 Hessian 矩阵是正定的,∀w∈W, ∇2L(w)≻0\forall{\bm{w}}\in\mathcal{W},\ \nabla^{2}L({\bm{w}})\succ 0,即 ∀w,v∈W\forall{\bm{w}},{\bm{v}}\in\mathcal{W},⟨v,∇2L(w)v⟩>0\langle{\bm{v}},\nabla^{2}L({\bm{w}}){\bm{v}}\rangle>0。The function LL is strictly convex if and only if the Hessian is positive-definite, ∀w∈W, ∇2L(w)≻0\forall{\bm{w}}\in\mathcal{W},\ \nabla^{2}L({\bm{w}})\succ 0, i.e., ∀w,v∈W\forall{\bm{w}},{\bm{v}}\in\mathcal{W}, ⟨v,∇2L(w)v⟩>0\langle{\bm{v}},\nabla^{2}L({\bm{w}}){\bm{v}}\rangle>0.

15.4.4 强凸函数Strongly-convex functions

凸性也可以通过考虑 μ\mu-强凸函数来加强。Convexity can also be strengthened by considering μ\mu-strongly convex functions.

定义 15.4.12(强凸函数)。Definition 15.4.12 (Strongly-convex functions).
称函数 L:W→RL:\mathcal{W}\rightarrow\mathbb{R} 是 μ\mu-强凸的(其中 μ>0\mu>0),若对所有 w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W} 和 τ∈[0,1]\tau\in[0,1],A function L:W→RL:\mathcal{W}\rightarrow\mathbb{R} is μ\mu-strongly convex for μ>0\mu>0 if for all w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W} and τ∈[0,1]\tau\in[0,1] L(τw+(1−τ)v)≤τL(w)+(1−τ)L(v)−μ2τ(1−τ)∥w−v∥22.L(\tau{\bm{w}}+(1-\tau){\bm{v}})\leq\tau L({\bm{w}})+(1-\tau)L({\bm{v}})-\frac{\mu}{2}\tau(1-\tau)\|{\bm{w}}-{\bm{v}}\|^{2}_{2}. 可微函数 LL 是 μ\mu-强凸的,当且仅当对所有 w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W},A differentiable function LL is μ\mu-strongly convex if and only if for all w,v∈W{\bm{w}},{\bm{v}}\in\mathcal{W} L(v)≥L(w)+⟨∇L(w),w−v⟩+μ2∥w−v∥22.L({\bm{v}})\geq L({\bm{w}})+\langle\nabla L({\bm{w}}),{\bm{w}}-{\bm{v}}\rangle+\frac{\mu}{2}\|{\bm{w}}-{\bm{v}}\|_{2}^{2}. 二次可微函数是 μ\mu-强凸的,当且仅当其Hessian 矩阵满足A twice differentiable function is μ\mu-strongly convex if and only if its Hessian satisfies ∀w∈W, ∇2L(w)⪰μI⁡, i.e., ∀w,v∈W, ⟨v,∇2L(w)v⟩≥μ∥v∥22.\forall{\bm{w}}\in\mathcal{W},\ \nabla^{2}L({\bm{w}})\succeq\mu\operatorname{I},\ \text{i.e.},\ \forall{\bm{w}},{\bm{v}}\in\mathcal{W},\ \langle{\bm{v}},\nabla^{2}L({\bm{w}}){\bm{v}}\rangle\geq\mu\|{\bm{v}}\|_{2}^{2}.

关于可微函数的强凸性刻画指出,L(w)L({\bm{w}}) 被一个二次函数从下方界定。这使得我们能够设计具有线性收敛性的算法,后文将对此加以说明。我们自然地有如下蕴含关系The characterization of strong convexity for differentiable functions states that L(w)L({\bm{w}}) is lower-bounded by a quadratic. This enables the design of linearly convergent algorithms as explained later. We naturally have the implications

L strongly convex  ⟹  L strictly convex  ⟹  L convex.\text{$L$ strongly convex}\implies\text{$L$ strictly convex}\implies\text{$L$ convex}.

关于任意范数With respect to arbitrary norms

一个函数可以关于任意范数强凸,只需将定义 15.4.12 中的 22-范数换成该范数即可。对于可微的强凸函数,我们还有如下另一种刻画,它将定义 15.4.12 推广到了任意范数。A function can be strongly convex w.r.t. an arbitrary norm, simply by replacing the 22-norm in Definition 15.4.12 with that norm. For differentiable strongly convex functions, we have the following alternative characterization, generalizing Definition 15.4.12 to arbitrary norms.

命题 15.4.13(可微的强凸函数)。Proposition 15.4.13 (Differentiable strongly-convex functions).
若可微函数 L:W→RL:\mathcal{W}\rightarrow\mathbb{R} 在集合 C\mathcal{C} 上关于范数 ∥⋅∥\|\cdot\| 是 μ\mu-强凸的,则对所有 w,v∈C{\bm{w}},{\bm{v}}\in\mathcal{C},If a differentiable function L:W→RL:\mathcal{W}\rightarrow\mathbb{R} is μ\mu-strongly convex w.r.t. a norm ∥⋅∥\|\cdot\| over a set C\mathcal{C}, then for all w,v∈C{\bm{w}},{\bm{v}}\in\mathcal{C} μ2∥w−v∥2≤L(w)−L(v)−⟨∇L(v),w−v⟩⏟BL(w,v).\frac{\mu}{2}\|{\bm{w}}-{\bm{v}}\|^{2}\leq\underbrace{L({\bm{w}})-L({\bm{v}})-\langle\nabla L({\bm{v}}),{\bm{w}}-{\bm{v}}\rangle}_{B_{L}({\bm{w}},{\bm{v}})}.

显而易见,若函数 LL 是 μ\mu-强凸的,则 λL\lambda L 是 (μλ)(\mu\lambda)-强凸的。由于所有范数彼此等价,一个函数若关于某一范数强凸,则它关于另一范数也必然强凸。不过,明确指出强凸性所依据的范数,往往能给出更好的常数 μ\mu(就例如梯度下降的收敛速率而言,该常数越大越好)。我们还要强调,指明强凸性在哪个集合上成立同样十分重要。下面给出几个例子。Obviously, if a function LL is μ\mu-strongly convex, then, λL\lambda L is (μλ)(\mu\lambda)-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 μ\mu (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.

例 15.4.14(强凸函数)。Example 15.4.14 (Strongly convex functions).
函数 f(u)=12∥u∥22f({\bm{u}})=\frac{1}{2}\|{\bm{u}}\|^{2}_{2} 在 RM\mathbb{R}^{M} 上关于 ∥⋅∥2\|\cdot\|_{2} 是 11-强凸的。The function f(u)=12∥u∥22f({\bm{u}})=\frac{1}{2}\|{\bm{u}}\|^{2}_{2} is 11-strongly convex w.r.t. ∥⋅∥2\|\cdot\|_{2} over RM\mathbb{R}^{M}. 函数 f(u)=⟨u,log⁡u⟩f({\bm{u}})=\langle{\bm{u}},\log{\bm{u}}\rangle 在 △M\triangle^{M} 上关于 ∥⋅∥1\|\cdot\|_{1} 是 11-强凸的。应用命题 15.4.13,可得对所有 p,q∈△M{\bm{p}},{\bm{q}}\in\triangle^{M}The function f(u)=⟨u,log⁡u⟩f({\bm{u}})=\langle{\bm{u}},\log{\bm{u}}\rangle is 11-strongly convex w.r.t. ∥⋅∥1\|\cdot\|_{1} over △M\triangle^{M}. Applying Proposition 15.4.13, we obtain for all p,q∈△M{\bm{p}},{\bm{q}}\in\triangle^{M} 12∥p−q∥12≤Bf(p,q)=KL(p,q),\frac{1}{2}\|{\bm{p}}-{\bm{q}}\|_{1}^{2}\leq B_{f}({\bm{p}},{\bm{q}})=\mathrm{KL}({\bm{p}},{\bm{q}}), 这就是所谓的 Pinsker 不等式。我们在图 15.1 中对该不等式进行了实证验证。which is known as Pinsker’s inequality. We empirically verify the inequality in Fig. 15.1. 更一般地,f(u)f({\bm{u}}) 在任意满足 μ=sup⁡u∈C∥u∥1\mu=\sup_{{\bm{u}}\in\mathcal{C}}\|{\bm{u}}\|_{1} 的有界集合 C⊂R+M\mathcal{C}\subset\mathbb{R}^{M}_{+} 上关于 ∥⋅∥1\|\cdot\|_{1} 是 1μ\frac{1}{\mu}-强凸的 [26]。然而,它在 R+M\mathbb{R}^{M}_{+} 上不是强凸的,因为该集合不是有界的。More generally, f(u)f({\bm{u}}) is 1μ\frac{1}{\mu}-strongly convex w.r.t. ∥⋅∥1\|\cdot\|_{1} over any bounded set C⊂R+M\mathcal{C}\subset\mathbb{R}^{M}_{+} such that μ=sup⁡u∈C∥u∥1\mu=\sup_{{\bm{u}}\in\mathcal{C}}\|{\bm{u}}\|_{1} [26]. However, it is not strongly convex over R+M\mathbb{R}^{M}_{+}, as it is not bounded.
图 15.1:Pinsker 不等式 12∥p−q∥12≤KL(p,q)\frac{1}{2}\|{\bm{p}}-{\bm{q}}\|_{1}^{2}\leq\mathrm{KL}({\bm{p}},{\bm{q}}) 的图示验证,其中 p:=(π,1−π){\bm{p}}\coloneqq(\pi,1-\pi),q:=(0.3,0.7){\bm{q}}\coloneqq(0.3,0.7)。Figure 15.1: Graphical verification of Pinsker’s inequality, 12∥p−q∥12≤KL(p,q)\frac{1}{2}\|{\bm{p}}-{\bm{q}}\|_{1}^{2}\leq\mathrm{KL}({\bm{p}},{\bm{q}}), with p:=(π,1−π){\bm{p}}\coloneqq(\pi,1-\pi) and q:=(0.3,0.7){\bm{q}}\coloneqq(0.3,0.7).

15.4.5 非凸函数Nonconvex functions

一般而言,函数的最小值点必然具有零梯度,即In general, the minimum of a function necessarily has a null gradient, that is,

w⋆∈arg min⁡w∈WL(w)  ⟹  ∇L(w⋆)=0.{\bm{w}}^{\star}\in\argmin_{{\bm{w}}\in\mathcal{W}}L({\bm{w}})\implies\nabla L({\bm{w}}^{\star})=0.

为看清这一点,考虑函数 F:t→L(w⋆−t∇L(w⋆))F:t\rightarrow L({\bm{w}}^{\star}-t\nabla L({\bm{w}}^{\star}))。若 ∇L(w⋆)≠0\nabla L({\bm{w}}^{\star})\neq 0,则 F′(0)=−∥∇L(w⋆)∥22≠0F^{\prime}(0)=-\|\nabla L({\bm{w}}^{\star})\|_{2}^{2}\neq 0。因此存在一个很小的 t>0t>0,使得 F(t)<F(0)F(t)<F(0),也就是 L(w⋆)L({\bm{w}}^{\star}) 并非最小值点。然而,若函数不是凸的,其逆命题先验地并不成立:找到一个梯度为零的点,并不足以保证我们已经找到了全局最小值,如图 15.3 所示。To see this, consider the function F:t→L(w⋆−t∇L(w⋆))F:t\rightarrow L({\bm{w}}^{\star}-t\nabla L({\bm{w}}^{\star})). If ∇L(w⋆)≠0\nabla L({\bm{w}}^{\star})\neq 0, then F′(0)=−∥∇L(w⋆)∥22≠0F^{\prime}(0)=-\|\nabla L({\bm{w}}^{\star})\|_{2}^{2}\neq 0. Therefore, there exists a small t>0t>0 such that F(t)<F(0)F(t)<F(0), i.e., L(w⋆)L({\bm{w}}^{\star}) 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.

对于非凸函数,梯度为零的点称为驻点。驻点可能对应局部极大值,也可能对应局部极小值。形式上,w^\hat{\bm{w}} 是局部极小值点,当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, w^\hat{\bm{w}} is a local minimum if

∃r>0, s.t. ∀v∈W satisfying ∥v−w^∥≤r, we have L(v)≥L(w^).\exists r>0,\ \text{s.t.}\ \forall{\bm{v}}\in\mathcal{W}\ \text{satisfying}\ \|{\bm{v}}-\hat{\bm{w}}\|\leq r,\ \text{we have}\ L({\bm{v}})\geq L(\hat{\bm{w}}).

局部极大值的定义与此类似,只是要求 w^\hat{\bm{w}} 的某个邻域内 L(v)≤L(w^)L({\bm{v}})\leq L(\hat{\bm{w}})。因此,对于非凸函数,收敛速率通常以梯度范数 ∥∇L(wt)∥2\|\nabla L({\bm{w}}^{t})\|_{2} 趋于 00 的收敛性来表示。这类理论结果并不能保证收敛到全局最小值,而只能保证收敛到这样一点:仅凭梯度信息,先验地可能无法再取得任何进展。A local maximum is defined similarly, except that L(v)≤L(w^)L({\bm{v}})\leq L(\hat{\bm{w}}) in a neighborhood of w^\hat{\bm{w}}. For non-convex functions, convergence rates are therefore generally expressed in terms of convergence of the norm of the gradient ∥∇L(wt)∥2\|\nabla L({\bm{w}}^{t})\|_{2} towards 00. 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.

图 15.2:凸函数:任意割线都位于函数图像上方,任意切线都位于函数图像下方,梯度为零的点即最小值点。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.
图 15.3:非凸函数:梯度为零的点未必是全局最小值点。Figure 15.3: Non-convex function: a point with zero gradient is not necessarily the global minimum.

15.5 性能保证15.5 Performance guarantees

对于给定的函数类,我们可以把算法的性能定义为:该算法找到一个如式 15.1 所示的 ε\varepsilon-精确解所需的迭代次数。这称为算法的计算复杂度,记为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 ε\varepsilon-accurate solution as in Eq. 15.1. This is called the computational complexity of the algorithm, denoted

t=T(ε).t=T(\varepsilon).

或者,算法的性能也可以用收敛速率来表述,即在 tt 次迭代后算法所达到的精度,Alternatively, the performance of an algorithm can be stated in terms of convergence rate, i.e., the accuracy that the algorithm reaches after tt iterations,

ε=R(t),\varepsilon=R(t),

其中 RR 是一个随 t→+∞t\rightarrow+\infty 趋于零的递减正函数。通常,RR 会包含被极小化的函数的性质(例如其光滑性常数 β\beta),以及关于初始点的信息(例如其函数值)。相应地,计算复杂度 T(ε)T(\varepsilon) 则定义为满足 R(t)≤εR(t)\leq\varepsilon 所需的最小迭代次数 tt,where RR is a decreasing positive function vanishing as t→+∞t\rightarrow+\infty. Usually, RR incorporates properties of the function minimized, such as its smoothness constant β\beta and information on the initial point, such as its function value. The corresponding computational complexity T(ε)T(\varepsilon) is then given as the minimum number of iterations tt such that R(t)≤εR(t)\leq\varepsilon,

T(ε)=min⁡{t∈N ⁣:R(t)≤ε}.T(\varepsilon)=\min\{t\in\mathbb{N}\colon R(t)\leq\varepsilon\}.

收敛速率一般可以通过考察第 tt 次迭代的进展比来分类,该比值定义为Convergence rates can generally be classified by considering the progress ratio on iteration tt, defined by

ρt:=R(t)R(t−1).\rho_{t}\coloneqq\frac{R(t)}{R(t-1)}.

渐近收敛速率则定义为The asymptotic convergence rate is then defined by

ρ∞:=lim⁡t→+∞ρt.\rho_{\infty}\coloneqq\lim_{t\rightarrow+\infty}\rho_{t}.

我们可以按如下方式对速率进行分类。We can classify the rates as follows.

  1. 1.

    次线性收敛速率,ρ∞=1\rho_{\infty}=1:算法运行得越久,进展越慢。也就是说,随着 t→+∞t\rightarrow+\infty,相对进展最终趋于停滞。属于这一类的 R(t)R(t) 的例子包括 O(1/t),O(1/t2)O(1/t),O(1/t^{2}),或者更一般地,对某个 α>0\alpha>0 有 O(1/tα)O(1/t^{\alpha})。这等价于 T(ε)=O(ε−1/α)T(\varepsilon)=O(\varepsilon^{-1/\alpha})。Sublinear convergence rates, ρ∞=1\rho_{\infty}=1: the longer the algorithm runs, the slower it makes progress. That is, the relative progress eventually tends to stall as t→+∞t\rightarrow+\infty. Examples of R(t)R(t) in this category include O(1/t),O(1/t2)O(1/t),O(1/t^{2}) or more generally O(1/tα)O(1/t^{\alpha}) for some α>0\alpha>0. This is equivalent to T(ε)=O(ε−1/α)T(\varepsilon)=O(\varepsilon^{-1/\alpha}).

  2. 2.

    线性收敛速率,ρ∞=c∈(0,1)\rho_{\infty}=c\in(0,1):算法最终会在每次迭代时达到恒定的相对进展状态,从而给出 cc 的总体速率 R(t)=O(exp⁡(−ct))R(t)=O(\exp(-ct)),具体取决于目标函数的性质。这对应 T(ε)=O(c−1ln⁡ε−1)T(\varepsilon)=O(c^{-1}\ln\varepsilon^{-1})。Linear convergence rates, ρ∞=c∈(0,1)\rho_{\infty}=c\in(0,1): the algorithm eventually reaches a state of constant relative progress at each iteration, leading to an overall rate R(t)=O(exp⁡(−ct))R(t)=O(\exp(-ct)) for cc depending on the properties of the objective. This corresponds to T(ε)=O(c−1ln⁡ε−1)T(\varepsilon)=O(c^{-1}\ln\varepsilon^{-1}).

  3. 3.

    超线性收敛速率,ρ∞=0\rho_{\infty}=0:每次新的迭代中相对进展都更好。例如,R(t)=O(exp⁡(−t2))R(t)=O(\exp(-t^{2})) 时便可能发生这种情况,从而导致 T(ε)=O(ln⁡ε−1)T(\varepsilon)=O(\sqrt{\ln\varepsilon^{-1}});或者 R(t)=O(exp⁡(−2t))R(t)=O(\exp(-2^{t})),这专门称为二次速率,会导致 T(ε)=O(ln⁡ln⁡ε−1)T(\varepsilon)=O(\ln\ln\varepsilon^{-1})。Superlinear convergence rates, ρ∞=0\rho_{\infty}=0: the relative progress is better at each new iteration. This can happen for, e.g., R(t)=O(exp⁡(−t2))R(t)=O(\exp(-t^{2})), leading to T(ε)=O(ln⁡ε−1)T(\varepsilon)=O(\sqrt{\ln\varepsilon^{-1}}), or R(t)=O(exp⁡(−2t))R(t)=O(\exp(-2^{t})), which is specifically called a quadratic rate, leading to T(ε)=O(ln⁡ln⁡ε−1)T(\varepsilon)=O(\ln\ln\varepsilon^{-1}).

这一点如图 15.4 所示。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.

图 15.4:左:收敛速率。右:进展比。具有次线性收敛速率的算法最终会停止取得进展。具有线性收敛速率的算法最终会达到恒定进展的状态。具有超线性收敛速率的算法在每次迭代后取得的进展更快。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

一类算法在给定 oracle(例如一阶 oracle)下所能达到的最佳性能,可以由上界或下界来刻画。由此可以证明:一个只能访问某一类 oracle 的算法,在理论上不可能优于某个数值。例如,对于限制在 [0,1]P[0,1]^{P} 上的 β\beta-光滑函数,使用一阶 oracle 进行极小化的计算复杂度下界为 cεP\frac{c}{\varepsilon^{P}} [143, 1.1.7]。例如,取 P=10P=10 和 ε=10−3\varepsilon=10^{-3} 时,这给出 103010^{30} 次迭代。注意,这些结果在构造上就是悲观的。对于该函数类的某个具体实例,算法的实际性能可能远好于这种最坏情形——诸如拟牛顿法之类的常用算法便是如此。通过进一步把函数类限制为凸函数,可以获得更好的计算复杂度;凸函数在优化以及许多其他领域中扮演着核心角色。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 β\beta-smooth functions restricted on [0,1]P[0,1]^{P} with first-order oracles is lower bounded by cεP\frac{c}{\varepsilon^{P}} [143, 1.1.7]. For example, with P=10P=10 and ε=10−3\varepsilon=10^{-3}, this gives 103010^{30} 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

对于光滑强凸函数类,最佳一阶算法的计算复杂度(在常数因子和对数因子意义下)比最佳零阶算法好 PP 倍 [146, 147]。这一理论比较表明:虽然对于低维问题 PP,零阶优化算法的表现可能与一阶优化算法相当,但对于高维问题,即 P≫1P\gg 1,它们可能慢得多。For the class of smooth strongly convex functions, the computational complexity of the best first-order algorithm is (up to constant and logarithmic factors) PP times better than that of the best zero-order algorithm [146, 147]. 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 PP, they can be much slower for high dimensional problems, i.e., P≫1P\gg 1.

在不同的设定下,例如使用随机 oracle [58] 或针对不同的函数类,可能会得到略有不同的比较结果,例如以 P\sqrt{P} 因子代替 PP。然而,在当前所考虑的框架中,同样的结论依然成立:一阶优化算法能够给出与维数无关的快速速率,而零阶优化算法的速率通常依赖于问题的维数,因此不适合高维问题。In different settings, for example with stochastic oracles [58] or for different classes of functions, slightly different comparisons may be achieved, such as a P\sqrt{P} factor instead of PP. 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.

这解释了一阶算法在训练神经网络方面取得的巨大成功。幸运的是,借助第 8 章所研究的反向模式自动微分,可以证明计算梯度的复杂度与计算函数本身的复杂度大致相同(见 8.3.3 节)。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 小结15.6 Summary

  • •

    我们所能获得的关于某个函数的信息,可以用 oracle 这一概念来形式化。零阶 oracle 只能对函数求值;一阶 oracle 还能计算梯度;二阶 oracle 还能计算Hessian 矩阵或Hessian 矩阵—向量乘积(HVP)。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.