Positional Encodings (PEs) are a critical component of Transformer-based Large Language Models (LLMs), providing the attention mechanism with important sequence-position information. One of the most popular types of encoding used today in LLMs are Rotary Positional Encodings (RoPE), that rotate the queries and keys based on their relative distance. A common belief is that RoPE is useful because it helps to decay token dependency as relative distance increases. In this work, we argue that this is unlikely to be the core reason. We study the internals of a trained Gemma 7B model to understand how RoPE is being used at a mechanical level. We find that Gemma learns to use RoPE to construct robust "positional" attention patterns by exploiting the highest frequencies. We also find that, in general, Gemma greatly prefers to use the lowest frequencies of RoPE, which we suspect are used to carry semantic information. We mathematically prove interesting behaviours of RoPE and conduct experiments to verify our findings, proposing a modification of RoPE that fixes some highlighted issues and improves performance. We believe that this work represents an interesting step in better understanding PEs in LLMs, which we believe holds crucial value for scaling LLMs to large sizes and context lengths.
KV-Latent: Dimensional-level KV Cache Reduction with Frequency-aware Rotary Positional Embedding
School of Computer Science, Wuhan University(武汉大学计算机学院);School of Artificial Intelligence, Wuhan University(武汉大学人工智能学院);Xiaomi(小米);School of Computer Science, Shanghai Jiao Tong University(上海交通大学计算机学院)
The University of Hong Kong(香港大学);University of Michigan, Ann Arbor(密歇根大学安阿伯分校);Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences(中国科学院深圳先进技术研究所)
ELLIS Institute Tübingen(图宾根埃利斯研究所);LIONS, EPFL(日内瓦理工学院LIONS实验室);University of Freiburg(弗赖堡大学);Max-Planck-Institute for Intelligent Systems(智能系统马克斯·普朗克研究所);Prior Labs(Prior实验室)
Let the Code LLM Edit Itself When You Edit the Code
National Key Laboratory of General Artificial Intelligence(通用人工智能国家重点实验室);School of Intelligence Science and Technology, Peking University(北京大学智能科学与技术学院);ByteDance Inc.(字节跳动公司)
Listening to the Wise Few: Query-Key Alignment Unlocks Latent Correct Answers in Large Language Models
Skolkovo Institute of Science and Technology(斯科尔科沃科学技术研究院);AI Foundation and Algorithm Lab(人工智能基金会与算法实验室);Moscow Institute of Physics and Technology(莫斯科物理技术学院);Artificial Intelligence Research Institute (AIRI)(人工智能研究院);CNRS(法国国家科学研究中心);Université Paris Cité(巴黎西岱大学)
Sensitivity Meets Sparsity: The Impact of Extremely Sparse Parameter Patterns on Theory-of-Mind of Large Language Models
Stanford University(斯坦福大学);Princeton University(普林斯顿大学);University of Minnesota Twin Cities(明尼苏达大学双城分校);University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);Stevens Institute of Technology(斯蒂文斯理工学院)
本文从机制视角研究大语言模型心智理论能力的涌现,提出识别 ToM 敏感参数的方法,发现仅扰动 0.001% 的极端稀疏参数即可显著损害 ToM 性能,并揭示其与 RoPE 位置编码及注意力机制的深层关联。
RoPE Attention Can Be Trained in Almost Linear Time
Wyoming Seminary(怀俄明神学院);University of Arizona(亚利桑那大学);The University of Hong Kong(香港大学);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);Simons Institute for the Theory of Computing, University of California, Berkeley(计算理论学院,加州大学伯克利分校)
Theoretical Constraints on the Expressive Power of $\mathsf{RoPE}$-based Tensor Attention Transformers
The University of Hong Kong(香港大学);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);The Simons Institute for the Theory of Computing at UC Berkeley(加州大学伯克利分校西蒙斯理论计算研究所);Anhui University(安徽大学)