Skip to content
,

How Many GPUs to Train an LLM? Formula, Worked Examples and Real Model Data

A practical answer to how many GPUs you need to train a large language model. Two simple formulas (one for time, one for memory), worked examples from 1B to 405B parameters on H100 and B200, real GPU counts and GPU-hours from Llama 3 and DeepSeek-V3, fine-tuning requirements, cost estimates and the factors that change the answer.

4 min read

How Many GPUs to Train an LLM? — how many gpus to train an llm

Short answer

How many GPUs to train an LLM depends on two limits. The compute limit: training needs about 6 × parameters × tokens FLOPs, so GPUs = total FLOPs ÷ (GPU speed × utilisation × time available). The memory limit: full training with Adam needs about 16 bytes per parameter plus activations. Assuming H100s at 40% utilisation, a 1B model on 20B tokens needs about 83 GPU-hours (one GPU for 3.5 days); a 7B model on 1 trillion tokens needs about 29,000 GPU-hours (about 41 H100s for 30 days); and a 70B model on 15 trillion tokens needs about 4.4 million GPU-hours (about 2,000 H100s for 90 days). For reference, Meta trained Llama 3.1 405B on 16,384 H100s using about 30.8 million GPU-hours, and DeepSeek-V3 used 2,048 H800s and 2.79 million GPU-hours.

Formula 1: compute (time)

Total FLOPs ≈ 6 × N × D
GPU-hours   = Total FLOPs ÷ (peak FLOP/s × MFU × 3,600)
GPUs needed = GPU-hours ÷ hours available
  • N = parameters, D = training tokens
  • Peak FLOP/s = dense BF16 throughput (H100: 989 TFLOPS; B200: ~2,250 TFLOPS)
  • MFU (model FLOPs utilisation) = realistic share of peak, typically 30–50%; see MFU explained

With H100 at 40% MFU, each GPU delivers about 4 × 1014 useful FLOP/s, or 1.44 × 1018 FLOPs per GPU-hour.

Formula 2: memory (minimum GPUs)

ItemBytes per parameter (mixed precision with Adam)
BF16 weights2
BF16 gradients2
FP32 master weights4
Adam first and second moments (FP32)8
Total~16
Minimum GPUs (memory) ≈ (16 × N) ÷ GPU memory  (with sharding such as FSDP/ZeRO)

Activations add more, depending on sequence length and batch size; activation checkpointing reduces them. A 7B model needs about 112 GB for model states alone, so at least two 80 GB GPUs with sharding, and in practice 4–8. See distributed training parallelism.

Final answer = the larger of the compute and memory requirements.

Worked examples (H100, 40% MFU)

ModelTokensTraining FLOPsH100 GPU-hoursGPUs for 7 daysGPUs for 30 daysGPUs for 90 daysMin. GPUs (memory)
124M10B7.4 × 1018~51111
1B20B1.2 × 1020~831111
1B1T6.0 × 1021~4,200~25~6~21
7B1T4.2 × 1022~29,000~174~41~14~2–8
7B15T6.3 × 1023~438,000~2,600~610~200~2–8
70B2T8.4 × 1023~583,000~3,500~810~270~16–32
70B15T6.3 × 1024~4.4 million~26,000~6,100~2,000~16–32
405B15.6T3.8 × 1025~26 million—~37,000~12,200~100+

Using B200s instead: at the same 40% MFU, each B200 delivers about 2.3× the BF16 throughput of an H100, so divide GPU counts by roughly 2.3 (more with FP8 training). See NVIDIA B200 specs.

Real-world training runs

ModelGPUsGPU-hoursNotes
Llama 3.1 8BH100s~1.46 million~15T tokens; far beyond compute-optimal
Llama 3.1 70BH100s~7.0 million
Llama 3.1 405B16,384 H100s~30.8 million~3.8 × 1025 FLOPs; ~38–43% MFU reported
DeepSeek-V3 (671B MoE, 37B active)2,048 H800s~2.79 million~$5.6 million at $2/GPU-hour; final run only
GPT-2 124M reproduction (llm.c)8 A100s~12 (about 90 minutes)~$20 in 2024

Our formula predicts about 26 million H100-hours for Llama 3.1 405B; Meta reported 30.8 million, which includes real-world inefficiencies such as failures and restarts. Meta also reported 419 unexpected interruptions in a 54-day period on its 16,384-GPU cluster, a reminder that reliability matters at scale. See how long do GPUs last?

How many GPUs for fine-tuning?

TaskModelGPUs needed (typical)
QLoRA7–8B1 × 16–24 GB GPU
QLoRA70B1 × 48–80 GB GPU
LoRA (16-bit)7–8B1 × 24 GB GPU
LoRA (16-bit)70B2–4 × 80 GB GPUs
Full fine-tuning7–8B2–8 × 80 GB GPUs
Full fine-tuning70B16–32 × 80 GB GPUs

See What is LoRA? and What is fine-tuning?

Cost estimates

At the December 1, 2026 median H100 rental price of $3.92/hour (lowest $1.80) from our GPU price report:

ModelH100 GPU-hoursCost at $3.92/hrCost at $1.80/hr
1B on 20B tokens~83~$330~$150
7B on 1T tokens~29,000~$114,000~$52,500
70B on 15T tokens~4.4 million~$17 million~$7.9 million

Large training runs usually use reserved capacity at lower negotiated rates. Use our training cost calculator and see LLM training cost.

What changes the answer

FactorEffect
MFU (software efficiency)50% instead of 30% MFU needs 40% fewer GPUs
PrecisionFP8 training on Hopper/Blackwell can nearly double throughput
GPU generationB200 ≈ 2.3× H100 (BF16); see Hopper vs Blackwell
InterconnectSlow networking lowers MFU at scale; see InfiniBand vs Ethernet and NVLink
Sequence lengthLonger contexts add attention compute and activation memory
Mixture of expertsCompute scales with active parameters (6 × active N × D) but memory with total parameters
Failures and restartsAdd 10–20%+ to real GPU-hours at large scale
ExperimentsAblations and failed runs often exceed the final run's cost

Frequently asked questions

How many GPUs did it take to train GPT-4?

OpenAI has not disclosed it. Estimates suggest tens of thousands of A100-class GPUs over several months, but these are unconfirmed.

Can I train an LLM on one GPU?

Yes, small models: a 124M–350M model trains on one modern GPU in hours to days, and a 1B model on tens of billions of tokens in days.

How many GPUs do I need to train a 7B model?

For 1 trillion tokens in about a month, roughly 40 H100s; for 15 trillion tokens in a month, roughly 600. You need at least 2–8 GPUs just to fit the training state.

What is the 6ND formula?

An approximation of training compute: 6 FLOPs per parameter per token (2 for the forward pass, 4 for the backward pass).

Sources and further reading

Think you understand it now? Prove it.

Solve real Tensor Core math in the TensorCore.si Challenge and earn a certificate with your name.

Take the challenge

Leave a Reply

Your email address will not be published. Required fields are marked *