arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.15213cs.CLcs.LG
收藏

大型语言模型中的函数向量

Function Vectors in Large Language Models

Khoury College of Computer Sciences, Northeastern University(东北大学卡尔霍里计算机科学学院)

Eric Todd, Millicent L. Li, Arnab Sen Sharma, Aaron Mueller, Byron C. Wallace, David Bau

AI总结:

本文发现大型语言模型中存在称为函数向量的紧凑内部表示,少量注意力头通过它触发上下文学习任务,该向量具有鲁棒性、可提取性和一定的语义组合能力。

摘要:

我们报告了一种简单神经机制的存在,该机制在自回归Transformer语言模型(LMs)中将输入-输出函数表示为一个向量。通过对多种上下文学习(ICL)任务进行因果中介分析,我们发现少量注意力头传输了所示任务的紧凑表示,我们称之为函数向量(FV)。FV对上下文变化具有鲁棒性,即它们会在零样本和自然文本等与收集它们的ICL上下文不相似的输入上触发任务执行。我们在一系列任务、模型和层上测试了FV,并发现中间层在各种设置下都具有强因果效应。我们研究了FV的内部结构,发现虽然它们通常包含编码函数输出空间的信息,但仅凭这些信息不足以重建FV。最后,我们测试了FV中的语义向量组合,发现它们在某种程度上可以被求和以创建触发新的复杂任务的向量。我们的发现表明,函数抽象的紧凑、因果的内部向量表示可以从LLM中显式提取。我们的代码和数据可在https://functions.baulab.info获取。

英文摘要:

We report the presence of a simple neural mechanism that represents an input-output function as a vector within autoregressive transformer language models (LMs). Using causal mediation analysis on a diverse range of in-context-learning (ICL) tasks, we find that a small number attention heads transport a compact representation of the demonstrated task, which we call a function vector (FV). FVs are robust to changes in context, i.e., they trigger execution of the task on inputs such as zero-shot and natural text settings that do not resemble the ICL contexts from which they are collected. We test FVs across a range of tasks, models, and layers and find strong causal effects across settings in middle layers. We investigate the internal structure of FVs and find while that they often contain information that encodes the output space of the function, this information alone is not sufficient to reconstruct an FV. Finally, we test semantic vector composition in FVs, and find that to some extent they can be summed to create vectors that trigger new complex tasks. Our findings show that compact, causal internal vector representations of function abstractions can be explicitly extracted from LLMs. Our code and data are available at https://functions.baulab.info.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑