arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.00284cs.DCcs.AI
收藏

SimpleFSDP:基于 torch.compile 的更简化的全分片数据并行

SimpleFSDP: Simpler Fully Sharded Data Parallel with torch.compile

UC San Diego(加州大学圣迭戈分校);Meta;Harvard University(哈佛大学)

Ruisi Zhang, Tianyu Liu, Will Feng, Andrew Gu, Sanket Purandare, Wanchao Liang, Francisco Massa

AI总结:

本文提出 SimpleFSDP,一个基于 torch.compile 的简化全分片数据并行框架,通过编译器后端优化和 IR 节点重排,在 Llama 3 上实现最高 28.54% 内存减少和 68.67% 吞吐提升。

摘要:

大规模模型的分布式训练消耗巨大的计算资源,并且需要大量的工程努力来组合各种训练技术。本文提出了 SimpleFSDP,一个基于 PyTorch 原生的编译器驱动的全分片数据并行(FSDP)框架,其实现简单,便于维护和组合,支持完整的计算-通信图追踪,并通过编译器后端优化带来性能提升。SimpleFSDP 的新颖之处在于其独特的 torch.compile 友好的集体通信实现,利用现有的 PyTorch 原语,即参数化、选择性激活检查点和 DTensor。它还首次在 TorchInductor 后端引入了中间表示(IR)节点的分桶和重排序,以实现有效的计算-通信重叠。因此,用户可以自动或手动地利用上述优化来包装模型组件,以最小化通信暴露。使用 TorchTitan 对 Llama 3 模型(包括超大型 405B)进行的广泛评估表明,与最广泛采用的 FSDP2 eager 框架相比,当与其他分布式训练技术组合时,SimpleFSDP 实现了高达 28.54% 的内存减少和 68.67% 的吞吐量提升。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑