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

大型语言模型中的旋转偏移特征

Rotary Offset Features in Large Language Models

André Jonasson(独立研究者)

André Jonasson

AI总结:

本文提出旋转偏移特征概念,分析其在LLMs各层和注意力头中的一致出现规律,推导出产生条件与最小角度的理论边界,并在多规模多架构模型上验证了预测。

摘要:

基于Transformer的大型语言模型(LLMs)依赖位置编码为其注意力机制提供序列位置信息。旋转位置编码(RoPE)通过旋转查询和键来编码相对位置,已在现代LLMs中得到广泛应用。我们研究了使用旋转嵌入时查询和键中出现的特征与模式,并引入旋转偏移特征的概念。我们的分析表明,这些特征经常表现出较大的激活值,且常被解释为离群点,它们在不同层、注意力头和模型架构中一致出现。我们推导出边界,预测哪些旋转频率会产生旋转偏移特征,以及这些特征的查询-键对之间的最小角度。我们在不同规模和架构的模型上通过实验验证了这些预测。

英文摘要:

Transformer-based Large Language Models (LLMs) rely on positional encodings to provide sequence position information to their attention mechanism. Rotary Positional Encodings (RoPE), which encode relative position by rotating queries and keys, have become widely used in modern LLMs. We study the features and patterns that emerge in queries and keys when using rotary embeddings and introduce the concept of rotary offset features. Our analysis reveals that these features, which frequently exhibit large activations and are often interpreted as outliers, arise consistently across layers, attention heads, and model architectures. We derive bounds predicting which rotary frequencies give rise to rotary offset features and the minimum angle between the query-key pairs for these features. We verify our predictions empirically across models of different sizes and architectures.

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

↑