The Discrete-Log Clock: How a Transformer Learns Modular Multiplication
Not on the map. Why?
Abstract (arXiv)
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 (mathbbZ/pmathbbZ)^* into its irreducible representations. Applying this transform to a grokked transformer trained on a · 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.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 8 of its 8 references that are in the map. First posted on arXiv 16 Jun 2026.
Builds on
8 of 8 references.
References · 8
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
- 2022Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasetscited by 599
- 2023The Clock and the Pizza: Two Stories in Mechanistic Explanation of Neural Networkscited by 153
- 2023A Toy Model of Universality: Reverse Engineering How Networks Learn Group Operationscited by 141
- 2023Grokking Group Multiplication with Cosetscited by 22
- 2024Grokking Modular Polynomialscited by 18
- 2024Towards Empirical Interpretation of Internal Circuits and Properties in Grokked Transformers on Modular Polynomialscited by 14
- 2025Uncovering a Universal Abstract Algorithm for Modular Addition in Neural Networkscited by 10
Built on by
Not cited yet.