arXiv:2504.17243cs.LGcs.AI2025-04被引 3

用梯度变换加速Transformer在算术任务中的泛化能力

NeuralGrok: Accelerate Grokking by Neural Gradient Transformation

  • 引入辅助模块动态调节梯度成分,提升泛化效率
  • 实验显示在复杂算术任务中显著缩短泛化所需时间
  • 适合关注模型泛化机制与训练稳定性的研究者

Grokking 是一种在长期过拟合后实现泛化的复杂现象。本文提出 NeuralGrok,一种基于梯度的新型方法,通过学习最优梯度变换,加速 Transformer 在算术任务中的泛化过程。NeuralGrok 训练一个辅助模块(如 MLP 块),结合主模型,利用双层优化算法动态调节各梯度分量对泛化的贡献。大量实验表明,NeuralGrok 显著加速泛化,尤其在挑战性算术任务中效果突出。同时,该方法促进更稳定的训练过程,持续降低模型复杂度;而传统正则化方法如权重衰减可能引入显著不稳定性并阻碍泛化。我们进一步引入绝对梯度熵(AGE)度量模型内在复杂度,揭示 NeuralGrok 通过减少复杂度有效促进泛化。本工作为理解 Transformer 模型的 grokking 现象提供了新视角,有助于深入探索泛化能力的本质机制。

原文摘要 · Abstract (English)

Grokking is proposed and widely studied as an intricate phenomenon in which generalization is achieved after a long-lasting period of overfitting. In this work, we propose NeuralGrok, a novel gradient-based approach that learns an optimal gradient transformation to accelerate the generalization of transformers in arithmetic tasks. Specifically, NeuralGrok trains an auxiliary module (e.g., an MLP block) in conjunction with the base model. This module dynamically modulates the influence of individual gradient components based on their contribution to generalization, guided by a bilevel optimization algorithm. Our extensive experiments demonstrate that NeuralGrok significantly accelerates generalization, particularly in challenging arithmetic tasks. We also show that NeuralGrok promotes a more stable training paradigm, constantly reducing the model's complexity, while traditional regularization methods, such as weight decay, can introduce substantial instability and impede generalization. We further investigate the intrinsic model complexity leveraging a novel Absolute Gradient Entropy (AGE) metric, which explains that NeuralGrok effectively facilitates generalization by reducing the model complexity. We offer valuable insights on the grokking phenomenon of Transformer models, which encourages a deeper understanding of the fundamental principles governing generalization ability.

Transformer泛化加速梯度调控

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