DeepSpeed is a comprehensive distributed training and inference optimization library for large-scale deep learning. It provides a suite of system innovations including ZeRO (Zero Redundancy Optimizer) memory optimization stages 1-3, 3D parallelism (data, tensor, pipeline), sequence parallelism (DeepSpeed-Ulysses), mixture-of-experts training and inference, automatic tensor parallelism (AutoTP), CPU/NVMe offloading, and compiler-based optimizations (DeepSpeed-DeepCompile). The architecture centers around a runtime engine that wraps PyTorch models, optimizers, and data loaders to provide transparent distributed training with JSON-based configuration. Key entry points include `deepspeed.initialize()` for training, `deepspeed.init_inference()` for inference, and CLI launchers (`deepspeed`, `ds_report`). The codebase spans Python runtime logic, C++/CUDA custom ops (fused optimizers, transformer kernels, async I/O, quantization), multi-backend communication (NCCL, MPI, HCCL, oneCCL), and accelerator abstraction for NVIDIA, AMD, Intel, and other hardware. Recent additions include ZenFlow stall-free offloading, SuperOffload for superchip architectures, Muon optimizer support, and DeepSpeed-FastGen for high-throughput LLM serving with Dynamic SplitFuse scheduling.
Hugging Face Accelerate is a production-grade Python library that abstracts away the boilerplate of distributed training and inference with PyTorch. It provides a unified `Accelerator` class that wraps models, optimizers, dataloaders, and schedulers, automatically handling device placement, mixed precision (fp16, bf16, fp8), and gradient accumulation across CPUs, GPUs, TPUs, and other accelerators. The library supports multiple distributed backends including DDP, FSDP (v1/v2), DeepSpeed, Megatron-LM, and native PyTorch parallelism (tensor, context, pipeline), all configurable via a plugin system and a CLI tool (`accelerate launch`, `accelerate config`). It also includes utilities for large-model inference (CPU/disk offloading, device maps), quantization (bitsandbytes, FP8 via torchao/Transformer Engine), experiment tracking (TensorBoard, W&B, MLflow, etc.), and checkpointing with resume support. The architecture centers on the `Accelerator` class in `accelerator.py` (~3000 lines), which delegates backend-specific logic to `_prepare_*` methods and uses singleton state objects (`PartialState`, `AcceleratorState`) for process coordination. The `state.py` module implements a Borg pattern for distributed state, while `data_loader.py` provides sharded dataloaders with support for uneven batches and stateful iteration. The `big_modeling.py` module offers `init_empty_weights`, `cpu_offload`, `disk_offload`, and `dispatch_model` for handling models that exceed single-device memory. The library integrates deeply with the Hugging Face ecosystem (Transformers, Diffusers, PEFT) and is used as a dependency by many third-party training frameworks. Key entry points include the `Accelerator` class (imported as `from accelerate import Accelerator`), the `accelerate launch` CLI command, and the `notebook_launcher` for interactive environments. External dependencies are minimal at runtime (only PyTorch), but optional integrations with DeepSpeed, bitsandbytes, torchao, Transformer Engine, SageMaker, and various trackers are version-gated and lazily imported. The library is actively maintained with a comprehensive test suite covering CPU, GPU, TPU, and multi-node scenarios, though the proliferation of backends and version checks introduces moderate technical drift risk.
ColossalAI is a comprehensive distributed training and inference framework for large-scale deep learning models, providing multiple parallelism strategies (data, tensor, pipeline, sequence, mixture-of-experts), ZeRO memory optimization, automatic parallelization via FX tracing, and high-performance custom CUDA/Triton kernels. The architecture is library-based with a plugin-style booster for orchestrating training and inference, a shardformer for model-level parallelism policies, and a legacy subsystem for older APIs. It includes application-level tools: ColossalChat for RLHF (PPO, DPO, GRPO), ColossalQA for retrieval-augmented question answering, ColossalEval for LLM evaluation with GPT judges, and Colossal-LLaMA for domain-specific LLM training. The codebase is actively maintained with recent commits, but has notable technical drift due to outdated dependency pins in some examples and a large legacy namespace that coexists with newer implementations.
Jaxformer is a JAX-based library for training large language models (LLMs) on TPUs with data and model parallelism. It provides a complete training loop supporting distributed training across TPU cores, checkpointing, and resumable data loading from TFRecord files. The codebase includes model definitions for transformer-based architectures (like CodeGen), utilities for learning rate scheduling and optimization, and integration with Hugging Face for model conversion and sampling. The system is designed for scalability, supporting models up to 6B parameters via sharding strategies, and includes tools for preprocessing large datasets into TFRecord format. While the core training functionality is tightly coupled to the TPU environment, several components like the resumable data iterator and checkpointing mechanism demonstrate reusable patterns.