LLM VRAM, KV Cache & Quantization Calculator
Size GPU memory for Llama 3, Qwen, DeepSeek-R1/V3, and custom transformers across FP16, FP8, INT4 AWQ/GPTQ, and GGUF (Q4_K_M, Q5_K_M, Q8_0) — including KV cache scaling, hardware fit, and decode speed.
Best 4-bit production GPU serving
FP8 KV cache halves KV VRAM on Hopper/Ada GPUs with near-zero accuracy loss.
Estimated Total GPU Memory Required
57.3 GB VRAM
GPU & Hardware Fit Matrix
| Hardware | Cards Needed | Headroom | Est. 1-User Speed | Est. Batched $/1M tok |
|---|---|---|---|---|
RTX 4090 Consumer GPU | 3× (72 GB) | +14.7 GB | ~49 tok/s | ~$1.71 |
RTX 5090 Consumer GPU | 2× (64 GB) | +6.7 GB | ~59 tok/s | ~$1.79 |
NVIDIA L40S Cloud Serving | 2× (96 GB) | +38.7 GB | ~28 tok/s | ~$4.89 |
A100 80GB SXM Cloud Serving | 1× (80 GB) | +22.7 GB | ~33 tok/s | ~$3.12 |
H100 80GB SXM Cloud Serving | 1× (80 GB) | +22.7 GB | ~55 tok/s | ~$3.16 |
H200 141GB Cloud Serving | 1× (141 GB) | +83.7 GB | ~79 tok/s | ~$2.99 |
Apple Silicon (64 GB) Local Unified (~75% usable) | 2× (96 GB) | +38.7 GB | ~13 tok/s | Local ($0 cloud) |
Apple Silicon (128 GB) Local Unified (~75% usable) | 1× (96 GB) | +38.7 GB | ~9 tok/s | Local ($0 cloud) |
Speed & cost are bandwidth-bound decode approximations assuming ~65% effective HBM utilization and typical on-demand cloud GPU rates. Always benchmark your exact serving engine (vLLM / SGLang / llama.cpp).
Machine Learning at Scale Newsletter · 13k+ ML Engineers
Get weekly LLM serving & inference teardowns in your inbox
Deep dives on speculative decoding (DSpark), vLLM at LinkedIn, FP8 quantization, and cutting GPU serving bills in production — free on Substack.
Spending $10k+/mo on GPU inference and want an independent architecture audit? Book a 1-week Focused ML Review →
Companion Production Serving Guides
LLM Quantization: GPTQ vs AWQ vs GGUF (INT4 vs INT8)
Full decision guide for choosing FP8, AWQ, GPTQ, or GGUF in production.
LLM Inference Cost Optimization: 6 Levers to Cut GPU Spend
Continuous batching, routing, quantization, prefix caching, and speculative decoding.
GGUF Q4_K_M vs Q5_K_M vs Q8_0 Explained
Exact local RAM math and quality trade-offs for llama.cpp and Ollama.
AWQ vs GPTQ: Which 4-Bit Method Wins on GPUs?
Marlin kernel speed, calibration overfitting, and accuracy benchmarks.
Frequently Asked Questions
How much VRAM do I need to run a 70B LLM?
A 70B model needs ~140 GB for weights in FP16, ~72 GB in FP8/INT8, and ~39–42 GB in 4-bit (AWQ, GPTQ, or GGUF Q4_K_M) before adding KV cache and CUDA runtime overhead. At 4-bit with an 8K context window, it fits comfortably on a single 80 GB A100/H100 or a 64 GB+ Apple Silicon Mac.
How is LLM KV cache memory calculated?
KV cache per token equals 2 (keys and values) × number of layers × KV heads × head dimension × bytes per element (2 bytes for FP16, 1 byte for FP8). Multiply by sequence length and concurrent batch size to get total KV cache VRAM.
Does 4-bit quantization also shrink the KV cache?
No. Weight quantization (AWQ, GPTQ, GGUF Q4_K_M) compresses only the model weights. To shrink the KV cache, enable FP8/INT4 KV cache quantization and PagedAttention in vLLM or SGLang.
What is the best quantization format for local vs. cloud GPU serving?
For production cloud GPU serving (vLLM, SGLang, TensorRT-LLM), start with FP8 on H100/L40S or INT4 AWQ when VRAM-constrained. For local CPUs, Apple Silicon, or single consumer GPUs via llama.cpp/Ollama, use GGUF Q4_K_M or Q5_K_M.