Illusion or Algorithm? Investigating Memorization, Emergence, and Symbolic Processing in In-Context Learning
Jingcheng Niu, Subhabrata Dutta, Ahmed Elshabrawy, Harish Tayyar Madabushi, Iryna Gurevych
TL;DR
This work interrogates in-context learning (ICL) in large Transformers trained on web-scale data, asking whether ICL arises from memorization, generalization, or a symbolic algorithm, and how it develops during pre-training. By introducing a suite of pattern-based, random-token tasks and leveraging the full Pythia scaling suite, the authors demonstrate that ICL is not mere memorization but also not a universal symbolic algorithm; performance depends on token frequency and task configuration, indicating a mix of generalization and statistics. They reveal a gradual, scalable development of ICL across pre-training, with a scaling law governing the emergence of more complex ICL capabilities, and they connect ICL development to internal subspace formation in the residual stream using the SUDA method, showing early emergence of dominant subspaces around $\sim$1000 steps and a peak in strong subspaces near $\sim$20{,}000 steps. The findings have implications for AI safety and model design, suggesting that ICL is a tractable, measurable phenomenon that can be analyzed and guided rather than an unpredictable emergent capability. Overall, the paper advances mechanistic understanding of ICL by tying behavioral generalization to internal subspace dynamics while acknowledging token statistics as a fundamental constraint on off-distribution generalization.
Abstract
Large-scale Transformer language models (LMs) trained solely on next-token prediction with web-scale data can solve a wide range of tasks after seeing just a few examples. The mechanism behind this capability, known as in-context learning (ICL), remains both controversial and poorly understood. Some studies argue that it is merely the result of memorizing vast amounts of data, while others contend that it reflects a fundamental, symbolic algorithmic development in LMs. In this work, we introduce a suite of investigative tasks and a novel method to systematically investigate ICL by leveraging the full Pythia scaling suite, including interim checkpoints that capture progressively larger amount of training data. By carefully exploring ICL performance on downstream tasks and simultaneously conducting a mechanistic analysis of the residual stream's subspace, we demonstrate that ICL extends beyond mere "memorization" of the training corpus, yet does not amount to the implementation of an independent symbolic algorithm. Our results also clarify several aspects of ICL, including the influence of training dynamics, model capabilities, and elements of mechanistic interpretability. Overall, our work advances the understanding of ICL and its implications, offering model developers insights into potential improvements and providing AI security practitioners with a basis for more informed guidelines.
