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

Giraffe:大语言模型上下文长度扩展探索

Giraffe: Adventures in Expanding Context Lengths in LLMs

Arka Pal, Deep Karkhanis, Manley Roberts, Samuel Dooley, Arvind Sundararajan, Siddartha Naidu

AI总结:

该研究调研并提出大语言模型上下文长度外推方法,通过新任务验证线性缩放效果最优,发布了三款Giraffe长上下文模型与相关数据集、代码。

摘要:

现代依赖注意力机制的大语言模型(LLM)通常采用固定上下文长度进行训练,这给模型推理阶段可处理的输入序列长度设定了上限。若要将这些模型用于长度超过训练时上下文长度的序列,可使用日益增多的上下文长度外推方法——这类方法大多聚焦于修改注意力机制中的位置编码系统,以标记输入序列中词元或激活值的位置。我们对基于基础LLaMA或LLaMA 2模型的现有上下文长度外推方法开展了广泛调研,同时也提出了若干自主设计的方法,尤其是一种用于修改位置编码基底的新型截断策略。我们使用三项全新的评估任务(FreeFormQA、AlteredNumericQA和LongChat-Lines)以及困惑度指标对这些方法进行测试,研究发现困惑度作为衡量大语言模型长上下文性能的指标,其细粒度程度较低。我们已将这三项任务作为数据集在HuggingFace上公开发布。我们发现线性缩放是扩展上下文长度的最优方法,并且证明在推理阶段使用更长的缩放比例可进一步提升性能。我们还发现截断基底具备可观的外推能力。为支持该领域的后续研究,我们发布了三款全新的130亿参数长上下文模型,将其命名为Giraffe:分别是基于基础LLaMA-13B训练的4k和16k上下文模型,以及基于基础LLaMA2-13B训练的32k上下文模型。我们同时发布了可复现实验结果的代码。

英文摘要:

Modern large language models (LLMs) that rely on attention mechanisms are typically trained with fixed context lengths which enforce upper limits on the length of input sequences that they can handle at evaluation time. To use these models on sequences longer than the train-time context length, one might employ techniques from the growing family of context length extrapolation methods -- most of which focus on modifying the system of positional encodings used in the attention mechanism to indicate where tokens or activations are located in the input sequence. We conduct a wide survey of existing methods of context length extrapolation on a base LLaMA or LLaMA 2 model, and introduce some of our own design as well -- in particular, a new truncation strategy for modifying the basis for the position encoding. We test these methods using three new evaluation tasks (FreeFormQA, AlteredNumericQA, and LongChat-Lines) as well as perplexity, which we find to be less fine-grained as a measure of long context performance of LLMs. We release the three tasks publicly as datasets on HuggingFace. We discover that linear scaling is the best method for extending context length, and show that further gains can be achieved by using longer scales at evaluation time. We also discover promising extrapolation capabilities in the truncated basis. To support further research in this area, we release three new 13B parameter long-context models which we call Giraffe: 4k and 16k context models trained from base LLaMA-13B, and a 32k context model trained from base LLaMA2-13B. We also release the code to replicate our results.

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

↑