TL;DR
When a neural network can choose among multiple valid internal representations to solve a task, how does it decide which ones to keep? Framing representation learning through an ecological lens of "Survival of the Fittest," this paper shows that competing Fourier frequencies in modular addition act like species battling for resources. Surviving circular representations are selected based on their initial signal magnitude and early gradients, and their competitive/cooperative dynamics can be accurately captured using a sparse, linear system of differential equations.
What Problem Does This Paper Address?
In mechanistic interpretability, researchers often observe that neural networks find clean, geometric representations to solve algorithmic problems—such as arranging numbers around circles in embedding space to perform modular addition ($a + b \equiv c \pmod p$). However, for any prime modulus $p$, there are $(p - 1) / 2$ valid Fourier frequencies (circles) that can be combined to solve the task.
At random initialization, projections onto all frequencies are present with roughly equal signal, yet after training with weight decay (and subsequent grokking), only 3 to 5 circles survive while the rest die out. This paper investigates:
- How many circles survive, and why?
- Which circles survive, and what determines their "fitness"?
- How do these representations interact (compete or collaborate) over training?
Methods
The authors adopt an ecological framework where frequencies act as species competing under environmental pressure (weight decay) for limited carrying capacity (embedding dimension $d$):
-
Fourier Decomposition of Embeddings: Token embeddings $E_n \in \mathbb{R}^d$ are projected onto the Fourier basis: $$F_k = \sum_{n=0}^{p-1} e^{-i 2\pi k n / p} E_n$$ The Fourier signal of frequency $k$ is quantified by its squared norm $\|F_k\|^2$.
-
Fitness Metrics: The authors evaluate two primary initialization features:
- Initial signal magnitude: The projection strength at step 0.
- Initial gradient: The rate of change in signal over the first few optimization steps.
- Controlled Perturbations & Synthetic Embeddings: To isolate causal factors, the authors manually amplify or suppress specific Fourier modes at initialization and measure downstream survival rates.
- Dynamical Modeling (ODE): Inspired by generalized Lotka–Volterra population models, the authors fit the signal evolution over the first 1,000 steps. While quadratic interaction terms overfit, a first-order linear system of differential equations ($\frac{dx}{dt} = Ax + b$) fit with Lasso regression accurately models representation dynamics while yielding a sparse interaction matrix.
Datasets
The authors evaluate on synthetic datasets for modular addition ($a + b \pmod p$):
- Default configuration: Prime modulus $p = 59$ with an 80/20 train/test split.
- Scale variations: Prime and non-prime moduli ranging from $p = 17$ to $97$.
- No external or real-world benchmark datasets were used; the focus is exclusively on this canonical toy task.
Key Insights and Ideas
- Capacity as Ecological Resources: Increasing the embedding dimension $d$ increases the number of surviving frequencies. Furthermore, when embeddings are frozen at initialization, a sharp phase transition occurs at $d = p$: when $d \ge p$, random embeddings almost surely contain linearly extractable circular representations.
- Fitness at Initialization Predicts Survival: Frequencies with larger initial Fourier signals survive far more frequently (Pearson correlation $r = 0.85$, $p < 10^{-3}$). Frequencies that also have high initial gradient velocity adapt faster and resist weight decay.
- Circles Must Collaborate: While a single Fourier circle theoretically suffices to compute modular addition (e.g., via the Clock algorithm), a single-circle network fails empirically. When forced via ablation:
- 1 circle fails to reach low test loss.
- 2 circles can achieve a loss as low as $10^{-7}$ only if initialized from the two fittest frequencies; random pairs fail.
- 3 or more circles naturally cooperate to drive test loss to zero.
- Linear ODEs Outperform Lotka-Volterra: Although ecological competition is traditionally modeled using quadratic Lotka–Volterra equations ($x_i x_j$ interaction terms), these terms cause numerical instability and severe overfitting. Remarkably, a sparse linear ODE ($\dot{x} = Ax + b$) is sufficient to capture representation trajectories, admitting a closed-form analytical solution.
Key Results
- Predicting Representation Survival: A simple linear Support Vector Machine (SVM) trained on two features—initial signal and step-4 gradient—classifies surviving vs. dead frequencies with 83.8% accuracy.
- Controlled Reanimation: In synthetic embeddings where only two frequencies are initialized with signal and all others are set to $\epsilon = 10^{-6}$, the dominant frequency survives 100% of the time, and the secondary frequency's survival scales monotonically with its relative ratio $r$.
- Trajectory Modeling: Lasso regression with an added small regularizer ($\epsilon = 10^{-8}$) fits the 29 frequency trajectories with high coefficient of determination ($R^2 \approx 0.8 - 0.9$), producing sparse interaction matrices where specific pairs exhibit collaborative or competitive weights.
Limitations and Future Work
- Scope Limited to Modular Addition: The findings rely on modular arithmetic's explicit Fourier basis, where circular representations are known a priori. Extending this decomposition framework to natural language models or vision transformers remains an open challenge.
- Non-Prime Moduli Nuances: Non-prime moduli introduce subgroups and non-trivial factors (e.g., $p=12$), causing greater variance in circle formation that the current Fourier formulation does not fully capture.
- AdamW Artifacts: Training exhibits "slingshot" loss spikes characteristic of AdamW and grokking; the authors excluded these optimizer-specific artifacts to focus solely on early representation dynamics.
Summary updated