Predictability Shapes Adaptation: An Evolutionary Perspective on Modes of Learning in Transformers
Alexander Y. Ku, Thomas L. Griffiths, Stephanie C. Y. Chan
TL;DR
The study analyzes how Transformers balance in-context learning (ICL) and in-weights learning (IWL) as a function of environmental stability $\alpha_{stability}$ and cue reliability $\sigma^2_{reliability}$, drawing on evolutionary concepts. It uses two controlled tasks—a sinusoid regression task and Omniglot few-shot binary classification—with a decoder-only Transformer to test how predictability shapes the ICL/IWL balance, quantified via evaluator-based targets and the preference score $S_{ICL} = \dfrac{E_{IWL}}{E_{ICL}+E_{IWL}+\epsilon}$. The key findings show that higher environmental stability favors IWL while higher cue reliability favors ICL, with task-dependent transience between modes and a relative-cost hypothesis explaining reversals when IWL is easier for a given task. These results provide a principled framework for understanding adaptive learning in Transformers and suggest practical training strategies that leverage predictability to balance flexibility and robustness in AI systems.
Abstract
Transformer models learn in two distinct modes: in-weights learning (IWL), encoding knowledge into model weights, and in-context learning (ICL), adapting flexibly to context without weight modification. To better understand the interplay between these learning modes, we draw inspiration from evolutionary biology's analogous adaptive strategies: genetic encoding (akin to IWL, adapting over generations and fixed within an individual's lifetime) and phenotypic plasticity (akin to ICL, enabling flexible behavioral responses to environmental cues). In evolutionary biology, environmental predictability dictates the balance between these strategies: stability favors genetic encoding, while reliable predictive cues promote phenotypic plasticity. We experimentally operationalize these dimensions of predictability and systematically investigate their influence on the ICL/IWL balance in Transformers. Using regression and classification tasks, we show that high environmental stability decisively favors IWL, as predicted, with a sharp transition at maximal stability. Conversely, high cue reliability enhances ICL efficacy, particularly when stability is low. Furthermore, learning dynamics reveal task-contingent temporal evolution: while a canonical ICL-to-IWL shift occurs in some settings (e.g., classification with many classes), we demonstrate that scenarios with easier IWL (e.g., fewer classes) or slower ICL acquisition (e.g., regression) can exhibit an initial IWL phase later yielding to ICL dominance. These findings support a relative-cost hypothesis for explaining these learning mode transitions, establishing predictability as a critical factor governing adaptive strategies in Transformers, and offering novel insights for understanding ICL and guiding training methodologies.
