TL;DR
This paper introduces "Dataset Decomposition" (DD), a novel method for training Large Language Models (LLMs) that significantly speeds up training and improves performance by intelligently handling variable document lengths. Instead of the standard "concat-and-chunk" approach, DD decomposes datasets into buckets of fixed-length sequences from individual documents, enabling more efficient attention computation and a variable sequence length curriculum.
What Problem Does This Paper Address?
Training LLMs typically involves concatenating documents of varying lengths and then chopping them into fixed-size sequences. This "concat-and-chunk" method has several drawbacks:
- Cross-document attention: Sequences can contain tokens from unrelated documents, leading to noisy learning signals and wasted computation.
- Computational inefficiency: The quadratic cost of attention makes training on long sequences prohibitively expensive. The standard approach incurs this high cost for every training step, regardless of the actual content length.
- Suboptimal sequence lengths: Documents shorter than the target sequence length are still split, leading to smaller-than-ideal chunks and hindering the model's ability to learn from longer contexts.
The authors aim to address these issues by proposing a more efficient and effective way to prepare and train LLMs on diverse text data.
Methods
The core innovation is Dataset Decomposition (DD). Here's how it works:
- Decomposition into Buckets: A dataset of documents with varying lengths is broken down into a collection of "buckets." Each bucket contains sequences of a fixed length, but crucially, all sequences within a single bucket originate from the same original document. This ensures that attention mechanisms only operate within a single document's context, eliminating cross-document attention noise.
- Variable Sequence Length (VSL) Training: During training, the model samples batches from different buckets. This means the sequence length used in each training step can vary.
- Length-based Curriculum: The sampling of buckets is guided by a curriculum. This curriculum can be designed to prioritize shorter sequences initially (easier to learn from) and gradually introduce longer ones, or follow other strategies based on the dataset's natural length distribution.
- Computational Efficiency: By processing sequences from individual documents, the computational cost of attention at each step is proportional to the actual document length (or sequence length within a bucket), rather than a fixed, potentially much larger, target length. This leads to significant speedups, especially for longer sequences.
Datasets
- Training/Evaluation: The primary dataset used is RefinedWeb [46], a large-scale web corpus.
- Benchmarks: The authors evaluate their method on a comprehensive set of standard NLP benchmarks, including:
- Regular Language Modeling Benchmarks: Commonsense Reasoning (CSR), Language Understanding (LU), Reading Comprehension (RC), and World Knowledge (WK).
- Long-Context Benchmarks: Multi-Document Question Answering (MDQA) with varying numbers of distractors (MDQA-10, MDQA-20, MDQA-30).
- Other Benchmarks: TOEFL and QUALITY (multiple-choice QA).
Key Insights and Ideas
- Cross-document attention is detrimental: The paper strongly suggests that attention across unrelated documents is a source of noise and inefficiency, and eliminating it is beneficial.
- Sequence length matters for specific tasks: Different NLP tasks benefit from different pretraining sequence lengths. For instance, reading comprehension tasks improve with longer sequences, while others show an inverted U-shape response.
- Dataset structure is a powerful tool: The way a dataset is structured (specifically, how document boundaries are handled) has a significant impact on LLM performance and training efficiency.
- Curriculum learning is effective for sequence length: A carefully designed curriculum for sampling sequence lengths can improve training stability and efficiency, especially when combined with VSL training.
- Natural distribution is often good: The "natural" mixture of sequence lengths derived from the dataset decomposition often yields near-optimal performance, suggesting that DD can leverage existing data structures effectively.
Key Results
- Training Speedup: The proposed method achieves up to 6x faster training to reach target accuracy compared to the baseline concat-and-chunk method. For example, an 8k context-length 1B model was trained at the same cost as a 2k context-length model using the baseline.
- Data Efficiency: DD shows more than 4x data efficiency, meaning it requires significantly less data to achieve comparable or better performance.
- Accuracy Gains: Experiments on a web-scale corpus demonstrate significant enhancements in performance on standard language evaluations and long-context benchmarks.
- Model Scaling: The benefits of DD are observed across different model sizes (1B, 3B, 7B parameters).
- Stability: DD, especially when combined with a curriculum, leads to more stable training dynamics, allowing for larger batch sizes and higher learning rates.
Limitations and Future Work
- Speedup dependency on sequence length: The significant training speedups are primarily observed when the target sequence length is long. For shorter sequences, the attention cost is less dominant, and the speedup is less pronounced.
- Hyperparameter tuning: While the authors state their conclusions are not sensitive to hyperparameters, explicit optimization for specific curricula or dataset mixtures might yield further improvements.
- Future Work: The authors suggest further exploration of sequence length distributions and curricula for LLM pretraining, as this is a "critical yet less studied aspect." They also imply that their method can be combined with other techniques for long-context LLMs.
Summary updated