MINI-SEQUENCE TRANSFORMER: Optimizing Intermediate Memory for Long Sequences Training
Preprint
Abstract
We introduce Mini-Sequence Transformer (MsT), a simple and effective methodology for highly efficient and accurate LLM training with extremely long sequences. MsT partitions input sequences and iteratively processes mini-sequences to reduce intermediate memory usage. Integrated with activation recomputation, it enables significant memory savings in both forward and backward passes. In experiments with the Llama3-8B model, with MsT, we measure no degradation in throughput or convergence even with 12x longer sequences than standard implementations due to our careful memory optimizations. MsT is fully general, implementation-agnostic, and requires minimal code changes to integrate with existing LLM training frameworks.Keywords
All Related Versions
This publication has 10 references indexed in Scilit:
- Effective Long-Context Scaling of Foundation Models2024
- GenSLMs: Genome-scale language models reveal SARS-CoV-2 evolutionary dynamicsThe International Journal of High Performance Computing Applications, 2023
- PyTorch FSDP: Experiences on Scaling Fully Sharded Data ParallelProceedings of the VLDB Endowment, 2023
- Long sequence time-series forecasting with deep learning: A surveyInformation Fusion, 2023
- GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints2023
- Sequence Parallelism: Long Sequence Training from System Perspective2023
- BOOKSUM: A Collection of Datasets for Long-form Narrative Summarization2022
- Efficient Content-Based Sparse Attention with Routing TransformersTransactions of the Association for Computational Linguistics, 2021
- Transformer-XL: Attentive Language Models beyond a Fixed-Length Context2019
- The Cross-Entropy Method for Combinatorial and Continuous OptimizationMethodology and Computing in Applied Probability, 1999