arXiv:2501.15383cs.CL2025-01被引 193

Qwen2.5-1M将上下文长度扩展至100万词元,支持超长文本处理。

Qwen2.5-1M Technical Report

  • 通过长文本合成与渐进式预训练提升长上下文能力
  • 14B模型在长文本任务上超越GPT-4o-mini,上下文达其8倍
  • 开源推理框架支持无额外训练的上下文长度四倍扩展

我们提出Qwen2.5-1M系列模型,将上下文长度扩展至100万词元。相比此前128K版本,该系列通过长文本预训练与后训练显著增强长上下文能力,采用长数据合成、渐进式预训练及多阶段监督微调等关键技术,在降低训练成本的同时有效提升性能。为推广长上下文模型应用,我们开源了推理框架,包含无需额外训练即可实现至少4倍上下文长度扩展的长度外推方法。为降低推理开销,引入稀疏注意力机制、分块prefill优化及稀疏性精炼方法,并在推理引擎中实现内核优化、流水线并行与调度优化,使100万词元场景下prefill速度提升3倍至7倍。当前发布模型包括开源的Qwen2.5-7B-Instruct-1M与Qwen2.5-14B-Instruct-1M,以及API访问的Qwen2.5-Turbo。评估显示,该系列在长上下文任务中表现显著提升,同时保持短上下文性能,其中14B模型在长文本任务中优于GPT-4o-mini,支持上下文长度达其8倍。

原文摘要 · Abstract (English)

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.

大模型长上下文推理优化开源

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。