理解DL的局部最小
DL是在一个非常高维的世界里做梯度下降。局部最小值很难形成,因为局部最小值要求函数在所有维度上都是局部最小。更实际得情况是,函数会落到一个鞍点上,如下图:
多层神经网络,大部分局部极小值都在底部 ,已经非常接近全局最小值,如下图
DL训练的困难主要是鞍点问题。我们很可能也从来没有真的遇到过局部极值。Bengio组这篇文章Eigenvalues of the Hessian in Deep Learning里面的实验研究给出以下的结论:
• Training stops at a point that has a small gradient. The norm of the gradient is not zero, therefore it does not, technically speaking, converge to a critical point.
• There are still negative eigenvalues even when they are small in magnitude.
即使有局部极值,具有较差的loss的局部极值的吸引域也是很小的Towards Understanding Generalization of Deep Learning: Perspective of Loss Landscapes。
• For the landscape of loss function for deep networks, the volume of basin of attraction of good minima dominates over that of poor minima, which guarantees optimization methods with random initialization to converge to good minima.
更令人信服的是,在高维空间里真正可怕的是一些特殊地形。比如大面积的平坦区域,在平坦区域导数很小,很难逃离。甚至在这段地形的二阶导数过于特殊的情况下,一阶优化算法走无穷多步也走不出去。
与其担忧陷入局部最优点怎么跳出来,更不如去考虑
- 设计合适的loss函数与模型,去尽可能避免类似于平坦区的危险地形。
- 优化起始点:采用均匀分布初始权重;高斯分布初始权重;Xavier等
- 让最优化过程对危险地形有一定的判断力,如梯度截断,momentum;
- batch normalization