How much VRAM do you need to run an LLM?
We may earn commissions when you shop through the links below. Learn more
How model size, precision, quantization, context length and batch size drive GPU memory — with worked estimates.
On this page
Summary
For inference, the memory you need is roughly the weights plus the KV cache plus runtime overhead. Weights take the parameter count times the bytes per parameter: about 2 GB per billion parameters at BF16, 1 GB at FP8 and roughly 0.5 GB at 4-bit. The KV cache grows with every token held in memory, across all concurrent requests, and at the long contexts agents need it rivals the weights. Serving frameworks do not hand the whole card to the model, so leave headroom before you pick a GPU. Without a GPU, the same arithmetic applies to system RAM, at lower speed.
- Weights = parameters × bytes per parameter (2 at BF16, 1 at FP8, about 0.5 at 4-bit).
- KV cache per token = 2 × layers × KV heads × head size × bytes; multiply by tokens held at once.
- Estimates differ mostly in the context length they assume; check it before comparing two numbers.
- Mixture-of-experts models must load every expert, even though few are active per token.
- Full fine-tuning with Adam needs about 16 bytes per parameter before activations; adapters need far less.
1. The three parts of GPU memory
Serving a language model uses GPU memory for three things: the weights, the KV cache that holds the attention keys and values of every token in flight, and working memory for activations, the CUDA context and the serving framework itself.
VRAM needed ≈ weights + KV cache + runtime overhead
The first two follow from the model card and your settings. The third depends on the runtime, and it is why a card is never fully available to the model. vLLM, for example, lets the model executor use a fixed fraction of GPU memory, set by --gpu-memory-utilization, which defaults to 0.92 in the current documentation [1], and by default it captures CUDA graphs, which “take up extra memory in the GPU” [2].
2. Weights: parameters × precision
Weights need one value per parameter. Multiply the parameter count by the bytes per value: a billion parameters at BF16 take about 2 GB.
Memory per billion parameters by precision
| Precision | Bytes per parameter | GB per billion parameters |
|---|---|---|
| FP32 | 4 | 4.0 |
| BF16 / FP16 | 2 | 2.0 |
| FP8 / INT8 | 1 | 1.0 |
| 4-bit (INT4, NF4, MXFP4) | 0.5 | 0.5 |
Qwen3-8B has 8.2 billion parameters [3], so its weights take about 16.4 GB at BF16, 8.2 GB at FP8 and roughly 4.1 GB at 4-bit. Quantised formats store scales next to the values, so real 4-bit files are slightly larger than half a byte per parameter.
Mixture-of-experts models load every expert
A mixture-of-experts model uses only some parameters per token, but all of them must be in memory. Qwen3-30B-A3B has 30.5 billion parameters in total and 3.3 billion activated [4]: it computes like a small model but needs about 61.0 GB for BF16 weights. The format matters as much as the count: OpenAI’s gpt-oss-120b has 117 billion parameters, and because its expert weights ship in MXFP4 it runs on a single 80 GB GPU, while gpt-oss-20b runs within 16 GB [5].
Lower precision is not free
In vLLM’s words, quantised models “take less memory at the cost of lower precision” [2]. Check the model provider’s evaluations at the precision you plan to run, or run your own on your prompts.
3. KV cache: context length × concurrent requests
For every token the model is working on, each layer keeps a key vector and a value vector per KV head. The PagedAttention paper gives the example of OPT-13B, where one token takes 800 KB: 2 (key and value) × 5,120 (hidden size) × 40 (layers) × 2 bytes [6].
bytes per token = 2 × layers × KV heads × head size × bytes per value
Newer models use grouped-query attention, with fewer KV heads than query heads, which shrinks the cache. Qwen3-8B has 32 query heads but 8 KV heads [3]. With the layer count and head size from each model’s configuration file, the cache at BF16 comes out as follows:
KV cache at BF16 by number of tokens held in memory
| Model | Layers × KV heads × head size | Per token | 8K tokens | 32K tokens | 128K tokens |
|---|---|---|---|---|---|
| Qwen3-8B [7] | 36 × 8 × 128 | 147,456 bytes | 1.2 GB | 4.8 GB | 19.3 GB |
| Qwen3-30B-A3B [8] | 48 × 4 × 128 | 98,304 bytes | 0.8 GB | 3.2 GB | 12.9 GB |
| Qwen2.5-72B-Instruct [9] | 80 × 8 × 128 | 327,680 bytes | 2.7 GB | 10.7 GB | 42.9 GB |
The token count that matters is everything held at once: context length × concurrent requests. Ten chats with 8K tokens each need the same cache as one chat with 80K tokens. That is why a model that “fits” in a quick test can run out of memory under load.
Two settings bring the cache down. vLLM notes that storing the KV cache in FP8 “can significantly reduce its memory footprint”, so more tokens fit in the same memory [11], and capping context length (max_model_len) and batch size (max_num_seqs) limits how much cache can be requested [2].
4. Worked estimates for three open models
Adding weights and a 32,768-token KV cache at BF16 gives the memory to plan for before runtime overhead:
Weights plus a 32,768-token BF16 KV cache, in GB
| Model | BF16 weights | FP8 weights | 4-bit weights |
|---|---|---|---|
| Qwen3-8B | 21.2 | 13.0 | 8.9 |
| Qwen3-30B-A3B | 64.2 | 33.7 | 18.5 |
| Qwen2.5-72B-Instruct | 156.1 | 83.4 | 47.1 |
- Qwen3-8B needs about 21.2 GB at BF16: tight on a 24 GB card once overhead is added, comfortable on 48 GB, and about 13.0 GB with FP8 weights.
- Qwen3-30B-A3B computes like a 3B model but needs about 64.2 GB at BF16, because every expert stays loaded.
- Qwen2.5-72B-Instruct needs about 156.1 GB at BF16, more than two 80 GB GPUs leave for vLLM at its default setting (147.2 GB). With FP8 weights (83.4 GB) it fits on one 141 GB H200 or across two 80 GB GPUs. At 4-bit it fits a 48 GB card only with a shorter budget: about 39.0 GB with 8K tokens.
Why estimates for the same model differ
Memory calculators rarely disagree about the weights. They disagree about the context they assume, whether they count the KV cache at all, and how much of the card they treat as usable. The same model and precision give very different answers:
Qwen3-8B at BF16 under four common assumptions, in GB
| Assumption | Estimate |
|---|---|
| Weights plus a flat 20% margin | 19.7 |
| Weights plus a 32,768-token KV cache | 21.2 |
| The same, divided by a usable share of 0.92 | 23.1 |
| Weights plus a 131,072-token KV cache | 35.7 |
Before you compare two estimates, check the context length and the number of concurrent requests behind each. To run the arithmetic for your own model, precision and context, use the VRAM / model fit tool.
5. Long contexts: sizing for a 64K-token agent
Agents need long contexts, and the KV cache grows with every token. Hermes Agent, for example, requires a model with at least 64,000 tokens of context and asks you to set a local model to 64K, for instance --ctx-size 65536 in llama.cpp [12]. Ollama uses a context window of 4,096 tokens unless you raise it with OLLAMA_CONTEXT_LENGTH or num_ctx [13], so the default is far below what such an agent needs.
At 65,536 tokens, Qwen3-8B needs about 26.1 GB with BF16 weights and cache, more than a 24 GB card holds. With FP8 weights and an FP8 KV cache it comes to about 13.0 GB. The model supports 32,768 tokens natively, so a 64K window also means enabling YaRN scaling as its model card describes [3].
Concurrency multiplies the cache again: in Ollama, the memory a model needs scales with the number of parallel requests times the context length [13]. Size for the number of conversations the agent runs at once, not for one.
6. When one GPU is not enough
vLLM’s own guidance for choosing a layout is short:
- If the model fits on a single GPU, run it on that GPU; distributed inference is probably unnecessary.
- If it is too large for one GPU but fits on one node with several GPUs, use tensor parallelism.
- If it is too large for one node, combine tensor parallelism with pipeline parallelism [14].
Tensor parallelism splits the model across GPUs (tensor_parallel_size) [2], and those GPUs then exchange data on every layer. That is where the interconnect in the GPU cloud checklist matters: GPUs linked by NVLink handle it far better than cards that only talk over PCIe.
Before adding GPUs, try the cheaper levers: quantise the weights, store the KV cache in FP8, and cap the context length and concurrency to what your application needs.
7. Fine-tuning needs a different budget
Training keeps far more than the weights. The ZeRO paper breaks down mixed-precision training with the Adam optimiser: 2 bytes per parameter for FP16 weights, 2 for gradients and 12 for the FP32 copy of the weights, momentum and variance, 16 bytes in total. A 1.5-billion-parameter GPT-2 therefore needs at least 24 GB, against 3 GB for its FP16 weights alone [15]. By the same arithmetic, fully fine-tuning Qwen3-8B needs about 131.2 GB for model states before any activations, which means several GPUs and a sharded optimiser.
Adapters change the budget
Low-rank adapters train a small number of extra weights instead. Compared with GPT-3 175B fine-tuned with Adam, the LoRA authors report 10,000 times fewer trainable parameters and a 3 times smaller GPU memory requirement [16]. QLoRA combines a 4-bit base model with adapters and made it possible to fine-tune a 65B model on a single 48 GB GPU [17].
8. Match the estimate to a GPU
With an estimate in hand, pick the smallest memory tier that leaves headroom for overhead and traffic peaks. The table lists every GPU in our catalog that has a verified price today:
GPUs with a verified price, by memory
| GPU | Memory | Bandwidth | Providers | Lowest on-demand, per hr | Lowest serverless, per hr |
|---|---|---|---|---|---|
| T4 | 16 GB GDDR6 | 0.32 TB/s | 1 | Not listed | $0.59≈ €0.527 (estimated conversion from $0.59) |
| V100 | 16 GB HBM2 | 0.90 TB/s | 2 | $0.79≈ €0.706 (estimated conversion from $0.79) | Not listed |
| A10 | 24 GB GDDR6 | 0.60 TB/s | 3 | $0.867≈ €0.774 (estimated conversion from $0.867) | $1.03≈ €0.917 (estimated conversion from $1.03) |
| L4 | 24 GB GDDR6 | 0.30 TB/s | 3 | $0.855≈ €0.764 (estimated conversion from $0.855) | $0.80≈ €0.715 (estimated conversion from $0.80) |
| A100 | 40 GB HBM2 | 1.55 TB/s | 2 | $1.99≈ €1.78 (estimated conversion from $1.99) | $2.10≈ €1.88 (estimated conversion from $2.10) |
| L40 | 48 GB GDDR6 | 0.86 TB/s | 1 | $1.00≈ €0.893 (estimated conversion from $1.00) | Not listed |
| L40S | 48 GB GDDR6 | 0.86 TB/s | 5 | $1.55≈ €1.38 (estimated conversion from $1.55) | $1.77≈ €1.58 (estimated conversion from $1.77) |
| RTX 6000 Ada Generation | 48 GB GDDR6 | 0.96 TB/s | 1 | $1.57≈ €1.40 (estimated conversion from $1.57) | Not listed |
| RTX A6000 | 48 GB GDDR6 | 0.77 TB/s | 2 | $0.50≈ €0.447 (estimated conversion from $0.50) | Not listed |
| A100 PCIe | 80 GB HBM2e | 1.94 TB/s | 1 | $1.35≈ €1.21 (estimated conversion from $1.35) | Not listed |
| A100 SXM4 | 80 GB HBM2e | 2.04 TB/s | 3 | $1.60≈ €1.43 (estimated conversion from $1.60) | $2.50≈ €2.23 (estimated conversion from $2.50) |
| H100 PCIe | 80 GB HBM2e | 2.00 TB/s | 4 | $2.50≈ €2.23 (estimated conversion from $2.50) | $3.53≈ €3.16 (estimated conversion from $3.53) |
| H100 SXM | 80 GB HBM3 | 3.35 TB/s | 7 | $3.20≈ €2.86 (estimated conversion from $3.20) | $3.95≈ €3.53 (estimated conversion from $3.95) |
| GH200 Grace Hopper Superchip (96GB HBM3) | 96 GB HBM3 | 4.00 TB/s | 1 | $2.29≈ €2.05 (estimated conversion from $2.29) | Not listed |
| RTX PRO 6000 Blackwell | 96 GB GDDR7 | Not verified | 1 | Not listed | $3.03≈ €2.71 (estimated conversion from $3.03) |
| RTX PRO 6000 Blackwell Max-Q Workstation Edition | 96 GB GDDR7 | 1.79 TB/s | 1 | $2.74≈ €2.45 (estimated conversion from $2.74) | Not listed |
| H200 SXM | 141 GB HBM3e | 4.80 TB/s | 5 | $3.99≈ €3.56 (estimated conversion from $3.99) | $4.54≈ €4.06 (estimated conversion from $4.54) |
| B200 SXM | 180 GB HBM3e | 7.70 TB/s | 5 | $6.00≈ €5.36 (estimated conversion from $6.00) | $6.25≈ €5.58 (estimated conversion from $6.25) |
| Instinct MI300X | 192 GB HBM3 | 5.30 TB/s | 1 | $2.59≈ €2.31 (estimated conversion from $2.59) | Not listed |
Providers for each tier are listed in the inference hosting and GPU cloud comparisons. By memory tier: RTX 4090 cloud (24 GB), L40S hosting (48 GB) and H100 hosting (80 GB).
9. Running a model without a GPU
A model can also run from ordinary system memory. llama.cpp runs on x86 CPUs with AVX, AVX2, AVX512 and AMX, and its CPU+GPU hybrid mode exists to “partially accelerate models larger than the total VRAM capacity” [18]. Ollama shows where a loaded model lives: ollama ps reports 100% GPU, 100% CPU (system memory) or a split between the two [13].
The arithmetic does not change: weights plus KV cache must fit, now in RAM, next to the operating system and everything else on the server. On a 16 GB machine, Qwen3-8B at 4-bit with a 32,768-token cache needs about 8.9 GB and fits, while Qwen3-30B-A3B at 4-bit needs about 15.3 GB for its weights alone and does not leave enough room.
Expect CPU-only generation to be slower than on a GPU; that gap is what the hybrid mode above partially closes. It suits small models, light traffic and background agents; test your model at the context length you need before you pick a plan. CPU servers are compared under AI VPS, and providers with Ollama templates or guides under Ollama hosting.
Next steps
Next step: Check which GPUs fit your model, precision and context length.VRAM / Model Fit
Sources
Factual statements about providers, models, software and law link to these sources: primary sources first (official pricing pages, documentation, model cards and legal texts), third-party sources only where necessary and clearly labelled. Prices and specifications in the tables come from the AIHostCompare dataset; each provider's own sources and verification times are listed on its provider page, and the methodology explains how we verify data. Recommendations and rules of thumb are our editorial judgment.