Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatch

πŸ“… 2026-07-03
πŸ“ˆ Citations: 0
✨ Influential: 0
πŸ“„ PDF
πŸ€– AI Summary
Existing theories of in-context learning typically assume that demonstration examples in prompts are independent and identically distributed, thereby overlooking the pervasive temporal correlations present in real-world sequences. This work develops a theoretically tractable model based on linear attention, integrating a linear regression theory sandbox with an actual Transformer architecture to systematically investigate how temporal dependencies within prompts affect in-context learning. We reveal for the first time that such temporal correlations induce an β€œeffective context length,” rendering correlated prompts equivalent to shorter i.i.d. ones. Moreover, we find that when queries are temporally aligned with the context, Softmax attention substantially outperforms linear attention, highlighting the critical importance of aligning attention mechanisms with task-specific structural properties.
πŸ“ Abstract
Modern sequence models have a striking capacity for in-context learning (ICL); they can perform new tasks based only on examples given in the prompt. Understanding how this ability emerges requires theory that captures important properties of natural data. Linear regression has served as a useful sandbox for ICL theory, but existing work has largely focused on prompts with independent examples. In this work, we extend this setting to sequentially correlated data, a basic feature of real sequences. We present a solvable model based on linear attention and test our predictions on realistic transformer architectures. We identify two distinct effects: First, when the query token is independent of the context, within-context correlations induce an effective context length: correlated prompts behave like shorter i.i.d. prompts. Second, when the query is also correlated with its context, test error is reduced, particularly for softmax attention when compared to linear attention. These results suggest that correlated prompts alter not only the effective sample size of in-context learning, but also which attention architectures are best matched to the task.
Problem

Research questions and friction points this paper is trying to address.

in-context learning
sequential correlations
effective context length
architectural mismatch
attention mechanisms
Innovation

Methods, ideas, or system contributions that make the work stand out.

in-context learning
sequential correlations
effective context length
attention architecture
linear attention
M
Mary Letey
John A. Paulson School of Engineering and Applied Sciences, Harvard University; Kempner Institute for the Study of Natural and Artificial Intelligence, Harvard University
Yue M. Lu
Yue M. Lu
Gordon McKay Professor of Electrical Engineering and of Applied Mathematics, Harvard University
Signal and information processing
Cengiz Pehlevan
Cengiz Pehlevan
Harvard University
Neural NetworksTheoretical NeuroscienceMachine LearningPhysics of Learning
J
Jacob Zavatone-Veth
Society of Fellows and Center for Brain Science, Harvard University