Start one unit from the minimum along each axis. A learning rate of 0.01 takes the steep coordinate straight to zero while the shallow coordinate moves only one hundredth of a unit. Raising the rate to 0.03 barely helps the shallow coordinate and doubles the error in the steep one. Both outcomes follow from the same multiplication.从离最低点横、纵各一个单位的位置出发。学习率取 0.01,陡峭方向一步就到了零,平缓方向却只走了百分之一个单位。把学习率调到 0.03,平缓方向也只多走了一点,陡峭方向的误差反而翻倍。两种结果都可以由一道乘法算出来。

One learning rate, two curvatures一个学习率,两种曲率

The Hessian, the matrix of second derivatives, is diagonal with eigenvalues 1 and 100. Its eigenvalues measure how quickly the slope changes in the two principal directions. For this bowl the smallest and largest curvatures are and , so the condition number is 100. The minimizer is the origin.二阶偏导数组成的矩阵叫作 Hessian 矩阵。本例中它是对角矩阵,两个特征值 1 和 100 表示沿两条主轴移动时,斜率变化的快慢。最小曲率为 ,最大曲率为 ,最大曲率与最小曲率之比 称为条件数。函数在原点取得最小值。

Gradient descent subtracts the gradient multiplied by a positive step size η. Project the error onto a Hessian eigenvector with eigenvalue λ, and call that scalar error e. In this direction the gradient component is . Repeated substitution gives the error after any number of steps.梯度下降沿负梯度走一步,步长系数记作 η。把当前位置与最优点的差投影到特征值为 λ 的方向上,记这个分量为 e,梯度在该方向的分量就是 。把同一个更新式反复代入,便能算出任意一步的误差。

Contraction along every axis requires , hence . A negative factor flips the sign of the error and sends the path across the valley. To minimize the largest absolute factor for a fixed step, set equal to . The two endpoint directions then contract at the same rate.要让每个方向的误差都缩小,须有 ,因此 。因子为负时,误差翻转符号,轨迹就越过谷底。若只能使用一个固定步长,可令两端的因子等大反号,即让 等于 。这样能使收缩最慢的方向也尽可能快。

What one previous displacement buys保留上一步位移有什么用

Polyak’s heavy-ball method adds a fraction β of the previous displacement to the gradient step. Directions that repeatedly agree accumulate speed. On our quadratic, a guess of the form turns a two-step memory into a quadratic equation. The magnitudes of its two roots govern long-run decay.Polyak 重球法把上一步位移的 β 倍加到本次梯度步上。若连续几步方向一致,位移就会积累。在这个二次函数上,尝试用 表示误差,两步递推便化为一元二次方程。它的两个根决定误差长期衰减得多快。

The roots have product β. If they are complex conjugates, both have modulus . A useful tuning puts a repeated root at + for the shallowest direction and one at − for the steepest. Set the middle coefficient to +2 at μ and −2 at L, then solve the two equations.两个根的乘积为 β。若为共轭复根,二者的模都等于 。针对正定二次函数,可以让最平缓方向的两个根重合于 +,最陡方向的两个根重合于 −。将 在 μ、L 两端分别设为 +2 和 −2,联立即得下式。

Interior directions now have the same root modulus. At a repeated root the sequence can contain . Even with a smaller asymptotic factor than gradient descent, early errors can grow. These parameters optimize the asymptotic spectral radius on this quadratic class. On a smooth strongly convex function whose curvature varies with position, the same tuning can fail to converge. Lessard, Recht & Packard中间曲率方向的根也具有相同的模。遇到重根时,误差中可以出现 这一项。因此即使长期收缩因子更小,前几步的误差仍可能放大。这组参数优化的是正定二次函数上最坏方向的渐近谱半径。对曲率随位置变化的光滑强凸函数,同一组参数甚至可能不收敛。 Lessard、Recht 与 Packard

Where Nesterov evaluates the gradientNesterov 在哪里计算梯度

Start with so the initial displacement is zero. Use the last displacement to extrapolate to , measure the slope there, and step from that point. For a deterministic μ-strongly convex, L-smooth objective, one classical choice is and . Each iteration still evaluates just one gradient. Sutskever et al., §2令 ,初始位移为零。Nesterov 加速先沿上一步位移外推到 ,在那里求梯度,再从外推点迈出梯度步。对 μ 强凸且梯度为 L-Lipschitz 连续的确定性目标,经典取法是 、 。每轮仍然只需求一次梯度。 Sutskever 等,第 2 节

For an eigenvalue λ, the entire extrapolated error is multiplied by . In the steep direction of this example that factor is zero, even if momentum would have carried the extrapolated point past the minimum. In the shallow direction the characteristic polynomial is . With zero initial velocity the exact shallow-coordinate trajectory is .在曲率为 λ 的方向上,外推后的整个误差都要乘以 。本例最陡方向的这个因子恰好为零,即使外推点越过谷底,本次更新也能回到纵坐标零点。平缓方向上的特征多项式是 。初始位移为零、横坐标从 1 出发时,横坐标在第 t 步恰好等于 。

Loss of gradient descent, heavy ball and Nesterov over 50 iterations / 三种算法在 50 次迭代中的损失曲线
Starting at 50.5, heavy-ball loss climbs to 687.5 at step 4 before falling. Nesterov removes the steep-direction error on its first step. The vertical axis is logarithmic.重球法的损失从 50.5 升至第 4 步的 687.5,随后才降下来。Nesterov 第一步就消除了陡峭方向的误差。纵轴为对数刻度。
Loss after t full-gradient evaluations求完整梯度 t 次后的损失
tGDHeavy ballNesterov
050.550.550.5
148.520266.3000.49005
1033.851332.5370.24315
506.833980.0008140.000478

All three columns start at (1, 1) and use the fixed tunings above. The numbers come directly from the recurrences. Heavy ball overshoots strongly in the steep direction at the start. Nesterov happens to remove that component in its first step here. Changing the spectrum, start or tuning can change the finite-step ordering.三列都从 (1, 1) 出发,使用上面各自的固定参数,数值直接由递推式算得。重球法开始时在陡峭方向上明显过冲;Nesterov 在这个例子里第一步恰好消除了这一分量。改变曲率分布、起点或参数,有限步数下的排名都可能改变。

Why SGD fluctuates near the minimum为什么 SGD 在最优点附近仍会波动

Full gradients average over every example. SGD samples one example or a mini-batch. Consider a single eigen-direction and model its batch gradient as , where the fresh noise has mean zero, is independent of the current error, and has variance for B independent examples. The deterministic factor still contracts the mean. Squaring the recurrence and taking expectations adds a new variance term every step. Bottou, Curtis & Nocedal完整梯度对所有样本求平均,SGD 则抽取一个样本或一个小批次。只看一个特征方向,把批次梯度写成 。假设本次噪声均值为零,与当前误差独立,B 个样本独立抽取时批次噪声的方差为 。平均误差仍按原因子收缩,但将递推式平方后取期望,会发现每一步都额外引入一项方差。 Bottou、Curtis 与 Nocedal

The limit follows by setting both consecutive second moments equal, provided . Halving η reduces the disturbance per step but slows initial progress along a flat direction. Increasing B reduces the limiting mean squared error here, at the cost of more examples per update. If a training curve stalls, compare a smaller late learning rate or a larger batch while recording both the number of examples and elapsed time. The precise noise floor above assumes additive independent noise of fixed variance.在 时,让相邻两步的二阶矩相等,就得到上式的极限。减半学习率能削弱每次采样的扰动,同时也会放慢沿平缓方向的初期进展。增加批量 B 可以压低本例中的稳态均方误差,但每次更新要多处理样本。若训练曲线后段迟迟不降,可以对照减小后期学习率或增大批量的结果,同时记录处理的样本数与实际耗时。这里的精确极限依赖独立、方差固定的加性噪声假设。