DeepCompile: A Compiler-Driven Approach to Optimizing Distributed Deep Learning Training

Masahiro Tanaka, Du Li, Umesh Chand, Ali Zafar, Haiying Shen, Olatunji RuwasearXiv 2025 · DOI

Abstract

DeepCompile is a novel compiler-driven framework designed to optimize distributed training for large-scale AI models. By treating communication and memory management as a series of graph transformation passes and utilizing real-world profiling data, DeepCompile achieves significant performance gains. Experimental results demonstrate up to a 1.54× speedup over industry standards like ZeRO-3 and FSDP, while its "adaptive offloading" capability enables training on significantly reduced hardware resources.

Introduction

Training modern Large Language Models (LLMs) with hundreds of billions of parameters necessitates "fully sharded" strategies, such as DeepSpeed ZeRO-3 or PyTorch FSDP. These methods distribute model parameters across multiple GPUs to conserve memory, fetching them via "all-gather" operations only when required.

However, existing systems rely on runtime "hooks" triggered at layer boundaries, which lack fine-grained control. This leads to two primary inefficiencies: communication and computation often occur sequentially rather than simultaneously, and optimizations like prefetching and unsharding compete for limited GPU memory without a unified coordinator, often resulting in Out-of-Memory (OOM) errors.

Methodology

DeepCompile shifts the responsibility of optimization from the runtime framework to the compiler. The framework operates through a three-stage process:

  1. Graph Transformation: The model script is converted into a computation graph where communication and memory allocation are represented as explicit nodes.
  2. Profiling-Guided Optimization (PGO): The system executes "warm-up" iterations to precisely measure the memory footprint and execution time of each operation.
  3. Modular Optimization Passes: Using the profile data, DeepCompile applies targeted passes, including proactive prefetching, selective unsharding, and adaptive offloading.
The DeepCompile workflow utilizes a feedback loop between a profiler and optimization passes to generate a modified, high-performance computation graph.

Key Insights: The "Memory Valley"

A core innovation of DeepCompile is the identification of "memory valleys"—periods between memory spikes (e.g., during log-softmax operations) where GPU memory is underutilized. DeepCompile uses these valleys to aggressively prefetch data without exceeding memory limits. Furthermore, the researchers found that the sequence of optimizations is vital; prefetching must be prioritized to hide latency, with remaining memory then allocated for selective unsharding.

DeepCompile identifies unused memory gaps to schedule aggressive prefetching and reduces peak memory through adaptive offloading during the backward pass.

Experimental Results

The framework was evaluated using Llama-3 70B and Mixtral 8x7B MoE models. Key findings include:

  • Throughput Gains: DeepCompile achieved a 1.28× speedup on Llama-3 70B and a 1.54× speedup on Mixtral 8x7B compared to ZeRO-3 and FSDP baselines.
  • Resource Efficiency: In hardware-constrained environments, DeepCompile’s adaptive offloading allowed a model that typically requires 32 GPUs to run on just 16 GPUs, delivering a 7.01× increase in throughput over standard offloading methods.
  • Memory Utilization: DeepCompile consistently utilized memory up to the safety margin, maximizing on-device data storage compared to baseline heuristics.

Conclusion and Future Work

While DeepCompile introduces a one-time compilation overhead (4–7 minutes) and currently relies on static model behavior, it represents a significant step forward in distributed training efficiency. Future research will explore extending this compiler-driven approach to other parallelization strategies, such as Pipeline and Tensor Parallelism.

Summary updated

BibTeX
@misc{tanaka2025deepcompile,
  author = {Masahiro Tanaka and Du Li and Umesh Chand and Ali Zafar and Haiying Shen and Olatunji Ruwase},
  title = {{DeepCompile: A Compiler-Driven Approach to Optimizing Distributed Deep Learning Training}},
  year = {2025},
  eprint = {2504.09983},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.09983},
}
Figure