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

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 GB
■ Model weights18.5 GB
■ KV cache4 GB
■ Overhead0.9 GB

Recommended hardware

RTX 3060 12GB
≈11.2 GB usable
Doesn’t fit
RTX 4090 24GB
≈23 GB usable
Doesn’t fit
RTX 5090 32GB
≈30.8 GB usable
Fits
2× RTX 3090 48GB
≈45.6 GB usable
Fits
Mac M4 Max 64GB
≈48 GB usable
Fits
Mac M4 Max 128GB
≈96 GB 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

VRAM needed by popular models (8K context, 1 request, f16 KV)

Model sizeQ4_K_MQ8_0FP16
7B
Qwen2.5-7B-Instruct
5.5 GB8.8 GB15.4 GB
14B
Qwen3-14B
10.5 GB16.7 GB29.7 GB
32B
Qwen3-32B
21.4 GB35.4 GB64 GB
70B
Llama-3.3-70B-Instruct
43.4 GB73.4 GB135.1 GB
120B MoE
gpt-oss-120b
67.6 GB117.2 GB219.2 GB
405B
Llama-3.1-405B-Instruct
234.5 GB407 GB761.4 GB
671B MoE
DeepSeek-V3.1 / R1
381.1 GB666.2 GB1,252.1 GB

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.