发现神经网络在记忆阶段已隐含算法结构,泛化是逐步优化的结果。
Latent Algorithmic Structure Precedes Grokking: A Mechanistic Study of ReLU MLPs on Modular Arithmetic
- 用DFT分析权重,发现输入为近似方波,输出满足相位相加关系
- 理想模型仅用真实权重的频相信息,准确率达95.5%(原模型仅0.23%)
- 适合研究神经网络内部机制与泛化本质的学者
在对两个整数模加法任务中,先前研究将神经网络的‘突现’现象(grokking)归因于正弦型输入权重分布。本文实验发现,ReLU MLP 在相同设定下反而学习到近似二值的方波输入权重,中间值仅出现在符号变化边界附近;同时输出权重的主导傅里叶相位满足相位和关系 $ϕ_{\mathrm{out}} = ϕ_a + ϕ_b$,该关系即使在噪声数据训练且未实现突现时仍成立。通过离散傅里叶变换(DFT)提取各神经元权重的频率与相位,构建理想化MLP:输入权重替换为理想二值方波,输出权重替换为余弦函数,参数来自真实模型主频成分。该理想模型在噪声数据训练、真实模型仅达0.23%准确率的情况下,仍可实现95.5%准确率。这表明突现并非发现新算法,而是对记忆阶段已存在的算法进行逐步优化,通过输入权重二值化与输出权重对齐,最终实现泛化。
原文摘要 · Abstract (English)
Grokking-the phenomenon where validation accuracy of neural networks on modular addition of two integers rises long after training data has been memorized-has been characterized in previous works as producing sinusoidal input weight distributions in transformers and multi-layer perceptrons (MLPs). We find empirically that ReLU MLPs in our experimental setting instead learn near-binary square wave input weights, where intermediate-valued weights appear exclusively near sign-change boundaries, alongside output weight distributions whose dominant Fourier phases satisfy a phase-sum relation $ϕ_{\mathrm{out}} = ϕ_a + ϕ_b$; this relation holds even when the model is trained on noisy data and fails to grok. We extract the frequency and phase of each neuron's weights via DFT and construct an idealized MLP: Input weights are replaced by perfect binary square waves and output weights by cosines, both parametrized by the frequencies, phases, and amplitudes extracted from the dominant Fourier components of the real model weights. This idealized model achieves 95.5% accuracy when the frequencies and phases are extracted from the weights of a model trained on noisy data that itself achieves only 0.23% accuracy. This suggests that grokking does not discover the correct algorithm, but rather sharpens an algorithm substantially encoded during memorization, progressively binarizing the input weights into cleaner square waves and aligning the output weights, until generalization becomes possible.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。