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

通过上下文学习中的隐藏状态几何统一注意力头与任务向量

Unifying Attention Heads and Task Vectors via Hidden State Geometry in In-Context Learning

University of Chicago(芝加哥大学);JAIST;University of Wisconsin - Madison(威斯康星大学麦迪逊分校);RIKEN(日本研究机构)

Haolin Yang, Hakaze Cho, Yiqiao Zhong, Naoya Inoue

AI总结:

本文提出基于隐藏状态可分离性与对齐性的统一几何框架,揭示分类 ICL 的两阶段机制,并阐明不同注意力头与任务向量的作用。

摘要:

上下文学习(ICL)的特殊性质促使人们研究大型语言模型的内部机制。以往工作通常聚焦于特定层中的特殊注意力头或任务向量,但缺乏一个统一框架,将这些组件与跨层隐藏状态的演化联系起来,而这种演化最终产生模型的输出。本文通过分析两个决定性能的几何因素——查询隐藏状态的可分离性和对齐性,为分类任务中的 ICL 提出了这样一个框架。对逐层动态的细粒度分析揭示了一个显著的两阶段机制:可分离性在早期层出现,而对齐性在后期层形成。消融研究进一步表明,Previous Token Heads(前一 token 头)驱动可分离性,而 Induction Heads(归纳头)和任务向量增强对齐性。因此,我们的发现弥合了注意力头与任务向量之间的差距,为 ICL 的底层机制提供了统一解释。

英文摘要:

The unusual properties of in-context learning (ICL) have prompted investigations into the internal mechanisms of large language models. Prior work typically focuses on either special attention heads or task vectors at specific layers, but lacks a unified framework linking these components to the evolution of hidden states across layers that ultimately produce the model's output. In this paper, we propose such a framework for ICL in classification tasks by analyzing two geometric factors that govern performance: the separability and alignment of query hidden states. A fine-grained analysis of layer-wise dynamics reveals a striking two-stage mechanism: separability emerges in early layers, while alignment develops in later layers. Ablation studies further show that Previous Token Heads drive separability, while Induction Heads and task vectors enhance alignment. Our findings thus bridge the gap between attention heads and task vectors, offering a unified account of ICL's underlying mechanisms.

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

↑