Litcius/Paper detail

Characterizing In-Context Learning: When Can Transformers Match Standard Learning Algorithms?

Mosab Hawarey

202610 citationsDOIOpen Access PDF

Abstract

Transformers exhibit remarkable in-context learning (ICL) capabilities—the ability to learn new tasks from examples provided in the context window without weight updates. Despite extensive empirical investigation, a fundamental theoretical question remains unanswered: which function classes can be learned in-context, and which cannot? This gap in our understanding limits principled system design and creates uncertainty about when ICL will succeed or fail. We address this gap by developing a theoretical framework based on Sufficient Statistic Complexity (SSC)—the minimal information that must be extracted from context examples to enable accurate prediction. We prove that function classes with attention-computable sufficient statistics (those expressible as sums over examples) are efficiently ICL-learnable, matching the sample complexity of standard learning algorithms (Theorem 1). Conversely, we prove that function classes requiring combinatorial sufficient statistics—such as sparse parity—cannot be efficiently ICL-learned by any polynomial-size transformer (Theorem 2), establishing a fundamental computational barrier via novel connections to circuit complexity. These results yield a near-complete characterization: we prove a Master Theorem (Theorem 3) establishing necessary and sufficient conditions for ICL-learnability, and a Dichotomy Theorem (Theorem 6) showing that natural function classes are either ICL-Easy (learnable with optimal sample complexity) or ICL-Hard (requiring exponentially more resources). The boundary corresponds to whether learning is parallelizable or inherently sequential. Our framework explains empirical ICL phenomena, provides architectural guidance, and opens new research directions connecting learning theory, circuit complexity, and meta-learning.

Topics & Concepts

Sample complexityComputer scienceTheoretical computer scienceMathematicsFunction (biology)StatisticTransformerContext (archaeology)Matching (statistics)AlgorithmQ-learningArtificial intelligenceSample (material)Computational complexity theoryParallelizable manifoldVC dimensionComputational learning theoryConcept classMachine Learning and AlgorithmsDomain Adaptation and Few-Shot LearningMachine Learning and Data Classification
Characterizing In-Context Learning: When Can Transformers Match Standard Learning Algorithms? | Litcius