Local LLM VRAM & Quantization Calculator
A 24 GB RTX 4090 runs 8B models with room to spare (6.3 GiB at Q4_K_M) and a 32B model only just (21.4 GiB); a 32 GB RTX 5090 gives 32B comfortable headroom. A 70B model needs 43.4 GiB at Q4_K_M — an Apple M4 Max 128GB or one A100/H100 80GB. DeepSeek-class 671B MoE needs 381.1 GiB: at least 5 cards of 80 GB or CPU-RAM offload. Figures assume an 8K context, one request and GGUF weights.
Pick a model size, GGUF quantization, context length and parallel requests — the calculator splits VRAM into weights, KV cache and overhead, recommends real GPUs (RTX 3060 to Mac M4 Max 128 GB) and builds a ready-to-copy llama-server command for Open WebUI.
23.4 GiB
Recommended hardware
≈11.2 GiB usableDoesn’t fit
≈23 GiB usableDoesn’t fit
≈30.8 GiB usableFits
≈45.6 GiB usableFits
≈48 GiB usableFits
≈96 GiB usableFits
Doesn’t fit? Lower -ngl to keep some layers in RAM (slower), choose a smaller quant or context, or switch the KV cache to q8_0. Mac: by default the GPU can use about 75% of unified memory; the rest stays with the system.
llama-server command
llama-server -hf unsloth/Qwen3-32B-GGUF:Q4_K_M \
--ctx-size 16384 --parallel 1 \
--n-gpu-layers 99 \
--jinja --host 127.0.0.1 --port 8080
# Open WebUI → Admin Settings → Connections → OpenAI API:
# http://host.docker.internal:8080/v1
# Linux Docker Engine: --host 0.0.0.0 --api-key <KEY> + extra_hosts host-gatewayLocal LLM GPU VRAM Requirements 2026–2027
| Model | Quantization | VRAM needed | RTX 4090 24GB | RTX 5090 32GB | Apple M4 Max 128GB | A100 / H100 80GB |
|---|---|---|---|---|---|---|
| 8BLlama-3.1-8B-Instruct | Q4_K_M4-bit · best size/quality balance | 6.3 GiB | Fits | Fits | Fits | Fits |
| 8BLlama-3.1-8B-Instruct | Q8_08-bit · near-lossless, ≈ FP8 | 9.7 GiB | Fits | Fits | Fits | Fits |
| 32BQwen3-32B | Q4_K_M4-bit · best size/quality balance | 21.4 GiB | Tight | Fits | Fits | Fits |
| 32BQwen3-32B | Q8_08-bit · near-lossless, ≈ FP8 | 35.4 GiB | Doesn’t fit | Doesn’t fit | Fits | Fits |
| 70BLlama-3.3-70B-Instruct | Q4_K_M4-bit · best size/quality balance | 43.4 GiB | Doesn’t fit | Doesn’t fit | Fits | Fits |
| 70BLlama-3.3-70B-Instruct | Q8_08-bit · near-lossless, ≈ FP8 | 73.4 GiB | Doesn’t fit | Doesn’t fit | Fits | Tight |
| 671B MoEDeepSeek-V3.1 / R1 | Q4_K_M4-bit · best size/quality balance | 381.1 GiB | Doesn’t fit | Doesn’t fit | Doesn’t fit | Doesn’t fit≥ 5× 80GB |
| 671B MoEDeepSeek-V3.1 / R1 | Q8_08-bit · near-lossless, ≈ FP8 | 666.2 GiB | Doesn’t fit | Doesn’t fit | Doesn’t fit | Doesn’t fit≥ 9× 80GB |
VRAM = GGUF weights + KV cache + runtime overhead at an 8K context, one request and an f16 KV cache, computed with the same formulas as the calculator above (accuracy ±10%). “Fits” leaves at least 8% headroom; “Tight” is within the card’s usable memory. Usable memory: RTX 4090 — 23 GiB, RTX 5090 — 30.8 GiB, Apple M4 Max 128GB — 96 GiB (default GPU share of unified memory), A100 / H100 — 78.5 GiB. FP8 (8-bit) formats need roughly the same memory as Q8_0. “≥ N× 80GB” is the minimum number of 80 GB cards for a multi-GPU split.
VRAM needed by popular models (8K context, 1 request, f16 KV)
| Model size | Q4_K_M | Q8_0 | FP16 |
|---|---|---|---|
| 7B Qwen2.5-7B-Instruct | 5.5 GiB | 8.8 GiB | 15.4 GiB |
| 14B Qwen3-14B | 10.5 GiB | 16.7 GiB | 29.7 GiB |
| 32B Qwen3-32B | 21.4 GiB | 35.4 GiB | 64 GiB |
| 70B Llama-3.3-70B-Instruct | 43.4 GiB | 73.4 GiB | 135.1 GiB |
| 120B MoE gpt-oss-120b | 67.6 GiB | 117.2 GiB | 219.2 GiB |
| 405B Llama-3.1-405B-Instruct | 234.5 GiB | 407 GiB | 761.4 GiB |
| 671B MoE DeepSeek-V3.1 / R1 | 381.1 GiB | 666.2 GiB | 1,252.1 GiB |
Weights = parameters × bits per weight / 8 (effective GGUF bpw). KV cache = 2 × layers × KV heads × head dim × bytes × context × parallel requests (compressed MLA cache for DeepSeek). Overhead is an estimate: ≈0.5 GB runtime + compute buffers. Accuracy ±10%; totals in GiB, as reported by nvidia-smi and llama.cpp.
Frequently asked questions
How does the calculator estimate VRAM?
It adds three parts: weights (parameters × effective GGUF bits per weight / 8), KV cache (2 × layers × KV heads × head dim × bytes per element × context × parallel requests) and runtime plus compute-buffer overhead. Architecture constants come from real model configs — Qwen2.5/Qwen3, Llama 3.x, gpt-oss and DeepSeek-V3.
Which quantization should I choose?
Q4_K_M is the best quality-per-GB trade-off for most work; Q5_K_M and Q6_K stay noticeably closer to the original; Q8_0 is near-lossless; IQ3_XS is for squeezing a model that otherwise would not fit, at a quality cost. FP16 is mainly for reference runs and fine-tuning.
What if the model does not fit?
In order of speed: switch the KV cache to q8_0, shorten the context or parallel requests, use a lower quant, keep MoE expert layers in system RAM with --n-cpu-moe, or lower -ngl so some layers run on the CPU. On a Mac, about 75% of unified memory is available to the GPU by default.
Why does context length matter so much?
The KV cache grows linearly with context and parallel requests: Qwen3-32B needs 256 KiB per token in f16, i.e. 8 GiB for 32K tokens. Quantizing the KV cache to q8_0 roughly halves that part with minimal quality loss.
The AI brief engineers actually read
The day’s most important AI stories — models, tools, prices and agents — in five minutes. Free, unsubscribe in one click.