arXiv:2501.04697cs.LGcs.AI2025-01ICLR被引 38

发现模型过拟合后数值不稳是突然泛化的原因,提出新方法让模型无需正则也能泛化。

Grokking at the Edge of Numerical Stability

  • 过拟合后梯度沿非预测方向缩放逻辑斯蒂值,引发数值崩溃
  • 数值崩溃阻止泛化,缓解该问题可实现无正则泛化
  • 提出StableMax和⊥Grad,解决训练中的数值不稳问题

Grokking——在长期过拟合后突然出现的泛化现象——挑战了我们对深度学习的理解。尽管已有研究进展,但延迟泛化的成因及其对正则化的依赖仍不清晰。本文指出:在无正则化时,grokking任务使模型逼近数值稳定边界,导致Softmax函数产生浮点误差,称为软最大化崩溃(SC)。我们证明SC会阻止grokking,而缓解SC可实现无正则化下的grokking。进一步分析发现,过拟合后梯度强烈对齐于我们称之为‘朴素损失最小化’(NLM)的方向,该方向虽不改变预测结果,却通过缩放逻辑斯蒂值降低损失,通常沿当前权重方向放大权重。这种缩放解释了grokking的延迟泛化特征,并最终导致SC,终止学习。为验证假设,本文提出两个关键贡献:StableMax——一种防止SC的新激活函数,支持无正则泛化;以及⊥Grad——一种训练算法,通过完全避免NLM实现快速泛化。这些成果深化了对grokking机制的理解,揭示其延迟泛化、依赖正则及现有方法有效的根源。代码已公开于https://github.com/LucasPrietoAl/grokking-at-the-edge-of-numerical-stability。

原文摘要 · Abstract (English)

Grokking, the sudden generalization that occurs after prolonged overfitting, is a surprising phenomenon challenging our understanding of deep learning. Although significant progress has been made in understanding grokking, the reasons behind the delayed generalization and its dependence on regularization remain unclear. In this work, we argue that without regularization, grokking tasks push models to the edge of numerical stability, introducing floating point errors in the Softmax function, which we refer to as Softmax Collapse (SC). We demonstrate that SC prevents grokking and that mitigating SC enables grokking without regularization. Investigating the root cause of SC, we find that beyond the point of overfitting, the gradients strongly align with what we call the naïve loss minimization (NLM) direction. This component of the gradient does not alter the model's predictions but decreases the loss by scaling the logits, typically by scaling the weights along their current direction. We show that this scaling of the logits explains the delay in generalization characteristic of grokking and eventually leads to SC, halting further learning. To validate our hypotheses, we introduce two key contributions that address the challenges in grokking tasks: StableMax, a new activation function that prevents SC and enables grokking without regularization, and $\perp$Grad, a training algorithm that promotes quick generalization in grokking tasks by preventing NLM altogether. These contributions provide new insights into grokking, elucidating its delayed generalization, reliance on regularization, and the effectiveness of existing grokking-inducing methods. Code for this paper is available at https://github.com/LucasPrietoAl/grokking-at-the-edge-of-numerical-stability.

深度学习数值稳定泛化模型训练

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