Structured Packing in LLM Training Improves Long Context Utilization
Konrad Staniszewski, Szymon Tworkowski, Sebastian Jaszczur, Yu Zhao, Henryk Michalewski, Lukasz Kucinski, Piotr Milos
Abstract
Recent advancements in long-context language modeling have attracted significant attention, yet their practical applications often suffer from suboptimal context utilization. To efficiently address this issue, we introduce the Structured Packing for Long Context, SPLiCe, a method that uses retrieval to collate mutually relevant documents into long training samples. We demonstrate that SPLiCe improves performance on long-context tasks, particularly by achieving perfect accuracy on the synthetic Needle in the Haystack benchmark, and effectively mitigating the ‘lost-in-the-middle’ phenomenon often observed in large language models. Notably, these long-context capabilities also extend to realistic downstream tasks, such as Qasper, across multiple model sizes—3B, 7B, and 13B—and are achieved with only brief fine-tuning on 2-6 billion tokens. We supplement these results with a detailed analysis of SPLiCe, examining the impact of hyperparameter choices, the different mixtures and proportions of SPLiCe-generated training data, and the choice of the retriever. We also study the transfer of long-context utilization skills between the modalities. An intriguing finding from our analysis is that training on a corpus of code can enhance performance on natural language tasks.
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.
6 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
- Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Models cites Measuring Massive Multitask Language Understanding
- Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Models cites Improving Language Models by Retrieving from Trillions of Tokens
- Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Models cites YaRN: Efficient Context Window Extension of Large Language Models
- YaRN: Efficient Context Window Extension of Large Language Models cites Measuring Massive Multitask Language Understanding
- DAPE: Data-Adaptive Positional Encoding for Length Extrapolation cites YaRN: Efficient Context Window Extension of Large Language Models
- Re³Syn: A Dependency-Based Data Synthesis Framework for Long-Context Post-training cites Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language Models
- Re³Syn: A Dependency-Based Data Synthesis Framework for Long-Context Post-training cites Measuring Massive Multitask Language Understanding
- Re³Syn: A Dependency-Based Data Synthesis Framework for Long-Context Post-training cites Improving Language Models by Retrieving from Trillions of Tokens
- Re³Syn: A Dependency-Based Data Synthesis Framework for Long-Context Post-training cites YaRN: Efficient Context Window Extension of Large Language Models
- Solving Quantitative Reasoning Problems with Language Models cites Measuring Massive Multitask Language Understanding
- DAPE V2: Process Attention Score as Feature Map for Length Extrapolation cites YaRN: Efficient Context Window Extension of Large Language Models
- DAPE V2: Process Attention Score as Feature Map for Length Extrapolation cites DAPE: Data-Adaptive Positional Encoding for Length Extrapolation
Cited by top-tier papers6
- DAPE: Data-Adaptive Positional Encoding for Length ExtrapolationChuanyang Zheng, Yihang Gao, Han Shi, Minbin Huang et al.NeurIPS 2024 · 42 citations
- DAPE V2: Process Attention Score as Feature Map for Length ExtrapolationChuanyang Zheng, Yihang Gao, Han Shi, Jing Xiong et al.ACL 2025 · 12 citations
- Long Context is Not Long at All: A Prospector of Long-Dependency Data for Large Language ModelsLongze Chen, Ziqiang Liu, Wanwei He, Yinhe Zheng et al.ACL 2024 · 4 citations
- Re³Syn: A Dependency-Based Data Synthesis Framework for Long-Context Post-trainingZhiyang Zhang, Ziqiang Liu, Huiming Wang, Renke Shan et al.ACL 2025 · 4 citations
- Attribute or Abstain: Large Language Models as Long Document AssistantsJan Buchmann, Xiao Liu, Iryna GurevychEMNLP 2024
Builds on12
- Measuring Massive Multitask Language UnderstandingDan Hendrycks, Collin Burns, Steven Basart, Andy Zou et al.ICLR 2021 · 7,905 citations
- Solving Quantitative Reasoning Problems with Language ModelsAitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer et al.NeurIPS 2022 · 2,039 citations
- Improving Language Models by Retrieving from Trillions of TokensSebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai et al.ICML 2022 · 1,629 citations
- Large Language Models Can Be Easily Distracted by Irrelevant ContextFreda Shi, Xinyun Chen, Kanishka Misra, Nathan Scales et al.ICML 2023 · 970 citations
- YaRN: Efficient Context Window Extension of Large Language ModelsBowen Peng, Jeffrey Quesnelle, Honglu Fan, Enrico ShippoleICLR 2024 · 508 citations
Related papers
- Training with "Paraphrasing the Original Text" Teaches LLM to Better Retrieve in Long-Context TasksYijiong Yu, Yongfeng Huang, Zhixiao Qi, Zhe ZhouAAAI 2025 · 5 citations
- Fewer Truncations Improve Language ModelingHantian Ding, Zijian Wang, Giovanni Paolini, Varun Kumar et al.ICML 2024 · 28 citations
- Scaling Long Context Training Data by Long-Distance ReferralsYonghao Zhuang, Lanxiang Hu, Longfei Yun, Souvik Kundu et al.ICLR 2025
- How to Train Long-Context Language Models (Effectively)Tianyu Gao, Alexander Wettig, Howard Yen, Danqi ChenACL 2025
- GMSA: Enhancing Context Compression via Group Merging and Layer Semantic AlignmentJiwei Tang, Zhicheng Zhang, Shunlong Wu, Jingheng Ye et al.ACL 2026 · 24 citations
