Introduction
Deep learning models are increasingly constrained by GPU memory, primarily due to "activations"—intermediate data stored during the forward pass for use in the backward pass. To mitigate this, researchers use checkpointing, which drops some activations and re-computes them only when needed. However, existing planners struggle with dynamic inputs, such as varying sequence lengths in Natural Language Processing (NLP). Static planners are often too conservative, planning for worst-case scenarios and wasting time, while dynamic planners like DTR are reactive, waiting for "Out of Memory" (OOM) errors to occur before taking action, which leads to high overhead.
The Mimose Framework
Mimose bridges the gap between static and dynamic approaches by predicting memory usage based on input size. It consists of three primary components designed to manage memory proactively during training.
- Shuttling Online Collector: During the initial "sheltered execution" phase, Mimose profiles the model. It uses a "shuttling" technique—executing blocks twice—to measure memory and time without crashing the GPU, even if the model is technically too large for the budget.
- Lightning Memory Estimator: Mimose leverages the fact that the relationship between input size and activation memory is typically linear or quadratic. It uses simple polynomial regression to predict per-layer memory usage for any given input size with over 99% accuracy.
- Responsive Memory Scheduler: Instead of reacting to OOM errors, this scheduler uses predictions to generate a near-optimal checkpointing plan before the forward pass starts. Crucially, it caches these plans to avoid redundant calculations for recurring input sizes.
Proactive vs. Reactive Planning
The core advantage of Mimose is its ability to anticipate memory requirements. While dynamic planners like DTR suffer from a "planning tax" because they treat every iteration as a new problem and react only when memory is exhausted, Mimose's proactive scheduling ensures smooth execution.
Experimental Evaluation
The researchers evaluated Mimose on standard NLP benchmarks (SWAG, SQuAD, and GLUE-QQP) using popular transformer models like BERT, RoBERTa, and XLNet. These datasets were selected specifically for their highly dynamic input sequence lengths.
- Throughput Gains: Mimose outperformed the static Sublinear planner by 17.1% and the dynamic DTR planner by 15.0% on average.
- Minimal Overhead: The total cost for data collection and planning is equivalent to just 3.95 iterations, representing less than 0.2% of the total time in a typical training run.
- Memory Efficiency: Mimose successfully kept memory usage within 0.5 GB to 1 GB of the hard budget, maximizing GPU utilization without triggering OOM errors.
- Model Accuracy: The system does not affect convergence; loss curves for Mimose were nearly identical to unconstrained baselines.
Conclusion and Future Work
Mimose demonstrates that activation memory is highly predictable and that leveraging this predictability can significantly improve training efficiency on limited hardware. While the current framework excels in NLP, future work will focus on adapting these algorithms for Computer Vision tasks where memory usage can be non-deterministic due to content-aware operations like object proposal generation.
Summary updated