Neural networks trained to solve modular arithmetic tasks exhibit grokking, a phenomenon where the test accuracy starts improving long after the model achieves 100% training accuracy in the training process. It is often taken as an example of "emergence", where model ability manifests sharply through a phase transition. In this work, we show that the phenomenon of grokking is not specific to neural networks nor to gradient descent-based optimization. Specifically, we show that this phenomenon occurs when learning modular arithmetic with Recursive Feature Machines (RFM), an iterative algorithm that uses the Average Gradient Outer Product (AGOP) to enable task-specific feature learning with general machine learning models. When used in conjunction with kernel machines, iterating RFM results in a fast transition from random, near zero, test accuracy to perfect test accuracy. This transition cannot be predicted from the training loss, which is identically zero, nor from the test loss, which remains constant in initial iterations. Instead, as we show, the transition is completely determined by feature learning: RFM gradually learns block-circulant features to solve modular arithmetic. Paralleling the results for RFM, we show that neural networks that solve modular arithmetic also learn block-circulant features. Furthermore, we present theoretical evidence that RFM uses such block-circulant features to implement the Fourier Multiplication Algorithm, which prior work posited as the generalizing solution neural networks learn on these tasks. Our results demonstrate that emergence can result purely from learning task-relevant features and is not specific to neural architectures nor gradient descent-based optimization methods. Furthermore, our work provides more evidence for AGOP as a key mechanism for feature learning in neural networks.
翻译:在模运算任务训练中,神经网络会表现出"顿悟"现象,即模型在训练过程中达到100%训练准确率后,测试准确率经过较长时间才开始提升。这常被视为"涌现"的典型案例——模型能力通过相变突然显现。本研究表明,顿悟现象并非神经网络或基于梯度下降的优化方法所独有。具体而言,当使用递归特征机学习模运算时也会出现该现象。递归特征机是一种迭代算法,它利用平均梯度外积实现通用机器学习模型的任务特定特征学习。与核机结合使用时,递归特征机的迭代会导致测试准确率从接近零的随机状态快速跃迁至完美准确率。这种跃迁无法通过恒为零的训练损失来预测,也无法通过初始迭代中保持不变的测试损失来预测。我们证明,该跃迁完全由特征学习决定:递归特征机通过逐步学习块循环特征来解决模运算问题。与此对应,我们发现解决模运算的神经网络同样会学习块循环特征。此外,我们提出理论证据表明递归特征机利用此类块循环特征实现傅里叶乘法算法——该算法被先前研究认为是神经网络在此类任务中学习的泛化解。我们的结果表明,涌现现象可纯粹源于任务相关特征的学习,而非神经架构或基于梯度下降的优化方法所特有。本研究进一步证实了平均梯度外积作为神经网络特征学习关键机制的重要性。