Navigation
๐Ÿ‹๏ธ Training Systemsยท 8 min read

The Memory Wall

Why a 70B model in BF16 needs ~140 GB before gradients or optimizer states โ€” and what this means for infrastructure decisions.

memory-wallmodel-sizegpu-memoryscalinginfrastructure

The memory wall is a hard physical constraint: as models scale, memory requirements grow faster than GPU memory capacity. This chapter quantifies the wall for every model size and shows exactly where infrastructure decisions are forced.


1. The Wall in Numbers

Weights Only (Inference Baseline)

Mweights=ฮจร—bytes_per_paramM_{\text{weights}} = \Psi \times \text{bytes\_per\_param}
ModelBF16 (2B)INT8 (1B)INT4 (0.5B)Fits on 1ร— 80 GB GPU?
1.5B3 GB1.5 GB0.75 GBโœ… (any precision)
7B14 GB7 GB3.5 GBโœ… (any precision)
13B26 GB13 GB6.5 GBโœ… (any precision)
70B140 GB70 GB35 GBโŒ BF16, โœ… INT8, โœ… INT4
405B810 GB405 GB202 GBโŒ โŒ โŒ
671B (MoE, all experts)1,342 GB671 GB336 GBโŒ โŒ โŒ

Training (Full State)

Training multiplies the problem by 8-16ร—:

ModelWeights (BF16)Full training (16ฮจ)Min GPUs (80 GB, FSDP)
1.5B3 GB24 GB1 (barely)
7B14 GB112 GB2
13B26 GB208 GB3
70B140 GB1,120 GB14
405B810 GB6,480 GB81

2. The Three Memory Walls

Wall 1: Single-GPU Capacity

When: Weight memory (BF16) exceeds GPU memory. Where: ~40B parameters on 80 GB GPU, ~13B on 24 GB consumer GPU. Force: Must use TP (split model across GPUs) or PP (split layers across GPUs).

Wall 2: Single-Node Capacity

When: Weight memory exceeds total node memory (8 ร— 80 GB = 640 GB). Where: ~320B parameters in BF16. Force: Must use multi-node training with InfiniBand. Cannot use NVLink-only strategies.

Wall 3: Cluster Memory

When: Total training state exceeds cluster memory. Where: Trillion-parameter models on small clusters. Force: Must use aggressive optimization: FSDP + activation checkpointing + CPU offloading.


3. How Model Scaling Hits the Walls

Modern LLMs follow scaling laws that increase all dimensions:

GenerationParametersHidden dimLayersWall hit
GPT-2 (2019)1.5B160048None โ€” fits on one V100
GPT-3 (2020)175B1228896Wall 2 โ€” multi-node required
LLaMA-2 (2023)70B819280Wall 1 (BF16), borderline Wall 2
LLaMA-3.1 (2024)405B16384126Wall 2 โ€” ~81 GPUs minimum
DeepSeek-V3 (2024)671B MoE716861Wall 2 โ€” but MoE reduces active params

MoE Softens the Wall

MoE models have many total parameters but only activate a subset per token:

ModelTotal paramsActive params/tokenTraining memory (active)
LLaMA-70B (dense)70B70B1,120 GB
Mixtral 8ร—7B (MoE)47B13B752 GB total, but experts are distributed
DeepSeek-V3 (MoE)671B37BShared params (11B) + 4 experts per GPU

With EP, each GPU only holds a subset of experts โ€” the memory wall is determined by per-GPU parameters, not total parameters.


4. Memory Wall vs GPU Evolution

Are GPUs growing fast enough to keep up?

GPUYearMemoryModel that fits (BF16 inference)Model that fits (training, FSDPร—8)
V100201732 GB16B10B
A100202080 GB40B25B
H100202280 GB40B25B
H2002024141 GB70B44B
B2002024192 GB96B60B
GB200 NVL72 (aggregate)202413.8 TBEffectively unlimited (single domain)500B+ in one NVLink domain

Memory per GPU grows ~2ร— per generation (every 2-3 years). But models grow 10-100ร— per generation. The gap widens โ€” distributed training is permanently necessary.

The GB200 NVL72โ€™s 13.8 TB NVLink domain fundamentally changes this โ€” for the first time, a 500B model can train within a single NVLink domain without InfiniBand. See NVLink & NVSwitch.


5. Practical Decision Points

Use this table to quickly determine your infrastructure needs:

Model sizeTraining approachMin hardware
โ‰ค1.5BSingle GPU, no sharding1ร— 24 GB GPU
3-7BFSDP across 2-8 GPUs1 node (8ร— 80 GB)
7-13BFSDP, activation checkpointing1-2 nodes
13-70BTP=8 + FSDP, checkpointing2-8 nodes
70-405BTP=8 + PP + FSDP16-64 nodes
>405BTP=8 + PP + EP + FSDP100+ nodes

For the complete decision algorithm, see Parallelism Planning Decision Process.


Self-Check

  • Calculate weights-only and training memory for a 13B model
  • Identify which memory wall (1, 2, or 3) a 175B model hits
  • Explain how MoE reduces the effective memory wall
  • Compare GPU memory growth rate vs model size growth rate
  • Determine minimum hardware for training a 70B model

References