Spin glass model of in-context learning
Yuhao Li, Ruoran Bai, Haiping Huang

TL;DR
This paper models in-context learning in large language models using a spin glass framework, providing a physics-inspired mechanistic understanding of how prompts enable predictions without additional training.
Contribution
It introduces a simplified transformer model mapped to a spin glass system, linking data disorder and model interactions to in-context learning phenomena.
Findings
Increasing task diversity promotes in-context learning.
The spin glass model explains how pre-trained weights predict unseen functions.
The model offers a new theoretical perspective on large language model behavior.
Abstract
Large language models show a surprising in-context learning ability -- being able to use a prompt to form a prediction for a query, yet without additional training, in stark contrast to old-fashioned supervised learning. Providing a mechanistic interpretation and linking the empirical phenomenon to physics are thus challenging and remain unsolved. We study a simple yet expressive transformer with linear attention and map this structure to a spin glass model with real-valued spins, where the couplings and fields explain the intrinsic disorder in data. The spin glass model explains how the weight parameters interact with each other during pre-training, and further clarifies why an unseen function can be predicted by providing only a prompt yet without further training. Our theory reveals that for single-instance learning, increasing the task diversity leads to the emergence of in-context…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsCognitive Science and Education Research
MethodsSoftmax · Attention Is All You Need
