arXiv:2510.00236cs.LG2025-10被引 2

通过逐样本梯度分析,揭示了优化器设计的新方向。

Per-example gradients: a new frontier for understanding and improving optimizers

  • 在自动微分图中重构梯度统计,几乎无额外开销
  • 发现Adam预条件应以均值为主而非方差
  • 为优化器改进提供可解释的新思路,适合算法研究者

深度学习训练通常将小批量样本视为单一对象,对梯度取平均后进行处理。传统认为计算梯度的其他统计量在自动微分框架中资源消耗过高,我们证明并非如此。通过重构自动微分图,可高效实现梯度统计,部分情况下计算和内存开销几乎与小批量梯度计算相当。此外,在某些模型(如Transformer)中,JAX的向量化变换可用于快速原型设计。我们从逐样本梯度的角度重新审视两种非线性操作:首先分析signSGD,发现符号操作在梯度处理链中的最优位置至关重要,可用信噪比简单预测;其次研究Adam预条件器的逐样本变体,发现当预条件器主要受梯度分布均值主导时优化效果最佳,与传统认知相反。总体表明,逐样本梯度信息为算法分析与设计开辟了新路径。

原文摘要 · Abstract (English)

Training algorithms in deep learning usually treat a mini-batch of samples as a single object; they average gradients over the mini-batch, and then process the average in various ways. Computing other statistics beyond the average may have been seen as prohibitively resource intensive in automatic differentiation (AD) frameworks. We show that this is not the case. Generally, gradient statistics can be implemented through a surgery of the AD graph, which, in some cases, incur almost no computational and memory overheads compared to the mini-batch gradient computation. Additionally, we show that in certain classes of models, including transformers, JAX's vectorization transformation offers a viable implementation for prototyping and experimentation. We then revise our understanding of two nonlinear operations in optimization through the lens of per-example gradient transformations. We first study signSGD and show that the optimal placement of the sign operation in the gradient processing chain is crucial to success and can be predicted with a simple signal-to-noise ratio argument. Next we study per-example variations of the Adam preconditioner, and show that optimization is best served when the preconditioner is dominated by the mean rather than the variance of the gradient distribution - in contrast to conventional wisdom. Overall we demonstrate that per-example gradient information enables new analyses and possibilities for algorithm design.

优化器梯度分析深度学习

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。