Training a 2.8-Trillion-Parameter Model on 16 GPUs: Memory Limits and a Scaled-Down Experiment Plan
This guide shows how to estimate GPU memory for a 2.8-trillion-parameter model, choose tensor, pipeline, and data parallelism for a two-node, 16-GPU cluster, design small validation runs, and set up checkpoint saving and resume checks.
Large-scale multimodal model training starts with memory. If you cannot account for memory, you cannot tell what your hardware can run. This article uses a 2.8-trillion-parameter model as an example. It covers how to estimate memory, principles for choosing a parallel configuration, a scaled-down experiment plan, and key design points for checkpointing and resuming training.
Units are decimal throughout: 1 TB = 1000 GB, and each GPU is assumed to have 80 GB of memory. If a vendor’s “80 GB” actually means 80 GiB (about 85.9 GB), scale the memory figures below up by roughly 7%.
1. Start with the memory budget: two nodes with 16 GPUs cannot hold full training state
Conclusion: Sixteen GPUs provide about 1.28 TB of total memory (16 × 80 GB). Full training state for a 2.8-trillion-parameter model exceeds this by more than an order of magnitude, so 16 GPUs cannot complete full training.
Let N = 2.8 × 10¹² be the parameter count. The main state in mixed-precision training is:
| State | Calculation | Memory |
|---|---|---|
| Model weights (FP16) | N × 2 bytes | About 5.6 TB |
| Gradients (FP16) | N × 2 bytes | About 5.6 TB |
| Adam momentum and variance (FP32) | N × 8 bytes | About 22.4 TB |
| Total | About 33.6 TB |
Keeping FP32 master weights adds about 11.2 TB, for a total of about 44.8 TB, or 16 bytes per parameter. Activations, communication buffers, and memory fragmentation are not in the table, so actual usage is higher.
FP16 weights alone take 5.6 TB, more than the 1.28 TB total. Even without optimizer state, these 16 GPUs cannot hold one complete copy of the weights.
ZeRO-3 can shard this state across all participating GPUs. With all 16 GPUs participating, each GPU carries an average of 33.6 TB ÷ 16 = 2.1 TB, about 26 times one 80 GB GPU. Sharding spreads the total across GPUs but does not reduce it.
MoE models activate only some experts per step, but every expert’s parameters and optimizer state must be stored. The memory budget therefore still uses the total parameter count. Expert parallelism changes peak memory per GPU and communication overhead, so measure it separately.
Two nodes with 16 GPUs are suitable for validating the sharding logic, testing parallel configurations, running end-to-end training with fewer layers or parameters, and running stability tests for a few hundred steps. Full training needs more GPUs, or it depends on CPU memory and NVMe offload, quantization, or sparsification. Section 6 covers the costs of these options.
2. One-million-token context: control the attention matrix and KV cache
Conclusion: To train with a 1M-token context, avoid writing the full attention matrix to GPU memory, and control activation memory.
Take one attention head as an example. At sequence length 10⁶, the attention score matrix has 10¹² elements, or about 2 TB in FP16. That figure covers one head in one layer, so the computation must be blocked. There are three common methods:
- FlashAttention computes in blocks and performs softmax in on-chip cache. It avoids writing the full matrix back to high-bandwidth memory (HBM). This reduces peak memory and memory access cost, but compute still grows quadratically with sequence length (O(S²)). Long sequences still need sequence or context parallelism.
- Activation recomputation (gradient checkpointing) saves activations for only some layers during the forward pass. The backward pass recomputes the rest. This trades extra compute for memory and increases training time, so measure the cost.
- Sequence and context parallelism splits one long sequence across GPUs. Each GPU processes a segment and exchanges the necessary K and V data through communication.
The KV cache estimate is: 2 × layers × KV heads ×
