LongPO: Long Context Self-Evolution of Large Language Models through Short-to-Long Preference Optimization
LongPO通过短到长偏好优化,使大型语言模型能够在长上下文中自我进化,同时保持其在短上下文中的性能。
更新于 2025-02-20。作者:Guanzheng Chen、Xin Li、Michael Qizhe Shieh、Lidong Bing。
中文摘要
大型语言模型(LLMs)通过预训练和对齐展现了卓越的能力。然而,由于长上下文对齐不足,卓越的短上下文LLMs可能在长上下文场景中表现不佳。由于人类对长上下文的标注不切实际以及平衡短上下文和长上下文性能的难度,这种对齐过程仍然具有挑战性。为了应对这些挑战,我们提出了LongPO,它使短上下文LLMs能够通过内部迁移短上下文能力自我进化,以在长上下文任务上表现出色。LongPO利用LLMs学习自生成的短至长偏好数据,包括为相同指令生成的具有长上下文输入及其对应的压缩短上下文配对响应。这种偏好揭示了LLMs在短上下文对齐过程中培养出的能力和潜力,这些能力和潜力在长上下文对齐不足的场景中可能会减弱。此外,LongPO还包含一个短至长的KL约束,以减轻长上下文对齐期间短上下文性能的下降。当将Mistral-7B-Instruct-v0.2从128K上下文长度扩展到512K时,LongPO完全保留了短上下文性能,并在长上下文和短上下文任务中都大幅超越了简单的SFT和DPO。具体来说,我们的方法训练的模型在长上下文基准测试中可以达到的结果与,甚至超越那些涉及广泛长上下文标注和更大参数规模的顶级LLMs(如GPT-4-128K)相当。
英文摘要
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, \ourMethod-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.
解读
一句话总结
LongPO通过短到长偏好优化,使大型语言模型能够在长上下文中自我进化,同时保持其在短上下文中的性能。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:现有的大型语言模型(LLMs)在短上下文中表现出色,但在长上下文中可能表现不佳,因为缺乏足够的长上下文对齐。
- 现有方案不足:长上下文对齐困难,因为人工标注扩展上下文不切实际,且难以平衡短上下文和长上下文性能。
- 研究目标:提出LongPO,通过内部转移短上下文能力,使短上下文LLMs能够自我进化以在长上下文任务中表现优异。
问题2:论文的核心创新点是什么?
- 技术创新:LongPO通过学习自生成的短到长偏好数据,这些数据包括针对相同指令的具有长上下文输入和其压缩的短上下文对应项生成的配对响应。
- 方法改进:LongPO结合了短到长KL约束,以减轻长上下文对齐期间短上下文性能下降。
- 优势:LongPO在长上下文和短上下文任务中均优于基线方法,同时保留了短上下文性能。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:将LongPO应用于Mistral-7B-Instruct-v0.2,将其上下文长度从128K扩展到512K。
- 性能提升:LongPO在长上下文基准测试中比基线方法(如SFT和DPO)提高了25.45个点。
- 对比结果:LongPO在长上下文和短上下文任务中都优于SFT和DPO,同时在长上下文中与顶级LLMs(如GPT-4-128K)相当。
问题4:这个研究的实际应用价值是什么?
- 应用场景:适用于需要长上下文理解和生成的各种任务,如问答、对话系统、文本摘要等。
- 实施建议:使用LongPO对LLMs进行训练,以提升其在长上下文任务中的性能。
- 局限与展望:LongPO需要高质量的短上下文LLMs作为起点,未来可探索更有效的信息提取方法以提高长上下文性能。
来源
机器可读索引:llms.txt