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

CLEX:面向大型语言模型的连续长度外推

CLEX: Continuous Length Extrapolation for Large Language Models

Sun Yat-sen University(中山大学);DAMO Academy, Alibaba Group(阿里巴巴集团达摩院);Hupan Lab(湖畔实验室);University of Glasgow(格拉斯哥大学);Mohamed bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学)

Guanzheng Chen, Xin Li, Zaiqiao Meng, Shangsong Liang, Lidong Bing

AI总结:

针对LLM上下文窗口受限问题,提出连续长度外推方法CLEX,通过常微分方程建模长度缩放因子动态,实现长度外推且不损失性能,在LongBench基准上表现优异。

摘要:

基于Transformer的大型语言模型(LLMs)在许多自然语言处理任务中开创了新进展,然而,其卓越的能力被限制在Transformer预设的上下文窗口内。位置嵌入(PE)缩放方法虽然在将上下文窗口扩展到特定长度方面有效,但在外推能力上表现出明显的局限性,或者会牺牲上下文窗口内的部分性能。长度外推方法虽然在理论上能够将上下文窗口扩展到训练序列长度之外,但在实际的长上下文应用中往往表现不佳。为了应对这些挑战,我们提出了面向LLMs的连续长度外推(CLEX)。我们将PE缩放方法推广,通过常微分方程对长度缩放因子的连续动态进行建模,从而克服了当前为特定长度设计的PE缩放方法的约束。此外,通过将动态扩展到超出训练序列长度的所需上下文长度,CLEX促进了长度外推,并在实际任务中展现出令人印象深刻的性能。我们证明,CLEX可以无缝集成到配备旋转位置嵌入的LLMs中,例如LLaMA和GPT-NeoX,对训练和推理延迟的影响微乎其微。实验结果表明,CLEX可以有效地将上下文窗口扩展到训练长度的4倍以上或近8倍,且性能没有下降。此外,在实用的LongBench基准上进行评估时,我们在4k长度上训练的模型,与在高达32k上下文长度上训练的最先进开源模型相比,展现出有竞争力的性能。

英文摘要:

Transformer-based Large Language Models (LLMs) are pioneering advances in many natural language processing tasks, however, their exceptional capabilities are restricted within the preset context window of Transformer. Position Embedding (PE) scaling methods, while effective in extending the context window to a specific length, demonstrate either notable limitations in their extrapolation abilities or sacrificing partial performance within the context window. Length extrapolation methods, although theoretically capable of extending the context window beyond the training sequence length, often underperform in practical long-context applications. To address these challenges, we propose Continuous Length EXtrapolation (CLEX) for LLMs. We generalise the PE scaling approaches to model the continuous dynamics by ordinary differential equations over the length scaling factor, thereby overcoming the constraints of current PE scaling methods designed for specific lengths. Moreover, by extending the dynamics to desired context lengths beyond the training sequence length, CLEX facilitates the length extrapolation with impressive performance in practical tasks. We demonstrate that CLEX can be seamlessly incorporated into LLMs equipped with Rotary Position Embedding, such as LLaMA and GPT-NeoX, with negligible impact on training and inference latency. Experimental results reveal that CLEX can effectively extend the context window to over 4x or almost 8x training length, with no deterioration in performance. Furthermore, when evaluated on the practical LongBench benchmark, our model trained on a 4k length exhibits competitive performance against state-of-the-art open-source models trained on context lengths up to 32k. Our code is available at https://github.com/DAMO-NLP-SG/CLEX.

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

↑