arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2411.05037cs.CLcs.AIcs.LG
收藏

迈向语言模型的可解释性:多跳推理的案例研究

Towards Interpreting Language Models: A Case Study in Multi-Hop Reasoning

The University of Chicago(芝加哥大学)

Mansi Sakarvadia

AI总结:

本文通过分析GPT-2的注意力头,提出定向记忆注入以提升多跳推理,并开发Attention Lens工具解释模型决策,实验显示成功率最高提升424%。

摘要:

回答多跳推理问题需要从不同来源检索并综合信息。语言模型(LMs)在进行此类推理时难以保持一致。我们提出了一种通过针对语言模型注意力头进行定向记忆注入来定位并修正多跳推理失败的方法。首先,我们分析了GPT-2模型在单跳和多跳提示下各层激活的情况。随后,我们提出了一种机制,允许用户在推理过程中将相关的提示特定信息(我们称之为“记忆”)注入到关键的语言模型位置。通过这种方式,使语言模型在推理过程中能够整合额外的相关信息,我们提升了多跳提示补全的质量。我们通过实验证明,向关键注意力层进行简单、高效且定向的记忆注入,在多跳任务中通常能将期望的下一个词元的概率提高多达424%。我们观察到,注意力头的小子集在多跳推理过程中能显著影响模型预测。为了更忠实地解释这些注意力头,我们开发了Attention Lens:一个开源工具,通过称为透镜的学习变换,将注意力头的输出转化为词汇词元。我们展示了使用透镜来揭示模型如何得出其答案,并利用它们定位模型失败的来源,例如在有偏见和恶意语言生成的情况下。

英文摘要:

Answering multi-hop reasoning questions requires retrieving and synthesizing information from diverse sources. Language models (LMs) struggle to perform such reasoning consistently. We propose an approach to pinpoint and rectify multi-hop reasoning failures through targeted memory injections on LM attention heads. First, we analyze the per-layer activations of GPT-2 models in response to single- and multi-hop prompts. We then propose a mechanism that allows users to inject relevant prompt-specific information, which we refer to as "memories," at critical LM locations during inference. By thus enabling the LM to incorporate additional relevant information during inference, we enhance the quality of multi-hop prompt completions. We empirically show that a simple, efficient, and targeted memory injection into a key attention layer often increases the probability of the desired next token in multi-hop tasks, by up to 424%. We observe that small subsets of attention heads can significantly impact the model prediction during multi-hop reasoning. To more faithfully interpret these heads, we develop Attention Lens: an open source tool that translates the outputs of attention heads into vocabulary tokens via learned transformations called lenses. We demonstrate the use of lenses to reveal how a model arrives at its answer and use them to localize sources of model failures such as in the case of biased and malicious language generation.

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

↑