TL;DR
μ-cuDNN is a transparent wrapper library for NVIDIA's cuDNN that eliminates severe performance drops caused by GPU memory limits. By automatically splitting mini-batches into optimized "micro-batches" using dynamic programming and integer linear programming, it unlocks faster convolution algorithms under tight memory constraints—boosting training speeds by up to 1.63x without altering model accuracy or changing a single line of core network logic.
What Problem Does This Paper Address?
When training deep neural networks (DNNs), engineers favor large mini-batch sizes to maximize GPU utilization and hide communication overhead. However, this pushes GPU memory to its absolute limit.
NVIDIA’s cuDNN library provides multiple mathematically equivalent algorithms to compute convolutions (e.g., GEMM-based, FFT-based, Winograd). Some are incredibly fast but require a significant temporary memory footprint, known as a workspace. Currently, cuDNN selects these algorithms on a rigid, per-layer basis. If a highly efficient algorithm requires even a single byte more workspace than what is available, cuDNN falls off a "performance cliff," reverting to a much slower, lower-memory algorithm. As shown in the paper's analysis of AlexNet, missing the memory threshold by just one byte can cause a layer to run up to 4.51x slower.
Methods
The authors introduce μ-cuDNN, a drop-in C++ wrapper that intercepts cuDNN calls and applies loop tiling to the mini-batch dimension. Because individual samples within a mini-batch are computationally independent, a single large convolution can be broken down into sequential "micro-batches." This drastically lowers the peak workspace memory required at any given moment, allowing the system to utilize the fastest cuDNN algorithms.
To determine the optimal micro-batch sizes and algorithm choices, μ-cuDNN introduces two strategies:
- Workspace Reuse (WR): Designed for sequential networks, this policy assumes each layer uses the workspace exclusively. It uses a Dynamic Programming (DP) algorithm to independently find the fastest micro-batch configuration for each layer within the memory limit.
- Workspace Division (WD): Designed for complex networks with parallel branches (like Inception modules), this policy manages memory globally. It uses 0-1 Integer Linear Programming (ILP) to distribute a single global workspace across multiple co-dependent layers.
To prevent the ILP problem from exploding mathematically, the authors implement a Pareto front pruning technique that discards "undesirable" configurations (those that are both slower and consume more memory than alternatives), keeping the optimization time down to mere milliseconds.
Datasets
The library was evaluated using standard deep learning workloads trained on the ILSVRC2012 (ImageNet) classification dataset and the CIFAR dataset. These datasets were processed through popular architectures including AlexNet, ResNet-18, ResNet-50, and DenseNet-40.
Key Insights and Ideas
- Decoupling Efficiencies: The core breakthrough is separating statistical efficiency (how fast a model learns per parameter update) from hardware efficiency (how fast the GPU computes those updates). Micro-batching changes the execution mechanics but preserves the exact mathematical semantics of the mini-batch, ensuring zero loss in training accuracy.
- Global vs. Local Memory Management: The Workspace Division (WD) approach highlights that uniform memory allocation across layers is highly inefficient. By looking at the network holistically, the ILP solver can intentionally starve low-impact layers of memory to feed memory-hungry bottleneck layers, yielding superior global throughput.
- Extreme Ease of Integration: Because μ-cuDNN shadows the standard cuDNN API, it acts as a transparent proxy. Integrating it into frameworks like Caffe requires changing as few as three lines of code.
Key Results
- Throughput Speedups: On an NVIDIA P100-SXM2 GPU, μ-cuDNN achieved a 1.63x speedup for AlexNet and a 1.21x speedup for ResNet-18 compared to standard cuDNN execution under moderate workspace constraints (64 MiB).
- Memory Footprint Reduction: Under unconstrained memory scenarios, μ-cuDNN cut peak per-layer memory consumption by up to 3.43x on AlexNet and 2.73x on ResNet-18 by finding smarter, micro-batched pathways that matched the speed of massive, memory-hogging algorithms.
- Portability: The authors successfully demonstrated performance gains across two entirely different underlying deep learning frameworks: Caffe and TensorFlow.
Limitations and Future Work
A notable limitation involves framework compatibility: TensorFlow (version 1.4.1 at the time of the study) does not natively expose workspace limits to external benchmarking functions before executing convolutions. As a result, users must manually supply workspace limits to μ-cuDNN when using the TensorFlow framework.
Additionally, while this paper focuses entirely on optimizing convolutional layers, the authors note that the micro-batching methodology could theoretically be extended to other memory-heavy layer types that feature independent sample dimensions.
Summary updated