Abstract
Understanding the internal representations learned by neural networks is a cornerstone challenge in the science of machine learning. While there have been significant recent strides in some cases towards understanding how neural networks implement specific target functions, this paper explores a complementary question -- why do networks arrive at particular computational strategies? Our inquiry focuses on the algebraic learning tasks of modular addition, sparse parities, and finite group operations. Our primary theoretical findings analytically characterize the features learned by stylized neural networks for these algebraic tasks. Notably, our main technique demonstrates how the principle of margin maximization alone can be used to fully specify the features learned by the network. Specifically, we prove that the trained networks utilize Fourier features to perform modular addition and employ features corresponding to irreducible group-theoretic representations to perform compositions in general groups, aligning closely with the empirical observations of Nanda et al. and Chughtai et al. More generally, we hope our techniques can help to foster a deeper understanding of why neural networks adopt specific computational strategies.
Introduction
In the growing field of mechanistic interpretability, researchers have found that neural networks trained on modular arithmetic or group theory often "grok" the problem by developing highly structured internal representations, such as circles or Fourier transforms. While the "how" of these circuits has been documented, the "why" remains elusive. There are infinite ways a network could technically solve "a + b mod p." Why does it consistently settle on a Fourier-based strategy? This research bridges the gap between empirical observations and theoretical inductive bias, arguing that these structured features are the unique solutions that maximize the "margin"—the gap between correct and incorrect classes—under specific regularization.
Methodology
The study focuses on stylized, one-hidden-layer neural networks with homogeneous polynomial activations (e.g., $x^2$ or $x^k$). The primary analytical tool is the maximum margin solution.
Key technical components include:
- $L_{2,\nu}$ Margin Maximization: Analyzing networks where the total parameter norm is minimized while maintaining fixed confidence on training data.
- Certificate Pairs: A theoretical framework using pairs $(\theta^*, q^*)$ to prove a specific configuration $\theta^*$ is the global maximum margin solution.
- Representation Theory: Using group representation theory to show how weights align with irreducible representations (irreps) for general finite groups.
- Empirical Validation: Training networks with gradient descent and small $L_2$ or $L_{2,3}$ regularization to observe convergence to theoretical predictions.
The tasks studied include modular addition (e.g., $p=71$), sparse parity (e.g., $(10, 4)$-parity), and finite group operations for symmetric groups $S_3, S_4,$ and $S_5$.
Key Insights
The "Why" of Fourier Features
For modular addition, the paper proves that maximizing the margin forces a network to concentrate its weights on single Fourier frequencies. Any "dense" solution that lacks Fourier sparsity inherently possesses a lower margin and is discarded by the optimizer.
Symmetry and Structure
Margin maximization acts as a filter, allowing only features that respect the task's symmetries (e.g., group structure) to persist. In general finite groups, the network learns to map inputs to matrices corresponding to the group's irreducible representations, effectively performing "matrix multiplication in the head."
Grokking as Optimization
The transition from memorization to generalization—known as "grokking"—is interpreted as the network's trajectory toward the high-margin, structured solution predicted by the theory.
Results and Empirical Alignment
The theoretical findings are supported by both analytical proofs and empirical evidence. Theorem 7 characterizes the max-margin solution for modular addition, proving each neuron in an $x^2$ network corresponds to a single Fourier frequency. Theorem 9 extends this to group composition, showing the utilization of all non-trivial irreps for groups like $S_5$.
As shown in the figure above, training trajectories demonstrate that "Fourier power" concentrates toward perfect sparsity (1.0), and the achieved margin asymptotically matches the calculated theoretical maximum.
Discussion and Future Work
While this work provides a rigorous "margin-as-explanation" framework for algebraic tasks, several limitations remain. The current proofs rely on one-hidden-layer networks and polynomial activations. Extending these results to deeper architectures like Transformers or more complex activations like ReLU is a key challenge. Additionally, the analysis assumes full population data; understanding feature emergence under heavy sub-sampling (the typical grokking regime) is a vital next step. Finally, applying this framework to naturalistic data (images/text) remains a significant hurdle for the field.
Summary updated