Zubnet AIApprendreWiki › Distributed Training
Infrastructure

Distributed Training

Data Parallelism, Model Parallelism, FSDP
Entraîner un modèle à travers multiples GPU ou machines simultanément. Le parallélisme de données donne à chaque GPU une copie du modèle et split les données d'entraînement. Le parallélisme de modèle split le modèle lui-même à travers les GPU quand il est trop gros pour un. Les approches modernes comme FSDP (Fully Sharded Data Parallel) et DeepSpeed combinent les deux, permettant l'entraînement de modèles avec des centaines de milliards de paramètres.

Pourquoi c'est important

Aucun modèle de frontière ne fitte sur un seul GPU. Entraîner GPT-4 ou Claude demande des milliers de GPU travaillant ensemble pendant des mois. L'entraînement distribué est l'ingénierie qui rend ça possible — c'est aussi critique que l'architecture ou les données. L'efficacité de ton entraînement distribué détermine directement combien de modèle tu peux entraîner pour un budget donné.

Deep Dive

Data parallelism (DP): each GPU has a full model copy, processes a different mini-batch, and gradients are averaged across GPUs. Simple and efficient for models that fit on one GPU. Tensor parallelism (TP): individual layers are split across GPUs, with each GPU computing part of each matrix multiplication. Needed when a single layer's weights don't fit on one GPU. Pipeline parallelism (PP): different layers run on different GPUs, with micro-batches flowing through the pipeline.

FSDP and DeepSpeed

Fully Sharded Data Parallel (FSDP, from PyTorch) and DeepSpeed ZeRO (from Microsoft) shard model parameters, gradients, and optimizer states across GPUs. Each GPU only stores a fraction of the model, and parameters are gathered on-demand for computation, then released. This enables training models much larger than a single GPU's memory. DeepSpeed ZeRO has three stages: Stage 1 shards optimizer states, Stage 2 adds gradients, Stage 3 adds parameters.

The Communication Bottleneck

The fundamental challenge of distributed training is communication: GPUs must synchronize gradients (in data parallelism) or exchange activations (in model/pipeline parallelism). This communication happens over NVLink (within a node, 900 GB/s) or InfiniBand (between nodes, 400 Gb/s). Training efficiency drops when GPUs spend more time waiting for communication than computing. Optimal configurations minimize cross-node communication by keeping tightly-coupled operations (like tensor parallelism) within a node and loosely-coupled operations (like data parallelism) across nodes.

Concepts liés

← Tous les termes
← Distillation DPO →