Learning without training: The implicit dynamics of in-context learning
Benoit Dherin, Michael Munn, Hanna Mazzawi, Michael Wunder, Javier Gonzalvo
TL;DR
The paper analyzes how large language models can learn from in-context information without updating weights by introducing the contextual blocks framework, where a contextual layer paired with an MLP induces an exact rank-1 update to the MLP weights. It provides a formal theorem stating that context can be translated into a low-rank, weight-modifying operation, and shows an implicit gradient-descent-like dynamic as the prompt is consumed. Empirically, the authors validate the theory on a linear-function ICL task, demonstrating that the implicit weight updates reproduce the same outputs as explicit fine-tuning and converge as context accumulates. They further connect the mechanism to model-editing concepts and discuss implications for prompt engineering, context compression, and architecture design.
Abstract
One of the most striking features of Large Language Models (LLMs) is their ability to learn in-context. Namely at inference time an LLM is able to learn new patterns without any additional weight update when these patterns are presented in the form of examples in the prompt, even if these patterns were not seen during training. The mechanisms through which this can happen are still largely unknown. In this work, we show that the stacking of a self-attention layer with an MLP, allows the transformer block to implicitly modify the weights of the MLP layer according to the context. We argue through theory and experimentation that this simple mechanism may be the reason why LLMs can learn in-context and not only during training. Specifically, we show how a transformer block implicitly transforms a context into a low-rank weight-update of its MLP layer.
