Fewer Truncations Improve Language Modeling
Hantian Ding, Zijian Wang, Giovanni Paolini, Varun Kumar, Anoop Deoras, Dan Roth, Stefano Soatto
Abstract
In large language model training, input documents are typically concatenated together and then split into sequences of equal length to avoid padding tokens. Despite its efficiency, the concatenation approach compromises data integrity -- it inevitably breaks many documents into incomplete pieces, leading to excessive truncations that hinder the model from learning to compose logically coherent and factually consistent content that is grounded on the complete context. To address the issue, we propose Best-fit Packing, a scalable and efficient method that packs documents into training sequences through length-aware combinatorial optimization. Our method completely eliminates unnecessary truncations while retaining the same training efficiency as concatenation. Empirical results from both text and code pre-training show that our method achieves superior performance (e.g., relatively +4.7% on reading comprehension; +16.8% in context following; and +9.2% on program synthesis), and reduces closed-domain hallucination effectively by up to 58.3%.
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.
19 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Large Language Models Struggle to Learn Long-Tail Knowledge cites Language Models are Few-Shot Learners
- Large Language Models Struggle to Learn Long-Tail Knowledge cites Deduplicating Training Data Makes Language Models Better
- Dataset Decomposition: Faster LLM Training with Variable Sequence Length Curriculum cites PIQA: Reasoning about Physical Commonsense in Natural Language
- Dataset Decomposition: Faster LLM Training with Variable Sequence Length Curriculum cites FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
- DAPE: Data-Adaptive Positional Encoding for Length Extrapolation cites Language Models are Few-Shot Learners
- Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach cites PIQA: Reasoning about Physical Commonsense in Natural Language
- Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach cites FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality cites PIQA: Reasoning about Physical Commonsense in Natural Language
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality cites Dataset Decomposition: Faster LLM Training with Variable Sequence Length Curriculum
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality cites FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality cites Language Models are Few-Shot Learners
- Deduplicating Training Data Makes Language Models Better cites Language Models are Few-Shot Learners
Cited by top-tier papers19
- Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space DualityTri Dao, Albert GuICML 2024 · 1,407 citations
- Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth ApproachJonas Geiping, Sean McLeish, Neel Jain, John Kirchenbauer et al.NeurIPS 2025 · 431 citations
- DAPE: Data-Adaptive Positional Encoding for Length ExtrapolationChuanyang Zheng, Yihang Gao, Han Shi, Minbin Huang et al.NeurIPS 2024 · 42 citations
- Demons in the Detail: On Implementing Load Balancing Loss for Training Specialized Mixture-of-Expert ModelsZihan Qiu, Zeyu Huang, Bo Zheng, Kaiyue Wen et al.ACL 2025 · 42 citations
- Dataset Decomposition: Faster LLM Training with Variable Sequence Length CurriculumHadi Pouransari, Chun-Liang Li, Jen-Hao Rick Chang, Pavan Kumar Anasosalu Vasu et al.NeurIPS 2024 · 40 citations
Builds on12
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- PIQA: Reasoning about Physical Commonsense in Natural LanguageYonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao et al.AAAI 2020 · 2,916 citations
- FlashAttention-2: Faster Attention with Better Parallelism and Work PartitioningTri DaoICLR 2024 · 2,600 citations
- Deduplicating Training Data Makes Language Models BetterKatherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang et al.ACL 2022 · 844 citations
- Large Language Models Struggle to Learn Long-Tail KnowledgeNikhil Kandpal, Haikang Deng, Adam Roberts, Eric Wallace et al.ICML 2023 · 623 citations
Related papers
- Improving Continual Pre-training Through Seamless Data PackingRuicheng Yin, Xuan Gao, Changze Lv, Xiaohua Wang et al.ACL Findings 2025
- Scaling Long Context Training Data by Long-Distance ReferralsYonghao Zhuang, Lanxiang Hu, Longfei Yun, Souvik Kundu et al.ICLR 2025
- In-Context Pretraining: Language Modeling Beyond Document BoundariesWeijia Shi, Sewon Min, Maria Lomeli, Chunting Zhou et al.ICLR 2024 · 87 citations
- Structured Packing in LLM Training Improves Long Context UtilizationKonrad Staniszewski, Szymon Tworkowski, Sebastian Jaszczur, Yu Zhao et al.AAAI 2025 · 17 citations
- Packing Analysis: Packing Is More Appropriate for Large Models or Datasets in Supervised Fine-tuningShuhe Wang, Guoyin Wang, Yizhong Wang, Jiwei Li et al.ACL Findings 2025 · 4 citations
