LLM VRAM calculator: model weights, KV cache, and GPU tier sizing
Choose an open-weight model preset (architectures verified from official model specifications and Hugging Face config.json files) or enter custom parameters, quantization, context length, and batch concurrency to estimate total VRAM in GiB and GPU requirements.
- Total VRAM
- 6.53 GiB
- GPU tier
- 1 x 8 GB GPU
- Weights
- 4.53 GiB
- KV cache
- 1.00 GiB
- Runtime
- 1.00 GiB
Example: RTX 4060
Custom KV cache uses an estimated GQA-8 architecture with 32 layers, 8 KV heads and a head dimension of 128.
VRAM by weight quantization
Each row keeps the selected model, context, batch size, KV cache precision and inference engine.
| Quant | Bits/weight | Weights | Total VRAM | GPU tier |
|---|---|---|---|---|
| FP16 | 16 | 14.96 GiB | 16.96 GiB | 1 x 24 GB GPU |
| Q8_0 | 8.5 | 7.95 GiB | 9.95 GiB | 1 x 12 GB GPU |
| FP8 | 8 | 7.48 GiB | 9.48 GiB | 1 x 12 GB GPU |
| Q6_K | 6.56 | 6.13 GiB | 8.13 GiB | 1 x 12 GB GPU |
| Q5_K_M | 5.7 | 5.33 GiB | 7.33 GiB | 1 x 8 GB GPU |
| Q4_K_M | 4.85 | 4.53 GiB | 6.53 GiB | 1 x 8 GB GPU |
| IQ3_XS | 3.3 | 3.08 GiB | 5.08 GiB | 1 x 8 GB GPU |
VPS plans for AI agents that call hosted APIs
These plans provide 4 to 16 GB of system RAM for agent processes and API calls. Best VPS for AI agents
For a model with a memory estimate of up to 12 GiB, llama.cpp can use CPU offload and system RAM for low-throughput personal testing.
| Provider and plan | Specs | Ongoing cost | Provider link |
|---|---|---|---|
| RackNerdBlack Friday 4 GB KVM VPS | 4 GB4 vCPU | $4.00/mo | Visit |
| AlphaVPSCheap C4G | 4 GB2 vCPU | $4.39/mo | Visit |
| LuxvpsKVM Rootserver Tiny | 4 GB1 vCPU | $4.95/mo | Visit |
| VPSDimeLinux 4GB | 4 GB2 vCPU | $5.00/mo | Visit |
| OVHcloudVPS-1 | 4 GB2 vCPU | $5.35/mo | Visit |
| AlphaVPSCheap C6G | 6 GB3 vCPU | $5.48/mo | Visit |
How is total LLM VRAM calculated from model weights and KV cache?
Total LLM VRAM equals model weight memory plus key-value (KV) attention cache memory plus inference engine CUDA and activation overhead, all measured in binary GiB (1,024^3 bytes, matching nvidia-smi GPU reporting).
Weight memory scales directly with parameter count and effective bits per weight (for example, FP16 uses 16 bits, Q8_0 uses ~8.5 bits with quantization scales, and Q4_K_M averages ~4.85 bits). KV cache memory uses the exact Grouped Query Attention (GQA) formula: 2 × layers × kv_heads × head_dim × context_length × batch_size × kv_bytes / 1,024^3, which is why modern GQA models such as Llama 3.1 and Qwen 2.5 hold far larger contexts in VRAM than legacy Multi-Head Attention architectures.
How much VRAM do Q4_K_M, Q8_0, and FP16 save on 8B to 70B models?
Moving from FP16 to Q4_K_M cuts model weight VRAM by roughly 70%, letting an 8B model fit comfortably inside an 8 GB GPU and a 70B model fit inside a single 48 GB GPU or dual 24 GB GPUs at moderate context lengths.
However, weight quantization alone does not shrink an FP16 KV cache: at 32K to 128K context or multi-user concurrency, switching llama.cpp KV cache precision from FP16 to Q8_0 (34/32 bytes per element including FP16 block scales) or Q4_0 (18/32 bytes per element) cuts cache VRAM by roughly 47% to 72%, while vLLM FP8 KV cache cuts it by 50%. When a chosen context length exceeds a model's native max_position_embeddings (such as 32,768 tokens on Qwen 2.5), the calculator flags that RoPE or YaRN scaling is required.
When do you need a GPU server vs a standard CPU VPS for AI workloads?
Rent a GPU server when running local open-weight LLM inference for interactive tokens per second; rent a standard 4 GB+ CPU VPS when running AI agents, MCP tools, or RAG pipelines that call external LLM APIs.
CPU-only RAM offloading via llama.cpp can run small quantized models (such as 7B to 8B Q4_K_M) for low-throughput personal scripts on a high-RAM CPU VPS, but never confuses system RAM with GPU VRAM bandwidth. If your stack orchestrates hosted OpenAI, Anthropic, or Gemini APIs around the clock, open our Best VPS for AI Agents guide to filter cost-effective 4 GB+ CPU VPS plans.