揭示Gemma-2 2B模型在少样本学习中的信息整合机制
Contextualize-then-Aggregate: Circuits for In-Context Learning in Gemma-2 2B
- 分两步处理:先上下文化单个示例,再聚合识别任务
- 低层构建示例表征,高层聚合形成任务判断与预测
- 该机制对模糊示例更敏感,适合研究模型内学习机理
少样本学习(ICL)是大语言模型的显著能力。尽管已有大量研究关注其行为特征及在小规模设置中的涌现方式,但模型如何从提示中的个别示例中整合任务信息仍不明确。本文通过因果干预分析Gemma-2 2B在五个自然任务上的信息流动,发现模型采用一种称为‘上下文化-聚合’的两阶段策略:在低层,模型构建单个示例的表征,并通过序列中示例输入与输出标记间的连接实现上下文化;在高层,这些表征被聚合以识别任务并生成下一步预测。上下文化步骤的重要性因任务而异,在存在模糊示例时尤为关键。本研究通过严格的因果分析,揭示了语言模型中ICL的内在机制。
原文摘要 · Abstract (English)
In-Context Learning (ICL) is an intriguing ability of large language models (LLMs). Despite a substantial amount of work on its behavioral aspects and how it emerges in miniature setups, it remains unclear which mechanism assembles task information from the individual examples in a fewshot prompt. We use causal interventions to identify information flow in Gemma-2 2B for five naturalistic ICL tasks. We find that the model infers task information using a two-step strategy we call contextualize-then-aggregate: In the lower layers, the model builds up representations of individual fewshot examples, which are contextualized by preceding examples through connections between fewshot input and output tokens across the sequence. In the higher layers, these representations are aggregated to identify the task and prepare prediction of the next output. The importance of the contextualization step differs between tasks, and it may become more important in the presence of ambiguous examples. Overall, by providing rigorous causal analysis, our results shed light on the mechanisms through which ICL happens in language models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。