What problem does it solve?
PyTorch FSDP (Fully Sharded Data Parallel) addresses the memory and scalability limits of large-model training by sharding parameters, gradients, and optimizer states across devices and workers to enable training models that would otherwise not fit in GPU memory. It also helps engineers migrate from legacy FSDP1 patterns to the newer FSDP2/DTensor-based workflows, and provides guidance for mixed precision, CPU offloading, and collective configuration to avoid hangs and performance regressions.
Core Features & Use Cases
- Parameter and optimizer sharding: Advice on per-parameter sharding, grouping strategies, and when to apply fully_shard bottom-up for best communication efficiency.
- Mixed precision & memory optimizations: Recommendations for AMP/autocast, gradient scaling, and resharding strategies to maximize throughput while conserving memory.
- CPU offloading and cluster integration: Guidance for using CPU offload, device meshes, NCCL/Gloo backend selection, and environment variables for multi-node setups.
- Debugging and migration: Tips to debug init_process_group issues, common NCCL/Gloo pitfalls, and steps to migrate from FSDP1 to FSDP2 with DTensor and distributed checkpointing.
- Use case: Training large transformer models across 4+ GPU nodes with reduced memory footprint and overlapped communication.
Quick Start
Show me how to configure PyTorch FSDP2 with mixed precision, CPU offloading, and a DTensor device mesh for a multi-node GPU cluster.