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

理解长上下文大语言模型的RoPE扩展:注意力视角

Understanding the RoPE Extensions of Long-Context LLMs: An Attention Perspective

Institute of Computing and Intelligence, Harbin Institute of Technology, Shenzhen(哈尔滨工业大学(深圳)计算与智能学院);Xiaohongshu Inc.(小红书科技有限公司)

Meizhi Zhong, Chen Zhang, Yikun Lei, Xikai Liu, Yan Gao, Yao Hu, Kehai Chen, Min Zhang

AI总结:

该研究从注意力视角探究长上下文LLM的RoPE扩展机制,通过两项基准任务的实验得出三项发现,为提升RoPE长上下文外推效果提供了参考。

摘要:

让大语言模型(LLM)能够处理长上下文是当前的研究热点。大多数LLM基于旋转位置嵌入(rotary position embedding, RoPE)——一种流行的位置编码方法——构建,因此一个重要的研究方向是将在相对较短文本上训练的RoPE外推到长得多的文本上。大量研究通过扩展RoPE的公式来提升外推效果,但很少有研究全面揭示其内在工作机制。本文从注意力视角、结合两项基准任务,对RoPE扩展提供直观且深入的理解。大量实验得出了若干有价值的发现:1)保持预训练长度下的注意力模式可提升外推效果;2)较大的注意力不确定性会导致检索错误;3)为RoPE扩展使用更长的持续预训练长度可降低注意力不确定性,并显著增强外推能力。

英文摘要:

Enabling LLMs to handle lengthy context is currently a research hotspot. Most LLMs are built upon rotary position embedding (RoPE), a popular position encoding method. Therefore, a prominent path is to extrapolate the RoPE trained on comparably short texts to far longer texts. A heavy bunch of efforts have been dedicated to boosting the extrapolation via extending the formulations of the RoPE, however, few of them have attempted to showcase their inner workings comprehensively. In this paper, we are driven to offer a straightforward yet in-depth understanding of RoPE extensions from an attention perspective and on two benchmarking tasks. A broad array of experiments reveals several valuable findings: 1) Maintaining attention patterns to those at the pretrained length improves extrapolation; 2) Large attention uncertainty leads to retrieval errors; 3) Using longer continual pretraining lengths for RoPE extensions could reduce attention uncertainty and significantly enhance extrapolation.

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

↑