TL;DR
Researchers from Apple and Anthropic have introduced Dataset Decomposition (DD), a training strategy that moves away from the standard practice of "smashing" documents together into fixed-length blocks. By training on variable-length sequences that respect actual document boundaries and using a length-based curriculum, they achieved up to a 6x speedup in training time and significantly improved performance on both standard and long-context benchmarks.
What Problem Does This Paper Address?
The current "gold standard" for training Large Language Models (LLMs) is the concat-and-chunk approach. You take a massive pile of documents, concatenate them with a separator token (like <EOT>), and slice them into uniform blocks (e.g., 2,048 or 8,192 tokens).
This approach has three major flaws:
- Cross-Document Contamination: Models end up attending to unrelated documents that happen to be in the same chunk, which can lead to "spurious modeling."
- Computational Waste: Attention mechanism costs grow quadratically ($O(n^2)$) with sequence length. Even if you mask out unrelated documents, the hardware still performs the full computation for the fixed block size.
- Document Fragmentation: A short, coherent document might be split across two chunks, depriving the model of its full context.
Methods
The authors propose Dataset Decomposition (DD) and Variable Sequence Length (VSL) training:
- Decomposition: Instead of concatenating, every document is broken down into its "binary decomposition" of lengths (powers of 2). For example, a document with 13 tokens would be split into sequences of length 8, 4, and 1. These are placed into corresponding "buckets" ($D_i$).
- VSL Training: During training, the system samples a bucket and creates a batch. To keep the total number of tokens per step constant, the batch size is adjusted: if the sequence length doubles, the number of sequences in the batch is halved.
- Curriculum Learning: The authors don't just sample randomly; they use a curriculum (like "Grow-P2"). They start by training mostly on shorter, "easier" sequences and gradually increase the probability of sampling longer sequences. This mimics how humans learn and improves training stability.
Datasets
The models were trained and evaluated on massive, web-scale corpora:
- RefinedWeb: A 525-billion-token dataset used for the primary scaling experiments.
- DataComp-LM: Used to verify the method's efficacy across different data distributions.
- Evaluation Suite: The authors used a comprehensive set of 14 standard benchmarks (including PIQA, HellaSwag, and WinoGrande) and three long-context benchmarks (MDQA, TOEFL, and QuALITY).
Key Insights and Ideas
- The Quadratic Tax: Because attention is so expensive at long lengths, training on a 2k context is much faster than an 8k context. DD allows the model to spend most of its time on shorter sequences, only paying the "quadratic tax" when necessary for long documents.
- Context Matters More Than Sequence Length: The paper distinguishes between sequence length (the block size) and context length (how many tokens from the same document a model can actually see). DD maximizes the "average context length," leading to better reasoning.
- Stability through Curriculum: Training on long sequences from the start often causes "gradient spikes" and instability. Starting short acts as a natural warm-up, allowing for higher learning rates and more stable convergence.
- RoPE Scaling: They found that increasing the base frequency ($f_b$) of Rotary Positional Embeddings (RoPE) from 10k to 100k is crucial for performance when training from scratch with long contexts.
Key Results
The results are striking across various model sizes (160M to 7B parameters):
- Efficiency: The DD approach reached the same accuracy as the baseline 6x faster.
- Data Efficiency: DD showed >4x better data efficiency, meaning it learned more from fewer tokens compared to the concat-and-chunk method.
- Long Context Superiority: On the Multi-Document Question Answering (MDQA) task, DD models significantly outperformed baselines. In fact, they could train an 8k-context model for the same computational cost as a 2k-context baseline model.
- Scaling: The performance gap between DD and the baseline actually widened as they scaled the number of training tokens, suggesting this isn't just a "small data" fluke.
Limitations and Future Work
While the results are impressive, the authors note a few caveats:
- Target Length Dependency: The training speedup is most significant when the target context length is long (8k+). If you are only training a model with a very short context (e.g., 512), the attention cost isn't the bottleneck, and the gains from DD would be marginal.
- Implementation Complexity: Moving from fixed-length blocks to variable-length batches requires a more sophisticated data loader and training infrastructure.
- Future Directions: The authors suggest exploring even more complex curricula and investigating how DD interacts with other efficiency techniques like Mixture-of-Experts (MoE) or linear attention variants.
Summary updated