arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.15859cs.LGcs.AI
收藏

Mesa-Extrapolation:一种用于增强大语言模型外推能力的 Weave 位置编码方法

Mesa-Extrapolation: A Weave Position Encoding Method for Enhanced Extrapolation in LLMs

Digital Research Institute, Enn Group(恩集团数字研究院);Institute for AI Industry Research, Tsinghua University(清华大学人工智能产业研究院);Shanghai Artificial Intelligence Laboratory(上海人工智能实验室)

Xin Ma, Yang Liu, Jingjing Liu, Xiaoxu Ma

AI总结:

针对 LLM 超出训练长度后外推能力骤降的问题,本文提出 Mesa-Extrapolation,通过分块三角注意力与 Stair PE 实现低成本、省内存且更快的长度外推。

摘要:

大语言模型(LLM)虽然已经革新了许多领域,但仍面临具有挑战性的外推问题:当超出最大训练长度后,LLM 的推理能力会急剧下降。在本工作中,我们进行了理论分析,以更好地理解无位置编码(NoPE)为何在其有效范围之外失效,并考察了位置编码(PE)在此情境下的能力。研究发现表明,通过精细的 weave 位置设计,PE 确实可以被扩展到有效范围之外。我们的定理证明,配备 weave PE 的 LLM 能够在不产生额外成本的情况下获得更好的外推性能。此外,我们提出了一种新颖的 weave PE 方法 Mesa-Extrapolation,该方法利用基于分块的三角注意力矩阵,并应用 Stair PE 来管理最后一个分块。该方法不仅保持了具有竞争力的性能,还带来了显著优势,例如大幅降低的内存需求和更快的推理速度。大量实验验证了 Mesa-Extrapolation 的有效性,证明其有潜力成为增强 LLM 应用覆盖范围的可扩展解决方案。我们的代码可在 https://github.com/soacker/Mesa-Extrapolation 获取。

英文摘要:

Large language models (LLMs), although having revolutionized many fields, still suffer from the challenging extrapolation problem, where the inference ability of LLMs sharply declines beyond their max training lengths. In this work, we conduct a theoretical analysis to better understand why No Position Encoding (NoPE) fails outside its effective range, as well as examining the power of Position Encoding (PE) in this context. Our findings reveal that with meticulous weave position, PE can indeed be extended beyond effective range. Our theorems establish that LLMs equipped with weave PE can achieve improved extrapolation performance without additional cost. Furthermore, we introduce a novel weave PE method, Mesa-Extrapolation, which utilizes a chunk-based triangular attention matrix and applies Stair PE to manage the final chunk. This method not only retains competitive performance but also offers substantial benefits such as significantly reduced memory demand and faster inference speed. Extensive experiments validate the effectiveness of Mesa-Extrapolation, demonstrating its potential as a scalable solution to enhancing LLMs applicative reach. Our code is available at \url{https://github.com/soacker/Mesa-Extrapolation}.

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

↑