Local Inference & VRAM

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

Billion (B)
Total parameter count (e.g., 8B, 32B, 70B).
tokens
streams
layers
heads
dim
%
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 TierQ4_K_M (8K Ctx)Q6_K (8K Ctx)FP8 (32K Ctx)Recommended Hardware
8B (32L, 8 KV heads)6.6 GiB8.3 GiB10.9 GiB12GB RTX 3060 / 4070
14B (40L, 8 KV heads)10.6 GiB13.7 GiB18.1 GiB16GB 4060 Ti / 24GB 3090
32B (64L, 8 KV heads)22.3 GiB29.9 GiB40.6 GiB24GB 3090/4090 (Q4) or 48GB L40S
70B (80L, 8 KV heads)46.7 GiB63.4 GiB86.8 GiB2x 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

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.

Related Engineering Calculators

ComputeSizer runs 100% locally in your browser with open formulas and zero account gates. If these VRAM and GPU cost tools saved your team money, support us via Fourthwall or sponsor an ad-free developer placement.