对比填充与打包在大模型微调中的效率,发现打包更适合大模型和大数据集。
Packing Analysis: Packing Is More Appropriate for Large Models or Datasets in Supervised Fine-tuning
- 通过对比填充与打包,系统评估了不同规模模型与数据集的微调效果。
- 在8B到70B模型、69K至120万数据集上,打包显著提升训练效率。
- 适合大模型或大数据集的微调场景,开源代码与检查点供研究使用。
打包(Packing)最初用于预训练阶段,旨在通过将不同训练序列组合以填满模型最大输入长度,从而最大化硬件资源利用效率。尽管其在预训练中表现有效,但在监督微调(SFT)阶段仍缺乏全面分析:(1)打包能否在保持性能的同时提升训练效率;(2)适用于何种规模的模型与数据集;(3)混合无关或相关样本是否导致模型过度忽视或依赖上下文。本文对69K至1.2M规模的数据集与8B至70B参数的模型进行了广泛比较,涵盖知识、推理、编码等多类基准测试及GPT-based评估、时间效率与微调参数。首次系统分析了打包相比填充的优势与局限,并提供可复现的微调代码与检查点,推动未来对打包方法的研究。代码已开源:https://github.com/ShuheWang1998/Packing-Analysis?tab=readme-ov-file。
原文摘要 · Abstract (English)
Packing, initially utilized in the pre-training phase, is an optimization technique designed to maximize hardware resource efficiency by combining different training sequences to fit the model's maximum input length. Although it has demonstrated effectiveness during pre-training, there remains a lack of comprehensive analysis for the supervised fine-tuning (SFT) stage on the following points: (1) whether packing can effectively enhance training efficiency while maintaining performance, (2) the suitable size of the model and dataset for fine-tuning with the packing method, and (3) whether packing unrelated or related training samples might cause the model to either excessively disregard or over-rely on the context. In this paper, we perform extensive comparisons between SFT methods using padding and packing, covering SFT datasets ranging from 69K to 1.2M and models from 8B to 70B. This provides the first comprehensive analysis of the advantages and limitations of packing versus padding, as well as practical considerations for implementing packing in various training scenarios. Our analysis covers various benchmarks, including knowledge, reasoning, and coding, as well as GPT-based evaluations, time efficiency, and other fine-tuning parameters. We also open-source our code for fine-tuning and evaluation and provide checkpoints fine-tuned on datasets of different sizes, aiming to advance future research on packing methods. Code is available at: https://github.com/ShuheWang1998/Packing-Analysis?tab=readme-ov-file.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。