Dataset Decomposition: Faster LLM Training with Variable Sequence Length Curriculum

Hadi Pouransari, Chun-Liang Li, Jen-Hao Rick Chang, Pavan Kumar Anasosalu Vasu, Cem Koc +2 more
5/21/2024
cs.CLcs.LG

No official code found. Best implementation: apple/ml-dataset-decomposition (21 stars, last commit 2025-01-08).

Abstract

Large language models (LLMs) are commonly trained on datasets consisting of fixed-length token sequences. These datasets are created by randomly concatenating documents of various lengths and then chunking them into sequences of a predetermined target length (concat-and-chunk). Recent attention implementations mask cross-document attention, reducing the effective length of a chunk of tokens. Additionally, training on long sequences becomes computationally prohibitive due to the quadratic cost of attention. In this study, we introduce dataset decomposition, a novel variable sequence length training technique, to tackle these challenges. We decompose a dataset into a union of buckets, each containing sequences of the same size extracted from a unique document. During training, we use variable sequence length and batch-size, sampling simultaneously from all buckets with a curriculum. In contrast to the concat-and-chunk baseline, which incurs a fixed attention cost at every step of training, our proposed method incurs a computational cost proportional to the actual document lengths at each step, resulting in significant savings in training time. We train an 8k context-length 1B model at the same cost as a 2k context-length model trained with the baseline approach. Experiments on a web-scale corpus demonstrate that our approach significantly enhances performance on standard language evaluations and long-context benchmarks, reaching target accuracy with up to 6x faster training compared to the baseline. Our method not only enables efficient pretraining on long sequences but also scales effectively with dataset size. Lastly, we shed light on a critical yet less studied aspect of training large language models: the distribution and curriculum of sequence lengths, which results in a non-negligible difference in performance.

View on arXivView PDF

Code Implementations(1)

Official repo of dataset-decomposition paper [NeurIPS 2024]

213Shell, PythonDec 20, 20241 years agoNOASSERTION

Similar Papers

Cite this paper

@article{pouransari2024dataset,
  title  = {Dataset Decomposition: Faster LLM Training with Variable Sequence Length Curriculum},
  author = {Hadi Pouransari and Chun-Liang Li and Jen-Hao Rick Chang and Pavan Kumar Anasosalu Vasu and Cem Koc and Vaishaal Shankar and Oncel Tuzel},
  year   = {2024},
  eprint = {2405.13226},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2405.13226},
  url    = {http://arxiv.org/abs/2405.13226v2},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.13226.svg)](https://codeofpaper.com/paper/2405.13226)

Discussion