Qwen2.5-1M Technical Report
Qwen2.5-1M系列模型通过长上下文预训练和后训练,显著增强了长上下文能力,并开源了高效的推理框架,提高了长上下文处理的应用效率。
更新于 2025-01-28。作者:An Yang、Bowen Yu、Chengyuan Li、Dayiheng Liu、Fei Huang、Haoyan Huang、Jiandong Jiang、Jianhong Tu、Jianwei Zhang、Jingren Zhou、Junyang Lin、Kai Dang、Kexin Yang、Le Yu、Mei Li、Minmin Sun、Qin Zhu、Rui Men、Tao He、Weijia Xu、Wenbiao Yin、Wenyuan Yu、Xiafei Qiu、Xingzhang Ren、Xinlong Yang、Yong Li、Zhiying Xu、Zipeng Zhang。
中文摘要
我们推出了Qwen2.5-1M系列模型,这一系列模型将上下文长度扩展至一百万个标记。与之前的128K版本相比,Qwen2.5-1M系列通过长上下文预训练和后训练,显著提升了长上下文能力。采用了诸如长数据合成、渐进式预训练和多阶段监督微调等关键技术,有效地增强了长上下文性能,同时降低了训练成本。为了促进长上下文模型在更广泛的用户群体中的应用,我们开源了我们的推理框架。该框架包括一种长度外推方法,能够在不进行额外训练的情况下将模型上下文长度扩展至少四倍,甚至更多。为了降低推理成本,我们实现了稀疏注意力方法以及分块预填充优化用于部署场景,以及稀疏度优化方法以提升精度。此外,我们还详细介绍了我们在推理引擎中的优化,包括内核优化、管道并行和调度优化,这些优化显著提升了整体推理性能。通过利用我们的推理框架,Qwen2.5-1M模型在上下文长度为一百万标记的场景中实现了3倍到7倍的预填充速度提升。该框架为开发需要使用开源模型进行长上下文处理的应用提供了高效且强大的解决方案。 Qwen2.5-1M系列目前包括开源模型Qwen2.5-7B-Instruct-1M和Qwen2.5-14B-Instruct-1M,以及通过API访问的模型Qwen2.5-Turbo。评估显示,Qwen2.5-1M模型在长上下文任务中得到了显著改进,而没有影响短上下文场景的性能。特别是,Qwen2.5-14B-Instruct-1M模型在长上下文任务中的表现显著优于GPT-4o-mini,并支持长达八倍的上下文长度。
英文摘要
We introduce Qwen2.5-1M, a series of models that extend the context length to 1 million tokens. Compared to the previous 128K version, the Qwen2.5-1M series have significantly enhanced long-context capabilities through long-context pre-training and post-training. Key techniques such as long data synthesis, progressive pre-training, and multi-stage supervised fine-tuning are employed to effectively enhance long-context performance while reducing training costs. To promote the use of long-context models among a broader user base, we present and open-source our inference framework. This framework includes a length extrapolation method that can expand the model context lengths by at least four times, or even more, without additional training. To reduce inference costs, we implement a sparse attention method along with chunked prefill optimization for deployment scenarios and a sparsity refinement method to improve precision. Additionally, we detail our optimizations in the inference engine, including kernel optimization, pipeline parallelism, and scheduling optimization, which significantly enhance overall inference performance. By leveraging our inference framework, the Qwen2.5-1M models achieve a remarkable 3x to 7x prefill speedup in scenarios with 1 million tokens of context. This framework provides an efficient and powerful solution for developing applications that require long-context processing using open-source models. The Qwen2.5-1M series currently includes the open-source models Qwen2.5-7B-Instruct-1M and Qwen2.5-14B-Instruct-1M, as well as the API-accessed model Qwen2.5-Turbo. Evaluations show that Qwen2.5-1M models have been greatly improved in long-context tasks without compromising performance in short-context scenarios. Specifically, the Qwen2.5-14B-Instruct-1M model significantly outperforms GPT-4o-mini in long-context tasks and supports contexts eight times longer.
解读
一句话总结
Qwen2.5-1M系列模型通过长上下文预训练和后训练,显著增强了长上下文能力,并开源了高效的推理框架,提高了长上下文处理的应用效率。
问题1:这篇论文想要解决什么具体问题?
• 问题背景:大型语言模型(LLM)在处理大量文本时受限于上下文长度,难以进行复杂的信息处理或生成任务。 • 现有方案不足:现有LLM的上下文长度有限,难以处理长文本,限制了其应用范围。 • 研究目标:通过长上下文预训练和后训练,提高LLM处理长文本的能力,并开源高效的推理框架,降低长上下文处理的成本。
问题2:论文的核心创新点是什么?
• 技术创新:长上下文预训练、长数据合成、渐进式预训练、多阶段监督微调、长度外推方法、稀疏注意力机制、块预填充优化、推理引擎优化。 • 方法改进:通过长上下文预训练和后训练,有效提高长上下文处理能力,同时降低训练成本;通过长度外推方法,无需额外训练即可扩展模型上下文长度;通过稀疏注意力机制和块预填充优化,降低推理成本;通过推理引擎优化,提高整体推理性能。 • 优势:与现有方法相比,Qwen2.5-1M系列模型在长上下文任务上表现优异,同时保持了在短上下文场景下的性能。
问题3:实验结果如何验证了方法的有效性?
• 关键实验:在Passkey检索、RULER、LV-Eval、Longbench-Chat等长上下文任务上进行评估。 • 性能提升:Qwen2.5-1M系列模型在长上下文任务上取得了显著的性能提升,例如Qwen2.5-14B-Instruct-1M模型在长上下文任务上显著优于GPT-4o-mini,支持上下文长度是后者的八倍。 • 对比结果:与Qwen2.5-1M的128k版本相比,Qwen2.5-1M系列模型在长上下文任务上取得了显著的性能提升。
问题4:这个研究的实际应用价值是什么?
• 应用场景:长文本处理、复杂信息处理、深度研究、代码生成和调试等。 • 实施建议:利用开源的Qwen2.5-1M模型和推理框架,降低长上下文处理的成本,提高应用效率。 • 局限与展望:Qwen2.5-1M系列模型在长上下文任务上取得了显著的性能提升,但在某些特定任务上仍需进一步优化。未来将继续探索更有效的训练策略、模型架构和推理方法,以进一步提高长上下文模型的应用价值。