Chris Collins

Tools · ai

Training memory and parallelism planner

How much memory each GPU needs to train a model under data, tensor, pipeline, expert and context parallelism with ZeRO 0–3 / FSDP and activation recomputation, what each axis sends over the network, the pipeline bubble with a 1F1B timeline, MFU vs HFU, an animated activation-checkpointing walk-through, and the memory and FLOPs of PPO, GRPO and DPO.

Added

How to use it

Five tabs:

  • Planner — pick a model (or type its size) and a GPU, then set the degrees of data (DP), tensor (TP), pipeline (PP), context (CP) and expert (EP) parallelism. The planner adds up what one GPU holds: 16 bytes per parameter of model state (BF16 weights and gradients, FP32 master weights and Adam’s two moments), sharded by ZeRO-1, -2 or -3 / FSDP over the data-parallel ranks, plus activations for the micro-batches the pipeline schedule keeps in flight, under no checkpointing, √n checkpoints, selective or full recomputation. A table compares the four ZeRO stages for the same layout, and another lists what each parallel axis sends per step, whether it fits in the NVLink domain, and how long it would take if nothing overlapped it.

  • Pipeline bubble — a timeline of GPipe or 1F1B on p stages with m micro-batches, the bubble (p − 1)/(m + p − 1), and how many micro-batches of activations each stage holds.

  • MFU & HFU — model FLOPs utilisation from one measured step (6·N·D ÷ (peak × chips × seconds)), from tokens per second, or from a reported FLOP rate, optionally with attention FLOPs; HFU adds the recomputed FLOPs.

  • Checkpointing — step through (or play) the forward and backward passes of an n-layer network checkpointed every k layers: which activations are kept, which are discarded and recomputed, and how many are held at each moment, against the no-checkpointing line.

  • RLHF — the resident memory of PPO (actor, critic, reward, reference), GRPO (no critic, and no reward model with a rule-based reward) and DPO (policy and reference), and the FLOPs and time share of one RL step: rollout generation, scoring, and training.

The accelerator figures (memory and dense BF16 peak, each with its source) are in one table at the bottom of the page.

Limits

Every figure is an estimate. Model state assumes mixed-precision Adam with no extra buffers (real runs add gradient-accumulation and communication buffers: 18–20 B/param). Activations follow Korthikanti et al. (2022) with sequence parallelism and leave out the embedding and output layers. TP and PP divide the parameters evenly; MoE experts are also split by EP, with the expert parallel group carved out of the DP × CP ranks. Communication volumes are ring-algorithm bytes sent per GPU per step; ZeRO-3’s per-micro-batch re-gathers and overlap with compute are not modelled. The pipeline timeline treats every stage as equally fast. RLHF FLOPs use 2·N per token for inference and 6·N for training, and leave out the rollout engine’s own weight copy and KV cache.

Related: AI hardware calculator (training compute and time, LLM memory, roofline), failures, checkpoints and goodput, floating-point inspector (BF16, FP8 and the block-scaled formats).

Sources

Linking to an example

Links can be written by hand. Add the tab after #: plan, pipeline, mfu, ckpt or rlhf. Parameters you leave out take their defaults. Numbers may be written 4e6, 4000000 or 4,000,000. In a URL + means a space, so write a plus sign as %2B (D=4e%2B6); a 4e+6 typed straight into the address bar also works, because the tool reads 4e 6 back as 4e6.

Parameter Meaning Example

model

Planner model: 70b, llama2-7b, llama3-8b, llama3-70b, gpt3-175b, llama31-405b, megatron-1t, mixtral-8x7b, deepseek-v3 or custom

model=llama31-405b

p, L, h, a, kv

Custom model: parameters (billions), layers, hidden size, attention heads, KV heads

model=custom&p=7.5&L=32&h=4096&a=32

gpu

h100, h200, b200, a100, a100_40, mi300x, tpuv4

gpu=b200

sl, b, gb

Sequence length, micro-batch and global batch (sequences)

sl=8192&gb=2048

dp, tp, pp, cp, ep

Parallel degrees

tp=8&pp=16&dp=128

zero

0, 1, 2, 3 (also fsdp = 3, ddp = 0)

zero=3

rc

Activations: none, sqrt, sel (selective) or full

rc=full

fa

FlashAttention (1, the default, or 0)

fa=0

pipe, v

Planner schedule 1f1b, gpipe or int (interleaved), and chunks per GPU

pipe=int&v=2

node, nvl, net

GPUs per NVLink domain; NVLink and scale-out GB/s per GPU

node=72

stages, mb, sched, bf

Pipeline tab: stages, micro-batches, 1f1b or gpipe, backward ÷ forward time

stages=4&mb=8

mode

MFU tab: step, tps (tokens/s) or pf (reported PFLOP/s)

mode=pf

N, D, t

Parameters (billions), tokens in the step, step seconds

N=70&D=4e6&t=7

tps, pf

Tokens per second, or achieved petaFLOP/s

pf=502

chip, peak, gpus

Accelerator, dense peak TFLOPS per chip, number of chips

peak=989&gpus=512

attn, layers, hidden, seq

Count attention FLOPs (1): layers, heads × head dim, sequence

attn=1&layers=118

extra

Recomputed FLOPs %, for HFU

extra=33.3

n, k, label

Checkpointing tab: layers, checkpoint every k, labels out (layer outputs) or in (layer inputs)

n=9&k=3

step

Start the walk-through at this step

step=12

alg

RLHF: ppo, grpo or dpo

alg=grpo

pol, rmsz, rule

Policy and reward-model sizes (billions); rule=1 for a rule-based reward

pol=70&rule=1

prompts, G, lp, lc, epochs

Prompts per step, samples per prompt, prompt and completion tokens, epochs

G=16&lc=4096

de, tm

Decode and training MFU %

de=5

example

One of the presets below; parameters given with it override the preset’s

example=p04-mfu-worked

Presets:

example= Shows

p17-70b-state

70B × 16 bytes = 1.12 TB of training state on one GPU (open)

p17-zero-stages

70B over 64 data-parallel GPUs with ZeRO-3 / FSDP; the table shows ZeRO-1 ≈ 4×, ZeRO-2 ≈ 8×, ZeRO-3 = 64× at 1.5× the traffic (open)

p17-zero-paper

The ZeRO paper’s 7.5B on 64 GPUs: 120 → 31.4 / 16.6 / 1.9 GB (open)

p03-4d-llama3

Llama 3 405B: TP 8 × PP 16 × DP 128 = 16,384 GPUs (open)

p03-long-context-cp

The same at 128K context with CP 16 (open)

p17-megatron-1t

Megatron-LM’s 1T model: TP 8 × PP 64 × DP 6 on 3,072 A100s (open)

p03-moe-ep

DeepSeek-V3 with EP 64: expert all-to-all (open)

p17-bubble

4 stages, 8 micro-batches, 1F1B: bubble 3/11 = 27% (open)

p17-bubble-gpipe

The same with GPipe: same bubble, 8 micro-batches of activations per stage (open)

p17-bubble-many

8 stages, 64 micro-batches: bubble ≈ 10% (open)

p04-mfu-worked

6 · 70e9 · 4e6 ÷ (989e12 · 512 · 7 s) = 47.4% (open)

p17-megatron-mfu

502 PFLOP/s ÷ (3,072 × 312 TFLOPS) = 52% (open)

p04-palm-hfu

PaLM 540B: 46.2% MFU (45.7% without attention FLOPs), 57.8% HFU (open)

p17-ckpt-9

The book’s 9-layer network checkpointed every 3 layers (open)

p17-ckpt-9-inputs

The same, labelled by layer inputs (open)

p17-ckpt-sqrt

100 layers every √100 = 10: 20 tensors held instead of 101, +33% compute (open)

p17-ppo-memory

PPO: four resident 70B networks, 36 bytes per policy parameter (open)

p17-grpo-memory

GRPO: 3 networks instead of 4, ≈44% fewer bytes (open)

p17-grpo-rule

GRPO with a rule-based reward, as DeepSeek-R1 (open)

p17-dpo

DPO: policy + reference, no rollout (open)

p17-rollout-bill

Long reasoning rollouts: a fifth of the FLOPs, over 70% of the time (open)

Sharing

Share link copies a URL that opens this tool with your current settings, written as the parameters above. Opening a link replaces your saved settings for this tool (Restore my settings undoes it).

Runs entirely in your browser; nothing you type leaves this page.