Differential learning kinetics govern the transition from memorization to generalization during in-context learning
Alex Nguyen, Gautam Reddy
TL;DR
This paper tackles the mechanism behind the emergence of in-context learning (ICL) in transformers by introducing a minimal one-layer transformer that disentangles memorization (IWL) from generalization (ICL) into two largely independent sub-circuits. A dynamical theory shows that ICL is acquired via differential learning kinetics, not solely by capacity limits, and predicts a memorization scaling law $I_K(\\infty) \\sim K^{\\nu}$ with $\\nu \\approx 0.7$, yielding a task-diversity threshold $K^* \\sim N^{1/\\nu} e^{-\\beta_0/\\nu}$; the acquisition time scales exponentially with initial conditions, producing long tails and bimodality near the threshold. The theory further explains ICL transience under regularization and predicts a nontrivial relationship between the ICL and IWL losses after acquisition. Empirical validation on synthetic data and the original model confirms the key predictions, linking data distribution, context length, and dynamics to the sharp memorization-generalization transition and its transient nature, with implications for understanding learning in both artificial and biological systems.
Abstract
Transformers exhibit in-context learning (ICL): the ability to use novel information presented in the context without additional weight updates. Recent work shows that ICL emerges when models are trained on a sufficiently diverse set of tasks and the transition from memorization to generalization is sharp with increasing task diversity. One interpretation is that a network's limited capacity to memorize favors generalization. Here, we examine the mechanistic underpinnings of this transition using a small transformer applied to a synthetic ICL task. Using theory and experiment, we show that the sub-circuits that memorize and generalize can be viewed as largely independent. The relative rates at which these sub-circuits learn explains the transition from memorization to generalization, rather than capacity constraints. We uncover a memorization scaling law, which determines the task diversity threshold at which the network generalizes. The theory quantitatively explains a variety of other ICL-related phenomena, including the long-tailed distribution of when ICL is acquired, the bimodal behavior of solutions close to the task diversity threshold, the influence of contextual and data distributional statistics on ICL, and the transient nature of ICL.
