Skip to main content
QUICK REVIEW

[Paper Review] Amazon SageMaker Model Parallelism: A General and Flexible Framework for Large Model Training

Can Karakus, Rahul Huilgol|arXiv (Cornell University)|Nov 10, 2021
Topic ModelingComputer Science28 references8 citations
TL;DR

This paper presents Amazon SageMaker Model Parallelism, a flexible, general-purpose framework that enables efficient large model training via automatic pipeline and tensor parallelism in PyTorch. It supports diverse architectures—including non-transformer, heterogeneous, and MoE models—without code changes, while preserving native PyTorch features and achieving competitive performance against DeepSpeed.

ABSTRACT

With deep learning models rapidly growing in size, systems-level solutions for large-model training are required. We present Amazon SageMaker model parallelism, a software library that integrates with PyTorch, and enables easy training of large models using model parallelism and other memory-saving features. In contrast to existing solutions, the implementation of the SageMaker library is much more generic and flexible, in that it can automatically partition and run pipeline parallelism over arbitrary model architectures with minimal code change, and also offers a general and extensible framework for tensor parallelism, which supports a wider range of use cases, and is modular enough to be easily applied to new training scripts. The library also preserves the native PyTorch user experience to a much larger degree, supporting module re-use and dynamic graphs, while giving the user full control over the details of the training step. We evaluate performance over GPT-3, RoBERTa, BERT, and neural collaborative filtering, and demonstrate competitive performance over existing solutions.

Motivation & Objective

  • To address the lack of a general, flexible framework for large model training that supports diverse model architectures and use cases.
  • To reduce the integration burden for new training scripts by enabling automatic partitioning and minimal code changes.
  • To maintain full compatibility with native PyTorch features such as dynamic computation graphs and module re-use.
  • To provide a scalable, extensible system for both pipeline and tensor parallelism across multi-GPU and multi-node setups.
  • To deliver competitive training performance compared to existing solutions like DeepSpeed.

Proposed method

  • The framework uses a module-server architecture to enable automatic, load-balancing auto-partitioning of arbitrary model architectures across devices.
  • It introduces a general tensor parallelism framework that supports uniformly large models, models with isolated large components, and mixture-of-experts (MoE) architectures.
  • A dedicated device-to-device (D2D) communication backend handles dynamically generated communication requests across devices and nodes.
  • The system provides a flexible API with hooks (init_hook, forward_hook, return_hook) to map native PyTorch modules to their distributed counterparts without modifying original code.
  • It includes utilities like parameter_creation_scope and distributed tensor operations (e.g., allgather, allreduce, reduce-scatter) for low-level tensor parallelism control.
  • A context manager, smp.delay_param_initialization, defers parameter initialization until model deployment, reducing CPU memory pressure.

Experimental results

Research questions

  • RQ1Can a general-purpose model parallelism framework be built that supports arbitrary model architectures with minimal code changes?
  • RQ2How can tensor parallelism be generalized to support non-uniform models, large embedding layers, and mixture-of-experts architectures?
  • RQ3To what extent can native PyTorch features like dynamic graphs and module re-use be preserved in a distributed training system?
  • RQ4How does the performance of the proposed framework compare to existing solutions like DeepSpeed in real-world training workloads?
  • RQ5Can automatic load-balancing partitioning be effectively applied to complex, heterogeneous model architectures?

Key findings

  • The framework successfully trains GPT-3, RoBERTa, BERT, and neural collaborative filtering models with competitive training throughput compared to DeepSpeed.
  • Automatic partitioning achieves effective load balancing across devices without requiring manual architectural analysis or reconfiguration.
  • The system maintains full compatibility with PyTorch’s dynamic computation graph and supports conditional execution flows and parameter re-use.
  • The D2D communication backend efficiently handles dynamically generated communication patterns, reducing overhead in complex training workflows.
  • The use of smp.delay_param_initialization allows training models with billions of parameters even when CPU memory is constrained.
  • The tensor parallelism framework supports a broader range of use cases than prior solutions, including MoE and non-transformer architectures.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.