Arrakis / Guides / GPU memory
How much GPU memory does your model need?
Count bytes per parameter. Serving needs 2 bytes per parameter in 16-bit, 1 in 8-bit and half a byte in 4-bit, plus about 20% for the KV cache and activations. Fine-tuning needs far more: about 16 bytes per parameter with Adam, unless LoRA or QLoRA freezes the base model.
Serving a model
Memory to run a model for inference, with the smallest GPU setup that holds it and the lowest price on Arrakis right now.
| Model size | 16-bit | 8-bit | 4-bit |
|---|---|---|---|
| 8BLlama 3.1 8B | 19 GB: one RTX 4090 or RTX 3090 | 9.6 GB: one RTX 4090 or RTX 3090 | 4.8 GB: one RTX 4090 or RTX 3090 |
| 14BQwen2.5 14B | 34 GB: one L40S, RTX 6000 Ada or RTX A6000 | 17 GB: one RTX 4090 or RTX 3090 | 8.4 GB: one RTX 4090 or RTX 3090 |
| 32BQwen2.5 32B | 77 GB: one H100 or A100 | 38 GB: one L40S, RTX 6000 Ada or RTX A6000 | 19 GB: one RTX 4090 or RTX 3090 |
| 70BLlama 3.3 70B | 168 GB: one B200 | 84 GB: one RTX PRO 6000 | 42 GB: one L40S, RTX 6000 Ada or RTX A6000 |
| 405BLlama 3.1 405B | 972 GB: 8 × H200 | 486 GB: 4 × H200 | 243 GB: one B300 |
Fine-tuning a model
QLoRA trains adapters on a 4-bit frozen model, LoRA on a 16-bit one, and full fine-tuning updates every weight. Figures are before activations, which grow with batch size and sequence length.
| Model size | QLoRA | LoRA | Full fine-tuning |
|---|---|---|---|
| 8BLlama 3.1 8B | 5.6 GB: one RTX 4090 or RTX 3090 | 19 GB: one RTX 4090 or RTX 3090 | 128 GB: one H200 |
| 14BQwen2.5 14B | 9.8 GB: one RTX 4090 or RTX 3090 | 34 GB: one L40S, RTX 6000 Ada or RTX A6000 | 224 GB: one B300 |
| 32BQwen2.5 32B | 22 GB: one RTX 4090 or RTX 3090 | 77 GB: one H100 or A100 | 512 GB: 4 × H200 |
| 70BLlama 3.3 70B | 49 GB: one H100 or A100 | 168 GB: one B200 | 1,120 GB: 8 × H200 |
| 405BLlama 3.1 405B | 284 GB: one B300 | 972 GB: 8 × H200 | 6,480 GB: more than one 8-GPU machine |
The rules behind the numbers
Rules of thumb, close enough to choose a GPU. Measure before a long run.
- Weights
- Parameters times bytes per parameter: 2 in 16-bit (BF16 or FP16), 1 in 8-bit (FP8 or INT8), 0.5 in 4-bit.
- Serving headroom
- About 20% more for the KV cache and activations at moderate context and batch. Long contexts and large batches need more.
- Full fine-tuning
- About 16 bytes per parameter with mixed-precision Adam: weights, gradients, optimizer states and a 32-bit master copy (ZeRO, arXiv:1910.02054). Split it across GPUs with FSDP or ZeRO.
- LoRA
- The 16-bit base model stays frozen; small adapters train. Plan for the weights plus about 20%.
- QLoRA
- The frozen base model is stored in 4-bit. Its authors fine-tuned a 65B model on one 48 GB GPU (QLoRA, arXiv:2305.14314), about 0.7 bytes per parameter.
- GPU memory
- From NVIDIA's pages for each GPU, linked from its page here.
Questions
Live prices for every GPU are on the GPU prices page.