arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.11965cs.CL
收藏

从注意力头参数推断其功能

Inferring Functionality of Attention Heads from their Parameters

Blavatnik School of Computer Science, Tel Aviv University(巴尔-以色列计算机科学学院,特拉维夫大学)

Amit Elhelo, Mor Geva

AI总结:

本文提出 MAPS 框架,无需训练或推理即可从注意力头参数推断其功能,在多个 LLM 上验证了其估计与推理输出相关且具有因果性,并揭示了被忽视的注意力头功能及架构偏好。

摘要:

注意力头是大语言模型(LLMs)的基本构建模块之一。先前关于其运作机制的研究大多集中于分析它们在推理过程中针对特定电路或任务的行为。在本工作中,我们寻求对模型中注意力头所实现的操作进行全面的映射。我们提出了 MAPS(Mapping Attention head ParameterS,注意力头参数映射),这是一个高效的框架,能够在不进行任何模型训练或推理的情况下,从注意力头的参数中推断其功能。我们展示了 MAPS 在回答两类问题上的实用性:(a)给定一个预定义的操作,映射模型中各个注意力头实现该操作的强度;(b)给定一个注意力头,推断其显著功能。在 6 个流行的 LLM 上对 20 种操作评估 MAPS,结果表明其估计与注意力头在推理过程中的输出相关,并且与模型预测存在因果关联。此外,其映射揭示了先前研究中被忽视的某些操作的注意力头,并提供了关于 LLM 中功能普遍性和架构偏好的有价值见解。接下来,我们提出了一套自动化流程和分析方法,利用 MAPS 来刻画给定注意力头的显著操作。经人类判断评估,我们的流程为大多数注意力头生成了合理的操作描述,同时揭示了多样化的操作。

英文摘要:

Attention heads are one of the building blocks of large language models (LLMs). Prior work on investigating their operation mostly focused on analyzing their behavior during inference for specific circuits or tasks. In this work, we seek a comprehensive mapping of the operations they implement in a model. We propose MAPS (Mapping Attention head ParameterS), an efficient framework that infers the functionality of attention heads from their parameters, without any model training or inference. We showcase the utility of MAPS for answering two types of questions: (a) given a predefined operation, mapping how strongly heads across the model implement it, and (b) given an attention head, inferring its salient functionality. Evaluating MAPS on 20 operations across 6 popular LLMs shows its estimations correlate with the head's outputs during inference and are causally linked to the model's predictions. Moreover, its mappings reveal attention heads of certain operations that were overlooked in previous studies, and valuable insights on function universality and architecture biases in LLMs. Next, we present an automatic pipeline and analysis that leverage MAPS to characterize the salient operations of a given head. Our pipeline produces plausible operation descriptions for most heads, as assessed by human judgment, while revealing diverse operations.

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

↑