Can I run it? VRAM & KV cache calculator
Quick answer
How much VRAM do I need to run an LLM locally?
Weights + KV cache + runtime overhead must fit in the GPU memory. Weights ≈ parameters × bits per weight ÷ 8 (Q4_K_M is 4.89 bits per weight). The KV cache grows with context: 2 × layers × KV heads × head_dim × context tokens × bytes per value; for Llama 3.3 70B at FP16 that is about 0.33 MB per token, 10.7 GB at 32,768 tokens. The calculator below does this math for 1–8 GPUs, DGX Spark, Mac and Strix Halo, and links the measured builds for each setup.
Last updated:
Will a 2026 model fit on your 1–8 GPUs, a DGX Spark (or two), a Mac or a Strix Halo? Pick the model, engine and format (GGUF, AWQ, GPTQ, FP8, NVFP4, MXFP4, EXL, MLX), context and hardware. We show the weights, the KV cache, the math, and the real measured builds for that setup.
-ctk q8_0 -ctv q8_0 (quantized V needs flash attention); vLLM: --kv-cache-dtype fp8.Model architecture (for KV cache) — from config.json, editable
What are these?From the model's config.json: num_hidden_layers (or the count of full_attention entries in layer_types), num_key_value_heads, head_dim. Sliding-window layers only cache their window.
Show the math (with your numbers)
How to calculate KV cache size
While generating, the model stores a key and a value vector for every token, in every attention layer. That store is the KV cache, and it grows with context:
KV bytes = 2 × layers × KV heads × head_dim × context tokens × concurrent sequences × bytes per value
- 2: one key and one value.
- layers, KV heads, head_dim: from the model's
config.json(num_hidden_layers,num_key_value_heads,head_dim). Grouped-query attention models have far fewer KV heads than attention heads, which is why their cache is small. - bytes per value: FP16/BF16 = 2, FP8 = 1, llama.cpp q8_0 = 1.0625 and q4_0 = 0.5625 (34 and 18 bytes per block of 32, scales included).
Worked example, Llama 3.3 70B (80 layers, 8 KV heads, head_dim 128, FP16): 2 × 80 × 8 × 128 × 2 B = 327,680 bytes per token (≈0.33 MB). At 32,768 tokens that is 10.7 GB, as much as a 16 GB card. At q8_0 it is about half.
Why 2026 models need less: many new models only put full attention on some layers. Sliding-window layers (gpt-oss, Gemma 4, Muse, Step 5) cache just their window (128–2,048 tokens). Linear-attention / Gated DeltaNet layers (Qwen3.5–3.8, Ornith) and Mamba layers (Nemotron) keep a fixed-size state that does not grow. MLA (DeepSeek R1) caches one compressed latent per layer. The calculator reads these per-layer types from each model's config.json and counts only what grows with context.
Engines add some extra for compute buffers, and allocate KV in blocks/pages. vLLM pre-allocates all memory left after weights (up to gpu_memory_utilization, default 0.92) as KV cache, so it will look full however small your context is (vLLM source, FP8 KV cache docs).
Which quant or format should I use?
- Sweet spot: Q4_K_M (GGUF) or AWQ / GPTQ 4-bit (vLLM). This is the size most people run.
- Have room? Q5_K_M or Q6_K, closer to the original.
- Near-lossless: Q8_0 or FP8.
- Below ~4 bits (Q3_K, Q2_K, IQ3, 3-bit EXL) we do not recommend it unless nothing else fits; the calculator warns you. Very large models tolerate it better than small ones.
| Format | Bits / weight | Engines |
|---|---|---|
| Q8_0 (GGUF) | 8.50 | llama.cpp / Ollama / LM Studio |
| Q6_K (GGUF) | 6.56 | llama.cpp / Ollama / LM Studio |
| Q5_K_M (GGUF) | 5.70 | llama.cpp / Ollama / LM Studio |
| Q4_K_M (GGUF) | 4.89 | llama.cpp / Ollama / LM Studio |
| IQ4_XS (GGUF) | 4.46 | llama.cpp / Ollama / LM Studio |
| Q3_K_M (GGUF) | 4.00 | llama.cpp / Ollama / LM Studio |
| Q2_K (GGUF) | 3.16 | llama.cpp / Ollama / LM Studio |
| F16 (GGUF) | 16.00 | llama.cpp / Ollama / LM Studio |
| MXFP4 (gpt-oss native) | 4.25 | llama.cpp / Ollama / LM Studio, vLLM / SGLang |
| BF16 / FP16 (unquantized) | 16.00 | vLLM / SGLang |
| FP8 (W8A8) | 8.00 | vLLM / SGLang |
| AWQ 4-bit (g128, ≈) | 4.25 | vLLM / SGLang |
| GPTQ 4-bit (g128, ≈) | 4.25 | vLLM / SGLang |
| GPTQ 8-bit (g128, ≈) | 8.25 | vLLM / SGLang |
| NVFP4 (Blackwell) | 4.50 | vLLM / SGLang |
| EXL3 (ExLlamaV3) | you choose (2–8) | ExLlamaV2 / V3 |
| EXL2 (ExLlamaV2) | you choose (2–8) | ExLlamaV2 / V3 |
| MLX 4-bit | 4.50 | MLX |
| MLX 8-bit | 8.50 | MLX |
Hardware matters for some formats. FP8 compute needs compute capability ≥ 8.9 (Ada, Hopper, Blackwell); on Ampere cards such as the RTX 3090, vLLM runs FP8 checkpoints as weight-only W8A16 with FP8 Marlin kernels, saving memory but not compute (vLLM FP8 docs). NVFP4 is 4-bit E2M1 values with one FP8 scale per 16 values plus a per-tensor FP32 scale (4.5 bits per weight), about 3.5× smaller than FP16 and 1.8× smaller than FP8, and is computed natively by Blackwell's 5th-gen Tensor Cores (NVIDIA). On older NVIDIA GPUs vLLM falls back to weight-only W4A16 via Marlin (vLLM ModelOpt docs). MXFP4 (gpt-oss) shares one power-of-two scale per 32 values, 4.25 bits per weight; gpt-oss keeps attention and embeddings in BF16, so its real files are larger than params × 4.25 ÷ 8.
GGUF bits-per-weight are llama.cpp's measured values (quantize README); real files vary a little by model. AWQ/GPTQ ≈ 4.25 / 8.25 are our approximation (4 or 8 bits plus group-128 scales and zero points); embeddings and lm_head often stay 16-bit, so files run slightly larger. MLX: group size 64 with a 16-bit scale and bias, so 4-bit = 4.5 bpw (MLX docs). vLLM hardware support: vLLM quantization docs.
RAM matters less than you think
Most calculators tell you to buy as much system RAM as VRAM, or more. If the model fits fully in VRAM, you don't need that. System RAM then only holds the OS and the inference engine, and the weights pass through it once while loading. llama.cpp memory-maps the model file, so pages are read from disk and copied to the GPUs. They don't all have to sit in RAM at once, so RAM can be smaller than the model.
RAM becomes important only when you offload: layers or MoE experts that don't fit on the GPUs run from system RAM, and then both its size and its bandwidth (channels, DDR4 vs DDR5) set your speed.
Maintainer note: our maintainer runs 8× RTX 3090 with just 32 GB of DDR5 ECC RDIMM at home (for a measured 8x 3090 example from another builder, see 8x RTX 3090 serving DeepSeek V4 Flash (LimeChain vLLM kit)), and it works really well, because the models live in the 192 GB of VRAM. Spend the money on GPUs, not RAM, unless you plan to offload.
Caveat: converting or quantizing a model yourself, and some loaders, can need much more RAM for a short time. Keep swap enabled if you do that.
Multi-GPU and multi-node: tensor vs pipeline parallel
Memory adds up: 4× RTX 3090 = 96 GB, 8× = 192 GB, two DGX Sparks = 256 GB. Each GPU loses roughly 1 GB to its CUDA context and buffers (our assumption), and vLLM only uses 0.92 of each GPU by default.
- Pipeline / layer split (llama.cpp default, vLLM
--pipeline-parallel-size, ExLlama): each GPU holds a block of layers. Any number of GPUs, different sizes allowed, little PCIe traffic. One chat stream uses one GPU at a time, so you get capacity rather than speed. - Tensor parallel (vLLM/SGLang
--tensor-parallel-size, llama.cpp--split-mode row): every layer is split over all GPUs, which work on each token together. It is faster, but needs a lot of interconnect bandwidth, and in vLLM the attention-head count must divide by the TP size, so 2, 4 or 8 GPUs are the usual choice. For 3 or 6 GPUs, combine TP with PP or use PP only (vLLM parallelism docs). - Multi-node: NVIDIA says up to four DGX Spark systems can work together over ConnectX networking (each Spark has 128 GB unified memory, 273 GB/s and a 200 Gb/s ConnectX-7 NIC; NVIDIA). Mac Studios can cluster over Thunderbolt. See the DGX Spark recipes and the measured multi-node builds.
RigBase has 33 measured multi-GPU / multi-node builds; the calculator lists those matching your setup.
Why prefill speed matters for coding assistants
The tokens/sec most benchmarks quote is generation (decode) speed: how fast the answer streams out. Before the first token appears the model must first read the whole prompt. That is prompt processing, or prefill. Chat prompts are short, so prefill hardly matters there. Coding assistants and agents are different. They send the open files, the repo map, tool output and the chat history on every turn, and these prompts easily reach thousands of tokens. On such prompts the wait before the first token (time to first token, TTFT) can take longer than generating the answer.
Prefill is compute-bound, while decode is mostly limited by memory bandwidth. So two rigs with similar generation speed can differ a lot in prefill. Discrete NVIDIA/AMD GPUs usually prefill much faster than unified-memory machines and CPU offload setups. Rough TTFT for a prompt: TTFT ≈ prompt tokens ÷ prefill tok/s (plus model load time; prompt caching in llama.cpp, MLX or vLLM can skip the repeated part).
RigBase now records prefill speed for 168 results on 90 builds, with the prompt length each source measured it at. Where it was measured on 512+ tokens we show an estimated TTFT for an 8k-token prompt, calculated from that measured speed. Across the current data the estimate ranges from Llama 2 7B on Single RTX 4090 (llama.cpp CUDA scoreboard): 14,771 tok/s prefill measured @ 512 tokens → ≈0.55 s to Llama 3.1 405B on Mac Studio M3 Ultra 512GB (Geerling test): 12.92 tok/s prefill measured @ 4,096 tokens → ≈634 s. Prefill usually slows down as prompts get longer, so an estimate taken from a much shorter or much longer prompt is only indicative. Where a source measured TTFT itself, we show it separately as measured. See the "Prompt processing" column on every build and model page.
Referral link: if you sign up with Google and add $10, Runpod gives you and RigBase bonus credit (terms). It never affects our data.
Weights size by quant (GB)
gpt-oss ships natively in MXFP4; OpenAI's card says gpt-oss-120b runs on a single 80 GB GPU and gpt-oss-20b within 16 GB of memory.
FAQ
Can I run gpt-oss 120B on 4x RTX 3090?
Yes, by our estimate: gpt-oss 120B in its native MXFP4 checkpoint (65 GB) needs about 65.0 GB for the weights plus 4.8 GB of KV cache at 128k context, 69.8 GB in total, against about 92.0 GB usable on 4× RTX 3090 (96 GB, minus ~1 GB overhead per card). This is arithmetic, not a measurement; check the measured builds linked on the page. gpt-oss uses sliding-window attention on half its layers, which keeps the KV cache small.
Can I run Qwen3 32B on one RTX 3090 at 32k context?
Not fully, by our estimate: Qwen3 32B in Q4_K_M needs about 20.0 GB for the weights plus 8.6 GB of KV cache at 32k context, 28.6 GB in total, against about 23.0 GB usable on one RTX 3090. This is arithmetic, not a measurement; check the measured builds linked on the page. With the KV cache quantized to q4_0 it needs about 22.5 GB, which fits; with FP16 KV the largest context that fits is about 11k tokens.
Can two DGX Sparks run a ~200B model?
Yes, by our estimate: Qwen3.8 Flash-Next in NVFP4 needs about 101.2 GB for the weights plus 3.2 GB of KV cache at 128k context, 104.5 GB in total, against about 238.0 GB usable on 2× DGX Spark (2 × 128 GB, minus ~9 GB per node for OS and runtime). This is arithmetic, not a measurement; check the measured builds linked on the page. NVIDIA says up to four Sparks can be linked over ConnectX-7.
How do I calculate KV cache size?
KV cache bytes = 2 (keys and values) × attention layers × KV heads × head dimension × context tokens × concurrent sequences × bytes per value (FP16 = 2, FP8 = 1, q8_0 ≈ 1.06, q4_0 ≈ 0.56). Read layers, num_key_value_heads and head_dim from the model's config.json. Example: Llama 3.3 70B has 80 layers, 8 KV heads and head_dim 128, so one token costs 2 × 80 × 8 × 128 × 2 B = 327,680 bytes (0.33 MB), and 32k tokens cost 10.7 GB. Sliding-window layers only store their window; linear-attention and Mamba layers keep a fixed-size state.
How much VRAM does an NVFP4 model need?
NVFP4 stores 4-bit values with one FP8 scale per 16 values, about 4.5 bits per weight, so weights take roughly parameters × 0.5625 GB per billion: a 120B model is about 67.5 GB before KV cache. It is about 3.5× smaller than FP16 and 1.8× smaller than FP8 (NVIDIA). It runs natively only on Blackwell GPUs; vLLM falls back to slower weight-only kernels elsewhere.
Which quant should I use?
Q4_K_M (GGUF) or AWQ / GPTQ 4-bit (vLLM) is the usual sweet spot of size and quality. Use Q5_K_M or Q6_K if you have the room, and Q8_0 or FP8 when you want near-lossless output. We do not recommend going below about 4 bits per weight (Q3, Q2) unless nothing else fits, because quality drops faster there.
Does system RAM matter for running local LLMs?
Only if the model does not fit in VRAM. When weights and KV cache sit fully on the GPUs, system RAM just holds the OS and the inference engine and loads the weights once; llama.cpp memory-maps the file, so RAM can be smaller than the model. RAM size and speed matter when you offload layers or MoE experts to the CPU.
Tensor parallel or pipeline parallel?
Tensor parallel (vLLM -tp) splits every layer across GPUs so they work on each token together: faster, but it needs the head count to divide by the GPU count (2, 4, 8 are usual) and good interconnect. Pipeline / layer split (llama.cpp default, vLLM -pp) gives each GPU a block of layers: any GPU count works and it needs little bandwidth, but one stream uses one GPU at a time.
Architecture values come from each model's Hugging Face config.json (linked in the calculator). Everything marked estimate is arithmetic, not a benchmark. Spotted a wrong value? Tell us.