提出无缝数据打包方法,减少截断和上下文断裂,提升持续预训练效果。
Improving Continual Pre-training Through Seamless Data Packing
- 用滑动窗口同步相邻序列重叠词元,增强上下文连续性。
- 采用优先降序算法压缩短文本,降低填充与截断比例。
- 在99%实验中优于基线,适用于多种模型与领域。
持续预训练在特定领域场景中展现出显著潜力。当前主流的数据打包方法是拼接输入文本并分割为固定长度序列,虽高效但常导致过度截断和上下文断裂,影响模型性能。为此,我们探索数据工程对持续预训练的影响,提出一种名为无缝打包(Seamless Packing, SP)的新策略,旨在更有效保留上下文信息并提升模型表现。第一阶段采用滑动窗口技术,同步连续序列间的重叠词元,提升上下文连贯性;第二阶段使用优先降序算法,将较短文本打包至略大于目标序列长度的容器中,以最小化填充与截断。在多种模型架构与语料领域上的实证评估表明,该方法在99%的设置中优于基线。代码已开源于 https://github.com/Infernus-WIND/Seamless-Packing。
原文摘要 · Abstract (English)
Continual pre-training has demonstrated significant potential in enhancing model performance, particularly in domain-specific scenarios. The most common approach for packing data before continual pre-training involves concatenating input texts and splitting them into fixed-length sequences. While straightforward and efficient, this method often leads to excessive truncation and context discontinuity, which can hinder model performance. To address these issues, we explore the potential of data engineering to enhance continual pre-training, particularly its impact on model performance and efficiency. We propose Seamless Packing (SP), a novel data packing strategy aimed at preserving contextual information more effectively and enhancing model performance. Our approach employs a sliding window technique in the first stage that synchronizes overlapping tokens across consecutive sequences, ensuring better continuity and contextual coherence. In the second stage, we adopt a First-Fit-Decreasing algorithm to pack shorter texts into bins slightly larger than the target sequence length, thereby minimizing padding and truncation. Empirical evaluations across various model architectures and corpus domains demonstrate the effectiveness of our method, outperforming baseline method in 99% of all settings. Code is available at https://github.com/Infernus-WIND/Seamless-Packing.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。