研究大模型如何推理假设情境下的后果,发现其能自动捕捉隐藏变量和上下文噪声。
Counterfactual reasoning: an analysis of in-context emergence

- 设计线性回归任务,要求模型推断未观测的隐变量并复制上下文噪声。
- 在真实数据上实现90%以上的准确率,证明模型具备反事实推理能力。
- 揭示注意力机制与残差流中的线性表示,适合研究因果推理与故事生成者。
大规模神经语言模型展现出强大的上下文学习能力:能够在输入上下文中实时学习与推理。本文研究语言模型在上下文中的反事实推理能力,即预测假设情景下可能结果的能力。聚焦于一个定义明确、合成的线性回归任务,该任务需进行噪声反演(noise abduction)。准确预测依赖于两个关键步骤:(1) 推断未观测的潜在概念;(2) 复制来自事实观察的上下文噪声。我们证明语言模型具备反事实推理能力。进一步,我们强化了现有可识别性结果,并将一大类函数的反事实推理简化为对上下文观测的变换。在Transformer架构中,我们发现自注意力机制、模型深度以及预训练数据多样性显著提升性能。此外,我们提供了机制性证据,表明潜在概念在线性残差流中被线性表示,并引入专用的“噪声反演头”作为反事实推理的核心组件。最后,我们的发现扩展至随机微分方程(SDE)动态下的反事实推理,表明Transformer可在序列数据上执行噪声反演,为反事实故事生成提供了初步证据。代码已公开于 https://github.com/mrtzmllr/iccr。
原文摘要 · Abstract (English)
Large-scale neural language models exhibit remarkable performance in in-context learning: the ability to learn and reason about the input context on the fly. This work studies in-context counterfactual reasoning in language models, that is, the ability to predict consequences of a hypothetical scenario. We focus on a well-defined, synthetic linear regression task that requires noise abduction. Accurate prediction is based on (1) inferring an unobserved latent concept and (2) copying contextual noise from factual observations. We show that language models are capable of counterfactual reasoning. Further, we enhance existing identifiability results and reduce counterfactual reasoning for a broad class of functions to a transformation on in-context observations. In Transformers, we find that self-attention, model depth and pre-training data diversity drive performance. Moreover, we provide mechanistic evidence that the latent concept is linearly represented in the residual stream and we introduce designated \textit{noise abduction heads} central to performing counterfactual reasoning. Lastly, our findings extend to counterfactual reasoning under SDE dynamics and reflect that Transformers can perform noise abduction on sequential data, providing preliminary evidence on the potential for counterfactual story generation. Our code is available under https://github.com/mrtzmllr/iccr.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。