What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formation
Aaditya K. Singh, Ted Moskovitz, Felix Hill, Stephanie C. Y. Chan, Andrew M. Saxe
TL;DR
This work investigates the emergence of induction heads (IHs) as key components of in-context learning (ICL) in transformers by introducing a causal, optogenetics-inspired framework that clamps activations during training. It reveals that IHs arise in an additive, redundant fashion with many-to-many wiring between previous-token heads and IHs, and shows that three interacting subcircuits drive the phase change in IH formation. Through activation-level clamping, the authors isolate Subcircuits A (previous-token attend/copy), B (IH QK match), and C (IH-copy) and demonstrate their smooth, co-evolving dynamics explain a data-dependent timing shift in IH formation. The study provides open-source tooling and a nuanced mechanistic view of how IHs are learned, offering a framework to predict learning dynamics from subcircuit formation in small-scale models with implications for understanding and debugging ICL in larger transformers.
Abstract
In-context learning is a powerful emergent ability in transformer models. Prior work in mechanistic interpretability has identified a circuit element that may be critical for in-context learning -- the induction head (IH), which performs a match-and-copy operation. During training of large transformers on natural language data, IHs emerge around the same time as a notable phase change in the loss. Despite the robust evidence for IHs and this interesting coincidence with the phase change, relatively little is known about the diversity and emergence dynamics of IHs. Why is there more than one IH, and how are they dependent on each other? Why do IHs appear all of a sudden, and what are the subcircuits that enable them to emerge? We answer these questions by studying IH emergence dynamics in a controlled setting by training on synthetic data. In doing so, we develop and share a novel optogenetics-inspired causal framework for modifying activations throughout training. Using this framework, we delineate the diverse and additive nature of IHs. By clamping subsets of activations throughout training, we then identify three underlying subcircuits that interact to drive IH formation, yielding the phase change. Furthermore, these subcircuits shed light on data-dependent properties of formation, such as phase change timing, already showing the promise of this more in-depth understanding of subcircuits that need to "go right" for an induction head.
