[Paper Review] Optimal checkpointing for heterogeneous chains: how to train deep neural networks with limited memory
This paper proposes an optimal checkpointing strategy for training deep neural networks with limited memory by dynamically selecting which forward activations to store and which to recompute. Using a novel dynamic programming algorithm that models both input-only and full-operation-history checkpointing, it achieves 17.2% higher throughput on average than existing methods while supporting arbitrary memory limits and complex sequential networks in PyTorch.
This paper introduces a new activation checkpointing method which allows to significantly decrease memory usage when training Deep Neural Networks with the back-propagation algorithm. Similarly to checkpoint-ing techniques coming from the literature on Automatic Differentiation, it consists in dynamically selecting the forward activations that are saved during the training phase, and then automatically recomputing missing activations from those previously recorded. We propose an original computation model that combines two types of activation savings: either only storing the layer inputs, or recording the complete history of operations that produced the outputs (this uses more memory, but requires fewer recomputations in the backward phase), and we provide an algorithm to compute the optimal computation sequence for this model. This paper also describes a PyTorch implementation that processes the entire chain, dealing with any sequential DNN whose internal layers may be arbitrarily complex and automatically executing it according to the optimal checkpointing strategy computed given a memory limit. Through extensive experiments, we show that our implementation consistently outperforms existing checkpoint-ing approaches for a large class of networks, image sizes and batch sizes.
Motivation & Objective
- To address the memory bottleneck in training deep neural networks, especially on low-memory devices like IoT systems.
- To extend traditional automatic differentiation checkpointing to heterogeneous DNNs with arbitrarily complex internal layers.
- To develop a fully automatic, PyTorch-compatible implementation that supports arbitrary memory limits and optimizes training throughput.
- To outperform existing checkpointing strategies—both periodic and optimal—across diverse network architectures, image sizes, and batch sizes.
Proposed method
- The method models forward and backward operations in DNNs as a sequence of modules, allowing dynamic selection of which activations to checkpoint.
- It introduces two checkpointing types: storing only layer inputs (memory-efficient) or recording the full operation history (fewer recomputations).
- A dynamic programming algorithm computes the optimal persistent schedule under memory constraints, leveraging the memory persistency property of optimal solutions.
- The approach supports arbitrary sequential PyTorch modules, including those with complex internal computations.
- The implementation integrates seamlessly with autograd, automatically applying the optimal strategy based on a user-defined memory limit.
- It enables continuous memory adaptation, unlike discrete segment-based strategies, and supports both forward and backward phases with minimal overhead.
Experimental results
Research questions
- RQ1How can checkpointing strategies be optimized for heterogeneous deep neural network chains with arbitrary internal layer complexity?
- RQ2What is the optimal trade-off between memory usage and recomputation cost when storing either inputs or full operation histories?
- RQ3Can a dynamic programming approach outperform existing periodic and optimal checkpointing strategies in terms of training throughput under memory constraints?
- RQ4How does the proposed method scale across different network depths, image sizes, and batch sizes compared to PyTorch’s default strategy?
- RQ5To what extent can the method enable training on low-memory devices by supporting larger models, images, or batch sizes?
Key findings
- The proposed optimal strategy achieves an average 17.2% higher training throughput than the best-performing competitor across all tested configurations.
- For ResNet-1001 with 224×224 images and batch size 8, the optimal strategy achieves 9.18 images/second, while PyTorch’s default strategy fails due to memory limits.
- With a batch size of 8, PyTorch’s strategy would require 225 GiB of memory—over 16× more than the optimal strategy’s peak usage.
- The optimal strategy enables training on large models even when PyTorch’s default strategy fails, including for batch size 8 on ResNet-1001.
- The method outperforms both the sequential (segmented) strategy and the previous revolve algorithm, especially at higher memory limits where the latter cannot utilize available memory.
- The optimal strategy maintains stable performance across diverse network sizes and image resolutions, demonstrating robustness and flexibility.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.