When small transformers grok modular multiplication, prior work reports that the learned embedding has a "dense" Fourier spectrum requiring all frequencies. This contrasts with modular addition, where only a sparse set of key frequencies suffices. We show this density is an artifact of analyzing in the wrong basis. The natural Fourier transform for multiplication is not the standard additive DFT but the multiplicative character transform, which decomposes functions on the multiplicative group $(\mathbb{Z}/p\mathbb{Z})^*$ into its irreducible representations. Applying this transform to a grokked transformer trained on $a \cdot b \bmod 113$, we find the embedding spectrum becomes highly sparse (Gini coefficient 0.58 vs. 0.07 in the additive basis) with only 4 key frequencies carrying significant energy. Furthermore, 96.9% of MLP neurons are cleanly tuned to a single multiplicative frequency, and neuron activation heatmaps reveal 2D-periodic structure when reordered by the discrete logarithm. These results demonstrate the transformer reduces multiplication to addition in discrete-log space, implementing a "Discrete-Log Clock" algorithm analogous to Nanda et al.'s Clock algorithm for addition. The methodology generalizes: matching the analysis basis to the algebraic structure of the task reveals interpretable structure where standard tools see noise.
翻译:当小型Transformer掌握模乘法时,先前研究报道其学习到的嵌入具有“密集”的傅里叶谱,需要全部频率参与。这与模加法形成鲜明对比——后者仅需稀疏的关键频率集即可表征。我们证明这种密集性源于在错误基下进行分析。乘法的自然傅里叶变换并非标准加法DFT,而是乘法特征变换,该变换将乘法群$(\mathbb{Z}/p\mathbb{Z})^*$上的函数分解为不可约表示。将此变换应用于训练于$a \cdot b \bmod 113$的已顿悟Transformer时,我们发现嵌入谱变得高度稀疏(基尼系数0.58 vs 加法基下的0.07),仅4个关键频率携带显著能量。此外,96.9%的MLP神经元被清晰调谐至单一乘法频率,且按离散对数重排后的神经元激活热力图呈现二维周期结构。这些结果表明Transformer将乘法约简为离散对数空间中的加法,实现了一种类似于Nanda等人加法时钟算法的“离散对数时钟”算法。该方法具有普适性:将分析基与任务的代数结构匹配,能在标准工具仅见噪声之处揭示可解释结构。