Memory is the binding constraint for almost every LLM deployment decision. The calculation is simple, but you have to track all the pieces.
Total memory ≈ params × bytes_per_param + KV_cache + activation buffer + framework overhead
| Format | Bytes / param | 7B model weights | 70B model weights |
|---|---|---|---|
| FP32 | 4 | 28 GB | 280 GB |
| FP16 / BF16 | 2 | 14 GB | 140 GB |
| INT8 / Q8 | 1 | 7 GB | 70 GB |
| INT4 / Q4 | 0.5 | 3.5 GB | 35 GB |
This is just the weights. Add:
- KV cache — proportional to context length × n_layers × n_kv_heads × d_head × precision. For Llama 3.3 70B at 128K context FP16: ~32 GB.
- Activations during inference — typically a few GB, much larger during training.
- Framework overhead — CUDA driver, allocator, optimizer state. Often 5-15% of total.
An H100 80 GB can hold a 70B INT4 model (35 GB) with ~32 GB of KV cache room and overhead. FP16 needs at least 2 H100s. This single arithmetic shapes nearly every "should we use model X?" conversation in deployment.