GrowLength: Accelerating LLMs Pretraining by Progressively Growing Training Length

Hongye Jin, Xiaotian Han, Jingfeng Yang, Zhimeng Jiang, Chia-Yuan Chang, Xia Hu · DOI

Abstract

Training Large Language Models (LLMs) is computationally intensive due to the quadratic complexity of self-attention mechanisms. We introduce GrowLength, a pretraining strategy that progressively increases sequence length from 128 to 4096 tokens. By processing more tokens during early training stages when computational costs are lower, GrowLength achieves faster convergence and superior long-context performance compared to traditional fixed-length training. Our results demonstrate significant reductions in wall-clock time without sacrificing model quality.

Introduction

The standard practice for training state-of-the-art LLMs involves using a fixed sequence length (e.g., 2048 or 4096 tokens) from the start. However, this approach is inefficient as models in early training stages primarily learn basic linguistic patterns that do not require large context windows. This leads to wasted GPU memory and compute. GrowLength addresses this by starting with short sequences and progressively growing the context window, leveraging the properties of Rotary Position Embeddings (RoPE) to ensure smooth transitions.

Methodology

GrowLength implements a dynamic training schedule:

  1. Initial Phase: Training begins with very short sequences (e.g., 128 tokens). This maximizes token throughput, allowing the model to see significantly more data in the early hours of training.
  2. Growth Phase: The sequence length is doubled at specific intervals (256, 512, 1024, etc.) until the target length is reached.
  3. Direct Position Extrapolation: By using RoPE, the model can transition between different sequence lengths without experiencing massive loss spikes, as RoPE allows for consistent positional understanding across varying lengths.

The implementation is a data-centric optimization that requires no architectural changes, only a modified data loader that swaps datasets at specific intervals.

Experimental Setup

The authors evaluated GrowLength using the Pythia model suite's data distribution. Models ranging from 70M to 410M parameters were tested. Evaluation metrics included training loss over wall-clock time and perplexity on long-context tasks (up to 4096 tokens) using the evaluation dataset from Peng et al. (2023b).

Results and Discussion

Training Efficiency and Convergence

GrowLength provides a substantial "Token Throughput" advantage. For instance, at a sequence length of 128, a model can process approximately 3.4x more tokens than at 16,384 within the same memory budget. This efficiency translates directly into faster convergence in wall-clock time.

Training loss vs. wall-clock time. GrowLength achieves lower loss faster than the fixed-length LLM1024 baseline.

As illustrated in Figure 1, the GrowLength strategy reaches lower loss levels in less time than the standard LLM1024 baseline. The transitions between sequence lengths are notably smooth, confirming the effectiveness of RoPE-based extrapolation in maintaining training stability.

Long-Context Performance

Beyond training speed, GrowLength improves the model's ability to handle long contexts. Models trained with this progressive schedule demonstrate better generalization to longer sequences than those trained on fixed short contexts.

Perplexity across different context windows. GrowLength variants maintain significantly lower perplexity at larger windows compared to fixed-length baselines.

Figure 4 shows that GrowLength models maintain low perplexity as the context window expands, outperforming both the short-context baseline (LLM128) and the standard long-context baseline (LLM1024) in terms of extrapolation efficiency. This suggests that progressive growth helps the model learn to apply its knowledge across broader contexts more effectively.

Scaling and Compatibility

GrowLength is orthogonal to other optimizations like FlashAttention or quantization. Furthermore, scaling experiments indicate that smaller models (e.g., 70M) trained with GrowLength can eventually reach loss levels comparable to larger models (e.g., 160M) trained with traditional methods, effectively improving the scaling law efficiency.

Conclusion

GrowLength is a simple yet powerful strategy for accelerating LLM pretraining. By starting small and growing the context window, researchers can significantly reduce training costs while improving long-context capabilities. Future work will focus on automating the growth schedule based on loss convergence and validating the method at the 70B+ parameter scale.

Summary updated

BibTeX
@misc{jin2023growlength,
  author = {Hongye Jin and Xiaotian Han and Jingfeng Yang and Zhimeng Jiang and Chia-Yuan Chang and Xia Hu},
  title = {{GrowLength: Accelerating LLMs Pretraining by Progressively Growing Training Length}},
  year = {2023},
  eprint = {2310.00576},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.00576},
}
Figure