揭示了大模型在上下文学习中依赖的两种能力及其机制。
Context-Scaling versus Task-Scaling in In-Context Learning
- 提出简化Transformer结构,发现其仍可实现上下文学习。
- 实验证明仅用向量输入的MLP无法实现上下文泛化。
- 特征映射+MLP组合可同时支持上下文与任务泛化,适合研究ICL机制。
Transformer具备上下文学习(ICL)能力,即通过提示中的示例解决新任务而无需额外训练。本文识别并分析了ICL的两个关键成分:(1) 上下文缩放(context-scaling),即随着提示中示例数量增加,模型性能提升;(2) 任务缩放(task-scaling),即随着预训练任务数量增加,性能提升。尽管Transformer同时具备这两种能力,但标准多层感知机(MLP)在向量化输入下仅能实现任务缩放。为理解Transformer如何实现上下文缩放,我们提出一种去除key、query、value权重的简化Transformer架构。该结构在多项统计学习任务(如线性回归、师生设置)中表现与原始GPT-2相当。进一步发现,单个模块可视为数据相关的特征映射后接一个MLP。该特征映射本身具有强大的上下文缩放能力,但缺乏任务缩放能力。实验证明,将该特征映射输出与向量化数据拼接后输入到MLP中,即可同时实现上下文缩放和任务缩放。这一结果提供了一个简洁的框架,用于研究ICL中的两种缩放行为。
原文摘要 · Abstract (English)
Transformers exhibit In-Context Learning (ICL), where these models solve new tasks by using examples in the prompt without additional training. In our work, we identify and analyze two key components of ICL: (1) context-scaling, where model performance improves as the number of in-context examples increases and (2) task-scaling, where model performance improves as the number of pre-training tasks increases. While transformers are capable of both context-scaling and task-scaling, we empirically show that standard Multi-Layer Perceptrons (MLPs) with vectorized input are only capable of task-scaling. To understand how transformers are capable of context-scaling, we first propose a significantly simplified transformer architecture without key, query, value weights. We show that it performs ICL comparably to the original GPT-2 model in various statistical learning tasks including linear regression, teacher-student settings. Furthermore, a single block of our simplified transformer can be viewed as data dependent feature map followed by an MLP. This feature map on its own is a powerful predictor that is capable of context-scaling but is not capable of task-scaling. We show empirically that concatenating the output of this feature map with vectorized data as an input to MLPs enables both context-scaling and task-scaling. This finding provides a simple setting to study context and task-scaling for ICL.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。