🤖 AI Summary
This work investigates the dynamic switching between in-context learning (ICL) and in-weights learning (IWL) in large language models, focusing on how training data distribution governs their emergence and decay. We propose the first simplified gating-theoretic framework, characterizing critical conditions for ICL/IWL via generalization error bounds and regret analysis. To empirically validate our theory, we design controlled synthetic data experiments—employing Transformer-based models, LLM fine-tuning, and prompt interventions—to precisely identify distributional thresholds at which ICL emerges or vanishes. Our findings demonstrate consistent ICL/IWL behavior across both simplified theoretical models and real-world large language models. By unifying rigorous theoretical derivation with systematic empirical analysis, we establish a closed-loop validation and provide the first systematic evidence that data distribution fundamentally determines the competitive relationship between ICL and IWL.
📝 Abstract
It has recently been demonstrated empirically that in-context learning emerges in transformers when certain distributional properties are present in the training data, but this ability can also diminish upon further training. We provide a new theoretical understanding of these phenomena by identifying simplified distributional properties that give rise to the emergence and eventual disappearance of in-context learning. We do so by first analyzing a simplified model that uses a gating mechanism to choose between an in-weight and an in-context predictor. Through a combination of a generalization error and regret analysis we identify conditions where in-context and in-weight learning emerge. These theoretical findings are then corroborated experimentally by comparing the behaviour of a full transformer on the simplified distributions to that of the stylized model, demonstrating aligned results. We then extend the study to a full large language model, showing how fine-tuning on various collections of natural language prompts can elicit similar in-context and in-weight learning behaviour.