Lune

ACL Findings2025

Packing Analysis: Packing Is More Appropriate for Large Models or Datasets in Supervised Fine-tuning

Shuhe Wang, Guoyin Wang, Yizhong Wang, Jiwei Li, Eduard H. Hovy, Chen Guo

Abstract

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 pretraining, 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 finetuned on datasets of different sizes, aiming to advance future research on packing methods.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

4 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Hydraulis: Balancing Large Transformer Model Training via Co-designing Parallel Strategies and Data Assignment cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • QLoRA: Efficient Finetuning of Quantized LLMs cites LoRA: Low-Rank Adaptation of Large Language Models
  • QLoRA: Efficient Finetuning of Quantized LLMs cites Measuring Massive Multitask Language Understanding
  • QLoRA: Efficient Finetuning of Quantized LLMs cites Finetuned Language Models are Zero-Shot Learners
  • Hierachical Balance Packing: Towards Efficient Supervised Fine-tuning for Long-Context LLM cites Measuring Massive Multitask Language Understanding
  • Resource Multiplexing in Tuning and Serving Large Language Models cites LoRA: Low-Rank Adaptation of Large Language Models
  • LoRAFusion: Efficient LoRA Fine-Tuning for LLMs cites LoRA: Low-Rank Adaptation of Large Language Models
  • LoRAFusion: Efficient LoRA Fine-Tuning for LLMs cites QLoRA: Efficient Finetuning of Quantized LLMs
  • LoRAFusion: Efficient LoRA Fine-Tuning for LLMs cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers4

  1. Resource Multiplexing in Tuning and Serving Large Language ModelsYongjun He, Haofeng Yang, Yao Lu, Ana Klimovic et al.USENIX ATC 2025 · 9 citations
  2. Hydraulis: Balancing Large Transformer Model Training via Co-designing Parallel Strategies and Data AssignmentHaoyang Li, Fangcheng Fu, Sheng Lin, Hao Ge et al.SIGMOD 2026 · 7 citations
  3. LoRAFusion: Efficient LoRA Fine-Tuning for LLMsZhanda Zhu, Qidong Su, Yaoyao Ding, Kevin Song et al.EuroSys 2026 · 2 citations
  4. Hierachical Balance Packing: Towards Efficient Supervised Fine-tuning for Long-Context LLMYongqiang Yao, Jingru Tan, Kaihuan Liang, Feizhao Zhang et al.NeurIPS 2025

Builds on23

  1. LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu et al.ICLR 2022 · 18,833 citations
  2. Measuring Massive Multitask Language UnderstandingDan Hendrycks, Collin Burns, Steven Basart, Andy Zou et al.ICLR 2021 · 7,905 citations
  3. QLoRA: Efficient Finetuning of Quantized LLMsTim Dettmers, Artidoro Pagnoni, Ari Holtzman, Luke ZettlemoyerNeurIPS 2023 · 5,863 citations
  4. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra et al.NeurIPS 2022 · 5,493 citations
  5. Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu et al.ICLR 2022 · 4,966 citations

Related papers

  1. Fewer Truncations Improve Language ModelingHantian Ding, Zijian Wang, Giovanni Paolini, Varun Kumar et al.ICML 2024 · 28 citations
  2. Improving Continual Pre-training Through Seamless Data PackingRuicheng Yin, Xuan Gao, Changze Lv, Xiaohua Wang et al.ACL Findings 2025
  3. How to Train Long-Context Language Models (Effectively)Tianyu Gao, Alexander Wettig, Howard Yen, Danqi ChenACL 2025
  4. Unveiling the Secret Recipe: A Guide For Supervised Fine-Tuning Small LLMsAldo Pareja, Nikhil Shivakumar Nayak, Hao Wang, Krishnateja Killamsetty et al.ICLR 2025
  5. Scaling Law for Multimodal Large Language Model Supervised Fine-TuningYifan Zhang, Tao Yu, Feng Li, Chaoyou Fu et al.ACL 2026
Dusk over the sea between two cliffs drawn in fine vertical lines