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

LongPO:通过短到长偏好优化实现大型语言模型的长上下文自演化

LongPO: Long Context Self-Evolution of Large Language Models through Short-to-Long Preference Optimization

National University of Singapore(新加坡国立大学);DAMO Academy, Alibaba Group(阿里巴巴达摩院);Shanda AI Research Institute(盛大人工智能研究院)

Guanzheng Chen, Xin Li, Michael Qizhe Shieh, Lidong Bing

AI总结:

针对LLMs长上下文对齐困难的问题,提出LongPO方法,通过自生成短到长偏好数据和KL约束实现短到长能力转移,在保持短上下文性能的同时显著提升长上下文任务表现。

摘要:

大型语言模型(LLMs)通过预训练和对齐展现出了卓越的能力。然而,由于长上下文对齐不足,优秀的短上下文LLMs在长上下文场景中可能表现不佳。由于对扩展上下文进行人工标注不切实际,且难以平衡短上下文和长上下文性能,该对齐过程仍具挑战性。为应对这些挑战,我们提出了LongPO,它通过内部转移短上下文能力,使短上下文LLMs能够自演化以在长上下文任务中表现出色。LongPO利用LLMs从自生成的短到长偏好数据中学习,该数据由针对相同指令生成的配对响应组成,分别对应长上下文输入及其压缩的短上下文对应项。这种偏好揭示了LLMs在短上下文对齐过程中培养的能力和潜力,这些能力和潜力在欠对齐的长上下文场景中可能会被削弱。此外,LongPO结合了短到长KL约束,以减轻长上下文对齐过程中短上下文性能的下降。将LongPO应用于Mistral-7B-Instruct-v0.2,将上下文长度从128K扩展到512K时,LongPO完全保留了短上下文性能,并在长上下文和短上下文任务中均大幅优于朴素的SFT和DPO。具体而言,LongPO训练的模型在长上下文基准上的结果可与甚至超越那些涉及大量长上下文标注和更大参数规模的优秀LLMs(例如GPT-4-128K)。我们的代码可在https://github.com/DAMO-NLP-SG/LongPO获取。

英文摘要:

Large Language Models (LLMs) have demonstrated remarkable capabilities through pretraining and alignment. However, superior short-context LLMs may underperform in long-context scenarios due to insufficient long-context alignment. This alignment process remains challenging due to the impracticality of human annotation for extended contexts and the difficulty in balancing short- and long-context performance. To address these challenges, we introduce LongPO, that enables short-context LLMs to self-evolve to excel on long-context tasks by internally transferring short-context capabilities. LongPO harnesses LLMs to learn from self-generated short-to-long preference data, comprising paired responses generated for identical instructions with long-context inputs and their compressed short-context counterparts, respectively. This preference reveals capabilities and potentials of LLMs cultivated during short-context alignment that may be diminished in under-aligned long-context scenarios. Additionally, LongPO incorporates a short-to-long KL constraint to mitigate short-context performance decline during long-context alignment. When applied to Mistral-7B-Instruct-v0.2 from 128K to 512K context lengths, LongPO fully retains short-context performance and largely outperforms naive SFT and DPO in both long- and short-context tasks. Specifically, LongPO-trained models can achieve results on long-context benchmarks comparable to, or even surpassing, those of superior LLMs (e.g., GPT-4-128K) that involve extensive long-context annotation and larger parameter scales. Our code is available at https://github.com/DAMO-NLP-SG/LongPO.

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

↑