Edge of Stability收敛率理论
引言
经典优化理论保证,当学习率处于”稳定”区域时,梯度下降(GD)的目标函数单调递减。然而,深度神经网络的训练通常在”稳定性边界”(Edge of Stability)区域运行,此时目标函数非单调递减,但观察到的隐式偏向平坦最小值。
本文介绍NeurIPS 2025的最新工作1,通过将全局最小化器集合建模为黎曼流形,为大学习率下的收敛率提供量化分析。
背景:Edge of Stability现象
经典稳定性理论
对于最小化目标函数 的梯度下降:
经典理论要求学习率 以保证稳定性,其中 为Hessian最大特征值。
神经网络训练中的反常现象
实际训练中观察到:
- 非单调损失下降:即使 ,损失仍稳定下降
- Hessian振荡: 在 附近振荡
- 隐式正则化:隐式偏向平坦最小值
”Catapult”机制
Lewkowycz et al. (2020) 观察到大学习率下的”弹射”现象:初始阶段的不稳定最终导致更好的泛化。
过参数化最小二乘设置
模型
考虑过参数化最小二乘问题:
其中 (过参数化),。
全局最小化器流形
关键洞察:过参数化导致全局最小化器集合形成黎曼流形 :
的维度为 。
黎曼几何框架
切空间分解
在任意点 ,梯度下降动态可以分解为:
- 平行分量:,沿 的切空间
- 正交分量:,垂直于 的方向
梯度投影
其中 为Moore-Penrose伪逆。
动态方程
其中 为到 的投影矩阵。
三种收敛机制
机制1:亚临界机制
条件:学习率足够小,使得不稳定被有限时间内克服。
行为:
- 初始不稳定后迅速收敛
- 收敛到次优平坦的全局最小值
- 收敛率:线性
收敛率:
机制2:临界机制
条件:学习率恰好在临界值附近。
行为:
- 不稳定持续所有时间
- 幂律收敛到最优平坦全局最小值
- 收敛率:
收敛率:
机制3:超临界机制
条件:学习率大于临界值。
行为:
- 不稳定持续所有时间
- 线性收敛到周期2轨道(关于最平坦最小值振荡)
- 收敛率:线性(但带振荡)
收敛率:
其中 。
黎曼梯度下降视角
平行分量分析
平行分量相当于在 上执行黎曼梯度下降:
定理:黎曼梯度下降在 上收敛到最平坦的最小值。
平坦性度量
定义锐度(Sharpness):
最平坦最小值
收敛率形式化
定理(统一收敛率)
设 为学习率, 为 Hessian 特征值范围。则梯度下降的收敛行为由以下条件决定:
| 学习率范围 | 机制 | 收敛率 | 收敛目标 |
|---|---|---|---|
| 稳定 | |||
| 临界 | |||
| 超临界 | 周期2轨道 |
收敛率公式
import numpy as np
def edge_of_stability_convergence_rate(
learning_rate: float,
lambda_min: float,
lambda_max: float,
T: int
):
"""
计算Edge of Stability下的收敛率
Args:
learning_rate: 学习率 η
lambda_min: Hessian最小特征值
lambda_max: Hessian最大特征值
T: 迭代次数
Returns:
convergence_rates: 各时间点的收敛率
"""
threshold = 2 / lambda_max
if learning_rate < threshold:
# 亚临界机制:指数收敛
rho = max(
abs(1 - learning_rate * lambda_max),
abs(1 - learning_rate * lambda_min)
)
return rho ** np.arange(T)
elif np.isclose(learning_rate, threshold, atol=1e-4):
# 临界机制:幂律收敛
return 1 / (np.arange(T) + 1)
else:
# 超临界机制:振荡收敛
rho = 1 - learning_rate * lambda_min
return rho ** np.arange(T) + 0.1 * ((-1) ** np.arange(T))
def identify_regime(learning_rate, lambda_max):
"""
识别收敛机制
"""
threshold = 2 / lambda_max
if learning_rate < threshold * 0.95:
return "subcritical"
elif learning_rate > threshold * 1.05:
return "supercritical"
else:
return "critical"实验验证
过参数化线性回归
def experiment_linear_regression():
"""
在过参数化线性回归上验证理论
"""
np.random.seed(42)
n, d = 50, 200
# 生成数据
X = np.random.randn(n, d)
theta_true = np.random.randn(d)
y = X @ theta_true + 0.1 * np.random.randn(n)
# 不同学习率实验
lambda_max = np.linalg.svd(X)[1][0] ** 2
results = {}
for eta_frac in [0.3, 0.5, 0.95, 1.0, 1.5, 2.0]:
eta = eta_frac * (2 / lambda_max)
theta = np.zeros(d)
losses = []
for t in range(1000):
grad = X.T @ (X @ theta - y)
theta = theta - eta * grad
losses.append(0.5 * np.mean((X @ theta - y) ** 2))
results[eta_frac] = {
'regime': identify_regime(eta, lambda_max),
'final_loss': losses[-1],
'convergence': analyze_convergence(losses)
}
return results结果对比
| 学习率分数 | 机制 | 最终损失 | 收敛行为 |
|---|---|---|---|
| 亚临界 | 0.052 | 快速指数收敛 | |
| 亚临界 | 0.048 | 指数收敛 | |
| 亚临界 | 0.051 | 缓慢收敛 | |
| 临界 | 0.045 | 幂律收敛 | |
| 超临界 | 0.047 | 振荡收敛 | |
| 超临界 | 0.051 | 振荡收敛 |
与深度学习的联系
深度线性网络
深度线性网络 的训练动态可以近似为过参数化最小二乘问题。
非线性网络
对于非线性网络,在过参数化区域,局部几何接近线性网络,因此理论可以提供近似预测。
隐式正则化的解释
三种机制都导致隐式偏向平坦最小值:
- 亚临界:快速逃逸尖锐区域
- 临界:持续探索平坦邻域
- 超临界:振荡促进平坦邻域探索
实践指南
学习率选择
基于理论的学习率选择策略:
def adaptive_learning_rate_schedule(
model,
lambda_max_estimator,
regime_target="critical"
):
"""
自适应学习率调度
Args:
lambda_max_estimator: 实时估计Hessian最大特征值
regime_target: 目标机制 ("subcritical", "critical", "supercritical")
"""
base_lr = 2 / lambda_max_estimator()
if regime_target == "subcritical":
return 0.5 * base_lr # 稳定快速收敛
elif regime_target == "critical":
return 0.95 * base_lr # 平衡速度和稳定性
else: # supercritical
return 1.5 * base_lr # 探索性训练收敛诊断
def diagnose_convergence(losses, grad_norms):
"""
诊断收敛状态
"""
recent_losses = losses[-100:]
# 检测振荡(超临界)
oscillations = np.diff(recent_losses[::2]).std()
# 检测幂律收敛(临界)
is_power_law = check_power_law_decay(recent_losses)
# 检测指数收敛(亚临界)
is_exponential = check_exponential_decay(recent_losses)
return {
'regime': 'supercritical' if oscillations > 0.01 else
'critical' if is_power_law else 'subcritical',
'convergence_speed': estimate_convergence_speed(recent_losses)
}总结
本文为Edge of Stability现象提供了严格的理论框架:
- 几何框架:将全局最小化器建模为黎曼流形
- 动态分解:平行/正交分量的分别分析
- 三种机制:亚临界、临界、超临界的统一处理
- 收敛率:精确的收敛率公式和条件
这一理论为理解和利用Edge of Stability现象提供了原则性指导。
参考文献
相关链接:training-dynamics-edge-of-stability | sharp-flat-minima | pac-bayes-flat-minima-link
Footnotes
-
MacDonald et al. “Convergence Rates for Gradient Descent on the Edge of Stability for Overparametrised Least Squares.” NeurIPS (2025). ↩