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

表征语言模型中事实回忆的机制

Characterizing Mechanisms for Factual Recall in Language Models

Brown University(布朗大学)

Qinan Yu, Jack Merullo, Ellie Pavlick

AI总结:

研究语言模型在预训练记忆与上下文新信息冲突时的事实回忆机制,通过头归因识别影响答案选择的注意力头,并证明在运行时缩放单个头即可动态控制模型行为。

摘要:

语言模型(LMs)通常必须将它们在预训练中记忆的事实与给定上下文中出现的新信息进行整合。这两种来源可能不一致,从而在模型内部引发竞争,目前尚不清楚LM将如何解决这种冲突。在一个查询世界首都知识的数据集上,我们研究了此类情况下LM行为的分布性和机制性决定因素。具体而言,我们测量了LM使用反事实前缀(例如,“波兰的首都是伦敦”)来覆盖其在预训练中学到的内容(“华沙”)的时间比例。在Pythia和GPT2上,查询国家(“波兰”)和上下文城市(“伦敦”)的训练频率极大地影响了模型使用反事实的似然。随后,我们使用头归因来识别在logits中促进记忆答案或上下文答案的单个注意力头。通过放大或缩小这些头的值向量,我们可以控制在新数据上使用上下文答案的似然。该方法仅通过在运行时缩放单个头,就能将生成上下文答案的比率提高到88%。我们的工作为大量证据做出了贡献,表明我们通常可以将模型行为局部化到特定组件,并为未来方法如何在运行时动态控制模型行为提供了概念证明。

英文摘要:

Language Models (LMs) often must integrate facts they memorized in pretraining with new information that appears in a given context. These two sources can disagree, causing competition within the model, and it is unclear how an LM will resolve the conflict. On a dataset that queries for knowledge of world capitals, we investigate both distributional and mechanistic determinants of LM behavior in such situations. Specifically, we measure the proportion of the time an LM will use a counterfactual prefix (e.g., "The capital of Poland is London") to overwrite what it learned in pretraining ("Warsaw"). On Pythia and GPT2, the training frequency of both the query country ("Poland") and the in-context city ("London") highly affect the models' likelihood of using the counterfactual. We then use head attribution to identify individual attention heads that either promote the memorized answer or the in-context answer in the logits. By scaling up or down the value vector of these heads, we can control the likelihood of using the in-context answer on new data. This method can increase the rate of generating the in-context answer to 88\% of the time simply by scaling a single head at runtime. Our work contributes to a body of evidence showing that we can often localize model behaviors to specific components and provides a proof of concept for how future methods might control model behavior dynamically at runtime.

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

↑