NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Scaling Distributed Deep Learning Workloads beyond the Memory Capacity with KARMA

Mohamed Wahib, Haoyu Zhang, Truong Thao Nguyen, Aleksandr Drozd, Jens Domke, Lingqi Zhang, Ryousei Takano, Satoshi Matsuoka

TL;DR

KARMA (Kernel-Aware Resource Management and Allocation) is a new framework that allows training massive deep learning models that far exceed a single GPU's memory capacity. By intelligently combining data swapping between GPU and CPU with redundant recomputation, KARMA achieves a 1.52x speedup over existing methods and, for the first time, enables out-of-core training to scale across thousands of GPUs.

What Problem Does This Paper Address?

The "memory wall" is a major hurdle in deep learning. As models like GPT-3 grow to billions of parameters, they no longer fit into the dedicated memory (VRAM) of even the most powerful hardware accelerators.

Current solutions have significant drawbacks:

  1. Model Parallelism: Splitting a model across multiple GPUs is effective but requires invasive code changes and forces a high minimum number of GPUs to even start training.
  2. Out-of-Core (OOC) Methods: Swapping data to the host CPU memory (virtualization) is less invasive but often leads to massive performance stalls while the GPU waits for data to arrive.
  3. Gradient Checkpointing: Recomputing activations saves memory but adds significant computational overhead.

Furthermore, existing OOC methods were limited to single-GPU setups because the weight update process in distributed training conflicts with the data swapping cycle.

Methods

KARMA introduces a two-tier optimization strategy to maximize device occupancy—the percentage of time the GPU is actually doing work rather than waiting for data.

  • Performance Modeling: The authors developed a model that uses offline profiling to predict memory usage and compute time for different "blocks" of layers.
  • Capacity-Based Swapping: Instead of simple eager swapping, KARMA uses an Integer Linear Programming (ILP) solver to determine exactly when to swap blocks to the CPU based on available memory, minimizing pipeline stalls.
  • Interleaved Recomputation: In a clever twist, KARMA identifies gaps in the data transfer pipeline where the GPU would otherwise be idle. It fills these gaps by redundantly recomputing certain layers, which is often faster than waiting for a swap-in from the CPU.
  • 5-Stage Distributed Pipeline: To support multi-node training, KARMA implements a heterogeneous pipeline (shown in Figure 3) that overlaps backward computation, swapping blocks to the CPU, phased gradient exchanges (AllReduce), and performing weight updates directly on the CPU.
Fig. 1: Overview of KARMA’s workflow

Datasets

The authors evaluated KARMA across a wide range of standard benchmarks and massive-scale models:

  • Computer Vision: ImageNet (using ResNet-50, VGG16, ResNet-200, and ResNet-1001) and CIFAR-10 (WideResNet-28-10).
  • Medical Imaging: ssTEM (using U-Net), which involves high-resolution images that are difficult to fit in memory.
  • Natural Language Processing: OpenWebText, used to train the massive Megatron-LM (8.3B parameters) and Turing-NLG (17B parameters) models.

Key Insights and Ideas

  • Recompute as a Speedup, Not a Penalty: Traditionally, recomputing activations is seen as a "necessary evil" to save memory. KARMA proves that recomputation can actually improve performance by filling idle time in the I/O pipeline.
  • Breaking the Single-GPU Barrier: By moving the weight update to the CPU and pipelining it with gradient exchanges, the authors solved the fundamental conflict that previously prevented OOC methods from working in distributed environments.
  • Efficiency at Scale: The paper demonstrates that for very large models, pure data parallelism via KARMA can actually be more efficient than complex hybrid model/data parallel schemes because it requires fewer communication rounds.
Fig. 2: Different swapping strategies (simplified illustration that assumes the swap-in/out of one block of layers at a time, with swap- in/out taking double the time of the computation). (a) vDNN [32] and ooc cuDNN [11] family of solutions may lead to inefficiency when switching from forward to backward propagation, (b) Proposed capacity-based schedule can reduce the idle time by swapping in ahead of time and avoiding swaps when device capacity allows, (c) Improving capacity-based schedule to further reduce the idle time: swap-in ahead of time interleaved with recomputing following layers

Key Results

  • Speedup: KARMA achieved an average 1.52x speedup over state-of-the-art OOC and recompute methods like vDNN++ and SuperNeurons.
  • Memory Scaling: It enabled a 2x to 6x increase in batch size above the physical memory limit with only a modest performance degradation (9%–37%).
  • Distributed Performance: In a "parity comparison" on 2,048 GPUs, KARMA outperformed the standard Megatron-LM hybrid parallel implementation. When combined with Microsoft's ZeRO optimizer, it provided a 1.35x speedup for the 17-billion parameter Turing-NLG model.
  • Accuracy: The authors confirmed that KARMA has zero impact on model accuracy, as it does not change the underlying mathematical operations or hyperparameters.

Limitations and Future Work

  • Profiling Overhead: KARMA requires an initial offline profiling step to gather metadata for its performance model. While this is done only once per model/hardware combination, it adds a step to the workflow.
  • CPU Compute Power: The strategy relies on the host CPU being able to handle weight updates efficiently. In systems with very weak CPUs relative to their GPUs, the CPU-side update could become a bottleneck.
  • Framework Integration: While implemented in PyTorch, the authors note that static graph frameworks like TensorFlow would require different integration strategies (e.g., encoding the schedule into the computational graph).

For a summary of how KARMA compares to previous approaches, see the table below:

TABLE I: Limitations and Restrictions of Related Approaches; Label Explanation: OOC = Out-of-core, RECOMP = Redundant Recompu- tation, MP = Model Parallelism, N = Number of Layers, P = Number of Model Parameters, MN is Multi-node

Summary updated

BibTeX
@inproceedings{wahib2020scaling,
  author = {Mohamed Wahib and Haoyu Zhang and Truong Thao Nguyen and Aleksandr Drozd and Jens Domke and Lingqi Zhang and Ryousei Takano and Satoshi Matsuoka},
  title = {{Scaling Distributed Deep Learning Workloads beyond the Memory Capacity with KARMA}},
  booktitle = {SC},
  year = {2020},
  doi = {10.1109/sc41405.2020.00023},
}
Figure