解释大模型如何通过向量运算实现上下文学习中的事实记忆
Provable In-Context Vector Arithmetic via Retrieving Task Concepts
- 基于分层概念建模,建立梯度下降训练的理论框架
- 证明了0-1损失收敛,且具备强泛化能力与抗分布偏移特性
- 揭示了变换器相比静态嵌入的优势,适合研究模型内部机制
上下文学习(ICL)因其能从示范中理解任务而备受关注。近期研究表明,大语言模型在进行上下文学习时存在潜在的任务/函数向量。Merullo等(2024)发现,模型利用该向量与残差流进行类似Word2Vec的向量运算,以解决事实回忆类任务。此外,已有研究实证表明问答数据在提升事实回忆能力中起关键作用。然而,其理论机制仍不明确。本文提出一个基于实证的分层概念建模理论框架,发展优化理论,证明通过交叉熵损失梯度下降训练的非线性残差变压器可借助向量运算完成事实回忆型上下文学习任务。理论证明其0-1损失收敛,并展现出对概念重组和分布偏移的鲁棒性,揭示了变换器相较静态嵌入方法的优势。实验模拟验证了理论结果。
原文摘要 · Abstract (English)
In-context learning (ICL) has garnered significant attention for its ability to grasp functions/tasks from demonstrations. Recent studies suggest the presence of a latent task/function vector in LLMs during ICL. Merullo et al. (2024) showed that LLMs leverage this vector alongside the residual stream for Word2Vec-like vector arithmetic, solving factual-recall ICL tasks. Additionally, recent work empirically highlighted the key role of Question-Answer data in enhancing factual-recall capabilities. Despite these insights, a theoretical explanation remains elusive. To move one step forward, we propose a theoretical framework building on empirically grounded hierarchical concept modeling. We develop an optimization theory, showing how nonlinear residual transformers trained via gradient descent on cross-entropy loss perform factual-recall ICL tasks via vector arithmetic. We prove 0-1 loss convergence and show the strong generalization, including robustness to concept recombination and distribution shifts. These results elucidate the advantages of transformers over static embedding predecessors. Empirical simulations corroborate our theoretical insights.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。