cs.LGOct 31, 2026

Solvable dynamics model of in-context learning

Authors: Ruoran Bai, Haiping Huang

Organizations: PMI Lab, School of Physics, Sun Yat-sen University, Guangzhou 510275, People’s Republic of China · Guangdong Provincial Key Laboratory of Magnetoelectric Physics and Devices, Sun Yat-sen University, Guangzhou 510275, People’s Republic of China

Abstract

Pretrained Transformer architectures display a surprising in-context learning ability without additional training. How the learning process guides the network to achieve this intriguing capability remains unsolved. In this study, we focus on a single-layer, single-head linear attention model, where empirical risk minimization is defined for learning. Given a finite amount of training examples, we determine the exact solution of network parameter dynamics, which is linked to the training error and generalization error, characterizing how memorization and generalization emerge from learning and how these transitions are related to curvatures of the empirical risk landscape. Furthermore, we calculate a data-dependent free energy, from which the training and generalization errors in the long-time limit of learning dynamics can be well predicted. Our work adds insights toward understanding the mechanism of in-context learning, especially from a learning dynamics perspective.

Figures & tables

Explore similar work

CardsList
  1. Distinct mechanisms underlying in-context learning in transformers

    Apr 14, 2026Cole Gibson, Wenping Cui, Gautam ReddyIn-Context LearningTransformer Training Dynamics

  2. In-context Learning of Single-index Targets: Comparing Kernel and Feature Learners

    Oct 1, 2026Haotian Gu, Yizhou Xu, Lenka ZdeborováRepresentation LearningSingle-Index Models

  3. What can linear attention learn from nonlinear teachers in-context?

    Oct 7, 2026Mary Letey, Arman Rysmakhanov, Yue M. Lu +2In-Context LearningLinear Attention