Skip to content

The Discrete-Log Clock: How a Transformer Learns Modular Multiplication

Jun 2026 · arXiv.org · Vol abs/2606.17399 · 0 citations · 8 references
Computer Science

TL;DR

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, which generalizes: matching the analysis basis to the algebraic structure of the task reveals interpretable structure where standard tools see noise.

Abstract

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.

View source

Similar papers

#machine learning Preprint Sep 2026

Change the Product, Keep the Parameters: Associative Algebra Layers for Transformers

This work constructs a family with quadratic arithmetic in the matrix dimension when the physical block size remains fixed, and derive finite-shape constraints for GPU execution, and treats these results as a feasibility and trainability check for the proposed approach at small scale, leaving further investigation to f...

Ilya Koziev, I. Oseledets · 0 citations
Review Aug 2026

Transforms for LLM Quantization: The Great Inversion and Format Co-Design

This work identifies and formalizes the principle that organizes the Great Inversion, the Great Inversion: allocation-flexible coding rewards energy concentration, whereas the grouped shared-scale quantization a deployed matrix instruction performs rewards within-group flattening.

Ehsan Jokar · 0 citations
Preprint Aug 2026

TESLA: Taylor Expansion of Sinusoidal Learnable Activations

TESLA, an activation defined as a learnable combination of sine and cosine terms, enabling explicit control over polynomial degree and selective amplification of high-order components is proposed, indicating that activation-level degree control transfers to more general vision workloads.

Daehwa Ko, Jae-Hwan Kim, Seunghyun Ham et al. · 0 citations
#machine learning Preprint Sep 2026

EFQ-Softmax: Exp-Free Quantization for Softmax

EFQ-Softmax (Exp-Free Quantization for Softmax), a low-bit probability-generation method that directly maps shifted attention scores to block-scaled E2M1 operands, is proposed and shown to replace the conventional exp-then-quantize path while preserving end-to-end model quality.

Hao-Hui Han, Yu-Ming Wan, Hong-Ning Wang et al. · 0 citations
#artificial intelligence Preprint Sep 2026

RecKAN: Kolmogorov-Arnold Networks with a Learnable Recursive Polynomial Basis

RecKAN is introduced, which defines the basis itself by a second order polynomial recurrence, and it is shown that the learned recurrence coefficients are interpretable: on the task requiring the most local structure, training moves the basis away from the linear degree growth regime that contains every classical famil...

Amirhosein Azarpour · 1 citation
#natural language process... Preprint Sep 2026

Structured Transforms for Low-Overhead Quantization of Language Models

The proposed greedy algorithm with alternating updates guarantees the four-peak distribution required for stable 2-bit clustering of each factor and admits closed-form initialization of cluster centers, removing the multi-restart k-means bottleneck of prior work.

Daria Cherniuk, A. Rudikov, B. Kashin et al. · 0 citations

Related blog posts

MIT News · Artificial Intelligence Sep 29, 2026

Who we become when we talk to machines

Professor Sherry Turkle’s new book, “Artificial Intimacy,” offers a withering critique of chatbots and the antisocial dynamics she believes they encourage.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.