LLM Inference VRAM & Hardware Fit Calculator
Calculate exact GiB VRAM needed for LLM inference across model weights, GQA KV cache, batch concurrency, and CUDA runtime overhead.
Input Parameters
Calculated Output
Primary Result
—
Adjust inputs to recalculate immediately.
Need 48GB–80GB VRAM Without Buying Hardware?
Compare live hourly rates for L40S, A100 80GB, and H100 GPUs before committing.
Explore RunPod GPU Pricing ↗Common GPU VRAM Fit Reference (Single-Stream Inference)
Approximate VRAM footprint using GiB (1024^3 bytes) matching nvidia-smi.
| Model Tier | Q4_K_M (8K Ctx) | Q6_K (8K Ctx) | FP8 (32K Ctx) | Recommended Hardware |
|---|---|---|---|---|
| 8B (32L, 8 KV heads) | 6.6 GiB | 8.3 GiB | 10.9 GiB | 12GB RTX 3060 / 4070 |
| 14B (40L, 8 KV heads) | 10.6 GiB | 13.7 GiB | 18.1 GiB | 16GB 4060 Ti / 24GB 3090 |
| 32B (64L, 8 KV heads) | 22.3 GiB | 29.9 GiB | 40.6 GiB | 24GB 3090/4090 (Q4) or 48GB L40S |
| 70B (80L, 8 KV heads) | 46.7 GiB | 63.4 GiB | 86.8 GiB | 2x 24GB 3090 (Q4) or A100 80GB |
Formula & Engineering Methodology
Total VRAM separates static parameter storage from dynamic KV cache allocation and CUDA runtime overhead. Calculations divide by 1,073,741,824 bytes (1 GiB) so values match nvidia-smi rather than storage-vendor base-10 GB.
weights_gib = (params_b * 1e9 * quant_bpw / 8) / 1073741824
kv_gib = (2 * layers * kv_heads * head_dim * context_len * batch_size * kv_bytes) / 1073741824
overhead_gib = (weights_gib + kv_gib) * (overhead_pct / 100) + 0.5
total_vram_gib = weights_gib + kv_gib + overhead_gib
Variable Definitions
params_b: Model parameter count in billions (e.g., 8, 32, 70).quant_bpw: Effective bits per weight including quantization block scale headers.2 * layers * kv_heads * head_dim: Key + Value tensor elements per token under Grouped-Query Attention (GQA).0.5 GiB: Fixed baseline CUDA context and cuBLAS kernel workspace overhead.
Practical Note: FlashAttention and PagedAttention keep activation spikes modest, but setting batch_size > 8 or enabling multimodal vision encoders can add 1.5–4 GiB.
Frequently Asked Questions
Why does an 8B Q4_K_M model require more than 4.85 GB of VRAM?
On top of ~4.5 GiB of quantized weights, the GPU must store the FP16 KV cache (~1.0 GiB at 8K context), CUDA runtime buffers (~0.5 GiB), and intermediate compute scratchpad memory.
Why does this calculator report GiB instead of decimal GB?
Tools like nvidia-smi and PyTorch report binary gibibytes (1024^3 bytes). A 24 GB RTX 3090/4090 actually provides ~24.0 GiB minus ~0.5–1.0 GiB consumed if it drives your desktop display.
How much VRAM does Grouped-Query Attention (GQA) save?
With 32 query heads and 8 KV heads, GQA shrinks KV cache memory by 4x compared to legacy Multi-Head Attention while preserving long-context quality.