SimpleFSDP: Simpler Fully Sharded Data Parallel with torch.compile

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhang, Ruisi, Liu, Tianyu, Feng, Will, Gu, Andrew, Purandare, Sanket, Liang, Wanchao, Massa, Francisco
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912106748575744
author Zhang, Ruisi
Liu, Tianyu
Feng, Will
Gu, Andrew
Purandare, Sanket
Liang, Wanchao
Massa, Francisco
author_facet Zhang, Ruisi
Liu, Tianyu
Feng, Will
Gu, Andrew
Purandare, Sanket
Liang, Wanchao
Massa, Francisco
contents Distributed training of large models consumes enormous computation resources and requires substantial engineering efforts to compose various training techniques. This paper presents SimpleFSDP, a PyTorch-native compiler-based Fully Sharded Data Parallel (FSDP) framework, which has a simple implementation for maintenance and composability, allows full computation-communication graph tracing, and brings performance enhancement via compiler backend optimizations. SimpleFSDP's novelty lies in its unique $torch.compile$-friendly implementation of collective communications using existing PyTorch primitives, namely parametrizations, selective activation checkpointing, and DTensor. It also features the first-of-its-kind intermediate representation (IR) nodes bucketing and reordering in the TorchInductor backend for effective computation-communication overlapping. As a result, users can employ the aforementioned optimizations to automatically or manually wrap model components for minimal communication exposure. Extensive evaluations of SimpleFSDP on Llama 3 models (including the ultra-large 405B) using TorchTitan demonstrate up to 28.54% memory reduction and 68.67% throughput improvement compared to the most widely adopted FSDP2 eager framework, when composed with other distributed training techniques.
format Preprint
id arxiv_https___arxiv_org_abs_2411_00284
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle SimpleFSDP: Simpler Fully Sharded Data Parallel with torch.compile
Zhang, Ruisi
Liu, Tianyu
Feng, Will
Gu, Andrew
Purandare, Sanket
Liang, Wanchao
Massa, Francisco
Distributed, Parallel, and Cluster Computing
Artificial Intelligence
Distributed training of large models consumes enormous computation resources and requires substantial engineering efforts to compose various training techniques. This paper presents SimpleFSDP, a PyTorch-native compiler-based Fully Sharded Data Parallel (FSDP) framework, which has a simple implementation for maintenance and composability, allows full computation-communication graph tracing, and brings performance enhancement via compiler backend optimizations. SimpleFSDP's novelty lies in its unique $torch.compile$-friendly implementation of collective communications using existing PyTorch primitives, namely parametrizations, selective activation checkpointing, and DTensor. It also features the first-of-its-kind intermediate representation (IR) nodes bucketing and reordering in the TorchInductor backend for effective computation-communication overlapping. As a result, users can employ the aforementioned optimizations to automatically or manually wrap model components for minimal communication exposure. Extensive evaluations of SimpleFSDP on Llama 3 models (including the ultra-large 405B) using TorchTitan demonstrate up to 28.54% memory reduction and 68.67% throughput improvement compared to the most widely adopted FSDP2 eager framework, when composed with other distributed training techniques.
title SimpleFSDP: Simpler Fully Sharded Data Parallel with torch.compile
topic Distributed, Parallel, and Cluster Computing
Artificial Intelligence
url https://arxiv.org/abs/2411.00284