Easing Optimization Paths: a Circuit Perspective

Ambroise Odonnat, Wassim Bouaziz, Vivien Cabannes

TL;DR

This paper explores how neural networks learn by viewing them as a collection of "circuits"—functional pathways that process information. By studying a simple modular addition task, the authors demonstrate that gradient descent acts as a pruner of spurious circuits and that curriculum learning can "prime" a model with useful sub-circuits, allowing it to bypass high-loss barriers and find generalizable solutions instead of just memorizing data.

What Problem Does This Paper Address?

As AI models scale, the cost of training becomes prohibitive, and their internal decision-making remains a "black box." A major challenge in optimization is that models often take the path of least resistance: memorization. In many tasks, a model might achieve zero training loss by simply memorizing specific examples (spurious circuits) rather than learning the underlying algorithm (generalizing circuits).

The authors seek to understand the mechanics of how gradient descent chooses between these paths. They use the lens of mechanistic interpretability to ask: Can we visualize the birth and death of these circuits during training? And can we steer the optimization process toward better, more general solutions?

Methods

The researchers use a controlled experimental setup to isolate these dynamics:

  1. The Task: Sparse modular addition. The model receives a sequence of numbers and must output the sum of the first $k$ terms, modulo $p$.
  2. The Architecture: A simplified one-layer Transformer with cross-attention. They intentionally stripped down the architecture (e.g., removing the key matrix) to make the internal "circuits" easier to track.
  3. Circuit Visualization: They represent the attention mechanism as a bipartite graph. By tracking updates, they color-code edges: red for connections being reinforced by gradient descent and blue for those being pruned.
  4. Curriculum Learning: They test a "2 $\to$ 4" strategy. They first train the model on a simple version of the task (binary parity, $p=2$) before switching to a harder version ($p=4$).

Datasets

The paper uses synthetic datasets of integer sequences:

  • Inputs: Sequences of length $T$ (8 or 12) with tokens from the ring of integers modulo $p$ ($\mathbb{F}_p$).
  • Targets: The sum of the first $k=5$ tokens.
  • Vocabulary sizes ($p$): Primarily $p=2$ (simpler) and $p=4$ (harder).
  • Training size: 2,048 samples, which is small enough to allow for memorization but large enough to test generalization.

Key Insights and Ideas

  • Gradient Descent as a Pruner: Early in training, the gradient reinforces many circuits simultaneously—including "spurious" ones that attend to irrelevant tokens. Over time, as the model sees more data, these spurious circuits are pruned because they don't consistently help predict the output, while the "invariant" circuits (the ones that actually solve the math) become dominant.
  • The "Needle-in-a-Haystack" Problem: For the $p=4$ task, the space of possible inputs is so large ($12^4$) that the model, when trained from scratch, almost always falls into a "memorization trap." It learns the training set perfectly but fails to generalize to new data.
  • Sub-circuits as Stepping Stones: The authors found that the model solves the $p=4$ task by first learning to solve $p=2$. By pre-training on $p=2$, the model develops a "counting" sub-circuit. When the task shifts to $p=4$, the model already has the structural "scaffolding" needed to find the general algorithm.
  • Loss Barriers: There is a high "potential barrier" (a region of high loss) between the memorization solution and the generalization solution. Curriculum learning essentially provides a "tunnel" through or a path around this barrier.

Key Results

  • Generalization Breakthrough: Models trained from scratch on the $p=4$ task achieved ~0% test accuracy (pure memorization). However, models that used the $p=2 \to p=4$ curriculum achieved near 100% test accuracy.
  • Clustering in Latent Space: Visualization of the embeddings (Fig. 4) showed that the model learned to group sequences into distinct clusters based on their sum modulo $p$. After finetuning, the number of clusters increased from 6 (for $p=2, k=5$) to 16 (for $p=4, k=5$), showing the refinement of the learned circuit.
  • Optimization Path: Using t-SNE to visualize the 10,000 parameters of the Transformer, the authors showed that the curriculum-trained model took a fundamentally different path through the parameter space compared to the model trained from scratch.

Limitations and Future Work

  • Scale: The experiments are conducted on a "toy" model (one-layer Transformer) and a synthetic task. It remains to be seen how well these specific circuit dynamics translate to massive LLMs with hundreds of layers.
  • Subjectivity of Circuits: As the authors note, defining what constitutes a "circuit" can be subjective, especially in more complex, non-algorithmic tasks like creative writing.
  • Future Directions: The authors suggest using this perspective to study loss spikes and training stability in large-scale models. They also propose investigating how activation sparsity (making neurons fire less often) might naturally encourage the formation of cleaner, more interpretable circuits.

Summary updated

BibTeX
@inproceedings{odonnat2025easing,
  author = {Ambroise Odonnat and Wassim Bouaziz and Vivien Cabannes},
  title = {{Easing Optimization Paths: a Circuit Perspective}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2025},
  doi = {10.1109/icassp49660.2025.10888894},
}

Loading related content...

Figure