Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
FREE TOOL · llama.cpp · GGUF

Local LLM VRAM & Quantization Calculator

Bottom line

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.

Updated: Open WebUI · ComfyUI · llama.cpp
Total VRAM
23.4 GiB
■ Model weights18.5 GiB
■ KV cache4 GiB
■ Overhead0.9 GiB

Recommended hardware

RTX 3060 12GB
≈11.2 GiB usable
Doesn’t fit
RTX 4090 24GB
≈23 GiB usable
Doesn’t fit
RTX 5090 32GB
≈30.8 GiB usable
Fits
2× RTX 3090 48GB
≈45.6 GiB usable
Fits
Mac M4 Max 64GB
≈48 GiB usable
Fits
Mac M4 Max 128GB
≈96 GiB usable
Fits

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
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-gateway

Local LLM GPU VRAM Requirements 2026–2027

ModelQuantizationVRAM neededRTX 4090 24GBRTX 5090 32GBApple M4 Max 128GBA100 / H100 80GB
8BLlama-3.1-8B-InstructQ4_K_M4-bit · best size/quality balance6.3 GiBFitsFitsFitsFits
8BLlama-3.1-8B-InstructQ8_08-bit · near-lossless, ≈ FP89.7 GiBFitsFitsFitsFits
32BQwen3-32BQ4_K_M4-bit · best size/quality balance21.4 GiBTightFitsFitsFits
32BQwen3-32BQ8_08-bit · near-lossless, ≈ FP835.4 GiBDoesn’t fitDoesn’t fitFitsFits
70BLlama-3.3-70B-InstructQ4_K_M4-bit · best size/quality balance43.4 GiBDoesn’t fitDoesn’t fitFitsFits
70BLlama-3.3-70B-InstructQ8_08-bit · near-lossless, ≈ FP873.4 GiBDoesn’t fitDoesn’t fitFitsTight
671B MoEDeepSeek-V3.1 / R1Q4_K_M4-bit · best size/quality balance381.1 GiBDoesn’t fitDoesn’t fitDoesn’t fitDoesn’t fit≥ 5× 80GB
671B MoEDeepSeek-V3.1 / R1Q8_08-bit · near-lossless, ≈ FP8666.2 GiBDoesn’t fitDoesn’t fitDoesn’t fitDoesn’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 sizeQ4_K_MQ8_0FP16
7B
Qwen2.5-7B-Instruct
5.5 GiB8.8 GiB15.4 GiB
14B
Qwen3-14B
10.5 GiB16.7 GiB29.7 GiB
32B
Qwen3-32B
21.4 GiB35.4 GiB64 GiB
70B
Llama-3.3-70B-Instruct
43.4 GiB73.4 GiB135.1 GiB
120B MoE
gpt-oss-120b
67.6 GiB117.2 GiB219.2 GiB
405B
Llama-3.1-405B-Instruct
234.5 GiB407 GiB761.4 GiB
671B MoE
DeepSeek-V3.1 / R1
381.1 GiB666.2 GiB1,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.

Free · Daily AI brief

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.