Bayesian Optimality of In-Context Learning with Selective State Spaces
On the map: State-space sequence models (S4, Mamba) → Core SSM architectures for language
Abstract (arXiv)
We propose Bayesian optimal sequential prediction as a new principle for understanding in-context learning (ICL). Unlike interpretations framing Transformers as performing implicit gradient descent, we formalize ICL as meta-learning over latent sequence tasks. For tasks governed by Linear Gaussian State Space Models (LG-SSMs), we prove a meta-trained selective SSM asymptotically implements the Bayes-optimal predictor, converging to the posterior predictive mean. We further establish a statistical separation from gradient descent, constructing tasks with temporally correlated noise where the optimal Bayesian predictor strictly outperforms any empirical risk minimization (ERM) estimator. Since Transformers can be seen as performing implicit ERM, this demonstrates selective SSMs achieve lower asymptotic risk due to superior statistical efficiency. Experiments on synthetic LG-SSM tasks and a character-level Markov benchmark confirm selective SSMs converge faster to Bayes-optimal risk, show superior sample efficiency with longer contexts in structured-noise settings, and track latent states more robustly than linear Transformers. This reframes ICL from "implicit optimization" to "optimal inference," explaining the efficiency of selective SSMs and offering a principled basis for architecture design.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Placed in Core SSM architectures for language, one of 10 directions in State-space sequence models (S4, Mamba). Builds on 22 of its 28 references that are in the map. First posted on arXiv 19 Feb 2026.
Builds on
22 of 28 references.
Closest ancestors · 3
Same direction, newest first
- 2025Mamba Can Learn Low-Dimensional Targets In-Context via Test-Time Feature Learning14 Oct
- 2025From Markov to Laplace: How Mamba In-Context Learns Markov Chains14 Feb
- 2023Mamba: Linear-Time Sequence Modeling with Selective State Spaces1 Dec
Other references · 19
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2018Recasting Gradient-Based Meta-Learning as Hierarchical Bayescited by 180
- 2023The Learnability of In-Context Learningcited by 126
- 2024RNNs are not Transformers (Yet): The Key Bottleneck on In-context Retrievalcited by 62
- 2024The Expressive Capacity of State Space Models: A Formal Language Perspectivecited by 45
- 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 43
- 2024Learning to grok: Emergence of in-context learning and skill composition in modular arithmetic taskscited by 40
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 39
- 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 29
- 2024Linear Transformers are Versatile In-Context Learnerscited by 28
- 2024How Well Can Transformers Emulate In-context Newton's Method?cited by 23
7 more
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learningcited by 17
- 2025Emergence of Superposition: Unveiling the Training Dynamics of Chain of Continuous Thoughtcited by 16
- 2025On the Role of Transformer Feed-Forward Layers in Nonlinear In-Context Learningcited by 7
- 2025In-Context Occam's Razor: How Transformers Prefer Simpler Hypotheses on the Flycited by 4
- 2025Provable In-Context Learning of Nonlinear Regression with Transformerscited by 4
- 2024Learning in the Recurrent State: Gradient Descent with Linear Recurrent Networkscited by 2
- 2025Transformers are almost optimal metalearners for linear classificationcited by 1
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2026A Comparative Analysis of Attention versus State-Space Models for In-Context Learning
- 2025Rethinking Selectivity in State Space Models: A Minimal Predictive Sufficiency Approach
- 2024Bayesian scaling laws for in-context learning
- 2025How Transformers Learn In-Context Recall Tasks? Optimality, Training Dynamics and Generalization
- 2026Filtering Beats Fine Tuning: A Bayesian Kalman View of In Context Learning in LLMs
- 2025Probing In-Context Learning: Impact of Task Complexity and Model Architecture on Generalization and Efficiency
- 2025Memory Determines Learning Direction: A Theory of Gradient-Based Optimization in State Space Models
- 2024HiPPO-Prophecy: State-Space Models can Provably Learn Dynamical Systems in Context