LLM VRAM Calculator

Estimate the GPU memory an open-weight model needs for serving or fine-tuning, see where the memory goes, and find which GPUs it fits on.

tokens

Prompt + generated tokens per sequence

Users served at once, each with a full KV cache

Estimated GPU memory
17.9 GB
for serving
KV cache per token
128 KB
1.00 GB at 8,192 tokens × 1
Parameters
8.03B
dense
Where the memory goes
Model weights
15.0 GB
KV cache
1.00 GB
Activations
0.13 GB
Framework overhead
1.80 GB
12 rows
Which GPUs fit this configuration
RTX 4060 Ti 16GBConsumer / workstation16 GB No256%
RTX 4080 / 5080Consumer / workstation16 GB No256%
RTX 3090 / 4090Consumer / workstation24 GB Yes175%
RTX 5090Consumer / workstation32 GB Yes156%
RTX PRO 6000Consumer / workstation96 GB Yes119%
NVIDIA L4 / A10GDatacenter24 GB Yes175%
NVIDIA L40SDatacenter48 GB Yes137%
NVIDIA A100 40GBDatacenter40 GB Yes145%
NVIDIA A100 / H100 80GBDatacenter80 GB Yes122%
NVIDIA H200Datacenter141 GB Yes113%
NVIDIA B200Datacenter180 GB Yes110%
AMD MI300XDatacenter192 GB Yes19%

Estimates. Real usage depends on the runtime (vLLM pre-allocates most free memory for KV cache, llama.cpp and Ollama allocate for the configured context), CUDA graphs, and multi-GPU communication buffers. Multi-GPU counts assume tensor or pipeline parallelism and ~5% headroom per card.

How LLM GPU memory is calculated

GPU memory for running a model breaks down into four parts:

  • Weights: parameters × bits per weight ÷ 8. An 8B model is about 15 GB in BF16, 7.5 GB in FP8, and 4.6 GB in GGUF Q4_K_M (≈4.89 effective bits, including quantization scales). This tool reports binary gigabytes (GiB), which is what nvidia-smi shows.
  • KV cache: 2 × layers × KV heads × head_dim × bytes × context × concurrent sequences. Grouped-query attention (fewer KV heads than attention heads) is why modern models have much smaller KV caches than older ones.
  • Activations: small for inference. For training they scale with batch × sequence length × hidden size × layers, which gradient checkpointing reduces.
  • Overhead: CUDA context, allocator fragmentation, and framework buffers, usually 1–2 GB plus a few percent.

Choosing a quantization

Q8_0 and FP8 are nearly lossless for most models. Q5_K_M and Q4_K_M are the usual choices for local inference, cutting memory by about 3× compared with BF16 with a small quality loss. Below 4 bits (Q3, Q2), quality drops noticeably, especially for smaller models. For serving on GPUs, AWQ, GPTQ, and FP8 work well with vLLM and TensorRT-LLM. See our quantization guide for details.

Serving many users: the KV cache is the real limit

For a production agent or chat app, the weights are a fixed cost but the KV cache grows with every concurrent conversation. Serving 32 users at 8K context on Llama 3.1 8B needs 32 GB of KV cache in FP16, twice the size of the weights. Inference engines like vLLM use paged attention and prefix caching to share memory between requests, and FP8 KV cache halves it again.

Frequently asked questions

How much VRAM do I need to run a 7B or 8B model?

In FP16/BF16 the weights alone are about 15 GB, so you need a 24 GB GPU once you add KV cache and overhead. At 4-bit (Q4_K_M or AWQ) the weights drop to about 4.5–5 GB, which runs comfortably on 8–12 GB cards at moderate context lengths.

How much VRAM does a 70B model need?

About 131 GB for BF16 weights (two 80 GB GPUs), about 66 GB at FP8/INT8, and about 40 GB at Q4_K_M. That fits on a single 48 GB card or two 24 GB consumer GPUs, with a modest context length.

What is the KV cache and why does it grow with context?

During generation, the model stores a key and a value vector for every token, in every layer, so it doesn't recompute attention over earlier tokens. Its size is 2 × layers × KV heads × head dimension × bytes per value for each token, multiplied by context length and by the number of concurrent sequences. For long contexts or many users it can exceed the size of the weights.

Do mixture-of-experts (MoE) models need less VRAM?

Not for storage. All experts must stay in memory, so a 109B-parameter MoE needs memory for 109B parameters even though only about 17B are active per token. MoE mainly cuts compute per token, which makes it faster, not smaller.

How much memory does fine-tuning need?

Full fine-tuning with Adam in mixed precision needs about 16 bytes per parameter (weights, gradients, FP32 master weights, and two optimizer moments) plus activations: roughly 120+ GB for an 8B model. LoRA freezes the base model and trains small adapters, and QLoRA loads the base in 4-bit, so an 8B model can be fine-tuned on a single 24 GB GPU.

Related reading

More AI builder tools

  • LLM Token Counter — Count tokens for GPT, Claude, and Gemini, check context-window fit, and see what the prompt costs.
  • LLM API Cost Calculator — Compare per-request and monthly API costs across OpenAI, Anthropic, and Google models, with prompt caching.
  • AI Agent Cost Calculator — Model the real cost of agent loops: growing context, tool results, prompt caching, retries, and sub-agents.