mlsanityData to 14 Oct 2026

MEMO: Fine-grained Tensor Management For Ultra-long Context LLM Training

arXiv 2407.12117 ↗First posted 16 Jul 2024cs.LG cs.DCcited by 5

Not on the map. Why?

Abstract (arXiv)

Nowadays, Large Language Models (LLMs) have been trained using extended context lengths to foster more creative applications. However, long context training poses great challenges considering the constraint of GPU memory. It not only leads to substantial activation memory consumption during training, but also incurs considerable memory fragmentation. To facilitate long context training, existing frameworks have adopted strategies such as recomputation and various forms of parallelisms. Nevertheless, these techniques rely on redundant computation or extensive communication, resulting in low Model FLOPS Utilization (MFU). In this paper, we propose MEMO, a novel LLM training framework designed for fine-grained activation memory management. Given the quadratic scaling of computation and linear scaling of memory with sequence lengths when using FlashAttention, we offload memory-consuming activations to CPU memory after each layer's forward pass and fetch them during the backward pass. To maximize the swapping of activations without hindering computation, and to avoid exhausting limited CPU memory, we implement a token-wise activation recomputation and swapping mechanism. Furthermore, we tackle the memory fragmentation issue by employing a bi-level Mixed Integer Programming (MIP) approach, optimizing memory reuse across transformer layers. Empirical results demonstrate that MEMO achieves an average of 1.97x and 1.80x MFU compared to Megatron-LM and DeepSpeed, respectively. This improvement is attributed to MEMO's ability to minimize memory fragmentation, reduce recomputation and intensive communication, and circumvent the delays associated with the memory reorganization process due to fragmentation. By leveraging fine-grained activation memory management, MEMO facilitates efficient training of 7B LLM with 1 million sequence length on just 8 A800 GPUs, achieving an MFU of 52.30%.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 52 of its 104 references that are in the map. First posted on arXiv 16 Jul 2024.

Builds on

52 of 104 references.

References · 52

  1. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
  2. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  3. 2023GPT-4 Technical Reportcited by 18,396
  4. 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
  5. 2020Longformer: The Long-Document Transformercited by 3,413
  6. 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
  7. 2017Billion-scale similarity search with GPUscited by 2,497
  8. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
  9. 2019Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelismcited by 1,868
  10. 2020Big Bird: Transformers for Longer Sequencescited by 1,684
  11. 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
  12. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
38 more
  1. 2017Mixed Precision Trainingcited by 1,156
  2. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
  3. 2016Training Deep Nets with Sublinear Memory Costcited by 848
  4. 2023PyTorch FSDP: Experiences on Scaling Fully Sharded Data Parallelcited by 660
  5. 2021Nystr"omformer: A Nystr"om-Based Algorithm for Approximating Self-Attentioncited by 471
  6. 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
  7. 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 354
  8. 2021ZeRO-Offload: Democratizing Billion-Scale Model Trainingcited by 341
  9. 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 313
  10. 2022Reducing Activation Recomputation in Large Transformer Modelscited by 302
  11. 2023DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Modelscited by 245
  12. 2019A Study of BFLOAT16 for Deep Learning Trainingcited by 232
  13. 2024World Model on Million-Length Video And Language With Blockwise RingAttentioncited by 198
  14. 2024Data Engineering for Scaling Language Models to 128K Contextcited by 186
  15. 2020Memory-Efficient Pipeline-Parallel DNN Trainingcited by 134
  16. 2023Scaling Laws of RoPE-based Extrapolationcited by 125
  17. 2022Clinical-Longformer and Clinical-BigBird: Transformers for long clinical sequencescited by 69
  18. 2024USP: A Unified Sequence Parallelism Approach for Long Context Generative AIcited by 61
  19. 2022Galvatron: Efficient Transformer Training over Multiple GPUs Using Automatic Parallelismcited by 53
  20. 2020Dynamic Tensor Rematerializationcited by 46
  21. 2021tf.data: A Machine Learning Data Processing Frameworkcited by 41
  22. 2020Analyzing and Mitigating Data Stalls in DNN Trainingcited by 36
  23. 2021HET: Scaling out Huge Embedding Model Training via Cache-enabled Distributed Frameworkcited by 28
  24. 2021Survey: Transformer based Video-Language Pre-trainingcited by 27
  25. 2022MiCS: Near-linear Scaling for Training Gigantic Model on Public Cloudcited by 22
  26. 2020A Tensor Compiler for Unified Machine Learning Prediction Servingcited by 20
  27. 2024GMLake: Efficient and Transparent GPU Memory Defragmentation for Large-scale DNN Training with Virtual Memory Stitchingcited by 15
  28. 2023Improving Automatic Parallel Training via Balanced Memory Workload Optimizationcited by 14
  29. 2017Learning Models over Relational Data using Sparse Tensors and Functional Dependenciescited by 12
  30. 2023Experimental Analysis of Large-scale Learnable Vector Storage Compressioncited by 12
  31. 2020Tensor Relational Algebra for Machine Learning System Designcited by 11
  32. 2022Where Is My Training Bottleneck? Hidden Trade-Offs in Deep Learning Preprocessing Pipelinescited by 10
  33. 2022Optimizing Tensor Programs on Flexible Storagecited by 9
  34. 2023CAFE: Towards Compact, Adaptive, and Fast Embedding for Large-scale Recommendation Modelscited by 7
  35. 2018Profile-guided memory optimization for deep neural networkscited by 6
  36. 2021TOD: GPU-accelerated Outlier Detection via Tensor Operationscited by 6
  37. 2022OLLA: Optimizing the Lifetime and Location of Arrays to Reduce the Memory Usage of Neural Networkscited by 6
  38. 2024NeurDB: An AI-powered Autonomous Data Systemcited by 5

50 most cited of 52 All 52 (JSON)

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 2; 2025: 2; 2026: 1.

5 papers.