LLM VRAM Calculator: Model Weights & KV Cache Sizing
Interactive LLM VRAM Calculator: Model Weights & KV Cache Sizing
?
Parameter count of the model, in billions. The 8B and 70B rows use the Llama 3.1 layer count, KV-head count and head dimension; the 14B and 32B rows use Qwen2.5. The 405B row uses the architecture published in the Llama 3 paper (126 layers, 8 KV heads, head dimension 128); the 123B row is a model estimate whose architecture is not verified. Choose Custom to enter any size in the field below; its layer count comes from the listed size class it falls in, a model estimate. Default: 70.?
Effective bits per weight after quantization. Read it from the model file name or the server's quantization setting. Default: 4.5, a planning value for Q4_K_M. Including the 1.06 allowance for quantization scales, 4.5 bits gives 41.74 GB (38.87 GiB) for a 70B model, against the measured 42.52 GB (39.60 GiB) Llama 3 70B Instruct Q4_K_M GGUF file: about 2 % under. The 4.83 bits-per-weight figure of that file already includes its scales, so do not apply the 1.06 allowance on top of it. The allowance applies below 16 bits only.?
Tokens of context held for each sequence, prompt plus generated output. Set it to the longest sequence your server accepts. Default: 16,384 tokens.?
Sequences served at the same time. Read it from the server's maximum concurrent requests setting. Range: 1 to 64.?
Bytes stored per key and value element in the KV cache. FP16 or BF16 is 2 bytes; vLLM's default (auto) follows the model data type. FP8 is 1 byte and halves the KV term; it is set with vLLM's --kv-cache-dtype fp8 option (the docs list fp8, fp8_e4m3 and fp8_e5m2). Read the current value from your server's launch arguments. KV cache assumed FP16 unless FP8 is selected.?
Model size in billions of parameters, used only when the model above is Custom. Read it from the model name (for example 24 for a 24B model). Range: 0.1 to 2,000.?
Memory of one GPU in GB as advertised (24, 48, 80, 141). The calculator reads it as GiB, the same convention as its GPU tiers. Default: 80, the nominal H100 and A100 size.?
Number of identical GPUs that serve the model. The weights and KV cache are assumed to split evenly across them. Range: 1 to 64.?
Memory kept free on each GPU, in GiB, for the driver, the serving engine and fragmentation. Default: 4, about 5 % of an 80 GB card, a planning value. The result shows whether the total fits after this reserve.Use the LLM VRAM Calculator: Model Weights & KV Cache Sizing to evaluate VRAM_total (GiB) = o · P_B · 10^9 · (b_q / 8) / 2^30 + M_KV + M_act | M_KV = 2 · L · H_kv · d_h · b_kv · C_ctx · N_batch / 2^30 for self-hosted vLLM / TGI / Ollama inference servers, RTX 4090 / L40S / H100 GPU sizing. With the defaults (Model Parameter Count = 70B, Weight Quantization Precision = Q4_K_M 4-bit, Context Window Length = 16,384 Tokens) it returns Quantized model weights memory: 38.87 GiB static weight footprint.
Governing equationVRAM_total (GiB) = o · P_B · 10^9 · (b_q / 8) / 2^30 + M_KV + M_act | M_KV = 2 · L · H_kv · d_h · b_kv · C_ctx · N_batch / 2^30 (published model configuration files (Llama 3.1, Qwen2.5, Llama 3 paper; checked November 2026); 123B is a model estimate)
Model assumptions
Every figure is in GiB (2^30 bytes); the runtime buffer is a model estimate. The factor o is 1.06 for quantization scales below 16 bits and 1.0 at 16 bits. Cards are advertised in GB (24, 48, 80) and read as GiB. A tier fits while the total is at most the card size minus the per-card reserve below (4 GiB by default). KV cache assumed FP16 unless FP8 is selected (vLLM --kv-cache-dtype fp8). A custom size takes the layer count of the listed size class it falls in, a model estimate. The fit assumes an even split across the cards, with no communication buffers. Maximum context ignores the model's trained limit.
Why Model Weights Are Only Part of the GPU Memory Bill
A self-hosted LLM uses GPU memory for three things: the model weights, the KV cache that holds attention keys and values for every token of every active sequence, and runtime buffers. The calculator adds them: VRAM_total = weights + KV cache + activation buffer. Weights are P x 10^9 x (bits / 8) x o bytes divided by 2^30, where o = 1.06 below 16 bits is a declared allowance for quantization scales and o = 1.0 at 16 bits. Every figure is in GiB (2^30 bytes).
The KV cache per token is 2 x n_layers x n_kv_heads x head_dim x bytes. Together AI's KV-cache article gives 327,680 bytes per token for Llama 3.1 70B: 80 layers, 8 KV heads, head dimension 128, two bytes per FP16 value (together.ai/blog/kv-cache). The KV cache precision input sets the bytes per value: 2 for FP16 or BF16, 1 for FP8 (vLLM --kv-cache-dtype fp8, docs.vllm.ai). The Llama 3.1 configuration files on Hugging Face (checked November 2026) give 80 layers for 70B and 32 for 8B, Qwen2.5 gives 48 and 64 for 14B and 32B, and the Llama 3 paper gives 126 for 405B, all with 8 KV heads and head dimension 128. The 123B row and any custom size are model estimates: a custom size takes the layer count of the size class it falls in.
| Model Scale | FP16 (16-bit) | Q8_0 / FP8 (8-bit) | Q4_K_M / AWQ (4.5-bit planning value; ≈4.8 measured) | Recommended GPU (Q4_K_M) |
|---|---|---|---|---|
| 8B Params | 24.4 GiB | 17.4 GiB | 13.9 GiB | 1x RTX 4090 (24 GB) |
| 14B Params | 39.8 GiB | 27.5 GiB | 21.5 GiB | 1x L40S / A6000 (48 GB) |
| 32B Params | 77.9 GiB | 49.9 GiB | 36.1 GiB | 1x L40S / A6000 (48 GB) |
| 70B Params | 154.0 GiB | 92.8 GiB | 62.5 GiB | 1x H100 / A100 (80 GB) |
| 123B Params (model estimate, architecture not verified) | 256.6 GiB | 148.9 GiB | 95.8 GiB | 2x H100 / A100 (160 GB NVLink) |
| 405B Params | 801.2 GiB | 446.7 GiB | 271.8 GiB | 4x H100 / A100 (320 GB NVLink) |
VRAM for Real Open Models: Exact Parameter Counts
The table above uses size classes. Below are 21 widely used open-weight models with their exact parameter count, read from the safetensors metadata of each official Hugging Face repository on December 2, 2026. The VRAM shown is for the weights only (parameters × bits ÷ 8 ÷ 230), using the same bit widths as the calculator. Add the KV cache and runtime buffers from the calculator for your context length and batch size.
| Model | Parameters | Architecture | FP16 / BF16 | Q8_0 / FP8 (8-bit) | Q4_K_M / AWQ (4.5-bit) |
|---|---|---|---|---|---|
| Qwen2.5 7B Instruct | 7.62 B | Dense | 14.2 | 7.1 | 4.0 |
| Llama 3.1 8B Instruct | 8.03 B | Dense | 15.0 | 7.5 | 4.2 |
| Qwen3 8B | 8.19 B | Dense | 15.3 | 7.6 | 4.3 |
| Gemma 3 12B IT | 12.19 B | Dense | 22.7 | 11.4 | 6.4 |
| Phi-4 14B | 14.66 B | Dense | 27.3 | 13.7 | 7.7 |
| Qwen3 14B | 14.77 B | Dense | 27.5 | 13.8 | 7.7 |
| Qwen2.5 14B Instruct | 14.77 B | Dense | 27.5 | 13.8 | 7.7 |
| gpt-oss-20b | 20.91 B | MoE · 3.6B active | 39.0 | 19.5 | 11.0 |
| Mistral Small 3.1 24B | 24.01 B | Dense | 44.7 | 22.4 | 12.6 |
| Gemma 3 27B IT | 27.43 B | Dense | 51.1 | 25.5 | 14.4 |
| Qwen3 30B-A3B | 30.53 B | MoE · 3.3B active | 56.9 | 28.4 | 16.0 |
| Qwen3 32B | 32.76 B | Dense | 61.0 | 30.5 | 17.2 |
| Qwen2.5 32B Instruct | 32.76 B | Dense | 61.0 | 30.5 | 17.2 |
| DeepSeek-R1-Distill-Qwen-32B | 32.76 B | Dense | 61.0 | 30.5 | 17.2 |
| Mixtral 8x7B Instruct | 46.70 B | MoE · 12.9B active | 87.0 | 43.5 | 24.5 |
| Llama 3.3 70B Instruct | 70.55 B | Dense | 131.4 | 65.7 | 37.0 |
| Qwen2.5 72B Instruct | 72.71 B | Dense | 135.4 | 67.7 | 38.1 |
| gpt-oss-120b | 116.83 B | MoE · 5.1B active | 217.6 | 108.8 | 61.2 |
| Qwen3 235B-A22B | 235.09 B | MoE · 22B active | 437.9 | 218.9 | 123.2 |
| Llama 3.1 405B Instruct | 405.85 B | Dense | 756.0 | 378.0 | 212.6 |
| DeepSeek-V3 | 684.49 B | MoE · 37B active | 1,275.0 | 637.5 | 358.6 |
Mixture-of-experts (MoE) models only use part of their weights per token, which makes them fast, but all experts must still be loaded unless you offload some to CPU RAM, so plan VRAM on the total parameter count. Notes: gpt-oss models ship with MXFP4 expert weights (about 4.25 bits), so their published download is close to the 4.5-bit column; the DeepSeek-V3 count includes its multi-token-prediction module; the Gemma 3 and Mistral Small 3.1 counts include their vision encoders; 4.5 bits is a planning value for Q4_K_M, whose measured average is about 4.8 bits.
Download this table: CSV (CC BY 4.0).
How to Evaluate Context, Batch and Precision: How Each Input Moves the Total?
At the default settings (70B, 4.5-bit weights, 16,384 tokens, batch 4), the weights take 38.87 GiB, the KV cache 20.00 GiB and the activation buffer 3.65 GiB, for 62.52 GiB in total; the KV term is 2 x 80 x 8 x 128 x 2 x 16,384 x 4 / 1024^3 = 20.00 GiB. A tier is chosen while the total fits the card size minus the 4 GiB default reserve (24 GB card up to 20 GiB, 48 GB up to 44 GiB), so this total gets one 80 GB card (the nominal H100 and A100 size; the datasheet was not re-checked). Above 76 GiB the tier steps to 2x cards (160 GB with NVLink) up to 152 GiB, 4x (320 GB) up to 304 GiB and 8x (640 GB) up to 608 GiB; beyond that the model does not fit on one 8-GPU node.
The 8B preset (4.5-bit weights, 8,192 tokens, one user) totals 6.92 GiB and fits one 24 GB RTX 4090. The 32B preset (8-bit weights, 32,768 tokens, batch 4) totals 65.91 GiB and needs one 80 GB card. To test your own hardware, enter the VRAM per GPU, the GPU count and a reserve per card: the result gives the spare memory, the longest context at your batch and the most concurrent requests at your context. The 70B default on one 80 GB card with a 4 GiB reserve has 76 GiB usable and 13.48 GiB spare, enough for 27,425 tokens at batch 4 or 6 requests at 16,384 tokens.
| Context Window | Batch Size | Weights (GiB) | KV Cache (GiB) | Total VRAM (GiB) | Hardware Tier |
|---|---|---|---|---|---|
| 4,096 tok | 1x | 38.9 GiB | 1.25 GiB | 43.8 GiB | 1x L40S / A6000 (48 GB) |
| 8,192 tok | 2x | 38.9 GiB | 5.00 GiB | 47.5 GiB | 1x H100 / A100 (80 GB) |
| 16,384 tok | 4x | 38.9 GiB | 20.00 GiB | 62.5 GiB | 1x H100 / A100 (80 GB) |
| 32,768 tok | 4x | 38.9 GiB | 40.00 GiB | 82.5 GiB | 2x H100 / A100 (160 GB NVLink) |
| 65,536 tok | 8x | 38.9 GiB | 160.00 GiB | 202.5 GiB | 4x H100 / A100 (320 GB NVLink) |
| 131,072 tok | 8x | 38.9 GiB | 320.00 GiB | 362.5 GiB | 8x H100 / A100 (640 GB NVLink) |
Worked Examples: Two Presets Calculated with VRAM_total (GiB) = o · P_B · 10^9 · (b_q / 8) / 2^30 + M_KV + M_act | M_KV = 2 · L · H_kv · d_h · b_kv · C_ctx · N_batch / 2^30
Worked Example 1 (8B 4-bit RAG at 8k, one user): This preset sets Model Parameter Count = 8B, Weight Quantization Precision = Q4_K_M 4-bit, Context Window Length = 8,192 Tokens, Concurrent Batch Size = 1 Requests. Evaluating VRAM_total (GiB) = o · P_B · 10^9 · (b_q / 8) / 2^30 + M_KV + M_act | M_KV = 2 · L · H_kv · d_h · b_kv · C_ctx · N_batch / 2^30 gives: weights = 4.44 GiB, KV cache = 1.0 GiB, CUDA buffer = 1.48 GiB, total VRAM = 6.92 GiB, recommended GPU = 1x RTX 4090 (24 GB). Related in the Cloud, API, LLM & Automation Hub: LLM API Token Cost & Prompt Caching Calculator and Vector Database HNSW Index RAM & Disk Calculator.
Worked Example 2 (32B FP8 document Q&A at 32k, batch 4): This preset sets Model Parameter Count = 32B, Weight Quantization Precision = FP8 / Q8_0 Quantized, Context Window Length = 32,768 Tokens, Concurrent Batch Size = 4 Requests. The calculator returns: weights = 31.59 GiB, KV cache = 32.0 GiB, CUDA buffer = 2.32 GiB, total VRAM = 65.91 GiB, recommended GPU = 1x H100 / A100 (80 GB). You can compare these limits with other calculators in the Engineering Studio.
How to Evaluate Choosing a GPU Tier for Production Serving?
The activation buffer is a declared heuristic (1.2 GiB plus 0.035 GiB per billion parameters), not a measured value. Serving engines also reserve memory by a utilization fraction: the vLLM documentation gives the gpu_memory_utilization default as 0.92 (docs.vllm.ai, checked November 2026). Keep headroom above the calculator's total.
Sources
- Together AI · KV cache blogKV cache bytes per token = 2 × layers × KV heads × head dimension × bytes per element. Llama 3.1 70B: 80 layers, 8 KV heads, 327,680 bytes per token (0.3125 MiB). Basis of the KV term.
- Hugging Face · Llama 3.1 70B config (NousResearch mirror)num_hidden_layers 80, num_attention_heads 64, num_key_value_heads 8, hidden_size 8192, bfloat16. Basis of the 70B layer and KV-head values.
- Hugging Face · Llama 3.1 8B config (NousResearch mirror)num_hidden_layers 32, num_attention_heads 32, num_key_value_heads 8, hidden_size 4096, so head dimension 128. Basis of the 8B layer and KV-head values (checked November 2026).
- Hugging Face · Qwen2.5 14B confignum_hidden_layers 48, num_attention_heads 40, num_key_value_heads 8, hidden_size 5120, so head dimension 128. Basis of the 14B layer and KV-head values (checked November 2026). Phi-4 uses 40 layers and 10 KV heads, so it is not this row.
- Hugging Face · Qwen2.5 32B confignum_hidden_layers 64, num_attention_heads 40, num_key_value_heads 8, hidden_size 5120, so head dimension 128. Basis of the 32B layer and KV-head values (checked November 2026). The Mistral Large 2 configuration is in a gated repository (HTTP 401), so the 123B row remains a model estimate.
- arXiv · The Llama 3 Herd of Models (key hyperparameters table)405B: 126 layers, 128 attention heads, 8 key/value heads, model dimension 16,384, so head dimension 128. Basis of the 405B layer and KV-head values (checked November 2026).
- vLLM · Engine argumentsgpu_memory_utilization is the fraction of GPU memory used by the model executor (default 0.92, or 1.0 with the extensible KV cache). --kv-cache-dtype accepts auto (the default, which uses the model data type), float16, bfloat16, fp8, fp8_e4m3, fp8_e5m2 and others. Basis of the FP8 KV cache option at 1 byte per value, against 2 bytes for FP16 or BF16. Basis of the serving-headroom note.
- Hugging Face · bartowski Meta-Llama-3-70B-Instruct-GGUFThe Q4_K_M file weighs 42.52 GB (39.60 GiB), about 4.83 bits per weight, and that figure already includes the quantization scales. With the 1.06 allowance, 4.5 bits gives 41.74 GB (38.87 GiB) for 70B: about 2 % under the measured file.
- llama.cpp · quantize READMEBits per weight of the llama.cpp formats: Q8_0 is 8.5008 and Q4_K_M is 4.8944. Basis of keeping the 1.06 allowance below 16 bits (Q8_0 is 1.0625 times its nominal 8 bits) and of dropping it at 16 bits, where weights are two bytes per parameter.
Method and test suite: Calculation Methodology.
Frequently Asked Questions: LLM VRAM Calculator: Model Weights & KV Cache Sizing
Why does the 70B default need an 80 GB card rather than a 48 GB card?
The default total of 62.52 GiB is above the 44 GiB the 48 GB card offers (48 minus the 4 GiB reserve), so one 80 GB card applies.
Does quantization change the KV cache?
Weight precision changes only the weights line. The KV cache precision input switches it from FP16 to FP8, which halves it: 20.00 to 10.00 GiB at the 70B default.
Why is 4.5 bits used for 4-bit quantization?
The calculator uses 4.5 bits as a planning value for Q4_K_M-style formats. With the 1.06 allowance it gives 41.74 GB (38.87 GiB) against the measured 42.52 GB (39.60 GiB) Llama 3 70B Instruct Q4_K_M file (bartowski GGUF, checked November 2026), about 2 % under. That file's 4.83 bits per weight already include quantization scales, so do not add the 1.06 allowance to it.
How does context length change memory?
The KV term grows linearly with context and batch. At 70B with 16,384 tokens and batch 4 it is 20.00 GiB.