Training Deep Nets with Sublinear Memory Cost

TL;DR

Proposes an O(√n) memory training algorithm for deep networks, with only one extra forward pass, enabling training of 1000-layer ResNets on limited hardware.

cs.LG 🔴 Advanced 2016-04-21 60 views
Tianqi Chen Bing Xu Chiyuan Zhang Carlos Guestrin
deep learning memory optimization backpropagation computation graph model depth

Key Findings

Methodology

This paper introduces a systematic approach combining computation graph analysis, automatic in-place operations, and memory sharing to reduce memory during training. The core algorithm segments the network into k=√n parts, storing only segment endpoints, and re-computing intermediate features during backpropagation. An extension uses recursive segmentation for O(log n) memory with O(n log n) extra computation. The approach leverages graph coloring and liveness analysis for optimal memory sharing, enabling training of very deep networks with minimal memory footprint.

Key Results

  • On ImageNet, training a 1000-layer ResNet reduces memory from 48GB to 7GB with only 30% additional computation time. In long-sequence RNNs, memory consumption drops over 4x, allowing deeper unrolling and longer sequences without hardware upgrades.
  • In experiments with ResNet architectures, the proposed sublinear memory plan enables training of models 5 times deeper than traditional methods, with consistent accuracy. The method outperforms baseline static memory allocation and in-place sharing strategies, maintaining model performance while significantly reducing memory.
  • Ablation studies show that combining in-place operations, memory sharing, and dropping low-cost intermediate results yields the best trade-off. The recursive segmentation further reduces memory to O(log n), at the cost of increased forward computation, demonstrating the theoretical and practical benefits of the approach.

Significance

This work addresses a fundamental bottleneck in training ultra-deep neural networks, opening new horizons for model complexity and scale. By drastically reducing memory requirements, it enables researchers and practitioners to push the limits of current hardware, fostering innovations in computer vision, NLP, and reinforcement learning. The methodology bridges the gap between hardware constraints and model design, making deep learning more scalable and accessible.

Technical Contribution

The paper introduces a novel combination of graph-based analysis, automatic in-place operation, and recursive segmentation for memory-efficient training. It provides theoretical guarantees for sublinear and logarithmic memory bounds, along with practical algorithms compatible with existing frameworks like MXNet. The approach also offers a flexible trade-off between computation and memory, facilitating scalable deep learning system design.

Novelty

This is the first systematic, general-purpose algorithm to achieve sublinear and logarithmic memory complexity in deep neural network training, integrating automatic graph analysis, in-place optimization, and recursive segmentation. Unlike prior work limited to hardware tricks or manual tuning, this method provides a formal, automated solution with proven bounds, representing a significant leap forward.

Limitations

  • While highly memory-efficient, the increased forward recomputation can lead to longer training times, which may be a concern for time-sensitive applications.
  • Support for dynamic architectures and control flow remains limited; the current approach assumes static graphs.
  • In extremely memory-constrained environments, the additional computational overhead might outweigh benefits, requiring further optimization.

Future Work

Future research will focus on adaptive segmentation strategies, dynamic graph analysis, and hardware-aware optimizations to further reduce training time. Extending support to dynamic models and integrating with distributed training frameworks will broaden applicability. Additionally, exploring automatic tuning of the trade-off parameter between memory and computation could optimize performance across diverse hardware platforms.

AI Executive Summary

Deep neural networks have revolutionized fields like computer vision and natural language processing, yet their growth in depth and complexity is hampered by hardware memory limits. Traditional training methods require storing all intermediate feature maps and gradients, leading to linear memory growth with network depth. This bottleneck restricts the exploration of ultra-deep architectures, which are crucial for capturing complex patterns in large datasets.

To address this challenge, the authors propose a novel algorithm that systematically reduces memory consumption to O(√n) or even O(log n) for training deep networks. The core idea involves analyzing the computation graph to identify opportunities for in-place operations and memory sharing, combined with a segmentation strategy that stores only the endpoints of network segments. During backpropagation, the intermediate features are recomputed from stored endpoints, significantly reducing the memory footprint while incurring a manageable increase in computation.

Experimental results demonstrate the effectiveness of this approach. On ImageNet, a 1000-layer ResNet was trained using less than 7GB of GPU memory, compared to 48GB traditionally, with only a 30% increase in training time. Similar gains were observed in training long-sequence RNNs and LSTMs, where memory was reduced by over 4 times, enabling deeper and longer models.

This work has broad implications for scaling deep learning. It allows researchers to push model depth and complexity beyond current hardware limits, fostering innovation in model architectures and training strategies. The methodology is compatible with existing frameworks like MXNet and TensorFlow, and can be combined with other system optimizations.

Despite its advantages, the approach introduces additional computational overhead, which might be a concern for real-time applications. Support for dynamic architectures and further automation of segmentation strategies are promising directions for future research. Overall, this paper provides a foundational step toward scalable, memory-efficient deep learning, promising to accelerate progress across AI domains.

Deep Dive

Abstract

We propose a systematic approach to reduce the memory consumption of deep neural network training. Specifically, we design an algorithm that costs O(sqrt(n)) memory to train a n layer network, with only the computational cost of an extra forward pass per mini-batch. As many of the state-of-the-art models hit the upper bound of the GPU memory, our algorithm allows deeper and more complex models to be explored, and helps advance the innovations in deep learning research. We focus on reducing the memory cost to store the intermediate feature maps and gradients during training. Computation graph analysis is used for automatic in-place operation and memory sharing optimizations. We show that it is possible to trade computation for memory - giving a more memory efficient training algorithm with a little extra computation cost. In the extreme case, our analysis also shows that the memory consumption can be reduced to O(log n) with as little as O(n log n) extra cost for forward computation. Our experiments show that we can reduce the memory cost of a 1,000-layer deep residual network from 48G to 7G with only 30 percent additional running time cost on ImageNet problems. Similarly, significant memory cost reduction is observed in training complex recurrent neural networks on very long sequences.

cs.LG