ChatPaper.aiChatPaper

上下文学习策略的涌现具有合理性

In-Context Learning Strategies Emerge Rationally

June 21, 2025
作者: Daniel Wurgaft, Ekdeep Singh Lubana, Core Francisco Park, Hidenori Tanaka, Gautam Reddy, Noah D. Goodman
cs.AI

摘要

近期关于上下文学习(ICL)的分析研究揭示了一系列描述模型在不同实验条件下行为的策略。我们旨在通过探讨模型为何首先学习这些多样化策略来统一这些发现。具体而言,我们从一个观察出发:当模型被训练以学习任务混合体(这在文献中颇为常见)时,模型执行ICL所习得的策略可被一组贝叶斯预测器所捕捉:一个记忆型预测器,它假设在已见任务集上存在离散先验;以及一个泛化型预测器,其先验与底层任务分布相匹配。采用理性分析这一规范性视角,即学习者的行为被解释为在计算约束下对数据的最优适应,我们构建了一个层次贝叶斯框架,该框架几乎完美地预测了Transformer在整个训练过程中的下一个词预测——无需假设对其权重的访问。在此框架下,预训练被视为更新不同策略后验概率的过程,而推理时行为则作为这些策略预测的后验加权平均。我们的框架借鉴了关于神经网络学习动态的常见假设,这些假设明确指出了候选策略在损失与复杂性之间的权衡:除了对数据的解释能力外,模型对实施某一策略的偏好还受其复杂性的制约。这有助于解释众所周知的ICL现象,同时提供新颖的预测:例如,我们展示了随着任务多样性的增加,从泛化向记忆过渡的时间尺度呈现超线性趋势。总体而言,我们的工作推进了基于策略损失与复杂性权衡的ICL解释与预测理论。
English
Recent work analyzing in-context learning (ICL) has identified a broad set of strategies that describe model behavior in different experimental conditions. We aim to unify these findings by asking why a model learns these disparate strategies in the first place. Specifically, we start with the observation that when trained to learn a mixture of tasks, as is popular in the literature, the strategies learned by a model for performing ICL can be captured by a family of Bayesian predictors: a memorizing predictor, which assumes a discrete prior on the set of seen tasks, and a generalizing predictor, where the prior matches the underlying task distribution. Adopting the normative lens of rational analysis, where a learner's behavior is explained as an optimal adaptation to data given computational constraints, we develop a hierarchical Bayesian framework that almost perfectly predicts Transformer next-token predictions throughout training -- without assuming access to its weights. Under this framework, pretraining is viewed as a process of updating the posterior probability of different strategies, and inference-time behavior as a posterior-weighted average over these strategies' predictions. Our framework draws on common assumptions about neural network learning dynamics, which make explicit a tradeoff between loss and complexity among candidate strategies: beyond how well it explains the data, a model's preference towards implementing a strategy is dictated by its complexity. This helps explain well-known ICL phenomena, while offering novel predictions: e.g., we show a superlinear trend in the timescale for transitioning from generalization to memorization as task diversity increases. Overall, our work advances an explanatory and predictive account of ICL grounded in tradeoffs between strategy loss and complexity.
PDF71June 30, 2025