Home Knowledge Base Pipeline and Tensor Parallelism

Pipeline and Tensor Parallelism

Tensor Parallelism (TP) Split individual layers across GPUs, processing the same batch together.

How It Works For a linear layer $Y = XW$:

GPU 0: X × W[:, :d/2] → Y0
GPU 1: X × W[:, d/2:] → Y1
AllGather: [Y0 | Y1] → Y

Benefits

Challenges

Pipeline Parallelism (PP) Split layers sequentially across GPUs.

How It Works

GPU 0: Layers 0-7    → activations →
GPU 1: Layers 8-15   → activations →
GPU 2: Layers 16-23  → activations →
GPU 3: Layers 24-31  → output

Micro-batching To avoid GPU idle time (bubble), split batch into micro-batches:

Time →
GPU 0: [μ1][μ2][μ3][μ4]
GPU 1:     [μ1][μ2][μ3][μ4]
GPU 2:         [μ1][μ2][μ3][μ4]

Schedule Types

ScheduleBubble OverheadMemory
GPipeHighLow
1F1BLowerHigher
Interleaved 1F1BLowestHigher

Combining Strategies

3D Parallelism

[Data Parallel]
    ↓
[Tensor Parallel across GPUs in same node]
    ↓
[Pipeline Parallel across nodes]

Example: 32 GPUs, 4 nodes

When to Use What

ConstraintStrategy
Model fits in GPUDDP only
Model larger than GPUAdd FSDP/ZeRO or TP
Very large modelCombine TP + PP + DP
Slow interconnectMore PP, less TP
Fast NVLinkMore TP
pipeline paralleltensor parallel

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.