arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.18058cs.CLcs.LG
收藏

LongAlign:大语言模型长上下文对齐的一套方案

LongAlign: A Recipe for Long Context Alignment of Large Language Models

Tsinghua University(清华大学)

Yushi Bai, Xin Lv, Jiajie Zhang, Yuze He, Ji Qi, Lei Hou, Jie Tang, Yuxiao Dong, Juanzi Li

AI总结:

本研究提出大语言模型长上下文对齐方案LongAlign,通过构建长指令数据集、优化训练策略、推出评估基准,提升了模型长上下文任务表现且兼顾短任务能力,并开源相关资源。

摘要:

要让大语言模型能够有效处理长上下文,需要在长度相近的输入序列上进行指令微调。为解决这一问题,我们提出了LongAlign——一套用于长上下文对齐的指令数据、训练与评估方案。首先,我们利用Self-Instruct(自指令)方法构建了一个长指令跟随数据集,为保证数据多样性,该数据集涵盖了来自各类长上下文来源的广泛任务。其次,我们采用打包(packing)与排序批处理(sorted batching)策略,加快在长度分布不一的数据上的监督微调进程;此外,我们还提出了一种损失加权方法,以平衡打包训练过程中不同序列对损失的贡献。第三,我们推出了LongBench-Chat基准,用于评估模型在长度为1万至10万的查询上的指令跟随能力。实验表明,在长上下文任务中,LongAlign的表现比现有大语言模型方案最高高出30%,同时还能保持其处理短文本通用任务的能力。相关代码、数据和长上下文对齐模型已在https://github.com/THUDM/LongAlign 开源。

英文摘要:

Extending large language models to effectively handle long contexts requires instruction fine-tuning on input sequences of similar length. To address this, we present LongAlign -- a recipe of the instruction data, training, and evaluation for long context alignment. First, we construct a long instruction-following dataset using Self-Instruct. To ensure the data diversity, it covers a broad range of tasks from various long context sources. Second, we adopt the packing and sorted batching strategies to speed up supervised fine-tuning on data with varied length distributions. Additionally, we develop a loss weighting method to balance the contribution to the loss across different sequences during packing training. Third, we introduce the LongBench-Chat benchmark for evaluating instruction-following capabilities on queries of 10k-100k in length. Experiments show that LongAlign outperforms existing recipes for LLMs in long context tasks by up to 30\%, while also maintaining their proficiency in handling short, generic tasks. The code, data, and long-aligned models are open-sourced at https://github.com/THUDM/LongAlign.

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

↑