Level 5 · research · ~50 h
Build a distributed FSDP training harness
Implement a fully sharded data-parallel training harness with FSDP, mixed precision, activation checkpointing and a reproducible checkpoint/resume path, then measure scaling efficiency on a transformer workload.
Prerequisites
Problem statement
- 01Implement a fully sharded data-parallel training harness with FSDP, mixed precision, activation checkpointing and a reproducible checkpoint/resume path, then measure scaling efficiency on a transformer workload.
Real-world motivation
- 01Training large models requires distributing parameters, gradients and optimizer states; correctness under failure and resume is as important as throughput.
Learning objectives
- 01Implement sharded training with checkpoint/resume
- 02Measure scaling across GPU counts
- 03Diagnose communication bottlenecks
Technical architecture
- 01FSDP with full sharding and mixed precision
- 02activation checkpointing
- 03sharded optimizer state in checkpoints
Mathematical foundations
- 01memory per rank scales with 1/world_size for full sharding
- 02scaling efficiency $=T_1/(n T_n)$
- 03communication volume for allgather of sharded weights
Dataset and sources
- 01WikiText-103 tokenized corpus
- 02synthetic throughput microbenchmark
Step-by-step tasks
- 01Wrap the model with FSDP and verify loss parity with single-GPU training
- 02Add activation checkpointing and measure the tradeoff
- 03Implement sharded and consolidated checkpoint formats
- 04Test fault injection and resume from checkpoint
- 05Benchmark 1, 2 and 4 GPUs
- 06Profile communication time and overlap it with compute
Implementation requirements
- 01Use torch.distributed with NCCL
- 02Use torch.utils.checkpoint
- 03Validate checksums after resume
Testing requirements
- 01Verify identical losses across world sizes
- 02Check no parameter duplication after resume
- 03Confirm checkpoint files are complete
Evaluation metrics
- 01tokens per second
- 02scaling efficiency
- 03peak VRAM per rank
- 04communication fraction
Expected outputs
- 01training harness
- 02scaling report
- 03checkpoint schema documentation
- 04profiling traces
Common failure modes
- 01improper wrapping leaves parameters unsharded
- 02checkpoint resume shifts dataloader state
- 03allreduce dominates at small batch sizes
Stretch goals
- 01add hybrid sharding
- 02implement CPU offload
Research extensions
- 01derive a model for the communication-computation crossover
- 02study overlap strategies under different interconnects
GitHub submission requirements
- 01Harness code and launch scripts
- 02Scaling and memory table
- 03Checkpoint/resume test log
- 04Report with bottleneck analysis
Completion rubric
- 01loss parity across world sizes
- 02checkpoint resume correct
- 03scaling measured
- 04communication profiled
- 05report explains bottlenecks
Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.